dcim-topology2d 3.0.2
Sign up to get free protection for your applications and to get access to all the features.
- package/activity-diagram/index.d.ts +5 -0
- package/activity-diagram/index.js +6 -0
- package/activity-diagram/index.js.map +1 -0
- package/activity-diagram/src/final/final.d.ts +2 -0
- package/activity-diagram/src/final/final.js +10 -0
- package/activity-diagram/src/final/final.js.map +1 -0
- package/activity-diagram/src/final/final.rect.d.ts +3 -0
- package/activity-diagram/src/final/final.rect.js +11 -0
- package/activity-diagram/src/final/final.rect.js.map +1 -0
- package/activity-diagram/src/final/index.d.ts +2 -0
- package/activity-diagram/src/final/index.js +3 -0
- package/activity-diagram/src/final/index.js.map +1 -0
- package/activity-diagram/src/fork/fork.anchor.d.ts +3 -0
- package/activity-diagram/src/fork/fork.anchor.js +28 -0
- package/activity-diagram/src/fork/fork.anchor.js.map +1 -0
- package/activity-diagram/src/fork/fork.d.ts +2 -0
- package/activity-diagram/src/fork/fork.js +25 -0
- package/activity-diagram/src/fork/fork.js.map +1 -0
- package/activity-diagram/src/fork/fork.rect.d.ts +3 -0
- package/activity-diagram/src/fork/fork.rect.js +9 -0
- package/activity-diagram/src/fork/fork.rect.js.map +1 -0
- package/activity-diagram/src/fork/index.d.ts +3 -0
- package/activity-diagram/src/fork/index.js +4 -0
- package/activity-diagram/src/fork/index.js.map +1 -0
- package/activity-diagram/src/register.d.ts +1 -0
- package/activity-diagram/src/register.js +13 -0
- package/activity-diagram/src/register.js.map +1 -0
- package/activity-diagram/src/swimlaneH/index.d.ts +2 -0
- package/activity-diagram/src/swimlaneH/index.js +3 -0
- package/activity-diagram/src/swimlaneH/index.js.map +1 -0
- package/activity-diagram/src/swimlaneH/swimlaneH.d.ts +2 -0
- package/activity-diagram/src/swimlaneH/swimlaneH.js +27 -0
- package/activity-diagram/src/swimlaneH/swimlaneH.js.map +1 -0
- package/activity-diagram/src/swimlaneH/swimlaneH.rect.d.ts +3 -0
- package/activity-diagram/src/swimlaneH/swimlaneH.rect.js +9 -0
- package/activity-diagram/src/swimlaneH/swimlaneH.rect.js.map +1 -0
- package/activity-diagram/src/swimlaneV/index.d.ts +2 -0
- package/activity-diagram/src/swimlaneV/index.js +3 -0
- package/activity-diagram/src/swimlaneV/index.js.map +1 -0
- package/activity-diagram/src/swimlaneV/swimlaneV.d.ts +2 -0
- package/activity-diagram/src/swimlaneV/swimlaneV.js +27 -0
- package/activity-diagram/src/swimlaneV/swimlaneV.js.map +1 -0
- package/activity-diagram/src/swimlaneV/swimlaneV.rect.d.ts +3 -0
- package/activity-diagram/src/swimlaneV/swimlaneV.rect.js +9 -0
- package/activity-diagram/src/swimlaneV/swimlaneV.rect.js.map +1 -0
- package/chart-diagram/index.d.ts +3 -0
- package/chart-diagram/index.js +4 -0
- package/chart-diagram/index.js.map +1 -0
- package/chart-diagram/src/echarts/echarts.min.js +22 -0
- package/chart-diagram/src/echarts/index.d.ts +4 -0
- package/chart-diagram/src/echarts/index.js +104 -0
- package/chart-diagram/src/echarts/index.js.map +1 -0
- package/chart-diagram/src/register.d.ts +1 -0
- package/chart-diagram/src/register.js +12 -0
- package/chart-diagram/src/register.js.map +1 -0
- package/class-diagram/index.d.ts +2 -0
- package/class-diagram/index.js +3 -0
- package/class-diagram/index.js.map +1 -0
- package/class-diagram/src/class/class.d.ts +3 -0
- package/class-diagram/src/class/class.js +56 -0
- package/class-diagram/src/class/class.js.map +1 -0
- package/class-diagram/src/class/class.rect.d.ts +5 -0
- package/class-diagram/src/class/class.rect.js +16 -0
- package/class-diagram/src/class/class.rect.js.map +1 -0
- package/class-diagram/src/class/index.d.ts +2 -0
- package/class-diagram/src/class/index.js +3 -0
- package/class-diagram/src/class/index.js.map +1 -0
- package/class-diagram/src/register.d.ts +1 -0
- package/class-diagram/src/register.js +7 -0
- package/class-diagram/src/register.js.map +1 -0
- package/core/index.d.ts +8 -0
- package/core/index.js +26 -0
- package/core/index.js.map +1 -0
- package/core/src/activeLayer.d.ts +55 -0
- package/core/src/activeLayer.js +679 -0
- package/core/src/activeLayer.js.map +1 -0
- package/core/src/animateLayer.d.ts +23 -0
- package/core/src/animateLayer.js +227 -0
- package/core/src/animateLayer.js.map +1 -0
- package/core/src/calling.d.ts +37 -0
- package/core/src/calling.js +253 -0
- package/core/src/canvas.d.ts +19 -0
- package/core/src/canvas.js +81 -0
- package/core/src/canvas.js.map +1 -0
- package/core/src/common.d.ts +102 -0
- package/core/src/common.js +1254 -0
- package/core/src/core.d.ts +104 -0
- package/core/src/core.js +2281 -0
- package/core/src/core.js.map +1 -0
- package/core/src/divLayer.d.ts +61 -0
- package/core/src/divLayer.js +485 -0
- package/core/src/divLayer.js.map +1 -0
- package/core/src/healps/changeData.d.ts +8 -0
- package/core/src/healps/changeData.js +205 -0
- package/core/src/healps/index.d.ts +1 -0
- package/core/src/healps/index.js +1 -0
- package/core/src/hoverLayer.d.ts +32 -0
- package/core/src/hoverLayer.js +199 -0
- package/core/src/hoverLayer.js.map +1 -0
- package/core/src/layer.d.ts +5 -0
- package/core/src/layer.js +11 -0
- package/core/src/layer.js.map +1 -0
- package/core/src/middles/arrows/circle.d.ts +3 -0
- package/core/src/middles/arrows/circle.js +20 -0
- package/core/src/middles/arrows/circle.js.map +1 -0
- package/core/src/middles/arrows/diamond.d.ts +3 -0
- package/core/src/middles/arrows/diamond.js +28 -0
- package/core/src/middles/arrows/diamond.js.map +1 -0
- package/core/src/middles/arrows/line.d.ts +4 -0
- package/core/src/middles/arrows/line.js +42 -0
- package/core/src/middles/arrows/line.js.map +1 -0
- package/core/src/middles/arrows/triangle.d.ts +3 -0
- package/core/src/middles/arrows/triangle.js +25 -0
- package/core/src/middles/arrows/triangle.js.map +1 -0
- package/core/src/middles/default.anchor.d.ts +2 -0
- package/core/src/middles/default.anchor.js +9 -0
- package/core/src/middles/default.anchor.js.map +1 -0
- package/core/src/middles/default.d.ts +12 -0
- package/core/src/middles/default.js +257 -0
- package/core/src/middles/default.js.map +1 -0
- package/core/src/middles/default.rect.d.ts +3 -0
- package/core/src/middles/default.rect.js +19 -0
- package/core/src/middles/default.rect.js.map +1 -0
- package/core/src/middles/index.d.ts +3 -0
- package/core/src/middles/index.js +4 -0
- package/core/src/middles/index.js.map +1 -0
- package/core/src/middles/lines/curve.d.ts +10 -0
- package/core/src/middles/lines/curve.js +127 -0
- package/core/src/middles/lines/curve.js.map +1 -0
- package/core/src/middles/lines/line.d.ts +4 -0
- package/core/src/middles/lines/line.js +11 -0
- package/core/src/middles/lines/line.js.map +1 -0
- package/core/src/middles/lines/mind.d.ts +6 -0
- package/core/src/middles/lines/mind.js +90 -0
- package/core/src/middles/lines/mind.js.map +1 -0
- package/core/src/middles/lines/polyline.d.ts +7 -0
- package/core/src/middles/lines/polyline.js +309 -0
- package/core/src/middles/lines/polyline.js.map +1 -0
- package/core/src/middles/nodes/arbitrarygraph.anchor.d.ts +2 -0
- package/core/src/middles/nodes/arbitrarygraph.anchor.js +18 -0
- package/core/src/middles/nodes/arbitrarygraph.d.ts +2 -0
- package/core/src/middles/nodes/arbitrarygraph.js +17 -0
- package/core/src/middles/nodes/arrow.anchor.d.ts +2 -0
- package/core/src/middles/nodes/arrow.anchor.js +7 -0
- package/core/src/middles/nodes/arrow.anchor.js.map +1 -0
- package/core/src/middles/nodes/arrow.d.ts +4 -0
- package/core/src/middles/nodes/arrow.js +44 -0
- package/core/src/middles/nodes/arrow.js.map +1 -0
- package/core/src/middles/nodes/arrow.rect.d.ts +7 -0
- package/core/src/middles/nodes/arrow.rect.js +23 -0
- package/core/src/middles/nodes/arrow.rect.js.map +1 -0
- package/core/src/middles/nodes/circle.anchor.d.ts +2 -0
- package/core/src/middles/nodes/circle.anchor.js +18 -0
- package/core/src/middles/nodes/circle.anchor.js.map +1 -0
- package/core/src/middles/nodes/circle.d.ts +2 -0
- package/core/src/middles/nodes/circle.js +7 -0
- package/core/src/middles/nodes/circle.js.map +1 -0
- package/core/src/middles/nodes/circle.rect.d.ts +3 -0
- package/core/src/middles/nodes/circle.rect.js +27 -0
- package/core/src/middles/nodes/circle.rect.js.map +1 -0
- package/core/src/middles/nodes/cloud.anchor.d.ts +2 -0
- package/core/src/middles/nodes/cloud.anchor.js +9 -0
- package/core/src/middles/nodes/cloud.anchor.js.map +1 -0
- package/core/src/middles/nodes/cloud.d.ts +2 -0
- package/core/src/middles/nodes/cloud.js +11 -0
- package/core/src/middles/nodes/cloud.js.map +1 -0
- package/core/src/middles/nodes/cloud.rect.d.ts +3 -0
- package/core/src/middles/nodes/cloud.rect.js +9 -0
- package/core/src/middles/nodes/cloud.rect.js.map +1 -0
- package/core/src/middles/nodes/cube.anchor.d.ts +2 -0
- package/core/src/middles/nodes/cube.anchor.js +10 -0
- package/core/src/middles/nodes/cube.anchor.js.map +1 -0
- package/core/src/middles/nodes/cube.d.ts +2 -0
- package/core/src/middles/nodes/cube.js +5 -0
- package/core/src/middles/nodes/cube.js.map +1 -0
- package/core/src/middles/nodes/cube.model.d.ts +14 -0
- package/core/src/middles/nodes/cube.model.js +64 -0
- package/core/src/middles/nodes/cube.model.js.map +1 -0
- package/core/src/middles/nodes/cube.rect.d.ts +3 -0
- package/core/src/middles/nodes/cube.rect.js +11 -0
- package/core/src/middles/nodes/cube.rect.js.map +1 -0
- package/core/src/middles/nodes/diamond.d.ts +2 -0
- package/core/src/middles/nodes/diamond.js +11 -0
- package/core/src/middles/nodes/diamond.js.map +1 -0
- package/core/src/middles/nodes/diamond.rect.d.ts +3 -0
- package/core/src/middles/nodes/diamond.rect.js +27 -0
- package/core/src/middles/nodes/diamond.rect.js.map +1 -0
- package/core/src/middles/nodes/file.d.ts +2 -0
- package/core/src/middles/nodes/file.js +16 -0
- package/core/src/middles/nodes/file.js.map +1 -0
- package/core/src/middles/nodes/formtable.d.ts +2 -0
- package/core/src/middles/nodes/formtable.js +100 -0
- package/core/src/middles/nodes/hexagon.anchor.d.ts +2 -0
- package/core/src/middles/nodes/hexagon.anchor.js +21 -0
- package/core/src/middles/nodes/hexagon.anchor.js.map +1 -0
- package/core/src/middles/nodes/hexagon.d.ts +2 -0
- package/core/src/middles/nodes/hexagon.js +14 -0
- package/core/src/middles/nodes/hexagon.js.map +1 -0
- package/core/src/middles/nodes/hexagon.rect.d.ts +3 -0
- package/core/src/middles/nodes/hexagon.rect.js +14 -0
- package/core/src/middles/nodes/hexagon.rect.js.map +1 -0
- package/core/src/middles/nodes/image.anchor.d.ts +2 -0
- package/core/src/middles/nodes/image.anchor.js +12 -0
- package/core/src/middles/nodes/image.anchor.js.map +1 -0
- package/core/src/middles/nodes/image.rect.d.ts +3 -0
- package/core/src/middles/nodes/image.rect.js +65 -0
- package/core/src/middles/nodes/image.rect.js.map +1 -0
- package/core/src/middles/nodes/line.anchor.d.ts +2 -0
- package/core/src/middles/nodes/line.anchor.js +13 -0
- package/core/src/middles/nodes/line.anchor.js.map +1 -0
- package/core/src/middles/nodes/line.d.ts +2 -0
- package/core/src/middles/nodes/line.js +9 -0
- package/core/src/middles/nodes/line.js.map +1 -0
- package/core/src/middles/nodes/line.rect.d.ts +3 -0
- package/core/src/middles/nodes/line.rect.js +9 -0
- package/core/src/middles/nodes/line.rect.js.map +1 -0
- package/core/src/middles/nodes/message.anchor.d.ts +2 -0
- package/core/src/middles/nodes/message.anchor.js +9 -0
- package/core/src/middles/nodes/message.anchor.js.map +1 -0
- package/core/src/middles/nodes/message.d.ts +2 -0
- package/core/src/middles/nodes/message.js +14 -0
- package/core/src/middles/nodes/message.js.map +1 -0
- package/core/src/middles/nodes/message.rect.d.ts +3 -0
- package/core/src/middles/nodes/message.rect.js +10 -0
- package/core/src/middles/nodes/message.rect.js.map +1 -0
- package/core/src/middles/nodes/pentagon.anchor.d.ts +2 -0
- package/core/src/middles/nodes/pentagon.anchor.js +10 -0
- package/core/src/middles/nodes/pentagon.anchor.js.map +1 -0
- package/core/src/middles/nodes/pentagon.d.ts +2 -0
- package/core/src/middles/nodes/pentagon.js +12 -0
- package/core/src/middles/nodes/pentagon.js.map +1 -0
- package/core/src/middles/nodes/pentagon.rect.d.ts +3 -0
- package/core/src/middles/nodes/pentagon.rect.js +23 -0
- package/core/src/middles/nodes/pentagon.rect.js.map +1 -0
- package/core/src/middles/nodes/pentagram.anchor.d.ts +2 -0
- package/core/src/middles/nodes/pentagram.anchor.js +10 -0
- package/core/src/middles/nodes/pentagram.anchor.js.map +1 -0
- package/core/src/middles/nodes/pentagram.d.ts +2 -0
- package/core/src/middles/nodes/pentagram.js +11 -0
- package/core/src/middles/nodes/pentagram.js.map +1 -0
- package/core/src/middles/nodes/pentagram.rect.d.ts +3 -0
- package/core/src/middles/nodes/pentagram.rect.js +11 -0
- package/core/src/middles/nodes/pentagram.rect.js.map +1 -0
- package/core/src/middles/nodes/people.d.ts +2 -0
- package/core/src/middles/nodes/people.js +17 -0
- package/core/src/middles/nodes/people.js.map +1 -0
- package/core/src/middles/nodes/people.rect.d.ts +3 -0
- package/core/src/middles/nodes/people.rect.js +9 -0
- package/core/src/middles/nodes/people.rect.js.map +1 -0
- package/core/src/middles/nodes/rectangle.d.ts +2 -0
- package/core/src/middles/nodes/rectangle.js +25 -0
- package/core/src/middles/nodes/rectangle.js.map +1 -0
- package/core/src/middles/nodes/rectangle.rect.d.ts +3 -0
- package/core/src/middles/nodes/rectangle.rect.js +11 -0
- package/core/src/middles/nodes/rectangle.rect.js.map +1 -0
- package/core/src/middles/nodes/tablePagination.d.ts +2 -0
- package/core/src/middles/nodes/tablePagination.js +106 -0
- package/core/src/middles/nodes/text.d.ts +8 -0
- package/core/src/middles/nodes/text.js +295 -0
- package/core/src/middles/nodes/text.js.map +1 -0
- package/core/src/middles/nodes/triangle.anchor.d.ts +2 -0
- package/core/src/middles/nodes/triangle.anchor.js +9 -0
- package/core/src/middles/nodes/triangle.anchor.js.map +1 -0
- package/core/src/middles/nodes/triangle.d.ts +2 -0
- package/core/src/middles/nodes/triangle.js +10 -0
- package/core/src/middles/nodes/triangle.js.map +1 -0
- package/core/src/middles/nodes/triangle.rect.d.ts +3 -0
- package/core/src/middles/nodes/triangle.rect.js +23 -0
- package/core/src/middles/nodes/triangle.rect.js.map +1 -0
- package/core/src/models/data.d.ts +26 -0
- package/core/src/models/data.js +77 -0
- package/core/src/models/data.js.map +1 -0
- package/core/src/models/direction.d.ts +7 -0
- package/core/src/models/direction.js +9 -0
- package/core/src/models/direction.js.map +1 -0
- package/core/src/models/event.d.ts +13 -0
- package/core/src/models/event.js +16 -0
- package/core/src/models/event.js.map +1 -0
- package/core/src/models/index.d.ts +9 -0
- package/core/src/models/index.js +10 -0
- package/core/src/models/index.js.map +1 -0
- package/core/src/models/line.d.ts +53 -0
- package/core/src/models/line.js +442 -0
- package/core/src/models/line.js.map +1 -0
- package/core/src/models/node.d.ts +95 -0
- package/core/src/models/node.js +944 -0
- package/core/src/models/node.js.map +1 -0
- package/core/src/models/pen.d.ts +122 -0
- package/core/src/models/pen.js +362 -0
- package/core/src/models/pen.js.map +1 -0
- package/core/src/models/point.d.ts +25 -0
- package/core/src/models/point.js +59 -0
- package/core/src/models/point.js.map +1 -0
- package/core/src/models/rect.d.ts +22 -0
- package/core/src/models/rect.js +93 -0
- package/core/src/models/rect.js.map +1 -0
- package/core/src/models/status.d.ts +10 -0
- package/core/src/models/status.js +13 -0
- package/core/src/models/status.js.map +1 -0
- package/core/src/mqtt.d.ts +14 -0
- package/core/src/mqtt.js +82 -0
- package/core/src/mqtt.js.map +1 -0
- package/core/src/mqtt.min.d.ts +2 -0
- package/core/src/mqtt.min.js +2447 -0
- package/core/src/mqtt.min.js.map +1 -0
- package/core/src/offscreen.d.ts +16 -0
- package/core/src/offscreen.js +70 -0
- package/core/src/offscreen.js.map +1 -0
- package/core/src/options.d.ts +66 -0
- package/core/src/options.js +42 -0
- package/core/src/options.js.map +1 -0
- package/core/src/poll.js +39 -0
- package/core/src/preview.d.ts +29 -0
- package/core/src/preview.js +247 -0
- package/core/src/renderLayer.d.ts +36 -0
- package/core/src/renderLayer.js +187 -0
- package/core/src/renderLayer.js.map +1 -0
- package/core/src/socket.d.ts +10 -0
- package/core/src/socket.js +51 -0
- package/core/src/socket.js.map +1 -0
- package/core/src/utils/browser.d.ts +1 -0
- package/core/src/utils/browser.js +4 -0
- package/core/src/utils/browser.js.map +1 -0
- package/core/src/utils/canvas.d.ts +13 -0
- package/core/src/utils/canvas.js +84 -0
- package/core/src/utils/canvas.js.map +1 -0
- package/core/src/utils/construction.d.ts +41 -0
- package/core/src/utils/construction.js +36 -0
- package/core/src/utils/conversion.d.ts +0 -0
- package/core/src/utils/conversion.js +0 -0
- package/core/src/utils/dom.d.ts +8 -0
- package/core/src/utils/dom.js +67 -0
- package/core/src/utils/dom.js.map +1 -0
- package/core/src/utils/index.d.ts +9 -0
- package/core/src/utils/index.js +10 -0
- package/core/src/utils/index.js.map +1 -0
- package/core/src/utils/math.d.ts +3 -0
- package/core/src/utils/math.js +118 -0
- package/core/src/utils/math.js.map +1 -0
- package/core/src/utils/onmousevent.d.ts +5 -0
- package/core/src/utils/onmousevent.js +57 -0
- package/core/src/utils/padding.d.ts +7 -0
- package/core/src/utils/padding.js +47 -0
- package/core/src/utils/padding.js.map +1 -0
- package/core/src/utils/rect.d.ts +7 -0
- package/core/src/utils/rect.js +72 -0
- package/core/src/utils/rect.js.map +1 -0
- package/core/src/utils/uuid.d.ts +4 -0
- package/core/src/utils/uuid.js +13 -0
- package/core/src/utils/uuid.js.map +1 -0
- package/flow-diagram/index.d.ts +12 -0
- package/flow-diagram/index.js +13 -0
- package/flow-diagram/index.js.map +1 -0
- package/flow-diagram/src/comment/comment.anchor.d.ts +2 -0
- package/flow-diagram/src/comment/comment.anchor.js +5 -0
- package/flow-diagram/src/comment/comment.anchor.js.map +1 -0
- package/flow-diagram/src/comment/comment.d.ts +2 -0
- package/flow-diagram/src/comment/comment.js +10 -0
- package/flow-diagram/src/comment/comment.js.map +1 -0
- package/flow-diagram/src/comment/index.d.ts +2 -0
- package/flow-diagram/src/comment/index.js +3 -0
- package/flow-diagram/src/comment/index.js.map +1 -0
- package/flow-diagram/src/data/data.anchor.d.ts +2 -0
- package/flow-diagram/src/data/data.anchor.js +8 -0
- package/flow-diagram/src/data/data.anchor.js.map +1 -0
- package/flow-diagram/src/data/data.d.ts +2 -0
- package/flow-diagram/src/data/data.js +12 -0
- package/flow-diagram/src/data/data.js.map +1 -0
- package/flow-diagram/src/data/data.rect.d.ts +3 -0
- package/flow-diagram/src/data/data.rect.js +9 -0
- package/flow-diagram/src/data/data.rect.js.map +1 -0
- package/flow-diagram/src/data/index.d.ts +3 -0
- package/flow-diagram/src/data/index.js +4 -0
- package/flow-diagram/src/data/index.js.map +1 -0
- package/flow-diagram/src/db/db.d.ts +2 -0
- package/flow-diagram/src/db/db.js +14 -0
- package/flow-diagram/src/db/db.js.map +1 -0
- package/flow-diagram/src/db/db.rect.d.ts +4 -0
- package/flow-diagram/src/db/db.rect.js +9 -0
- package/flow-diagram/src/db/db.rect.js.map +1 -0
- package/flow-diagram/src/db/index.d.ts +2 -0
- package/flow-diagram/src/db/index.js +3 -0
- package/flow-diagram/src/db/index.js.map +1 -0
- package/flow-diagram/src/display/display.anchor.d.ts +2 -0
- package/flow-diagram/src/display/display.anchor.js +8 -0
- package/flow-diagram/src/display/display.anchor.js.map +1 -0
- package/flow-diagram/src/display/display.d.ts +2 -0
- package/flow-diagram/src/display/display.js +13 -0
- package/flow-diagram/src/display/display.js.map +1 -0
- package/flow-diagram/src/display/display.rect.d.ts +3 -0
- package/flow-diagram/src/display/display.rect.js +9 -0
- package/flow-diagram/src/display/display.rect.js.map +1 -0
- package/flow-diagram/src/display/index.d.ts +3 -0
- package/flow-diagram/src/display/index.js +4 -0
- package/flow-diagram/src/display/index.js.map +1 -0
- package/flow-diagram/src/document/document.anchor.d.ts +2 -0
- package/flow-diagram/src/document/document.anchor.js +8 -0
- package/flow-diagram/src/document/document.anchor.js.map +1 -0
- package/flow-diagram/src/document/document.d.ts +2 -0
- package/flow-diagram/src/document/document.js +15 -0
- package/flow-diagram/src/document/document.js.map +1 -0
- package/flow-diagram/src/document/document.rect.d.ts +3 -0
- package/flow-diagram/src/document/document.rect.js +9 -0
- package/flow-diagram/src/document/document.rect.js.map +1 -0
- package/flow-diagram/src/document/index.d.ts +3 -0
- package/flow-diagram/src/document/index.js +4 -0
- package/flow-diagram/src/document/index.js.map +1 -0
- package/flow-diagram/src/externStorage/externStorage.anchor.d.ts +2 -0
- package/flow-diagram/src/externStorage/externStorage.anchor.js +8 -0
- package/flow-diagram/src/externStorage/externStorage.anchor.js.map +1 -0
- package/flow-diagram/src/externStorage/externStorage.d.ts +2 -0
- package/flow-diagram/src/externStorage/externStorage.js +12 -0
- package/flow-diagram/src/externStorage/externStorage.js.map +1 -0
- package/flow-diagram/src/externStorage/externStorage.rect.d.ts +3 -0
- package/flow-diagram/src/externStorage/externStorage.rect.js +9 -0
- package/flow-diagram/src/externStorage/externStorage.rect.js.map +1 -0
- package/flow-diagram/src/externStorage/index.d.ts +3 -0
- package/flow-diagram/src/externStorage/index.js +4 -0
- package/flow-diagram/src/externStorage/index.js.map +1 -0
- package/flow-diagram/src/internalStorage/index.d.ts +2 -0
- package/flow-diagram/src/internalStorage/index.js +3 -0
- package/flow-diagram/src/internalStorage/index.js.map +1 -0
- package/flow-diagram/src/internalStorage/internalStorage.d.ts +2 -0
- package/flow-diagram/src/internalStorage/internalStorage.js +16 -0
- package/flow-diagram/src/internalStorage/internalStorage.js.map +1 -0
- package/flow-diagram/src/internalStorage/internalStorage.rect.d.ts +3 -0
- package/flow-diagram/src/internalStorage/internalStorage.rect.js +10 -0
- package/flow-diagram/src/internalStorage/internalStorage.rect.js.map +1 -0
- package/flow-diagram/src/manually/index.d.ts +3 -0
- package/flow-diagram/src/manually/index.js +4 -0
- package/flow-diagram/src/manually/index.js.map +1 -0
- package/flow-diagram/src/manually/manually.anchor.d.ts +2 -0
- package/flow-diagram/src/manually/manually.anchor.js +8 -0
- package/flow-diagram/src/manually/manually.anchor.js.map +1 -0
- package/flow-diagram/src/manually/manually.d.ts +2 -0
- package/flow-diagram/src/manually/manually.js +12 -0
- package/flow-diagram/src/manually/manually.js.map +1 -0
- package/flow-diagram/src/manually/manually.rect.d.ts +3 -0
- package/flow-diagram/src/manually/manually.rect.js +9 -0
- package/flow-diagram/src/manually/manually.rect.js.map +1 -0
- package/flow-diagram/src/parallel/index.d.ts +2 -0
- package/flow-diagram/src/parallel/index.js +3 -0
- package/flow-diagram/src/parallel/index.js.map +1 -0
- package/flow-diagram/src/parallel/parallel.anchor.d.ts +2 -0
- package/flow-diagram/src/parallel/parallel.anchor.js +6 -0
- package/flow-diagram/src/parallel/parallel.anchor.js.map +1 -0
- package/flow-diagram/src/parallel/parallel.d.ts +2 -0
- package/flow-diagram/src/parallel/parallel.js +9 -0
- package/flow-diagram/src/parallel/parallel.js.map +1 -0
- package/flow-diagram/src/queue/index.d.ts +2 -0
- package/flow-diagram/src/queue/index.js +3 -0
- package/flow-diagram/src/queue/index.js.map +1 -0
- package/flow-diagram/src/queue/queue.d.ts +2 -0
- package/flow-diagram/src/queue/queue.js +9 -0
- package/flow-diagram/src/queue/queue.js.map +1 -0
- package/flow-diagram/src/queue/queue.rect.d.ts +3 -0
- package/flow-diagram/src/queue/queue.rect.js +11 -0
- package/flow-diagram/src/queue/queue.rect.js.map +1 -0
- package/flow-diagram/src/register.d.ts +1 -0
- package/flow-diagram/src/register.js +26 -0
- package/flow-diagram/src/register.js.map +1 -0
- package/flow-diagram/src/subprocess/index.d.ts +2 -0
- package/flow-diagram/src/subprocess/index.js +3 -0
- package/flow-diagram/src/subprocess/index.js.map +1 -0
- package/flow-diagram/src/subprocess/subprocess.d.ts +2 -0
- package/flow-diagram/src/subprocess/subprocess.js +16 -0
- package/flow-diagram/src/subprocess/subprocess.js.map +1 -0
- package/flow-diagram/src/subprocess/subprocess.rect.d.ts +3 -0
- package/flow-diagram/src/subprocess/subprocess.rect.js +9 -0
- package/flow-diagram/src/subprocess/subprocess.rect.js.map +1 -0
- package/layout/index.d.ts +2 -0
- package/layout/index.js +3 -0
- package/layout/index.js.map +1 -0
- package/layout/src/align.d.ts +3 -0
- package/layout/src/align.js +67 -0
- package/layout/src/align.js.map +1 -0
- package/layout/src/layout.d.ts +9 -0
- package/layout/src/layout.js +50 -0
- package/layout/src/layout.js.map +1 -0
- package/myShape-diagram/myShape.js +196 -0
- package/myShape-diagram/myShape.ts +1 -0
- package/package.json +15 -0
- package/sequence-diagram/index.d.ts +3 -0
- package/sequence-diagram/index.js +4 -0
- package/sequence-diagram/index.js.map +1 -0
- package/sequence-diagram/src/focus/focus.anchor.d.ts +2 -0
- package/sequence-diagram/src/focus/focus.anchor.js +15 -0
- package/sequence-diagram/src/focus/focus.anchor.js.map +1 -0
- package/sequence-diagram/src/focus/focus.d.ts +2 -0
- package/sequence-diagram/src/focus/focus.js +13 -0
- package/sequence-diagram/src/focus/focus.js.map +1 -0
- package/sequence-diagram/src/focus/focus.rect.d.ts +3 -0
- package/sequence-diagram/src/focus/focus.rect.js +9 -0
- package/sequence-diagram/src/focus/focus.rect.js.map +1 -0
- package/sequence-diagram/src/focus/index.d.ts +3 -0
- package/sequence-diagram/src/focus/index.js +4 -0
- package/sequence-diagram/src/focus/index.js.map +1 -0
- package/sequence-diagram/src/lifeline/index.d.ts +3 -0
- package/sequence-diagram/src/lifeline/index.js +4 -0
- package/sequence-diagram/src/lifeline/index.js.map +1 -0
- package/sequence-diagram/src/lifeline/lifeline.anchor.d.ts +2 -0
- package/sequence-diagram/src/lifeline/lifeline.anchor.js +9 -0
- package/sequence-diagram/src/lifeline/lifeline.anchor.js.map +1 -0
- package/sequence-diagram/src/lifeline/lifeline.d.ts +2 -0
- package/sequence-diagram/src/lifeline/lifeline.js +35 -0
- package/sequence-diagram/src/lifeline/lifeline.js.map +1 -0
- package/sequence-diagram/src/lifeline/lifeline.rect.d.ts +3 -0
- package/sequence-diagram/src/lifeline/lifeline.rect.js +9 -0
- package/sequence-diagram/src/lifeline/lifeline.rect.js.map +1 -0
- package/sequence-diagram/src/register.d.ts +1 -0
- package/sequence-diagram/src/register.js +8 -0
- package/sequence-diagram/src/register.js.map +1 -0
@@ -0,0 +1,9 @@
|
|
1
|
+
import { Point } from '../models/point';
|
2
|
+
import { Direction } from '../models/direction';
|
3
|
+
export function defaultAnchors(node) {
|
4
|
+
node.anchors.push(new Point(node.rect.x, node.rect.y + node.rect.height / 2, Direction.Left));
|
5
|
+
node.anchors.push(new Point(node.rect.x + node.rect.width / 2, node.rect.y, Direction.Up));
|
6
|
+
node.anchors.push(new Point(node.rect.x + node.rect.width, node.rect.y + node.rect.height / 2, Direction.Right));
|
7
|
+
node.anchors.push(new Point(node.rect.x + node.rect.width / 2, node.rect.y + node.rect.height, Direction.Bottom));
|
8
|
+
}
|
9
|
+
//# sourceMappingURL=default.anchor.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"default.anchor.js","sourceRoot":"","sources":["../../../../packages/core/src/middles/default.anchor.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,EAAE,MAAM,iBAAiB,CAAC;AACxC,OAAO,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC;AAEhD,MAAM,UAAU,cAAc,CAAC,IAAU;IACvC,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,IAAI,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,EAAE,IAAI,CAAC,IAAI,CAAC,CAAC,GAAG,IAAI,CAAC,IAAI,CAAC,MAAM,GAAG,CAAC,EAAE,SAAS,CAAC,IAAI,CAAC,CAAC,CAAC;IAC9F,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,IAAI,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,GAAG,IAAI,CAAC,IAAI,CAAC,KAAK,GAAG,CAAC,EAAE,IAAI,CAAC,IAAI,CAAC,CAAC,EAAE,SAAS,CAAC,EAAE,CAAC,CAAC,CAAC;IAC3F,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,IAAI,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,GAAG,IAAI,CAAC,IAAI,CAAC,KAAK,EAAE,IAAI,CAAC,IAAI,CAAC,CAAC,GAAG,IAAI,CAAC,IAAI,CAAC,MAAM,GAAG,CAAC,EAAE,SAAS,CAAC,KAAK,CAAC,CAAC,CAAC;IACjH,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,IAAI,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,GAAG,IAAI,CAAC,IAAI,CAAC,KAAK,GAAG,CAAC,EAAE,IAAI,CAAC,IAAI,CAAC,CAAC,GAAG,IAAI,CAAC,IAAI,CAAC,MAAM,EAAE,SAAS,CAAC,MAAM,CAAC,CAAC,CAAC;AACpH,CAAC"}
|
@@ -0,0 +1,12 @@
|
|
1
|
+
import { Point } from '../models';
|
2
|
+
import { Node } from '../models';
|
3
|
+
import { Line } from '../models';
|
4
|
+
export declare const drawNodeFns: any;
|
5
|
+
export declare const iconRectFns: any;
|
6
|
+
export declare const textRectFns: any;
|
7
|
+
export declare const anchorsFns: any;
|
8
|
+
export declare const drawLineFns: any;
|
9
|
+
export declare const drawArrowFns: any;
|
10
|
+
export declare function registerNode(name: string, drawFn: (ctx: CanvasRenderingContext2D, node: Node) => void, anchorsFn?: (node: Node) => void, iconRectFn?: (node: Node) => void, textRectFn?: (node: Node) => void, force?: boolean): boolean;
|
11
|
+
export declare function registerLine(name: string, drawFn: (ctx: CanvasRenderingContext2D, line: Line) => void, drawControlPointsFn?: (ctx: CanvasRenderingContext2D, line: Line) => void, controlPointsFn?: (line: Line) => void, dockControlPointFn?: (point: Point, line: Line) => void, pointInFn?: (point: Point, line: Line) => boolean, force?: boolean): boolean;
|
12
|
+
export declare function registerArrow(name: string, drawFn: (ctx: CanvasRenderingContext2D, from: Point, to: Point, size: number) => void, force?: boolean): boolean;
|
@@ -0,0 +1,257 @@
|
|
1
|
+
import { rectangle } from './nodes/rectangle';
|
2
|
+
import { circle } from './nodes/circle';
|
3
|
+
import { triangle } from './nodes/triangle';
|
4
|
+
import { diamond } from './nodes/diamond';
|
5
|
+
import { leftArrow, rightArrow, twowayArrow } from './nodes/arrow';
|
6
|
+
import { text } from './nodes/text';
|
7
|
+
import { line as nodeLine } from './nodes/line';
|
8
|
+
import { triangleAnchors } from './nodes/triangle.anchor';
|
9
|
+
import { arrowAnchors } from './nodes/arrow.anchor';
|
10
|
+
import { lineAnchors } from './nodes/line.anchor';
|
11
|
+
import { circleIconRect, circleTextRect } from './nodes/circle.rect';
|
12
|
+
import { triangleIconRect, triangleTextRect } from './nodes/triangle.rect';
|
13
|
+
import { diamondIconRect, diamondTextRect } from './nodes/diamond.rect';
|
14
|
+
import { twowayArrowIconRect, twowayArrowTextRect, leftArrowIconRect, leftArrowTextRect, rightArrowIconRect, rightArrowTextRect } from './nodes/arrow.rect';
|
15
|
+
import { lineIconRect, lineTextRect } from './nodes/line.rect';
|
16
|
+
import { line, lineControlPoints, calcLineControlPoints } from './lines/line';
|
17
|
+
import { polyline, polylineControlPoints, pointInPolyline, calcPolylineControlPoints, dockPolylineControlPoint } from './lines/polyline';
|
18
|
+
import { curve, curveControlPoints, pointInCurve, calcCurveControlPoints } from './lines/curve';
|
19
|
+
import { mind, calcMindControlPoints, mindControlPoints, pointInMind } from './lines/mind';
|
20
|
+
import { triangleSolid, triangle as arrowTriangle } from './arrows/triangle';
|
21
|
+
import { diamondSolid, diamond as arrowDiamond } from './arrows/diamond';
|
22
|
+
import { circleSolid, circle as arrowCircle } from './arrows/circle';
|
23
|
+
import { circleAnchors } from './nodes/circle.anchor';
|
24
|
+
import { lineUp, lineDown, line as arrowLine } from './arrows/line';
|
25
|
+
import { pentagon } from './nodes/pentagon';
|
26
|
+
import { pentagonIconRect, pentagonTextRect } from './nodes/pentagon.rect';
|
27
|
+
import { pentagonAnchors } from './nodes/pentagon.anchor';
|
28
|
+
import { hexagon } from './nodes/hexagon';
|
29
|
+
import { hexagonAnchors } from './nodes/hexagon.anchor';
|
30
|
+
import { hexagonIconRect, hexagonTextRect } from './nodes/hexagon.rect';
|
31
|
+
import { pentagram } from './nodes/pentagram';
|
32
|
+
import { pentagramAnchors } from './nodes/pentagram.anchor';
|
33
|
+
import { pentagramIconRect, pentagramTextRect } from './nodes/pentagram.rect';
|
34
|
+
import { cloud } from './nodes/cloud';
|
35
|
+
import { cloudAnchors } from './nodes/cloud.anchor';
|
36
|
+
import { cloudIconRect, cloudTextRect } from './nodes/cloud.rect';
|
37
|
+
import { message } from './nodes/message';
|
38
|
+
import { messageIconRect, messageTextRect } from './nodes/message.rect';
|
39
|
+
import { messageAnchors } from './nodes/message.anchor';
|
40
|
+
import { file } from './nodes/file';
|
41
|
+
import { imageIconRect, imageTextRect } from './nodes/image.rect';
|
42
|
+
import { cube } from './nodes/cube';
|
43
|
+
import { cubeAnchors } from './nodes/cube.anchor';
|
44
|
+
import { cubeIconRect, cubeTextRect } from './nodes/cube.rect';
|
45
|
+
import { people } from './nodes/people';
|
46
|
+
import { peopleIconRect, peopleTextRect } from './nodes/people.rect';
|
47
|
+
import { rectangleIconRect, rectangleTextRect } from './nodes/rectangle.rect';
|
48
|
+
import { arbitraryGraph } from './nodes/arbitrarygraph';
|
49
|
+
import { arbitraryGraphAnchors } from './nodes/arbitrarygraph.anchor';
|
50
|
+
import { formtable } from './nodes/formtable';
|
51
|
+
import { tablePagination } from './nodes/tablePagination';
|
52
|
+
// Functions of drawing a node.
|
53
|
+
export var drawNodeFns = {};
|
54
|
+
// Calc the occupy rect of icon.
|
55
|
+
export var iconRectFns = {};
|
56
|
+
// Calc the occupy rect of text.
|
57
|
+
export var textRectFns = {};
|
58
|
+
// Calc the anchors of node.
|
59
|
+
export var anchorsFns = {};
|
60
|
+
// Functions of drawing a line.
|
61
|
+
export var drawLineFns = {};
|
62
|
+
// Functions of drawing a arrow.
|
63
|
+
export var drawArrowFns = {};
|
64
|
+
function init() {
|
65
|
+
console.log('Init middles.');
|
66
|
+
// ********Default nodes.*******
|
67
|
+
// tablePagination
|
68
|
+
drawNodeFns.tablePagination = tablePagination;
|
69
|
+
// formtable
|
70
|
+
drawNodeFns.formTable = formtable;
|
71
|
+
// ArbitraryGraph
|
72
|
+
drawNodeFns.arbitraryGraph = arbitraryGraph;
|
73
|
+
anchorsFns.arbitraryGraph = arbitraryGraphAnchors;
|
74
|
+
// Combine
|
75
|
+
drawNodeFns.combine = rectangle;
|
76
|
+
// Div
|
77
|
+
drawNodeFns.div = rectangle;
|
78
|
+
// Square
|
79
|
+
drawNodeFns.square = rectangle;
|
80
|
+
// Rectangle
|
81
|
+
drawNodeFns.rectangle = rectangle;
|
82
|
+
iconRectFns.rectangle = rectangleIconRect;
|
83
|
+
textRectFns.rectangle = rectangleTextRect;
|
84
|
+
// Ciricle
|
85
|
+
drawNodeFns.circle = circle;
|
86
|
+
iconRectFns.circle = circleIconRect;
|
87
|
+
textRectFns.circle = circleTextRect;
|
88
|
+
anchorsFns.circle = circleAnchors;
|
89
|
+
// Triangle
|
90
|
+
drawNodeFns.triangle = triangle;
|
91
|
+
anchorsFns.triangle = triangleAnchors;
|
92
|
+
iconRectFns.triangle = triangleIconRect;
|
93
|
+
textRectFns.triangle = triangleTextRect;
|
94
|
+
// Diamond
|
95
|
+
drawNodeFns.diamond = diamond;
|
96
|
+
iconRectFns.diamond = diamondIconRect;
|
97
|
+
textRectFns.diamond = diamondTextRect;
|
98
|
+
// Hexagon
|
99
|
+
drawNodeFns.hexagon = hexagon;
|
100
|
+
iconRectFns.hexagon = hexagonIconRect;
|
101
|
+
textRectFns.hexagon = hexagonTextRect;
|
102
|
+
anchorsFns.hexagon = hexagonAnchors;
|
103
|
+
// Pentagon
|
104
|
+
drawNodeFns.pentagon = pentagon;
|
105
|
+
iconRectFns.pentagon = pentagonIconRect;
|
106
|
+
textRectFns.pentagon = pentagonTextRect;
|
107
|
+
anchorsFns.pentagon = pentagonAnchors;
|
108
|
+
// Pentagram
|
109
|
+
drawNodeFns.pentagram = pentagram;
|
110
|
+
iconRectFns.pentagram = pentagramIconRect;
|
111
|
+
textRectFns.pentagram = pentagramTextRect;
|
112
|
+
anchorsFns.pentagram = pentagramAnchors;
|
113
|
+
// Left arrow
|
114
|
+
drawNodeFns.leftArrow = leftArrow;
|
115
|
+
anchorsFns.leftArrow = arrowAnchors;
|
116
|
+
iconRectFns.leftArrow = leftArrowIconRect;
|
117
|
+
textRectFns.leftArrow = leftArrowTextRect;
|
118
|
+
// Right arrow
|
119
|
+
drawNodeFns.rightArrow = rightArrow;
|
120
|
+
anchorsFns.rightArrow = arrowAnchors;
|
121
|
+
iconRectFns.rightArrow = rightArrowIconRect;
|
122
|
+
textRectFns.rightArrow = rightArrowTextRect;
|
123
|
+
// Two-way arrow
|
124
|
+
drawNodeFns.twowayArrow = twowayArrow;
|
125
|
+
anchorsFns.twowayArrow = arrowAnchors;
|
126
|
+
iconRectFns.twowayArrow = twowayArrowIconRect;
|
127
|
+
textRectFns.twowayArrow = twowayArrowTextRect;
|
128
|
+
// Cloud
|
129
|
+
drawNodeFns.cloud = cloud;
|
130
|
+
anchorsFns.cloud = cloudAnchors;
|
131
|
+
iconRectFns.cloud = cloudIconRect;
|
132
|
+
textRectFns.cloud = cloudTextRect;
|
133
|
+
// Message
|
134
|
+
drawNodeFns.message = message;
|
135
|
+
anchorsFns.message = messageAnchors;
|
136
|
+
iconRectFns.message = messageIconRect;
|
137
|
+
textRectFns.message = messageTextRect;
|
138
|
+
// File
|
139
|
+
drawNodeFns.file = file;
|
140
|
+
// Text
|
141
|
+
drawNodeFns.text = text;
|
142
|
+
iconRectFns.text = lineIconRect;
|
143
|
+
// Line
|
144
|
+
drawNodeFns.line = nodeLine;
|
145
|
+
anchorsFns.line = lineAnchors;
|
146
|
+
iconRectFns.line = lineIconRect;
|
147
|
+
textRectFns.line = lineTextRect;
|
148
|
+
// Image
|
149
|
+
drawNodeFns.image = function (ctx, node) { };
|
150
|
+
iconRectFns.image = imageIconRect;
|
151
|
+
textRectFns.image = imageTextRect;
|
152
|
+
// Cube
|
153
|
+
drawNodeFns.cube = cube;
|
154
|
+
anchorsFns.cube = cubeAnchors;
|
155
|
+
iconRectFns.cube = cubeIconRect;
|
156
|
+
textRectFns.cube = cubeTextRect;
|
157
|
+
// Cube
|
158
|
+
drawNodeFns.people = people;
|
159
|
+
iconRectFns.people = peopleIconRect;
|
160
|
+
textRectFns.people = peopleTextRect;
|
161
|
+
// ********end********
|
162
|
+
// ********Default lines.*******
|
163
|
+
drawLineFns.line = {
|
164
|
+
drawFn: line,
|
165
|
+
drawControlPointsFn: lineControlPoints,
|
166
|
+
controlPointsFn: calcLineControlPoints,
|
167
|
+
pointIn: pointInPolyline
|
168
|
+
};
|
169
|
+
drawLineFns.polyline = {
|
170
|
+
drawFn: polyline,
|
171
|
+
drawControlPointsFn: polylineControlPoints,
|
172
|
+
controlPointsFn: calcPolylineControlPoints,
|
173
|
+
dockControlPointFn: dockPolylineControlPoint,
|
174
|
+
pointIn: pointInPolyline
|
175
|
+
};
|
176
|
+
drawLineFns.curve = {
|
177
|
+
drawFn: curve,
|
178
|
+
drawControlPointsFn: curveControlPoints,
|
179
|
+
controlPointsFn: calcCurveControlPoints,
|
180
|
+
pointIn: pointInCurve
|
181
|
+
};
|
182
|
+
drawLineFns.mind = {
|
183
|
+
drawFn: mind,
|
184
|
+
drawControlPointsFn: mindControlPoints,
|
185
|
+
controlPointsFn: calcMindControlPoints,
|
186
|
+
pointIn: pointInMind
|
187
|
+
};
|
188
|
+
// ********end********
|
189
|
+
// ********Default nodes.*******
|
190
|
+
drawArrowFns.triangleSolid = triangleSolid;
|
191
|
+
drawArrowFns.triangle = arrowTriangle;
|
192
|
+
drawArrowFns.diamondSolid = diamondSolid;
|
193
|
+
drawArrowFns.diamond = arrowDiamond;
|
194
|
+
drawArrowFns.circleSolid = circleSolid;
|
195
|
+
drawArrowFns.circle = arrowCircle;
|
196
|
+
drawArrowFns.line = arrowLine;
|
197
|
+
drawArrowFns.lineUp = lineUp;
|
198
|
+
drawArrowFns.lineDown = lineDown;
|
199
|
+
// ********end********
|
200
|
+
}
|
201
|
+
init();
|
202
|
+
// registerNode: Register a custom node.
|
203
|
+
// name - The name of node.
|
204
|
+
// drawFn - How to draw.
|
205
|
+
// anchorsFn - How to get the anchors.
|
206
|
+
// iconRectFn - How to get the icon rect.
|
207
|
+
// textRectFn - How to get the text rect.
|
208
|
+
// force - Overwirte the node if exists.
|
209
|
+
export function registerNode(name, drawFn, anchorsFn, iconRectFn, textRectFn, force) {
|
210
|
+
if (force === void 0) { force = true; }
|
211
|
+
// Exist
|
212
|
+
if (drawNodeFns[name] && !force) {
|
213
|
+
return false;
|
214
|
+
}
|
215
|
+
drawNodeFns[name] = drawFn;
|
216
|
+
anchorsFns[name] = anchorsFn;
|
217
|
+
iconRectFns[name] = iconRectFn;
|
218
|
+
textRectFns[name] = textRectFn;
|
219
|
+
return true;
|
220
|
+
}
|
221
|
+
// registerLine: Register a custom line.
|
222
|
+
// name - The name of line.
|
223
|
+
// drawFn - How to draw.
|
224
|
+
// drawControlPointsFn - Draw the control points.
|
225
|
+
// controlPointsFn - How to get the controlPoints.
|
226
|
+
// dockControlPointFn - Dock a point to horizontal/vertial or related position.
|
227
|
+
// force - Overwirte the node if exists.
|
228
|
+
export function registerLine(name, drawFn, drawControlPointsFn, controlPointsFn, dockControlPointFn, pointInFn, force) {
|
229
|
+
if (force === void 0) { force = true; }
|
230
|
+
// Exist
|
231
|
+
if (drawLineFns[name] && !force) {
|
232
|
+
return false;
|
233
|
+
}
|
234
|
+
drawLineFns[name] = {
|
235
|
+
drawFn: drawFn,
|
236
|
+
drawControlPointsFn: drawControlPointsFn,
|
237
|
+
controlPointsFn: controlPointsFn,
|
238
|
+
dockControlPointFn: dockControlPointFn,
|
239
|
+
pointIn: pointInFn
|
240
|
+
};
|
241
|
+
return true;
|
242
|
+
}
|
243
|
+
// registerArrow: Register a custom arrow.
|
244
|
+
// name - the name of arrow.
|
245
|
+
// drawFn - how to draw.
|
246
|
+
// force - Overwirte the node if exists.
|
247
|
+
export function registerArrow(name, drawFn, force) {
|
248
|
+
if (force === void 0) { force = true; }
|
249
|
+
// Exist
|
250
|
+
if (drawArrowFns[name] && !force) {
|
251
|
+
return false;
|
252
|
+
}
|
253
|
+
drawArrowFns[name] = drawFn;
|
254
|
+
return true;
|
255
|
+
}
|
256
|
+
process.browser && (window.registerTopologyNode = registerNode);
|
257
|
+
//# sourceMappingURL=default.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"default.js","sourceRoot":"","sources":["../../../../packages/core/src/middles/default.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAC9C,OAAO,EAAE,MAAM,EAAE,MAAM,gBAAgB,CAAC;AACxC,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAC5C,OAAO,EAAE,OAAO,EAAE,MAAM,iBAAiB,CAAC;AAC1C,OAAO,EAAE,SAAS,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AACnE,OAAO,EAAE,IAAI,EAAE,MAAM,cAAc,CAAC;AACpC,OAAO,EAAE,IAAI,IAAI,QAAQ,EAAE,MAAM,cAAc,CAAC;AAChD,OAAO,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAC1D,OAAO,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AACpD,OAAO,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAClD,OAAO,EAAE,cAAc,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AACrE,OAAO,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AAC3E,OAAO,EAAE,eAAe,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AACxE,OAAO,EACL,mBAAmB,EACnB,mBAAmB,EACnB,iBAAiB,EACjB,iBAAiB,EACjB,kBAAkB,EAClB,kBAAkB,EACnB,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAC/D,OAAO,EAAE,IAAI,EAAE,i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1B,IAAY,EACZ,MAA2D,EAC3D,mBAAyE,EACzE,eAAsC,EACtC,kBAAuD,EACvD,SAAiD,EACjD,KAAY;IAAZ,sBAAA,EAAA,YAAY;IAEZ,QAAQ;IACR,IAAI,WAAW,CAAC,IAAI,CAAC,IAAI,CAAC,KAAK,EAAE;QAC/B,OAAO,KAAK,CAAC;KACd;IAED,WAAW,CAAC,IAAI,CAAC,GAAG;QAClB,MAAM,EAAE,MAAM;QACd,mBAAmB,EAAE,mBAAmB;QACxC,eAAe,EAAE,eAAe;QAChC,kBAAkB,EAAE,kBAAkB;QACtC,OAAO,EAAE,SAAS;KACnB,CAAC;IACF,OAAO,IAAI,CAAC;AACd,CAAC;AAED,0CAA0C;AAC1C,4BAA4B;AAC5B,wBAAwB;AACxB,wCAAwC;AACxC,MAAM,UAAU,aAAa,CAC3B,IAAY,EACZ,MAAqF,EACrF,KAAY;IAAZ,sBAAA,EAAA,YAAY;IAEZ,QAAQ;IACR,IAAI,YAAY,CAAC,IAAI,CAAC,IAAI,CAAC,KAAK,EAAE;QAChC,OAAO,KAAK,CAAC;KACd;IAED,YAAY,CAAC,IAAI,CAAC,GAAG,MAAM,CAAC;IAC5B,OAAO,IAAI,CAAC;AACd,CAAC;AAEA,MAAc,CAAC,oBAAoB,GAAG,YAAY,CAAC"}
|
@@ -0,0 +1,19 @@
|
|
1
|
+
import { Rect } from '../models/rect';
|
2
|
+
export function defaultIconRect(node) {
|
3
|
+
if (node.image && node.imageWidth) {
|
4
|
+
node.iconRect = new Rect(node.rect.x + node.paddingLeftNum, node.rect.y + node.paddingTopNum, node.imageWidth, node.imageHeight);
|
5
|
+
}
|
6
|
+
else if (node.icon && node.iconSize) {
|
7
|
+
node.iconRect = new Rect(node.rect.x + node.paddingLeftNum, node.rect.y + node.paddingTopNum, node.iconSize, node.iconSize);
|
8
|
+
}
|
9
|
+
else {
|
10
|
+
node.iconRect = new Rect(node.rect.x + node.paddingLeftNum, node.rect.y + node.paddingTopNum, node.rect.width - node.paddingLeftNum - node.paddingRightNum, (node.rect.height * 3) / 4 - node.paddingTopNum - node.paddingBottomNum);
|
11
|
+
}
|
12
|
+
node.fullIconRect = new Rect(node.rect.x + node.paddingLeftNum, node.rect.y + node.paddingTopNum, node.rect.width - node.paddingLeftNum - node.paddingRightNum, node.rect.height - node.paddingTopNum - node.paddingBottomNum);
|
13
|
+
}
|
14
|
+
export function defaultTextRect(node) {
|
15
|
+
var height = node.rect.height - node.paddingTopNum - node.paddingBottomNum;
|
16
|
+
node.textRect = new Rect(node.rect.x + node.paddingLeftNum, node.rect.y + node.paddingTopNum + (height * 3) / 4, node.rect.width - node.paddingLeftNum - node.paddingRightNum, height / 4);
|
17
|
+
node.fullTextRect = new Rect(node.rect.x + node.paddingLeftNum, node.rect.y + node.paddingTopNum, node.rect.width - node.paddingLeftNum - node.paddingRightNum, height);
|
18
|
+
}
|
19
|
+
//# sourceMappingURL=default.rect.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"default.rect.js","sourceRoot":"","sources":["../../../../packages/core/src/middles/default.rect.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,IAAI,EAAE,MAAM,gBAAgB,CAAC;AAEtC,MAAM,UAAU,eAAe,CAAC,IAAU;IACxC,IAAI,IAAI,CAAC,KAAK,IAAI,IAAI,CAAC,UAAU,EAAE;QACjC,IAAI,CAAC,QAAQ,GAAG,IAAI,IAAI,CACtB,IAAI,CAAC,IAAI,CAAC,CAAC,GAAG,IAAI,CAAC,cAAc,EACjC,IAAI,CAAC,IAAI,CAAC,CAAC,GAAG,IAAI,CAAC,aAAa,EAChC,IAAI,CAAC,UAAU,EACf,IAAI,CAAC,WAAW,CACjB,CAAC;KACH;SAAM,IAAI,IAAI,CAAC,IAAI,IAAI,IAAI,CAAC,QAAQ,EAAE;QACrC,IAAI,CAAC,QAAQ,GAAG,IAAI,IAAI,CACtB,IAAI,CAAC,IAAI,CAAC,CAAC,GAAG,IAAI,CAAC,cAAc,EACjC,IAA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,IAAI,CAAC,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC,cAAc,GAAG,IAAI,CAAC,eAAe,EAC5D,MAAM,GAAG,CAAC,CACX,CAAC;IACF,IAAI,CAAC,YAAY,GAAG,IAAI,IAAI,CAC1B,IAAI,CAAC,IAAI,CAAC,CAAC,GAAG,IAAI,CAAC,cAAc,EACjC,IAAI,CAAC,IAAI,CAAC,CAAC,GAAG,IAAI,CAAC,aAAa,EAChC,IAAI,CAAC,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC,cAAc,GAAG,IAAI,CAAC,eAAe,EAC5D,MAAM,CACP,CAAC;AACJ,CAAC"}
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../packages/core/src/middles/index.ts"],"names":[],"mappings":"AAAA,cAAc,WAAW,CAAC;AAC1B,cAAc,mBAAmB,CAAC;AAClC,cAAc,cAAc,CAAC"}
|
@@ -0,0 +1,10 @@
|
|
1
|
+
import { Point } from '../../models/point';
|
2
|
+
import { Pen } from '../../models/pen';
|
3
|
+
import { Line } from '../../models/line';
|
4
|
+
export declare function curve(ctx: CanvasRenderingContext2D, l: Line): void;
|
5
|
+
export declare function curveControlPoints(ctx: CanvasRenderingContext2D, l: Line): void;
|
6
|
+
export declare function calcCurveControlPoints(l: Line): void;
|
7
|
+
export declare function pointInCurve(point: Point, l: Line): boolean;
|
8
|
+
export declare function getBezierPoint(pos: number, from: Point, cp1: Point, cp2: Point, to: Point): Point;
|
9
|
+
export declare function getControlPt(pt: Point, to: Point): Point;
|
10
|
+
export declare function generateStoreKey(pen: Pen, key: String): string;
|
@@ -0,0 +1,127 @@
|
|
1
|
+
import { Store } from 'le5le-store';
|
2
|
+
import { Point } from '../../models/point';
|
3
|
+
import { Direction } from '../../models/direction';
|
4
|
+
import { pointInLine } from '../../utils/canvas';
|
5
|
+
var distance = 80;
|
6
|
+
export function curve(ctx, l) {
|
7
|
+
ctx.beginPath();
|
8
|
+
ctx.moveTo(l.from.x, l.from.y);
|
9
|
+
ctx.bezierCurveTo(l.controlPoints[0].x, l.controlPoints[0].y, l.controlPoints[1].x, l.controlPoints[1].y, l.to.x, l.to.y);
|
10
|
+
ctx.stroke();
|
11
|
+
}
|
12
|
+
export function curveControlPoints(ctx, l) {
|
13
|
+
ctx.save();
|
14
|
+
ctx.fillStyle = ctx.strokeStyle + '80';
|
15
|
+
ctx.lineWidth = 1;
|
16
|
+
ctx.beginPath();
|
17
|
+
ctx.moveTo(l.from.x, l.from.y);
|
18
|
+
ctx.lineTo(l.controlPoints[0].x, l.controlPoints[0].y);
|
19
|
+
ctx.stroke();
|
20
|
+
ctx.beginPath();
|
21
|
+
ctx.moveTo(l.to.x, l.to.y);
|
22
|
+
ctx.lineTo(l.controlPoints[1].x, l.controlPoints[1].y);
|
23
|
+
ctx.stroke();
|
24
|
+
ctx.fillStyle = '#fff';
|
25
|
+
ctx.lineWidth = 2;
|
26
|
+
for (var _i = 0, _a = l.controlPoints; _i < _a.length; _i++) {
|
27
|
+
var item = _a[_i];
|
28
|
+
ctx.beginPath();
|
29
|
+
ctx.arc(item.x, item.y, 4, 0, Math.PI * 2);
|
30
|
+
ctx.stroke();
|
31
|
+
ctx.fill();
|
32
|
+
}
|
33
|
+
ctx.restore();
|
34
|
+
}
|
35
|
+
export function calcCurveControlPoints(l) {
|
36
|
+
if (!l.from.direction) {
|
37
|
+
l.from.direction = Direction.Bottom;
|
38
|
+
}
|
39
|
+
if (!l.to.direction) {
|
40
|
+
l.to.direction = (l.from.direction + 2) % 4;
|
41
|
+
if (!l.to.direction) {
|
42
|
+
l.to.direction = Direction.Left;
|
43
|
+
}
|
44
|
+
}
|
45
|
+
l.controlPoints = [getControlPt(l.from, l.to), getControlPt(l.to, l.from)];
|
46
|
+
Store.set(generateStoreKey(l, 'pts-') + l.id, null);
|
47
|
+
}
|
48
|
+
export function pointInCurve(point, l) {
|
49
|
+
var points = Store.get(generateStoreKey(l, 'pts-') + l.id);
|
50
|
+
if (!points) {
|
51
|
+
points = [l.from];
|
52
|
+
for (var i = 0.01; i < 1; i += 0.01) {
|
53
|
+
points.push(getBezierPoint(i, l.from, l.controlPoints[0], l.controlPoints[1], l.to));
|
54
|
+
}
|
55
|
+
points.push(l.to);
|
56
|
+
Store.set(generateStoreKey(l, 'pts-') + l.id, points);
|
57
|
+
}
|
58
|
+
var cnt = points.length - 1;
|
59
|
+
for (var i = 0; i < cnt; ++i) {
|
60
|
+
if (pointInLine(point, points[i], points[i + 1])) {
|
61
|
+
return true;
|
62
|
+
}
|
63
|
+
}
|
64
|
+
return false;
|
65
|
+
}
|
66
|
+
// Get a point in bezier.
|
67
|
+
// pos - The position of point in bezier. It is expressed as a percentage(0 - 1).
|
68
|
+
export function getBezierPoint(pos, from, cp1, cp2, to) {
|
69
|
+
var x1 = from.x, y1 = from.y;
|
70
|
+
var x2 = to.x, y2 = to.y;
|
71
|
+
var cx1 = cp1.x, cy1 = cp1.y;
|
72
|
+
var cx2 = cp2.x, cy2 = cp2.y;
|
73
|
+
var x = x1 * (1 - pos) * (1 - pos) * (1 - pos) +
|
74
|
+
3 * cx1 * pos * (1 - pos) * (1 - pos) +
|
75
|
+
3 * cx2 * pos * pos * (1 - pos) +
|
76
|
+
x2 * pos * pos * pos;
|
77
|
+
var y = y1 * (1 - pos) * (1 - pos) * (1 - pos) +
|
78
|
+
3 * cy1 * pos * (1 - pos) * (1 - pos) +
|
79
|
+
3 * cy2 * pos * pos * (1 - pos) +
|
80
|
+
y2 * pos * pos * pos;
|
81
|
+
return new Point(x, y);
|
82
|
+
}
|
83
|
+
export function getControlPt(pt, to) {
|
84
|
+
var point = new Point(pt.x, pt.y, pt.direction, pt.anchorIndex, pt.id);
|
85
|
+
var dis = window.topologyControlPtDistance || distance;
|
86
|
+
if ((pt.direction === Direction.Up || pt.direction === Direction.Bottom) && Math.abs(pt.x - to.x) < 3) {
|
87
|
+
if (to.y > pt.y) {
|
88
|
+
dis = Math.floor((to.y - pt.y) / 3);
|
89
|
+
point.y += dis;
|
90
|
+
}
|
91
|
+
else {
|
92
|
+
dis = Math.floor((pt.y - to.y) / 3);
|
93
|
+
point.y -= dis;
|
94
|
+
}
|
95
|
+
return point;
|
96
|
+
}
|
97
|
+
if ((pt.direction === Direction.Left || pt.direction === Direction.Right) && Math.abs(pt.y - to.y) < 3) {
|
98
|
+
if (to.x > pt.x) {
|
99
|
+
dis = Math.floor((to.x - pt.x) / 3);
|
100
|
+
point.x += dis;
|
101
|
+
}
|
102
|
+
else {
|
103
|
+
dis = Math.floor((pt.x - to.x) / 3);
|
104
|
+
point.x -= dis;
|
105
|
+
}
|
106
|
+
return point;
|
107
|
+
}
|
108
|
+
switch (pt.direction) {
|
109
|
+
case Direction.Up:
|
110
|
+
point.y -= dis;
|
111
|
+
break;
|
112
|
+
case Direction.Right:
|
113
|
+
point.x += dis;
|
114
|
+
break;
|
115
|
+
case Direction.Bottom:
|
116
|
+
point.y += dis;
|
117
|
+
break;
|
118
|
+
case Direction.Left:
|
119
|
+
point.x -= dis;
|
120
|
+
break;
|
121
|
+
}
|
122
|
+
return point;
|
123
|
+
}
|
124
|
+
export function generateStoreKey(pen, key) {
|
125
|
+
return pen.getTID() + "-" + key;
|
126
|
+
}
|
127
|
+
//# sourceMappingURL=curve.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"curve.js","sourceRoot":"","sources":["../../../../../packages/core/src/middles/lines/curve.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AAEpC,OAAO,EAAE,KAAK,EAAE,MAAM,oBAAoB,CAAC;AAG3C,OAAO,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAC;AACnD,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AAEjD,IAAM,QAAQ,GAAG,EAAE,CAAC;AAEpB,MAAM,UAAU,KAAK,CAAC,GAA6B,EAAE,CAAO;IAC1D,GAAG,CAAC,SAAS,EAAE,CAAC;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AC,CAAC,GAAG,EAAE,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC;YACpC,KAAK,CAAC,CAAC,IAAI,GAAG,CAAC;SAChB;QACD,OAAO,KAAK,CAAC;KACd;IAED,QAAQ,EAAE,CAAC,SAAS,EAAE;QACpB,KAAK,SAAS,CAAC,EAAE;YACf,KAAK,CAAC,CAAC,IAAI,GAAG,CAAC;YACf,MAAM;QACR,KAAK,SAAS,CAAC,KAAK;YAClB,KAAK,CAAC,CAAC,IAAI,GAAG,CAAC;YACf,MAAM;QACR,KAAK,SAAS,CAAC,MAAM;YACnB,KAAK,CAAC,CAAC,IAAI,GAAG,CAAC;YACf,MAAM;QACR,KAAK,SAAS,CAAC,IAAI;YACjB,KAAK,CAAC,CAAC,IAAI,GAAG,CAAC;YACf,MAAM;KACT;IAED,OAAO,KAAK,CAAC;AACf,CAAC;AAED,MAAM,UAAU,gBAAgB,CAAC,GAAQ,EAAE,GAAW;IACpD,OAAU,GAAG,CAAC,MAAM,EAAE,SAAI,GAAK,CAAC;AAClC,CAAC"}
|
@@ -0,0 +1,4 @@
|
|
1
|
+
import { Line } from '../../models/line';
|
2
|
+
export declare function line(ctx: CanvasRenderingContext2D, l: Line): void;
|
3
|
+
export declare function lineControlPoints(ctx: CanvasRenderingContext2D, l: Line): void;
|
4
|
+
export declare function calcLineControlPoints(l: Line): void;
|
@@ -0,0 +1,11 @@
|
|
1
|
+
export function line(ctx, l) {
|
2
|
+
ctx.beginPath();
|
3
|
+
ctx.moveTo(l.from.x, l.from.y);
|
4
|
+
ctx.lineTo(l.to.x, l.to.y);
|
5
|
+
ctx.stroke();
|
6
|
+
}
|
7
|
+
export function lineControlPoints(ctx, l) { }
|
8
|
+
export function calcLineControlPoints(l) {
|
9
|
+
l.controlPoints = [];
|
10
|
+
}
|
11
|
+
//# sourceMappingURL=line.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"line.js","sourceRoot":"","sources":["../../../../../packages/core/src/middles/lines/line.ts"],"names":[],"mappings":"AAEA,MAAM,UAAU,IAAI,CAAC,GAA6B,EAAE,CAAO;IACzD,GAAG,CAAC,SAAS,EAAE,CAAC;IAChB,GAAG,CAAC,MAAM,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAC/B,GAAG,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,EAAE,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC;IAC3B,GAAG,CAAC,MAAM,EAAE,CAAC;AACf,CAAC;AAED,MAAM,UAAU,iBAAiB,CAAC,GAA6B,EAAE,CAAO,IAAG,CAAC;AAE5E,MAAM,UAAU,qBAAqB,CAAC,CAAO;IAC3C,CAAC,CAAC,aAAa,GAAG,EAAE,CAAC;AACvB,CAAC"}
|
@@ -0,0 +1,6 @@
|
|
1
|
+
import { Point } from '../../models/point';
|
2
|
+
import { Line } from '../../models/line';
|
3
|
+
export declare function mind(ctx: CanvasRenderingContext2D, l: Line): void;
|
4
|
+
export declare function mindControlPoints(ctx: CanvasRenderingContext2D, l: Line): void;
|
5
|
+
export declare function calcMindControlPoints(l: Line): void;
|
6
|
+
export declare function pointInMind(point: Point, l: Line): boolean;
|
@@ -0,0 +1,90 @@
|
|
1
|
+
import { Store } from 'le5le-store';
|
2
|
+
import { Point } from '../../models/point';
|
3
|
+
import { Direction } from '../../models/direction';
|
4
|
+
import { pointInLine } from '../../utils/canvas';
|
5
|
+
import { getBezierPoint, generateStoreKey } from './curve';
|
6
|
+
var distance = 8;
|
7
|
+
export function mind(ctx, l) {
|
8
|
+
ctx.beginPath();
|
9
|
+
ctx.moveTo(l.from.x, l.from.y);
|
10
|
+
ctx.lineTo(l.controlPoints[0].x, l.controlPoints[0].y);
|
11
|
+
ctx.bezierCurveTo(l.controlPoints[1].x, l.controlPoints[1].y, l.controlPoints[2].x, l.controlPoints[2].y, l.to.x, l.to.y);
|
12
|
+
ctx.stroke();
|
13
|
+
}
|
14
|
+
export function mindControlPoints(ctx, l) {
|
15
|
+
ctx.save();
|
16
|
+
ctx.fillStyle = ctx.strokeStyle + '80';
|
17
|
+
ctx.lineWidth = 1;
|
18
|
+
ctx.beginPath();
|
19
|
+
ctx.moveTo(l.controlPoints[0].x, l.controlPoints[0].y);
|
20
|
+
ctx.lineTo(l.controlPoints[1].x, l.controlPoints[1].y);
|
21
|
+
ctx.stroke();
|
22
|
+
ctx.beginPath();
|
23
|
+
ctx.moveTo(l.to.x, l.to.y);
|
24
|
+
ctx.lineTo(l.controlPoints[2].x, l.controlPoints[2].y);
|
25
|
+
ctx.stroke();
|
26
|
+
ctx.fillStyle = '#fff';
|
27
|
+
ctx.lineWidth = 2;
|
28
|
+
for (var _i = 0, _a = l.controlPoints; _i < _a.length; _i++) {
|
29
|
+
var item = _a[_i];
|
30
|
+
ctx.beginPath();
|
31
|
+
ctx.arc(item.x, item.y, 4, 0, Math.PI * 2);
|
32
|
+
ctx.stroke();
|
33
|
+
ctx.fill();
|
34
|
+
}
|
35
|
+
ctx.restore();
|
36
|
+
}
|
37
|
+
export function calcMindControlPoints(l) {
|
38
|
+
if (!l.from.direction) {
|
39
|
+
l.from.direction = Direction.Bottom;
|
40
|
+
}
|
41
|
+
if (!l.to.direction) {
|
42
|
+
l.to.direction = (l.from.direction + 2) % 4;
|
43
|
+
if (!l.to.direction) {
|
44
|
+
l.to.direction = Direction.Left;
|
45
|
+
}
|
46
|
+
}
|
47
|
+
var from = new Point(l.from.x, l.from.y, l.from.direction);
|
48
|
+
switch (l.from.direction) {
|
49
|
+
case Direction.Up:
|
50
|
+
from.y -= distance;
|
51
|
+
break;
|
52
|
+
case Direction.Right:
|
53
|
+
from.x += distance;
|
54
|
+
break;
|
55
|
+
case Direction.Bottom:
|
56
|
+
from.y += distance;
|
57
|
+
break;
|
58
|
+
case Direction.Left:
|
59
|
+
from.x -= distance;
|
60
|
+
break;
|
61
|
+
}
|
62
|
+
var w = l.to.x - from.x;
|
63
|
+
var h = l.to.y - from.y;
|
64
|
+
if (l.from.direction === Direction.Left || l.from.direction === Direction.Right) {
|
65
|
+
l.controlPoints = [from, new Point(from.x, from.y + h / 3), new Point(from.x, l.to.y)];
|
66
|
+
}
|
67
|
+
else {
|
68
|
+
l.controlPoints = [from, new Point(from.x + w / 3, from.y), new Point(l.to.x, from.y)];
|
69
|
+
}
|
70
|
+
Store.set(generateStoreKey(l, 'pts-') + l.id, null);
|
71
|
+
}
|
72
|
+
export function pointInMind(point, l) {
|
73
|
+
var points = Store.get(generateStoreKey(l, 'pts-') + l.id);
|
74
|
+
if (!points) {
|
75
|
+
points = [l.from];
|
76
|
+
for (var i = 0.01; i < 1; i += 0.01) {
|
77
|
+
points.push(getBezierPoint(i, l.controlPoints[0], l.controlPoints[1], l.controlPoints[2], l.to));
|
78
|
+
}
|
79
|
+
points.push(l.to);
|
80
|
+
Store.set(generateStoreKey(l, 'pts-') + l.id, points);
|
81
|
+
}
|
82
|
+
var cnt = points.length - 1;
|
83
|
+
for (var i = 0; i < cnt; ++i) {
|
84
|
+
if (pointInLine(point, points[i], points[i + 1])) {
|
85
|
+
return true;
|
86
|
+
}
|
87
|
+
}
|
88
|
+
return false;
|
89
|
+
}
|
90
|
+
//# sourceMappingURL=mind.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"mind.js","sourceRoot":"","sources":["../../../../../packages/core/src/middles/lines/mind.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AAEpC,OAAO,EAAE,KAAK,EAAE,MAAM,oBAAoB,CAAC;AAE3C,OAAO,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAC;AACnD,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AACjD,OAAO,EAAE,cAAc,EAAE,gBAAgB,EAAE,MAAM,SAAS,CAAC;AAE3D,IAAM,QAAQ,GAAG,CAAC,CAAC;AAEnB,MAAM,UAAU,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CAAC,CAAC,CAAC,EAAE,MAAM,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE;YAChD,OAAO,IAAI,CAAC;SACb;KACF;IACD,OAAO,KAAK,CAAC;AACf,CAAC"}
|
@@ -0,0 +1,7 @@
|
|
1
|
+
import { Point } from '../../models/point';
|
2
|
+
import { Line } from '../../models/line';
|
3
|
+
export declare function polyline(ctx: CanvasRenderingContext2D, l: Line): void;
|
4
|
+
export declare function polylineControlPoints(ctx: CanvasRenderingContext2D, l: Line): void;
|
5
|
+
export declare function calcPolylineControlPoints(l: Line): void;
|
6
|
+
export declare function pointInPolyline(point: Point, l: Line): boolean;
|
7
|
+
export declare function dockPolylineControlPoint(point: Point, l: Line): void;
|