翻譯|使用教程|編輯:況魚杰|2019-11-18 14:59:18.957|閱讀 317 次
概述:本系列教程整理了VectorDraw Developer Framework(VDF)最常見問題,教程整理的很齊全,非常適合新手學習。本文將會展示用戶如何在不使用預定義塊的情況下將預定義的折線形狀放置在布局中的某處。
# 界面/圖表報表/文檔/IDE等千款熱門軟控件火熱銷售中 >>
相關鏈接:
VectorDraw Developer Framework(VDF)是一個用于應用程序可視化的圖形引擎庫。有了VDF提供的功能,您可以輕松地創(chuàng)建、編輯、管理、輸出、輸入和打印2D和3D圖形文件。
VectorDraw Developer Framework試用版下載
問:
用戶如何在不使用預定義塊的情況下將預定義的折線形狀放置在布局中的某處?
答:
示例:
我們首先使用scriptCommand.rect制作一個矩形(或一條線,一條折線等),然后在rect的回調中調用actionentityadded,它調用了scriptCommand.select,所以現(xiàn)在矩形已經(jīng)被選中,在select的回調中我們調用moveCallback,所以現(xiàn)在我們可以移動矩形并將其放置在所需位置。
在scriptCommand.move的回調中,我們調用sclaleCallback,該腳本運行scriptCommand.scale()或scriptCommand.rotate()。縮放或旋轉逗號的回調,調用函數(shù)actionfinish,在其中更新布局,重新繪制畫布,然后將SetActionLineColor(null)恢復為默認值。
function redo() { vdcanvas.scriptCommand.redo(); setTimeout(vdcanvas.redraw); } function undo() { vdcanvas.scriptCommand.undo(); setTimeout(vdcanvas.redraw); } function polyline() { //we start the undogroup vdcanvas.scriptCommand.undogroup('begin'); //create a rect for example with InsertionPoint too far in order not to be draw on screen vdcanvas.scriptCommand.rect([[2000, 2000, 0], 3.0, 4.0,0], actionentityadded); } function actionentityadded(vdrawobj, entity) { vdrawobj.SetActionLineColor([0, 0, 0, 0]);//set the action line color invisible vdrawobj.scriptCommand.select([entity], movecallback);//update script select with user entity and call the move command } function movecallback(vdrawobj) { var rect = vdcanvas.scriptCommand.ActiveSelection()[0]; vdcanvas.scriptCommand.move(rect.InsertionPoint, null, sclaleCallback);//call move action with reference the InsertionPoint of rect } function sclaleCallback(vdrawobj) { var rect = vdcanvas.scriptCommand.ActiveSelection()[0]; if (!vdrawobj.ActiveAction().IsCanceled()) { //vdrawobj.scriptCommand.scale(rect.InsertionPoint, null, actionfinish); //call scale or rotate action with reference the InsertionPoint of rect vdcanvas.scriptCommand.rotate(rect.InsertionPoint,null,actionfinish); } else {//user press esc or right-click so the command is canceled actionfinish(vdrawobj); } } function actionfinish(vdrawobj) { var rect = vdrawobj.scriptCommand.ActiveSelection()[0]; if (vdrawobj.ActiveAction().IsCanceled()) {//in case action is canceled by the user esc or right click rect.Deleted = true;//mark the create figure as deleted vdrawobj.UpdateLayout(); //mark the layout bounds to be updated setTimeout(vdrawobj.redraw);//post a redraw in order to clear existing entity draw by the active action } vdrawobj.SetActionLineColor(null);//restore action line color to default value. vdcanvas.scriptCommand.undogroup('close');//Close the undogroup }
對于以上問答,如果您有任何的疑惑都可以在評論區(qū)留言,我們會及時回復。此系列的問答教程我們會持續(xù)更新,如果您感興趣,可以多多關注本教程。
熱門文章推薦:
如果您對想要購買正版授權VectorDraw Developer Framework(VDF),可以聯(lián)系咨詢相關問題。
關注慧聚IT微信公眾號 ???,了解產(chǎn)品的最新動態(tài)及最新資訊。
本站文章除注明轉載外,均為本站原創(chuàng)或翻譯。歡迎任何形式的轉載,但請務必注明出處、不得修改原文相關鏈接,如果存在內容上的異議請郵件反饋至chenjj@fc6vip.cn
文章轉載自: