yanchengPowerSupply/node_modules/mxdraw/dist/lib/MxModule/MxDbArrow/draw.js

1 line
1.0 KiB
JavaScript

var __awaiter=this&&this.__awaiter||function(t,e,n,r){return new(n||(n=Promise))(function(o,i){function a(t){try{u(r.next(t))}catch(t){i(t)}}function c(t){try{u(r.throw(t))}catch(t){i(t)}}function u(t){var e;t.done?o(t.value):(e=t.value,e instanceof n?e:new n(function(t){t(e)})).then(a,c)}u((r=r.apply(t,e||[])).next())})};import MxDbArrow from".";import McEdGetPointWorldDrawObject from"../McEdGetPointWorldDrawObject";import MrxDbgUiPrPoint from"../MrxDbgUiPrPoint";import MxFun from"../MxFun";export function getScreenPixel(t,e){let n=MxFun.screenCoordLong2World(e?t:t-t/3);return n=MxFun.worldCoordLong2Doc(n)};export default function drawMxDbArrow(){const t=new McEdGetPointWorldDrawObject,e=new MxDbArrow,n=MxFun.getCurrentDraw(),r=new MrxDbgUiPrPoint;r.setUserDraw(t),e.setLineWidth(10),r.go(()=>{e.innerOffset=getScreenPixel(10),e.outerOffset=getScreenPixel(22),e.topOffset=getScreenPixel(36),e.startPoint=r.value(),t.setDraw(n=>{e.endPoint=n,t.drawCustomEntity(e)}),r.go(t=>__awaiter(this,void 0,void 0,function*(){e.endPoint=r.value(),n.addMxEntity(e)}))})};