dcim-topology2d 1.0.1
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
package/core/src/core.js
ADDED
@@ -0,0 +1,2281 @@
|
|
1
|
+
var __extends = (this && this.__extends) || (function () {
|
2
|
+
var extendStatics = function (d, b) {
|
3
|
+
extendStatics = Object.setPrototypeOf ||
|
4
|
+
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
5
|
+
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
|
6
|
+
return extendStatics(d, b);
|
7
|
+
};
|
8
|
+
return function (d, b) {
|
9
|
+
extendStatics(d, b);
|
10
|
+
function __() { this.constructor = d; }
|
11
|
+
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
12
|
+
};
|
13
|
+
})();
|
14
|
+
import {Store} from 'le5le-store';
|
15
|
+
import { Common } from './common'
|
16
|
+
import {HoverLayer} from './hoverLayer';
|
17
|
+
import {ActiveLayer} from './activeLayer';
|
18
|
+
import {KeyType, KeydownType} from './options';
|
19
|
+
import {PenType, Node, Point, Line, TopologyData, Lock, AnchorMode, Rect} from './models';
|
20
|
+
import {drawNodeFns, drawLineFns} from './middles/index';
|
21
|
+
import { s8, pointInRect, formatPadding, previewType} from './utils';
|
22
|
+
import axios from 'axios'
|
23
|
+
|
24
|
+
var resizeCursors = ['nw-resize', 'ne-resize', 'se-resize', 'sw-resize'];
|
25
|
+
var dockOffset = 10;
|
26
|
+
var Topology = (function (_super) {
|
27
|
+
__extends(Topology, _super);
|
28
|
+
function Topology(parent, options) {
|
29
|
+
var _this = _super.call(this, parent, options) || this;
|
30
|
+
_this.hoverLayer = new HoverLayer(this.options, _this.id);
|
31
|
+
_this.activeLayer = new ActiveLayer(this.options, _this.id);
|
32
|
+
_this.offscreen.getRoutineLayer();
|
33
|
+
_this.activeLayer.topology = this;
|
34
|
+
_this.gridElem = document.createElement('div');
|
35
|
+
_this.caches = {
|
36
|
+
index: 0,
|
37
|
+
list: [],
|
38
|
+
};
|
39
|
+
_this.needCache = false;
|
40
|
+
_this.addingArbitraryGraph = false;
|
41
|
+
_this.arbitrarygGraphData = {
|
42
|
+
points: [],
|
43
|
+
circles: [],
|
44
|
+
indexCircle: 0, //当前点击的圆圈
|
45
|
+
oZindex: -1, //是否达到起点
|
46
|
+
isDragging: false, //是否在抓取
|
47
|
+
close: false, //闭合
|
48
|
+
};
|
49
|
+
_this.onMouseMove = function (e) {
|
50
|
+
if (Store.get('addingArbitraryGraph')) {
|
51
|
+
return
|
52
|
+
}
|
53
|
+
if (_this.scheduledAnimationFrame || _this.data.locked === Lock.NoEvent) {
|
54
|
+
return;
|
55
|
+
}
|
56
|
+
// https://caniuse.com/#feat=mdn-api_mouseevent_buttons
|
57
|
+
if (_this.mouseDown && !_this.mouseDown.restore && e.buttons !== 1) {
|
58
|
+
// 防止异常情况导致mouseup事件没有触发
|
59
|
+
_this.onmouseup(e);
|
60
|
+
return;
|
61
|
+
}
|
62
|
+
if (_this.mouseDown) {
|
63
|
+
var b = false;
|
64
|
+
switch (_this.options.translateKey) {
|
65
|
+
case KeyType.None:
|
66
|
+
b = true;
|
67
|
+
break;
|
68
|
+
case KeyType.Ctrl:
|
69
|
+
if (e.ctrlKey) {
|
70
|
+
b = true;
|
71
|
+
}
|
72
|
+
break;
|
73
|
+
case KeyType.Shift:
|
74
|
+
if (e.shiftKey) {
|
75
|
+
b = true;
|
76
|
+
}
|
77
|
+
break;
|
78
|
+
case KeyType.Alt:
|
79
|
+
if (e.altKey) {
|
80
|
+
b = true;
|
81
|
+
}
|
82
|
+
break;
|
83
|
+
default:
|
84
|
+
if (e.ctrlKey || e.altKey) {
|
85
|
+
b = true;
|
86
|
+
}
|
87
|
+
}
|
88
|
+
if (b) {
|
89
|
+
var canvasPos_1 = _this.divLayer.canvas.getBoundingClientRect();
|
90
|
+
const x = e.x - _this.mouseDown.x - canvasPos_1.x;
|
91
|
+
const y = e.y - _this.mouseDown.y - canvasPos_1.y;
|
92
|
+
_this.translate(x, y, true);
|
93
|
+
_this.render();
|
94
|
+
_this.cache();
|
95
|
+
_this.dispatch('translate', {x, y});
|
96
|
+
return false;
|
97
|
+
}
|
98
|
+
}
|
99
|
+
if (_this.data.locked && _this.mouseDown) {
|
100
|
+
return;
|
101
|
+
}
|
102
|
+
_this.scheduledAnimationFrame = true;
|
103
|
+
var canvasPos = _this.divLayer.canvas.getBoundingClientRect();
|
104
|
+
var pos = new Point(e.x - canvasPos.x, e.y - canvasPos.y);
|
105
|
+
if (_this.raf)
|
106
|
+
cancelAnimationFrame(_this.raf);
|
107
|
+
_this.raf = requestAnimationFrame(function () {
|
108
|
+
_this.raf = null;
|
109
|
+
if (!_this.mouseDown) {
|
110
|
+
_this.getMoveIn(pos);
|
111
|
+
// Render hover anchors.
|
112
|
+
if (_this.moveIn.hoverNode !== _this.lastHoverNode) {
|
113
|
+
if (_this.lastHoverNode) {
|
114
|
+
// Send a move event.
|
115
|
+
_this.dispatch('moveOutNode', _this.lastHoverNode);
|
116
|
+
_this.hideTip();
|
117
|
+
// Clear hover anchors.
|
118
|
+
_this.hoverLayer.node = null;
|
119
|
+
}
|
120
|
+
if (_this.moveIn.hoverNode) {
|
121
|
+
_this.hoverLayer.node = _this.moveIn.hoverNode;
|
122
|
+
// Send a move event.
|
123
|
+
_this.dispatch('moveInNode', _this.moveIn.hoverNode);
|
124
|
+
_this.showTip(_this.moveIn.hoverNode, pos);
|
125
|
+
// _this.showTipText(_this.moveIn.hoverNode, pos);
|
126
|
+
}
|
127
|
+
}
|
128
|
+
if (_this.moveIn.hoverLine !== _this.lastHoverLine) {
|
129
|
+
if (_this.lastHoverLine) {
|
130
|
+
_this.dispatch('moveOutLine', _this.lastHoverLine);
|
131
|
+
_this.hideTip();
|
132
|
+
}
|
133
|
+
if (_this.moveIn.hoverLine) {
|
134
|
+
_this.dispatch('moveInLine', _this.moveIn.hoverLine);
|
135
|
+
_this.showTip(_this.moveIn.hoverLine, pos);
|
136
|
+
}
|
137
|
+
}
|
138
|
+
if (_this.moveIn.type === _this.moveInType.LineControlPoint) {
|
139
|
+
_this.hoverLayer.hoverLineCP = _this.moveIn.lineControlPoint;
|
140
|
+
} else if (_this.hoverLayer.hoverLineCP) {
|
141
|
+
_this.hoverLayer.hoverLineCP = null;
|
142
|
+
}
|
143
|
+
if (_this.moveIn.hoverNode !== _this.lastHoverNode ||
|
144
|
+
_this.moveIn.type === _this.moveInType.HoverAnchors ||
|
145
|
+
_this.hoverLayer.lasthoverLineCP !== _this.hoverLayer.hoverLineCP) {
|
146
|
+
_this.hoverLayer.lasthoverLineCP = _this.hoverLayer.hoverLineCP;
|
147
|
+
_this.render();
|
148
|
+
}
|
149
|
+
_this.scheduledAnimationFrame = false;
|
150
|
+
return;
|
151
|
+
}
|
152
|
+
// Move out parent element.
|
153
|
+
var moveOutX = pos.x + 50 > _this.parentElem.clientWidth + _this.parentElem.scrollLeft;
|
154
|
+
var moveOutY = pos.y + 50 > _this.parentElem.clientHeight + _this.parentElem.scrollTop;
|
155
|
+
if (!_this.options.disableMoveOutParent && (moveOutX || moveOutY)) {
|
156
|
+
_this.dispatch('moveOutParent', pos);
|
157
|
+
if (_this.options.autoExpandDistance > 0) {
|
158
|
+
var resize = false;
|
159
|
+
if (pos.x + 50 > _this.divLayer.canvas.clientWidth) {
|
160
|
+
_this.canvas.width += _this.options.autoExpandDistance;
|
161
|
+
resize = true;
|
162
|
+
}
|
163
|
+
if (pos.y + 50 > _this.divLayer.canvas.clientHeight) {
|
164
|
+
_this.canvas.height += _this.options.autoExpandDistance;
|
165
|
+
resize = true;
|
166
|
+
}
|
167
|
+
if (resize) {
|
168
|
+
_this.resize({
|
169
|
+
width: _this.canvas.width,
|
170
|
+
height: _this.canvas.height,
|
171
|
+
});
|
172
|
+
}
|
173
|
+
_this.scroll(moveOutX ? _this.options.autoExpandDistance / 2 : 0, moveOutY ? _this.options.autoExpandDistance / 2 : 0);
|
174
|
+
}
|
175
|
+
}
|
176
|
+
var moveLeft = pos.x - 100 < _this.parentElem.scrollLeft;
|
177
|
+
var moveTop = pos.y - 100 < _this.parentElem.scrollTop;
|
178
|
+
if ((moveLeft || moveTop)) {
|
179
|
+
_this.scroll(moveLeft ? -100 : 0, moveTop ? -100 : 0);
|
180
|
+
}
|
181
|
+
// console.log('_this.moveIn.type----', _this.moveIn.type)
|
182
|
+
switch (_this.moveIn.type) {
|
183
|
+
case _this.moveInType.None:
|
184
|
+
_this.hoverLayer.dragRect = new Rect(_this.mouseDown.x, _this.mouseDown.y, pos.x - _this.mouseDown.x, pos.y - _this.mouseDown.y);
|
185
|
+
break;
|
186
|
+
case _this.moveInType.Nodes:
|
187
|
+
if (_this.activeLayer.locked()) {
|
188
|
+
break;
|
189
|
+
}
|
190
|
+
var x = pos.x - _this.mouseDown.x;
|
191
|
+
var y = pos.y - _this.mouseDown.y;
|
192
|
+
if (x || y) {
|
193
|
+
var offset = _this.getDockPos(x, y, e.ctrlKey || e.shiftKey || e.altKey);
|
194
|
+
_this.activeLayer.move(offset.x ? offset.x : x, offset.y ? offset.y : y);
|
195
|
+
_this.needCache = true;
|
196
|
+
}
|
197
|
+
break;
|
198
|
+
case _this.moveInType.ResizeCP:
|
199
|
+
var p1 = new Point(_this.mouseDown.x, _this.mouseDown.y);
|
200
|
+
var p2 = new Point(pos.x, pos.y);
|
201
|
+
var offsetX = p2.x - p1.x;
|
202
|
+
var offsetY = p2.y - p1.y;
|
203
|
+
switch (_this.moveIn.activeAnchorIndex) {
|
204
|
+
case 0:
|
205
|
+
offsetX = -offsetX;
|
206
|
+
offsetY = -offsetY;
|
207
|
+
break;
|
208
|
+
case 1:
|
209
|
+
offsetY = -offsetY;
|
210
|
+
break;
|
211
|
+
case 3:
|
212
|
+
offsetX = -offsetX;
|
213
|
+
break;
|
214
|
+
}
|
215
|
+
if (_this.activeLayer.pens.length === 1 && _this.activeLayer.pens[0].name === 'arbitraryGraph') {
|
216
|
+
|
217
|
+
if (_this.activeLayer.pens.length === 1 && _this.activeLayer.pens[0].rotate % 360) {
|
218
|
+
|
219
|
+
if (offsetX <= 0 && (_this.activeLayer.pens[0].rect.width) <= 20) {
|
220
|
+
|
221
|
+
// console.log('已无法缩小');
|
222
|
+
} else if (offsetY <= 0 && (_this.activeLayer.pens[0].rect.height) <= 20) {
|
223
|
+
|
224
|
+
// console.log('已无法缩小');
|
225
|
+
|
226
|
+
} else {
|
227
|
+
_this.activeLayer.resize(_this.moveIn.activeAnchorIndex, _this.mouseDown, pos);
|
228
|
+
_this.dispatch('resizePens', _this.activeLayer.pens);
|
229
|
+
_this.needCache = true;
|
230
|
+
}
|
231
|
+
} else {
|
232
|
+
if (offsetX <= 0 && (_this.activeLayer.nodeRects[0].width + offsetX) <= 10) {
|
233
|
+
|
234
|
+
// console.log('宽度已无法缩小');
|
235
|
+
|
236
|
+
} else if (offsetY <= 0 && (_this.activeLayer.nodeRects[0].height + offsetY) <= 10) {
|
237
|
+
|
238
|
+
// console.log('高度已无法缩小');
|
239
|
+
} else {
|
240
|
+
_this.activeLayer.resize(_this.moveIn.activeAnchorIndex, _this.mouseDown, pos);
|
241
|
+
_this.dispatch('resizePens', _this.activeLayer.pens);
|
242
|
+
_this.needCache = true;
|
243
|
+
}
|
244
|
+
}
|
245
|
+
} else {
|
246
|
+
_this.activeLayer.resize(_this.moveIn.activeAnchorIndex, _this.mouseDown, pos);
|
247
|
+
_this.dispatch('resizePens', _this.activeLayer.pens);
|
248
|
+
_this.needCache = true;
|
249
|
+
}
|
250
|
+
break;
|
251
|
+
case _this.moveInType.LineTo:
|
252
|
+
case _this.moveInType.HoverAnchors:
|
253
|
+
if (_this.moveIn.hoverNode && _this.moveIn.hoverNode.name == 'arbitraryGraph') {
|
254
|
+
|
255
|
+
_this.activeLayer.pens[0].rect.circles[_this.moveIn.hoverAnchorIndex].x = pos.x;
|
256
|
+
|
257
|
+
_this.activeLayer.pens[0].rect.circles[_this.moveIn.hoverAnchorIndex].y = pos.y;
|
258
|
+
|
259
|
+
_this.activeLayer.pens[0].anchors[_this.moveIn.hoverAnchorIndex].x = pos.x;
|
260
|
+
|
261
|
+
_this.activeLayer.pens[0].anchors[_this.moveIn.hoverAnchorIndex].y = pos.y;
|
262
|
+
|
263
|
+
let circles = _this.activeLayer.pens[0].rect.circles;
|
264
|
+
let minX = Math.min.apply(Math, circles.map((item) => {
|
265
|
+
return item.x
|
266
|
+
}));
|
267
|
+
let minY = Math.min.apply(Math, circles.map((item) => {
|
268
|
+
return item.y
|
269
|
+
}));
|
270
|
+
let rectW = Math.max.apply(Math, circles.map((item) => {
|
271
|
+
return item.x
|
272
|
+
})) - minX;
|
273
|
+
let rectH = Math.max.apply(Math, circles.map((item) => {
|
274
|
+
return item.y
|
275
|
+
})) - minY;
|
276
|
+
|
277
|
+
_this.activeLayer.pens[0].rect.x = minX;
|
278
|
+
_this.activeLayer.pens[0].rect.y = minY;
|
279
|
+
_this.activeLayer.pens[0].rect.ex = _this.activeLayer.pens[0].rect.x + rectW;
|
280
|
+
_this.activeLayer.pens[0].rect.ey = _this.activeLayer.pens[0].rect.y + rectH;
|
281
|
+
_this.activeLayer.pens[0].rect.width = rectW;
|
282
|
+
_this.activeLayer.pens[0].rect.height = rectH;
|
283
|
+
|
284
|
+
_this.activeLayer.pens[0].init();
|
285
|
+
|
286
|
+
} else {
|
287
|
+
|
288
|
+
var arrow = _this.data.toArrowType;
|
289
|
+
if (_this.moveIn.hoverLine) {
|
290
|
+
arrow = _this.moveIn.hoverLine.toArrow;
|
291
|
+
}
|
292
|
+
if (_this.hoverLayer.line) {
|
293
|
+
_this.activeLayer.pens = [_this.hoverLayer.line];
|
294
|
+
}
|
295
|
+
_this.hoverLayer.lineTo(_this.getLineDock(pos), arrow);
|
296
|
+
}
|
297
|
+
_this.needCache = true;
|
298
|
+
break;
|
299
|
+
case _this.moveInType.LineFrom:
|
300
|
+
_this.hoverLayer.lineFrom(_this.getLineDock(pos));
|
301
|
+
_this.needCache = true;
|
302
|
+
break;
|
303
|
+
case _this.moveInType.LineMove:
|
304
|
+
_this.hoverLayer.lineMove(pos, _this.mouseDown);
|
305
|
+
_this.needCache = true;
|
306
|
+
break;
|
307
|
+
case _this.moveInType.Line: {
|
308
|
+
var x_1 = pos.x - _this.mouseDown.x;
|
309
|
+
var y_1 = pos.y - _this.mouseDown.y;
|
310
|
+
if (x_1 || y_1) {
|
311
|
+
_this.activeLayer.move(x_1, y_1);
|
312
|
+
_this.needCache = true;
|
313
|
+
}
|
314
|
+
}
|
315
|
+
break;
|
316
|
+
case _this.moveInType.LineControlPoint:
|
317
|
+
_this.moveIn.hoverLine.controlPoints[_this.moveIn.lineControlPoint.id].x = pos.x;
|
318
|
+
_this.moveIn.hoverLine.controlPoints[_this.moveIn.lineControlPoint.id].y = pos.y;
|
319
|
+
_this.moveIn.hoverLine.textRect = null;
|
320
|
+
if (drawLineFns[_this.moveIn.hoverLine.name] &&
|
321
|
+
drawLineFns[_this.moveIn.hoverLine.name].dockControlPointFn) {
|
322
|
+
drawLineFns[_this.moveIn.hoverLine.name].dockControlPointFn(_this.moveIn.hoverLine.controlPoints[_this.moveIn.lineControlPoint.id], _this.moveIn.hoverLine);
|
323
|
+
}
|
324
|
+
_this.needCache = true;
|
325
|
+
Store.set(_this.generateStoreKey('LT:updateLines'), [
|
326
|
+
_this.moveIn.hoverLine,
|
327
|
+
]);
|
328
|
+
break;
|
329
|
+
case _this.moveInType.Rotate:
|
330
|
+
if (_this.activeLayer.pens.length) {
|
331
|
+
_this.activeLayer.offsetRotate(_this.getAngle(pos));
|
332
|
+
_this.activeLayer.updateLines();
|
333
|
+
}
|
334
|
+
_this.needCache = true;
|
335
|
+
break;
|
336
|
+
}
|
337
|
+
_this.render();
|
338
|
+
_this.scheduledAnimationFrame = false;
|
339
|
+
});
|
340
|
+
};
|
341
|
+
_this.onmousedown = function (e) {
|
342
|
+
if (e.button !== 0)
|
343
|
+
return;
|
344
|
+
var canvasPos = _this.divLayer.canvas.getBoundingClientRect();
|
345
|
+
_this.mouseDown = {x: e.x - canvasPos.x, y: e.y - canvasPos.y};
|
346
|
+
if (e.altKey) {
|
347
|
+
_this.divLayer.canvas.style.cursor = 'move';
|
348
|
+
}
|
349
|
+
if (_this.inputObj) {
|
350
|
+
_this.setNodeText();
|
351
|
+
}
|
352
|
+
if (Store.get('addingArbitraryGraph')) {
|
353
|
+
_this.addingArbitraryGraph = true;
|
354
|
+
_this.handleAddArbitrary();
|
355
|
+
return
|
356
|
+
} else {
|
357
|
+
switch (_this.moveIn.type) {
|
358
|
+
// Click the space.
|
359
|
+
case _this.moveInType.None:
|
360
|
+
_this.activeLayer.clear();
|
361
|
+
_this.hoverLayer.clear();
|
362
|
+
_this.pageListAndPageInputHide();
|
363
|
+
_this.dispatch('space', _this.mouseDown);
|
364
|
+
break;
|
365
|
+
// Click a line.
|
366
|
+
case _this.moveInType.Line:
|
367
|
+
case _this.moveInType.LineControlPoint:
|
368
|
+
if (e.ctrlKey || e.shiftKey) {
|
369
|
+
_this.activeLayer.add(_this.moveIn.hoverLine);
|
370
|
+
_this.dispatch('multi', _this.activeLayer.pens);
|
371
|
+
} else {
|
372
|
+
_this.activeLayer.pens = [_this.moveIn.hoverLine];
|
373
|
+
_this.dispatch('line', _this.moveIn.hoverLine);
|
374
|
+
}
|
375
|
+
break;
|
376
|
+
case _this.moveInType.LineMove:
|
377
|
+
_this.hoverLayer.initLine = new Line(_this.moveIn.hoverLine);
|
378
|
+
if (_this.data.locked || _this.moveIn.hoverLine.locked) {
|
379
|
+
_this.moveIn.hoverLine.click();
|
380
|
+
}
|
381
|
+
// tslint:disable-next-line:no-switch-case-fall-through
|
382
|
+
case _this.moveInType.LineFrom:
|
383
|
+
case _this.moveInType.LineTo:
|
384
|
+
_this.activeLayer.pens = [_this.moveIn.hoverLine];
|
385
|
+
_this.dispatch('line', _this.moveIn.hoverLine);
|
386
|
+
_this.hoverLayer.line = _this.moveIn.hoverLine;
|
387
|
+
break;
|
388
|
+
case _this.moveInType.HoverAnchors:
|
389
|
+
|
390
|
+
if (_this.moveIn.hoverNode && _this.moveIn.hoverNode.name == 'arbitraryGraph') {
|
391
|
+
|
392
|
+
_this.activeLayer.pens = [_this.moveIn.hoverNode];
|
393
|
+
|
394
|
+
} else {
|
395
|
+
_this.hoverLayer.line = _this.addLine({
|
396
|
+
name: _this.data.lineName,
|
397
|
+
from: new Point(_this.moveIn.hoverNode.rotatedAnchors[_this.moveIn.hoverAnchorIndex].x, _this.moveIn.hoverNode.rotatedAnchors[_this.moveIn.hoverAnchorIndex].y, _this.moveIn.hoverNode.rotatedAnchors[_this.moveIn.hoverAnchorIndex].direction, _this.moveIn.hoverAnchorIndex, _this.moveIn.hoverNode.id),
|
398
|
+
fromArrow: _this.data.fromArrowType,
|
399
|
+
to: new Point(_this.moveIn.hoverNode.rotatedAnchors[_this.moveIn.hoverAnchorIndex].x, _this.moveIn.hoverNode.rotatedAnchors[_this.moveIn.hoverAnchorIndex].y),
|
400
|
+
toArrow: _this.data.toArrowType,
|
401
|
+
strokeStyle: _this.options.color,
|
402
|
+
});
|
403
|
+
_this.dispatch('anchor', {
|
404
|
+
anchor: _this.moveIn.hoverNode.rotatedAnchors[_this.moveIn.hoverAnchorIndex],
|
405
|
+
anchorIndex: _this.moveIn.hoverAnchorIndex,
|
406
|
+
node: _this.moveIn.hoverNode,
|
407
|
+
line: _this.hoverLayer.line,
|
408
|
+
});
|
409
|
+
}
|
410
|
+
// tslint:disable-next-line:no-switch-case-fall-through
|
411
|
+
case _this.moveInType.Nodes:
|
412
|
+
if (!_this.moveIn.activeNode) {
|
413
|
+
break;
|
414
|
+
}
|
415
|
+
if (e.ctrlKey || e.shiftKey) {
|
416
|
+
if (_this.moveIn.hoverNode &&
|
417
|
+
_this.activeLayer.hasInAll(_this.moveIn.hoverNode)) {
|
418
|
+
_this.activeLayer.setPens([_this.moveIn.hoverNode]);
|
419
|
+
_this.dispatch('node', _this.moveIn.hoverNode);
|
420
|
+
} else if (!_this.activeLayer.has(_this.moveIn.activeNode)) {
|
421
|
+
// 非绘画页面下禁止不包含点击、双击事件的节点选中事件
|
422
|
+
if (!_this.checkNodeOfClickType(_this.moveIn.activeNode)) {
|
423
|
+
_this.activeLayer.add(_this.moveIn.activeNode);
|
424
|
+
if (_this.activeLayer.pens.length > 1) {
|
425
|
+
_this.dispatch('multi', _this.activeLayer.pens);
|
426
|
+
} else {
|
427
|
+
_this.dispatch('node', _this.moveIn.activeNode);
|
428
|
+
}
|
429
|
+
}
|
430
|
+
}
|
431
|
+
} else if (e.altKey) {
|
432
|
+
if (_this.moveIn.hoverNode) {
|
433
|
+
_this.activeLayer.setPens([_this.moveIn.hoverNode]);
|
434
|
+
_this.dispatch('node', _this.moveIn.hoverNode);
|
435
|
+
} else if (_this.moveIn.hoverLine) {
|
436
|
+
_this.activeLayer.setPens([_this.moveIn.hoverLine]);
|
437
|
+
_this.dispatch('line', _this.moveIn.hoverLine);
|
438
|
+
}
|
439
|
+
} else if (_this.activeLayer.pens.length < 2) {
|
440
|
+
// 非绘画页面下禁止不包含点击、双击事件的节点选中事件
|
441
|
+
const activeNode = _this.moveIn.activeNode;
|
442
|
+
if (!_this.checkNodeOfClickType(activeNode)) {
|
443
|
+
_this.activeLayer.setPens([activeNode]);
|
444
|
+
if (activeNode && activeNode.name == 'arbitraryGraph') {
|
445
|
+
_this.dispatch('node', activeNode);
|
446
|
+
} else if (activeNode && activeNode.name == 'tablePagination') {
|
447
|
+
if (_this.options.type === 'topology') return _this.dispatch('node', activeNode);
|
448
|
+
const pnlKeys = Object.keys(activeNode.paginationData.pageNumberLocals);
|
449
|
+
const pageNumArea = pnlKeys.find((pna) => {
|
450
|
+
return e.offsetX - 32 < pna && e.offsetX - parseInt(pna) > 0
|
451
|
+
});
|
452
|
+
//console.log('pageNumArea=============', pageNumArea)
|
453
|
+
if (pageNumArea) {
|
454
|
+
_this.paginationPrevNextPage(activeNode, activeNode.paginationData.pageNumberLocals[pageNumArea]);
|
455
|
+
} else {
|
456
|
+
//console.log('targetPageLocal.hide----------------', activeNode.paginationData.targetPageLocal.hide)
|
457
|
+
if (activeNode.paginationData.pageListState) _this.spreadPageListHandle(activeNode, e);
|
458
|
+
if (activeNode.paginationData.targetPageLocal.hide) _this.targetPageInputHandle(activeNode, e);
|
459
|
+
}
|
460
|
+
} else {
|
461
|
+
_this.dispatch('node', activeNode);
|
462
|
+
if(!window.location.pathname.includes('workspace')) {
|
463
|
+
const staticTypeNode = activeNode.events.find((ev) => {
|
464
|
+
return parseInt(ev.action) === 8
|
465
|
+
}); // 若绑定的是echarts统计图事件
|
466
|
+
if (staticTypeNode) {
|
467
|
+
_this.switchStaticsCheckType(activeNode, staticTypeNode);
|
468
|
+
}
|
469
|
+
}
|
470
|
+
}
|
471
|
+
}
|
472
|
+
}
|
473
|
+
if (_this.data.locked || _this.moveIn.activeNode.locked) {
|
474
|
+
_this.moveIn.activeNode.click();
|
475
|
+
}
|
476
|
+
break;
|
477
|
+
}
|
478
|
+
}
|
479
|
+
// Save node rects to move.
|
480
|
+
if (_this.activeLayer.pens.length) {
|
481
|
+
_this.activeLayer.saveNodeRects();
|
482
|
+
}
|
483
|
+
_this.render();
|
484
|
+
};
|
485
|
+
_this.onmouseup = function (e) {
|
486
|
+
if (Store.get('addingArbitraryGraph')) {
|
487
|
+
_this.createArbitraryGraph();
|
488
|
+
return
|
489
|
+
}
|
490
|
+
if (!_this.mouseDown)
|
491
|
+
return;
|
492
|
+
_this.clipboard = null;
|
493
|
+
_this.mouseDown = null;
|
494
|
+
_this.lastTranlated.x = 0;
|
495
|
+
_this.lastTranlated.y = 0;
|
496
|
+
_this.hoverLayer.dockAnchor = null;
|
497
|
+
_this.hoverLayer.dockLineX = 0;
|
498
|
+
_this.hoverLayer.dockLineY = 0;
|
499
|
+
_this.divLayer.canvas.style.cursor = 'default';
|
500
|
+
if (_this.hoverLayer.dragRect) {
|
501
|
+
_this.getPensInRect(_this.hoverLayer.dragRect);
|
502
|
+
if (_this.activeLayer.pens && _this.activeLayer.pens.length) {
|
503
|
+
_this.dispatch('multi', _this.activeLayer.pens);
|
504
|
+
}
|
505
|
+
} else {
|
506
|
+
switch (_this.moveIn.type) {
|
507
|
+
// Add the line.
|
508
|
+
case _this.moveInType.HoverAnchors:
|
509
|
+
|
510
|
+
// New active.
|
511
|
+
if (_this.hoverLayer.line) {
|
512
|
+
var willAddLine = void 0;
|
513
|
+
if (_this.hoverLayer.line.to.id) {
|
514
|
+
if (!_this.options.disableRepeatLine) {
|
515
|
+
willAddLine = true;
|
516
|
+
} else {
|
517
|
+
var lines = _this.data.pens.filter(function (pen) {
|
518
|
+
return pen.type === PenType.Line &&
|
519
|
+
pen.from.isSameAs(_this.hoverLayer.line.from) &&
|
520
|
+
pen.to.isSameAs(_this.hoverLayer.line.to);
|
521
|
+
});
|
522
|
+
willAddLine = lines.length <= 1;
|
523
|
+
}
|
524
|
+
} else {
|
525
|
+
willAddLine = !_this.options.disableEmptyLine;
|
526
|
+
}
|
527
|
+
if (willAddLine) {
|
528
|
+
_this.activeLayer.pens = [_this.hoverLayer.line];
|
529
|
+
_this.dispatch('addLine', _this.hoverLayer.line);
|
530
|
+
} else {
|
531
|
+
_this.data.pens.pop();
|
532
|
+
_this.activeLayer.clear();
|
533
|
+
}
|
534
|
+
}
|
535
|
+
_this.offscreen.render();
|
536
|
+
_this.hoverLayer.line = null;
|
537
|
+
break;
|
538
|
+
case _this.moveInType.Rotate:
|
539
|
+
_this.activeLayer.updateRotate();
|
540
|
+
break;
|
541
|
+
case _this.moveInType.LineControlPoint:
|
542
|
+
Store.set(_this.generateStoreKey('pts-') + _this.moveIn.hoverLine.id, null);
|
543
|
+
break;
|
544
|
+
case _this.moveInType.LineFrom:
|
545
|
+
case _this.moveInType.LineTo:
|
546
|
+
if (_this.hoverLayer.line.disableEmptyLine &&
|
547
|
+
(!_this.hoverLayer.line.from.id || !_this.hoverLayer.line.to.id)) {
|
548
|
+
_this.needCache = true;
|
549
|
+
_this.activeLayer.clear();
|
550
|
+
_this.data.pens.splice(_this.findIndex(_this.hoverLayer.line), 1);
|
551
|
+
}
|
552
|
+
break;
|
553
|
+
}
|
554
|
+
}
|
555
|
+
_this.hoverLayer.dragRect = null;
|
556
|
+
_this.render();
|
557
|
+
if (_this.needCache) {
|
558
|
+
_this.cache();
|
559
|
+
}
|
560
|
+
_this.needCache = false;
|
561
|
+
};
|
562
|
+
_this.onkeydown = function (key) {
|
563
|
+
if (_this.data.locked ||
|
564
|
+
key.target.tagName === 'INPUT' ||
|
565
|
+
key.target.tagName === 'TEXTAREA') {
|
566
|
+
return;
|
567
|
+
}
|
568
|
+
var done = false;
|
569
|
+
var moveX = 0;
|
570
|
+
var moveY = 0;
|
571
|
+
switch (key.key) {
|
572
|
+
case 'a':
|
573
|
+
case 'A':
|
574
|
+
_this.activeLayer.setPens(_this.data.pens);
|
575
|
+
_this.dispatch('multi', _this.activeLayer.pens);
|
576
|
+
done = true;
|
577
|
+
break;
|
578
|
+
case 'Delete':
|
579
|
+
case 'Backspace':
|
580
|
+
_this.delete();
|
581
|
+
break;
|
582
|
+
case 'ArrowLeft':
|
583
|
+
moveX = -5;
|
584
|
+
if (key.ctrlKey) {
|
585
|
+
moveX = -1;
|
586
|
+
}
|
587
|
+
done = true;
|
588
|
+
break;
|
589
|
+
case 'ArrowUp':
|
590
|
+
moveY = -5;
|
591
|
+
if (key.ctrlKey) {
|
592
|
+
moveY = -1;
|
593
|
+
}
|
594
|
+
done = true;
|
595
|
+
break;
|
596
|
+
case 'ArrowRight':
|
597
|
+
moveX = 5;
|
598
|
+
if (key.ctrlKey) {
|
599
|
+
moveX = 1;
|
600
|
+
}
|
601
|
+
done = true;
|
602
|
+
break;
|
603
|
+
case 'ArrowDown':
|
604
|
+
moveY = 5;
|
605
|
+
if (key.ctrlKey) {
|
606
|
+
moveY = 1;
|
607
|
+
}
|
608
|
+
done = true;
|
609
|
+
break;
|
610
|
+
case 'x':
|
611
|
+
case 'X':
|
612
|
+
if (key.ctrlKey) {
|
613
|
+
_this.cut();
|
614
|
+
}
|
615
|
+
break;
|
616
|
+
case 'c':
|
617
|
+
case 'C':
|
618
|
+
const copyState = _this.copy();
|
619
|
+
if(!copyState) _this.dispatch('copyNone');
|
620
|
+
break;
|
621
|
+
case 'v':
|
622
|
+
case 'V':
|
623
|
+
_this.paste();
|
624
|
+
break;
|
625
|
+
case 'y':
|
626
|
+
case 'Y':
|
627
|
+
if (key.ctrlKey) {
|
628
|
+
_this.redo();
|
629
|
+
}
|
630
|
+
break;
|
631
|
+
case 'z':
|
632
|
+
case 'Z':
|
633
|
+
if (key.shiftKey) {
|
634
|
+
_this.redo();
|
635
|
+
} else {
|
636
|
+
_this.undo();
|
637
|
+
}
|
638
|
+
break;
|
639
|
+
case 'g':
|
640
|
+
case 'G':
|
641
|
+
if (key.ctrlKey && _this.activeLayer.pens.length > 1) {
|
642
|
+
_this.combine();
|
643
|
+
}
|
644
|
+
break;
|
645
|
+
case 'b':
|
646
|
+
case 'B':
|
647
|
+
if (key.ctrlKey && _this.activeLayer.pens.length == 1 && _this.activeLayer.pens[0].name === 'combine') {
|
648
|
+
_this.uncombine();
|
649
|
+
}
|
650
|
+
break;
|
651
|
+
|
652
|
+
}
|
653
|
+
if (!done) {
|
654
|
+
return;
|
655
|
+
}
|
656
|
+
key.preventDefault();
|
657
|
+
if (moveX || moveY) {
|
658
|
+
_this.activeLayer.saveNodeRects();
|
659
|
+
_this.activeLayer.move(moveX, moveY);
|
660
|
+
_this.overflow();
|
661
|
+
_this.animateLayer.animate();
|
662
|
+
}
|
663
|
+
_this.render();
|
664
|
+
_this.cache();
|
665
|
+
};
|
666
|
+
_this.createGrid();
|
667
|
+
_this.divLayer.canvas.ondragover = function (event) {
|
668
|
+
return event.preventDefault();
|
669
|
+
};
|
670
|
+
_this.divLayer.canvas.ondrop = function (event) {
|
671
|
+
try {
|
672
|
+
var json = event.dataTransfer.getData('Topology') ||
|
673
|
+
event.dataTransfer.getData('Text');
|
674
|
+
if (!json)
|
675
|
+
return;
|
676
|
+
var obj = JSON.parse(json);
|
677
|
+
event.preventDefault();
|
678
|
+
if (obj.name && obj.name == 'arbitraryGraph') {
|
679
|
+
Store.set('addingArbitraryGraph', true);
|
680
|
+
_this.addingArbitraryGraph = true;
|
681
|
+
_this.dispatch('addingArbitraryGraph', true);
|
682
|
+
return
|
683
|
+
}
|
684
|
+
_this.addingArbitraryGraph = false;
|
685
|
+
Store.set('addingArbitraryGraph', false);
|
686
|
+
_this.arbitrarygGraphData = {
|
687
|
+
points: [],
|
688
|
+
circles: [],
|
689
|
+
indexCircle: 0, //当前点击的圆圈
|
690
|
+
oZindex: -1, //是否达到起点
|
691
|
+
isDragging: false, //是否在抓取
|
692
|
+
close: false, //闭合
|
693
|
+
};
|
694
|
+
if (obj.name == 'temp') {
|
695
|
+
// 温湿度元件
|
696
|
+
let activeTempNodes = []
|
697
|
+
_this.dropNodes([obj.children[0]], event.offsetX - 23.5, event.offsetY)
|
698
|
+
activeTempNodes.push(_this.activeLayer.pens[0])
|
699
|
+
_this.dropNodes([obj.children[1]], event.offsetX + 11.5, event.offsetY - 8.5)
|
700
|
+
activeTempNodes.push(_this.activeLayer.pens[0])
|
701
|
+
_this.dropNodes([obj.children[2]], event.offsetX + 11.5, event.offsetY + 8.5)
|
702
|
+
activeTempNodes.push(_this.activeLayer.pens[0])
|
703
|
+
_this.activeLayer.pens = activeTempNodes
|
704
|
+
_this.combine(activeTempNodes, null, 'temp');
|
705
|
+
} else {
|
706
|
+
_this.dropNodes(Array.isArray(obj) ? obj : [obj], event.offsetX, event.offsetY);
|
707
|
+
}
|
708
|
+
} catch (_a) {
|
709
|
+
}
|
710
|
+
};
|
711
|
+
_this.subcribeAnimateMoved = Store.subscribe(this.generateStoreKey('LT:rectChanged'), function (e) {
|
712
|
+
_this.activeLayer.updateLines(_this.data.pens);
|
713
|
+
});
|
714
|
+
_this.subcribeMediaEnd = Store.subscribe(this.generateStoreKey('mediaEnd'), function (node) {
|
715
|
+
if (node.nextPlay) {
|
716
|
+
_this.animateLayer.readyPlay(node.nextPlay);
|
717
|
+
_this.animateLayer.animate();
|
718
|
+
}
|
719
|
+
_this.dispatch('mediaEnd', node);
|
720
|
+
});
|
721
|
+
_this.subcribeHidePen = Store.subscribe(this.generateStoreKey('LT:hidePen'), function (e) {
|
722
|
+
if (window.location.pathname.includes('workspace')) {
|
723
|
+
return
|
724
|
+
}
|
725
|
+
_this.hidePenByTag(_this.data.pens, e);
|
726
|
+
const obj = e ? JSON.parse(e) : {}
|
727
|
+
const visibleRange = obj.visibleRange
|
728
|
+
if (visibleRange == '1') {
|
729
|
+
_this.openCount++
|
730
|
+
}
|
731
|
+
});
|
732
|
+
_this.divLayer.canvas.onmousemove = this.onMouseMove;
|
733
|
+
_this.divLayer.canvas.onmousedown = this.onmousedown;
|
734
|
+
_this.divLayer.canvas.onmouseup = this.onmouseup;
|
735
|
+
_this.divLayer.canvas.onwheel = function (event) {
|
736
|
+
if (_this.options.disableScale) {
|
737
|
+
return;
|
738
|
+
}
|
739
|
+
switch (_this.options.scaleKey) {
|
740
|
+
case KeyType.None:
|
741
|
+
break;
|
742
|
+
case KeyType.Ctrl:
|
743
|
+
if (!event.ctrlKey) {
|
744
|
+
return;
|
745
|
+
}
|
746
|
+
break;
|
747
|
+
case KeyType.Shift:
|
748
|
+
if (!event.shiftKey) {
|
749
|
+
return;
|
750
|
+
}
|
751
|
+
break;
|
752
|
+
case KeyType.Alt:
|
753
|
+
if (!event.altKey) {
|
754
|
+
return;
|
755
|
+
}
|
756
|
+
break;
|
757
|
+
default:
|
758
|
+
if (!event.ctrlKey && !event.altKey) {
|
759
|
+
return;
|
760
|
+
}
|
761
|
+
}
|
762
|
+
event.preventDefault();
|
763
|
+
if (event.deltaY < 0) {
|
764
|
+
if (event.layerX && event.layerY) {
|
765
|
+
_this.scale(1.1, {x: event.layerX, y: event.layerY});
|
766
|
+
_this.canvas.scale(1.1, {x: event.layerX, y: event.layerY});
|
767
|
+
} else {
|
768
|
+
_this.scale(1.1);
|
769
|
+
_this.canvas.scale(1.1);
|
770
|
+
}
|
771
|
+
} else {
|
772
|
+
if (event.layerX && event.layerY) {
|
773
|
+
_this.scale(0.9, {x: event.layerX, y: event.layerY});
|
774
|
+
_this.canvas.scale(0.9, {x: event.layerX, y: event.layerY});
|
775
|
+
} else {
|
776
|
+
_this.scale(0.9);
|
777
|
+
_this.canvas.scale(0.9);
|
778
|
+
}
|
779
|
+
}
|
780
|
+
_this.divLayer.canvas.focus();
|
781
|
+
return false;
|
782
|
+
};
|
783
|
+
_this.cache();
|
784
|
+
switch (_this.options.keydown) {
|
785
|
+
case KeydownType.Document:
|
786
|
+
document.onkeydown = _this.onkeydown;
|
787
|
+
break;
|
788
|
+
case KeydownType.Canvas:
|
789
|
+
_this.divLayer.canvas.onkeydown = _this.onkeydown;
|
790
|
+
break;
|
791
|
+
}
|
792
|
+
this.winResize = function () {
|
793
|
+
var timer;
|
794
|
+
if (timer) {
|
795
|
+
clearTimeout(timer);
|
796
|
+
}
|
797
|
+
timer = setTimeout(function () {
|
798
|
+
_this.overflow();
|
799
|
+
_this.render();
|
800
|
+
}, 100);
|
801
|
+
};
|
802
|
+
window.addEventListener('resize', this.winResize);
|
803
|
+
return _this;
|
804
|
+
}
|
805
|
+
// Render or redraw
|
806
|
+
Topology.prototype.render = function (noFocus, type) {
|
807
|
+
try{
|
808
|
+
if (noFocus === void 0) {
|
809
|
+
noFocus = false;
|
810
|
+
}
|
811
|
+
if (noFocus) {
|
812
|
+
this.activeLayer.pens = [];
|
813
|
+
this.hoverLayer.node = null;
|
814
|
+
this.hoverLayer.line = null;
|
815
|
+
}
|
816
|
+
if (this.rendering) {
|
817
|
+
return this;
|
818
|
+
}
|
819
|
+
this.rendering = true;
|
820
|
+
this.offscreen.render();
|
821
|
+
this.canvas.render();
|
822
|
+
this.rendering = false;
|
823
|
+
}catch (e){
|
824
|
+
console.log('render-error-------------')
|
825
|
+
}
|
826
|
+
};
|
827
|
+
Topology.prototype.resize = function (size) {
|
828
|
+
this.canvasResize(size);
|
829
|
+
this.showGrid();
|
830
|
+
this.dispatch('resize', size);
|
831
|
+
};
|
832
|
+
Topology.prototype.dropNodes = function (jsonList, offsetX, offsetY) {
|
833
|
+
var _this = this;
|
834
|
+
var x, y;
|
835
|
+
if (jsonList.length) {
|
836
|
+
var rect = jsonList[0].rect;
|
837
|
+
x = rect.x;
|
838
|
+
y = rect.y;
|
839
|
+
}
|
840
|
+
var firstNode;
|
841
|
+
jsonList.forEach(function (json) {
|
842
|
+
if (!firstNode) {
|
843
|
+
json.rect.x = (offsetX - json.rect.width / 2) << 0;
|
844
|
+
json.rect.y = (offsetY - json.rect.height / 2) << 0;
|
845
|
+
firstNode = json;
|
846
|
+
} else {
|
847
|
+
//Layout relative to the first node
|
848
|
+
var rect = json.rect;
|
849
|
+
var dx = rect.x - x, dy = rect.y - y;
|
850
|
+
json.rect.x = firstNode.rect.x + dx;
|
851
|
+
json.rect.y = firstNode.rect.y + dy;
|
852
|
+
}
|
853
|
+
if (json.name === 'lineAlone') {
|
854
|
+
_this.addLine({
|
855
|
+
name: _this.data.lineName,
|
856
|
+
from: new Point(json.rect.x, json.rect.y),
|
857
|
+
fromArrow: _this.data.fromArrowType,
|
858
|
+
to: new Point(json.rect.x + json.rect.width, json.rect.y + json.rect.height),
|
859
|
+
toArrow: _this.data.toArrowType,
|
860
|
+
strokeStyle: _this.options.color,
|
861
|
+
}, true);
|
862
|
+
}
|
863
|
+
|
864
|
+
if (json.name == 'define') {
|
865
|
+
|
866
|
+
// console.log('创建自定义组件 ', json);
|
867
|
+
|
868
|
+
console.log('store 中的 自定义 ', Store.get('defineNode'));
|
869
|
+
if (_this.data.locked) return
|
870
|
+
// let defineNode = Store.get('defineNode');
|
871
|
+
// let nodesList = Store.get('defineNode').pens;
|
872
|
+
let defineNode = JSON.parse(localStorage.getItem("defineNode_"))
|
873
|
+
let nodesList = defineNode.pens;
|
874
|
+
|
875
|
+
let renderNodesList = [];
|
876
|
+
|
877
|
+
for (let i = 0, len = nodesList.length; i < len; i++) {
|
878
|
+
|
879
|
+
nodesList[i].rect.x = offsetX - nodesList[i].rect.width / 2;
|
880
|
+
|
881
|
+
nodesList[i].rect.y = offsetY - nodesList[i].rect.height / 2;
|
882
|
+
|
883
|
+
let node = new Node(nodesList[i]);
|
884
|
+
|
885
|
+
node.setTID(s8());
|
886
|
+
node.id = s8();
|
887
|
+
node.fileId = defineNode.fileId;
|
888
|
+
|
889
|
+
// console.log('push之前的node', node);
|
890
|
+
|
891
|
+
_this.data.pens.push(node);
|
892
|
+
|
893
|
+
renderNodesList.push(node);
|
894
|
+
}
|
895
|
+
_this.activeLayer.setPens([renderNodesList[0]]);
|
896
|
+
|
897
|
+
_this.render(false);
|
898
|
+
|
899
|
+
_this.animate(true);
|
900
|
+
|
901
|
+
_this.cache();
|
902
|
+
|
903
|
+
_this.dispatch('addNode', renderNodesList[0]);
|
904
|
+
|
905
|
+
} else {
|
906
|
+
var node = new Node(json);
|
907
|
+
node.setTID(_this.id);
|
908
|
+
node.clearChildrenIds();
|
909
|
+
_this.addNode(node, true);
|
910
|
+
if (node.name === 'div') {
|
911
|
+
_this.dispatch('LT:addDiv', node);
|
912
|
+
}
|
913
|
+
if (node.name === 'formTable') {
|
914
|
+
_this.data.dataConstruct[node.id] = {
|
915
|
+
id: node.id,
|
916
|
+
name: 'table'
|
917
|
+
}
|
918
|
+
}
|
919
|
+
}
|
920
|
+
});
|
921
|
+
this.divLayer.canvas.focus();
|
922
|
+
};
|
923
|
+
Topology.prototype.addNode = function (node, focus) {
|
924
|
+
if (focus === void 0) {
|
925
|
+
focus = false;
|
926
|
+
}
|
927
|
+
if (this.data.locked || !drawNodeFns[node.name]) {
|
928
|
+
return null;
|
929
|
+
}
|
930
|
+
// if it's not a Node
|
931
|
+
if (!node.init) {
|
932
|
+
node = new Node(node);
|
933
|
+
}
|
934
|
+
if (!node.strokeStyle && this.options.color) {
|
935
|
+
node.strokeStyle = this.options.color;
|
936
|
+
}
|
937
|
+
for (var key in node.font) {
|
938
|
+
if (!node.font[key]) {
|
939
|
+
node.font[key] = this.options.font[key];
|
940
|
+
}
|
941
|
+
}
|
942
|
+
if (this.data.scale !== 1) {
|
943
|
+
node.scale(this.data.scale);
|
944
|
+
}
|
945
|
+
this.data.pens.push(node);
|
946
|
+
this.setSwitchTabData(node, this.data.pens.length-1);
|
947
|
+
if (focus) {
|
948
|
+
this.activeLayer.setPens([node]);
|
949
|
+
this.render();
|
950
|
+
this.animate(true);
|
951
|
+
this.cache();
|
952
|
+
this.dispatch('addNode', node);
|
953
|
+
}
|
954
|
+
return node;
|
955
|
+
};
|
956
|
+
Topology.prototype.addLine = function (line, focus) {
|
957
|
+
if (focus === void 0) {
|
958
|
+
focus = false;
|
959
|
+
}
|
960
|
+
if (this.data.locked) {
|
961
|
+
return null;
|
962
|
+
}
|
963
|
+
if (!line.clone) {
|
964
|
+
line = new Line(line);
|
965
|
+
line.calcControlPoints(true);
|
966
|
+
}
|
967
|
+
this.data.pens.push(line);
|
968
|
+
if (focus) {
|
969
|
+
this.activeLayer.setPens([line]);
|
970
|
+
this.render();
|
971
|
+
this.animate(true);
|
972
|
+
this.cache();
|
973
|
+
this.dispatch('addLine', line);
|
974
|
+
}
|
975
|
+
return line;
|
976
|
+
};
|
977
|
+
// open - redraw by the data
|
978
|
+
Topology.prototype.open = function (topoJSon) {
|
979
|
+
this.conversionData(topoJSon);
|
980
|
+
Store.set(this.generateStoreKey('LT:scale'), this.data.scale);
|
981
|
+
this.dispatch('scale', this.data.scale);
|
982
|
+
this.parentElem.scrollLeft = 0;
|
983
|
+
this.parentElem.scrollTop = 0;
|
984
|
+
this.caches.list = [];
|
985
|
+
this.divLayer.clear();
|
986
|
+
this.cache();
|
987
|
+
this.overflow();
|
988
|
+
this.render(true);
|
989
|
+
this.animate(true);
|
990
|
+
this.showGrid();
|
991
|
+
};
|
992
|
+
Topology.prototype.overflow = function () {
|
993
|
+
try {
|
994
|
+
var rect = this.getRect();
|
995
|
+
let _a = this.canvas;
|
996
|
+
if(!_a.width) return;
|
997
|
+
let width = _a.width, height = _a.height;
|
998
|
+
if (width < rect.width) {
|
999
|
+
width = rect.width;
|
1000
|
+
}
|
1001
|
+
if (height < rect.height) {
|
1002
|
+
height = rect.height;
|
1003
|
+
}
|
1004
|
+
this.resize({width: width, height: height});
|
1005
|
+
return rect;
|
1006
|
+
}catch (e){
|
1007
|
+
console.log('init-error-----------')
|
1008
|
+
}
|
1009
|
+
};
|
1010
|
+
Topology.prototype.getMoveIn = function (pt) {
|
1011
|
+
this.lastHoverNode = this.moveIn.hoverNode;
|
1012
|
+
this.lastHoverLine = this.moveIn.hoverLine;
|
1013
|
+
this.moveIn.type = this.moveInType.None;
|
1014
|
+
this.moveIn.hoverNode = null;
|
1015
|
+
this.moveIn.lineControlPoint = null;
|
1016
|
+
this.moveIn.hoverLine = null;
|
1017
|
+
this.hoverLayer.hoverAnchorIndex = -1;
|
1018
|
+
if (!this.data.locked &&
|
1019
|
+
!(this.activeLayer.pens.length === 1 && this.activeLayer.pens[0].type) &&
|
1020
|
+
!this.activeLayer.locked() &&
|
1021
|
+
this.activeLayer.rotateCPs[0] &&
|
1022
|
+
this.activeLayer.rotateCPs[0].hit(pt, 15)) {
|
1023
|
+
this.moveIn.type = this.moveInType.Rotate;
|
1024
|
+
var cursor = this.options.rotateCursor;
|
1025
|
+
this.divLayer.canvas.style.cursor = cursor.includes('/')
|
1026
|
+
? "url(\"" + cursor + "\"), auto"
|
1027
|
+
: cursor;
|
1028
|
+
return;
|
1029
|
+
}
|
1030
|
+
if (this.activeLayer.pens.length > 1 &&
|
1031
|
+
pointInRect(pt, this.activeLayer.sizeCPs)) {
|
1032
|
+
this.moveIn.type = this.moveInType.Nodes;
|
1033
|
+
}
|
1034
|
+
if (!this.data.locked &&
|
1035
|
+
!this.activeLayer.locked() &&
|
1036
|
+
!this.options.hideSizeCP) {
|
1037
|
+
if (this.activeLayer.pens.length > 1 ||
|
1038
|
+
(!this.activeLayer.pens[0].type && !this.activeLayer.pens[0].hideSizeCP)) {
|
1039
|
+
for (var i = 0; i < this.activeLayer.sizeCPs.length; ++i) {
|
1040
|
+
if (this.activeLayer.sizeCPs[i].hit(pt, 10)) {
|
1041
|
+
this.moveIn.type = this.moveInType.ResizeCP;
|
1042
|
+
this.moveIn.activeAnchorIndex = i;
|
1043
|
+
this.divLayer.canvas.style.cursor = resizeCursors[i];
|
1044
|
+
return;
|
1045
|
+
}
|
1046
|
+
}
|
1047
|
+
}
|
1048
|
+
}
|
1049
|
+
// In active pen.
|
1050
|
+
if (!this.data.locked) {
|
1051
|
+
for (var _i = 0, _a = this.activeLayer.pens; _i < _a.length; _i++) {
|
1052
|
+
var item = _a[_i];
|
1053
|
+
if (item instanceof Line && !item.locked) {
|
1054
|
+
for (var i = 0; i < item.controlPoints.length; ++i) {
|
1055
|
+
if (!item.locked && item.controlPoints[i].hit(pt, 10)) {
|
1056
|
+
item.controlPoints[i].id = i;
|
1057
|
+
this.moveIn.type = this.moveInType.LineControlPoint;
|
1058
|
+
this.moveIn.lineControlPoint = item.controlPoints[i];
|
1059
|
+
this.moveIn.hoverLine = item;
|
1060
|
+
this.divLayer.canvas.style.cursor = 'pointer';
|
1061
|
+
return;
|
1062
|
+
}
|
1063
|
+
}
|
1064
|
+
if (this.inLine(pt, item)) {
|
1065
|
+
return;
|
1066
|
+
}
|
1067
|
+
}
|
1068
|
+
}
|
1069
|
+
}
|
1070
|
+
this.divLayer.canvas.style.cursor = 'default';
|
1071
|
+
var len = this.data.pens.length;
|
1072
|
+
for (var i = len - 1; i > -1; --i) {
|
1073
|
+
if (this.data.pens[i].type === PenType.Node &&
|
1074
|
+
this.inNode(pt, this.data.pens[i])) {
|
1075
|
+
return;
|
1076
|
+
} else if (this.data.pens[i].type === PenType.Line &&
|
1077
|
+
this.inLine(pt, this.data.pens[i])) {
|
1078
|
+
// 需要优先判断十分在节点锚点上
|
1079
|
+
// return;
|
1080
|
+
}
|
1081
|
+
}
|
1082
|
+
};
|
1083
|
+
Topology.prototype.inChildNode = function (pt, children) {
|
1084
|
+
if (!children) {
|
1085
|
+
return null;
|
1086
|
+
}
|
1087
|
+
for (var _i = 0, children_1 = children; _i < children_1.length; _i++) {
|
1088
|
+
var item = children_1[_i];
|
1089
|
+
if (item.type === PenType.Line) {
|
1090
|
+
if (this.inLine(pt, item)) {
|
1091
|
+
return item;
|
1092
|
+
}
|
1093
|
+
continue;
|
1094
|
+
}
|
1095
|
+
var node = this.inChildNode(pt, item.children);
|
1096
|
+
if (node) {
|
1097
|
+
return node;
|
1098
|
+
}
|
1099
|
+
node = this.inNode(pt, item, true);
|
1100
|
+
if (node) {
|
1101
|
+
return node;
|
1102
|
+
}
|
1103
|
+
}
|
1104
|
+
return null;
|
1105
|
+
};
|
1106
|
+
Topology.prototype.inNode = function (pt, node, inChild) {
|
1107
|
+
if (inChild === void 0) {
|
1108
|
+
inChild = false;
|
1109
|
+
}
|
1110
|
+
if (this.data.locked === Lock.NoEvent ||
|
1111
|
+
(!node.visible && !window.location.pathname.includes('workspace')) ||
|
1112
|
+
node.locked === Lock.NoEvent) {
|
1113
|
+
return null;
|
1114
|
+
}
|
1115
|
+
var child = this.inChildNode(pt, node.children);
|
1116
|
+
if (child) {
|
1117
|
+
if (this.moveIn.type !== this.moveInType.HoverAnchors) {
|
1118
|
+
if (child.type === PenType.Line) {
|
1119
|
+
this.moveIn.activeNode = node;
|
1120
|
+
this.moveIn.type = this.moveInType.Nodes;
|
1121
|
+
} else if (child.stand) {
|
1122
|
+
this.moveIn.activeNode = child;
|
1123
|
+
this.moveIn.type = this.moveInType.Nodes;
|
1124
|
+
} else {
|
1125
|
+
this.moveIn.activeNode = node;
|
1126
|
+
this.moveIn.type = this.moveInType.Nodes;
|
1127
|
+
}
|
1128
|
+
}
|
1129
|
+
return child;
|
1130
|
+
}
|
1131
|
+
if (node.hit(pt)) {
|
1132
|
+
this.moveIn.hoverNode = node;
|
1133
|
+
this.moveIn.type = this.moveInType.Nodes;
|
1134
|
+
// 非绘画页面下禁止不包含点击、双击事件的节点选中鼠标样式
|
1135
|
+
if (!this.checkNodeOfClickType(node)) {
|
1136
|
+
if (!this.data.locked && !node.locked) {
|
1137
|
+
this.divLayer.canvas.style.cursor = 'move';
|
1138
|
+
} else {
|
1139
|
+
this.divLayer.canvas.style.cursor = this.options.hoverCursor;
|
1140
|
+
}
|
1141
|
+
}
|
1142
|
+
// Too small
|
1143
|
+
if (!this.data.locked &&
|
1144
|
+
!node.locked &&
|
1145
|
+
!(this.options.hideAnchor ||
|
1146
|
+
node.hideAnchor ||
|
1147
|
+
node.rect.width < 20 ||
|
1148
|
+
node.rect.height < 20)) {
|
1149
|
+
for (var j = 0; j < node.rotatedAnchors.length; ++j) {
|
1150
|
+
if (node.rotatedAnchors[j].hit(pt, 5)) {
|
1151
|
+
if (!this.mouseDown &&
|
1152
|
+
node.rotatedAnchors[j].mode === AnchorMode.In) {
|
1153
|
+
continue;
|
1154
|
+
}
|
1155
|
+
this.moveIn.type = this.moveInType.HoverAnchors;
|
1156
|
+
this.moveIn.hoverAnchorIndex = j;
|
1157
|
+
this.hoverLayer.hoverAnchorIndex = j;
|
1158
|
+
this.divLayer.canvas.style.cursor = 'pointer';
|
1159
|
+
break;
|
1160
|
+
}
|
1161
|
+
}
|
1162
|
+
}
|
1163
|
+
if (!inChild) {
|
1164
|
+
this.moveIn.activeNode = this.moveIn.hoverNode;
|
1165
|
+
}
|
1166
|
+
return node;
|
1167
|
+
}
|
1168
|
+
if (this.options.hideAnchor ||
|
1169
|
+
node.hideAnchor ||
|
1170
|
+
this.data.locked ||
|
1171
|
+
node.locked) {
|
1172
|
+
return null;
|
1173
|
+
}
|
1174
|
+
if (node.hit(pt, 5)) {
|
1175
|
+
for (var j = 0; j < node.rotatedAnchors.length; ++j) {
|
1176
|
+
if (node.rotatedAnchors[j].hit(pt, 5)) {
|
1177
|
+
if (!this.mouseDown &&
|
1178
|
+
node.rotatedAnchors[j].mode === AnchorMode.In) {
|
1179
|
+
continue;
|
1180
|
+
}
|
1181
|
+
this.moveIn.hoverNode = node;
|
1182
|
+
this.moveIn.type = this.moveInType.HoverAnchors;
|
1183
|
+
this.moveIn.hoverAnchorIndex = j;
|
1184
|
+
this.hoverLayer.hoverAnchorIndex = j;
|
1185
|
+
this.divLayer.canvas.style.cursor = 'crosshair';
|
1186
|
+
if (!inChild) {
|
1187
|
+
this.moveIn.activeNode = node;
|
1188
|
+
}
|
1189
|
+
return node;
|
1190
|
+
}
|
1191
|
+
}
|
1192
|
+
}
|
1193
|
+
return null;
|
1194
|
+
};
|
1195
|
+
Topology.prototype.inLine = function (point, line) {
|
1196
|
+
if (!line.visible) {
|
1197
|
+
return null;
|
1198
|
+
}
|
1199
|
+
if (line.from.hit(point, 5)) {
|
1200
|
+
this.moveIn.type = this.moveInType.LineFrom;
|
1201
|
+
this.moveIn.hoverLine = line;
|
1202
|
+
if (this.data.locked || line.locked) {
|
1203
|
+
this.divLayer.canvas.style.cursor = this.options.hoverCursor;
|
1204
|
+
} else {
|
1205
|
+
this.divLayer.canvas.style.cursor = 'move';
|
1206
|
+
}
|
1207
|
+
return line;
|
1208
|
+
}
|
1209
|
+
if (line.to.hit(point, 5)) {
|
1210
|
+
this.moveIn.type = this.moveInType.LineTo;
|
1211
|
+
this.moveIn.hoverLine = line;
|
1212
|
+
if (this.data.locked || line.locked) {
|
1213
|
+
this.divLayer.canvas.style.cursor = this.options.hoverCursor;
|
1214
|
+
} else {
|
1215
|
+
this.divLayer.canvas.style.cursor = 'move';
|
1216
|
+
}
|
1217
|
+
return line;
|
1218
|
+
}
|
1219
|
+
if (line.pointIn(point)) {
|
1220
|
+
this.moveIn.type = this.moveInType.LineMove;
|
1221
|
+
this.moveIn.hoverLine = line;
|
1222
|
+
this.divLayer.canvas.style.cursor = this.options.hoverCursor;
|
1223
|
+
if (line.from.id || line.to.id) {
|
1224
|
+
this.moveIn.type = this.moveInType.Line;
|
1225
|
+
}
|
1226
|
+
return line;
|
1227
|
+
}
|
1228
|
+
return null;
|
1229
|
+
};
|
1230
|
+
Topology.prototype.getLineDock = function (point) {
|
1231
|
+
this.hoverLayer.dockAnchor = null;
|
1232
|
+
for (var _i = 0, _a = this.data.pens; _i < _a.length; _i++) {
|
1233
|
+
var item = _a[_i];
|
1234
|
+
if (item instanceof Node) {
|
1235
|
+
if (item.rect.hit(point, 10)) {
|
1236
|
+
this.hoverLayer.node = item;
|
1237
|
+
}
|
1238
|
+
for (var i = 0; i < item.rotatedAnchors.length; ++i) {
|
1239
|
+
if (item.rotatedAnchors[i].mode &&
|
1240
|
+
item.rotatedAnchors[i].mode !== AnchorMode.In) {
|
1241
|
+
continue;
|
1242
|
+
}
|
1243
|
+
if (item.rotatedAnchors[i].hit(point, 10)) {
|
1244
|
+
point.id = item.id;
|
1245
|
+
point.anchorIndex = i;
|
1246
|
+
point.direction = item.rotatedAnchors[point.anchorIndex].direction;
|
1247
|
+
point.x = item.rotatedAnchors[point.anchorIndex].x;
|
1248
|
+
point.y = item.rotatedAnchors[point.anchorIndex].y;
|
1249
|
+
this.hoverLayer.dockAnchor = item.rotatedAnchors[i];
|
1250
|
+
break;
|
1251
|
+
}
|
1252
|
+
}
|
1253
|
+
} else if (item instanceof Line) {
|
1254
|
+
if (item.id === this.hoverLayer.line.id) {
|
1255
|
+
continue;
|
1256
|
+
}
|
1257
|
+
if (item.from.hit(point, 10)) {
|
1258
|
+
point.x = item.from.x;
|
1259
|
+
point.y = item.from.y;
|
1260
|
+
this.hoverLayer.dockAnchor = item.from;
|
1261
|
+
break;
|
1262
|
+
}
|
1263
|
+
if (item.to.hit(point, 10)) {
|
1264
|
+
point.x = item.to.x;
|
1265
|
+
point.y = item.to.y;
|
1266
|
+
this.hoverLayer.dockAnchor = item.to;
|
1267
|
+
break;
|
1268
|
+
}
|
1269
|
+
if (item.controlPoints) {
|
1270
|
+
for (var _b = 0, _c = item.controlPoints; _b < _c.length; _b++) {
|
1271
|
+
var cp = _c[_b];
|
1272
|
+
if (cp.hit(point, 10)) {
|
1273
|
+
point.x = cp.x;
|
1274
|
+
point.y = cp.y;
|
1275
|
+
this.hoverLayer.dockAnchor = cp;
|
1276
|
+
break;
|
1277
|
+
}
|
1278
|
+
}
|
1279
|
+
}
|
1280
|
+
}
|
1281
|
+
if (this.hoverLayer.dockAnchor) {
|
1282
|
+
break;
|
1283
|
+
}
|
1284
|
+
}
|
1285
|
+
return point;
|
1286
|
+
};
|
1287
|
+
Topology.prototype.getPensInRect = function (rect) {
|
1288
|
+
if (rect.width < 0) {
|
1289
|
+
rect.width = -rect.width;
|
1290
|
+
rect.x = rect.ex;
|
1291
|
+
rect.ex = rect.x + rect.width;
|
1292
|
+
}
|
1293
|
+
if (rect.height < 0) {
|
1294
|
+
rect.height = -rect.height;
|
1295
|
+
rect.y = rect.ey;
|
1296
|
+
rect.ey = rect.y + rect.height;
|
1297
|
+
}
|
1298
|
+
this.activeLayer.pens = [];
|
1299
|
+
for (var _i = 0, _a = this.data.pens; _i < _a.length; _i++) {
|
1300
|
+
var item = _a[_i];
|
1301
|
+
if (item.locked === Lock.NoEvent) {
|
1302
|
+
continue;
|
1303
|
+
}
|
1304
|
+
if (item instanceof Node) {
|
1305
|
+
if (rect.hitByRect(item.rect)) {
|
1306
|
+
this.activeLayer.add(item);
|
1307
|
+
}
|
1308
|
+
}
|
1309
|
+
if (item instanceof Line) {
|
1310
|
+
if (rect.hit(item.from) && rect.hit(item.to)) {
|
1311
|
+
this.activeLayer.add(item);
|
1312
|
+
}
|
1313
|
+
}
|
1314
|
+
}
|
1315
|
+
};
|
1316
|
+
Topology.prototype.getAngle = function (pt) {
|
1317
|
+
if (pt.x === this.activeLayer.rect.center.x) {
|
1318
|
+
return pt.y <= this.activeLayer.rect.center.y ? 0 : 180;
|
1319
|
+
}
|
1320
|
+
if (pt.y === this.activeLayer.rect.center.y) {
|
1321
|
+
return pt.x < this.activeLayer.rect.center.x ? 270 : 90;
|
1322
|
+
}
|
1323
|
+
var x = pt.x - this.activeLayer.rect.center.x;
|
1324
|
+
var y = pt.y - this.activeLayer.rect.center.y;
|
1325
|
+
var angle = (Math.atan(Math.abs(x / y)) / (2 * Math.PI)) * 360;
|
1326
|
+
if (x > 0 && y > 0) {
|
1327
|
+
angle = 180 - angle;
|
1328
|
+
} else if (x < 0 && y > 0) {
|
1329
|
+
angle += 180;
|
1330
|
+
} else if (x < 0 && y < 0) {
|
1331
|
+
angle = 360 - angle;
|
1332
|
+
}
|
1333
|
+
if (this.activeLayer.pens.length === 1) {
|
1334
|
+
return angle - this.activeLayer.pens[0].rotate;
|
1335
|
+
}
|
1336
|
+
return angle;
|
1337
|
+
};
|
1338
|
+
// Get a dock rect for moving nodes.
|
1339
|
+
Topology.prototype.getDockPos = function (offsetX, offsetY, noDock) {
|
1340
|
+
this.hoverLayer.dockLineX = 0;
|
1341
|
+
this.hoverLayer.dockLineY = 0;
|
1342
|
+
var offset = {
|
1343
|
+
x: 0,
|
1344
|
+
y: 0,
|
1345
|
+
};
|
1346
|
+
if (noDock || this.options.disableDockLine) {
|
1347
|
+
return offset;
|
1348
|
+
}
|
1349
|
+
var x = 0;
|
1350
|
+
var y = 0;
|
1351
|
+
var disX = dockOffset;
|
1352
|
+
var disY = dockOffset;
|
1353
|
+
for (var _i = 0, _a = this.activeLayer.dockWatchers; _i < _a.length; _i++) {
|
1354
|
+
var activePt = _a[_i];
|
1355
|
+
for (var _b = 0, _c = this.data.pens; _b < _c.length; _b++) {
|
1356
|
+
var item = _c[_b];
|
1357
|
+
if (!(item instanceof Node) ||
|
1358
|
+
this.activeLayer.has(item) ||
|
1359
|
+
item.name === 'text') {
|
1360
|
+
continue;
|
1361
|
+
}
|
1362
|
+
if (!item.dockWatchers) {
|
1363
|
+
item.getDockWatchers();
|
1364
|
+
}
|
1365
|
+
for (var _d = 0, _e = item.dockWatchers; _d < _e.length; _d++) {
|
1366
|
+
var p = _e[_d];
|
1367
|
+
x = Math.abs(p.x - activePt.x - offsetX);
|
1368
|
+
if (x < disX) {
|
1369
|
+
disX = -99999;
|
1370
|
+
offset.x = p.x - activePt.x;
|
1371
|
+
this.hoverLayer.dockLineX = p.x | 0;
|
1372
|
+
}
|
1373
|
+
y = Math.abs(p.y - activePt.y - offsetY);
|
1374
|
+
if (y < disY) {
|
1375
|
+
disY = -99999;
|
1376
|
+
offset.y = p.y - activePt.y;
|
1377
|
+
this.hoverLayer.dockLineY = p.y | 0;
|
1378
|
+
}
|
1379
|
+
}
|
1380
|
+
}
|
1381
|
+
}
|
1382
|
+
return offset;
|
1383
|
+
};
|
1384
|
+
Topology.prototype.cache = function () {
|
1385
|
+
if (this.caches.index < this.caches.list.length - 1) {
|
1386
|
+
this.caches.list.splice(this.caches.index + 1, this.caches.list.length - this.caches.index - 1);
|
1387
|
+
}
|
1388
|
+
var data = new TopologyData(this.data);
|
1389
|
+
this.caches.list.push(data);
|
1390
|
+
if (this.caches.list.length > this.options.cacheLen) {
|
1391
|
+
this.caches.list.shift();
|
1392
|
+
}
|
1393
|
+
this.caches.index = this.caches.list.length - 1;
|
1394
|
+
};
|
1395
|
+
Topology.prototype.cacheReplace = function (pens) {
|
1396
|
+
if (pens && pens.length) {
|
1397
|
+
var needPenMap = {};
|
1398
|
+
for (var i = 0, len = pens.length; i < len; i++) {
|
1399
|
+
var pen = pens[i];
|
1400
|
+
var id = pen.id;
|
1401
|
+
if (pen instanceof Node) {
|
1402
|
+
needPenMap[id] = new Node(pen);
|
1403
|
+
} else if (pen instanceof Line) {
|
1404
|
+
needPenMap[id] = new Line(pen);
|
1405
|
+
}
|
1406
|
+
}
|
1407
|
+
var cacheListData = this.caches.list[0];
|
1408
|
+
if (!cacheListData) {
|
1409
|
+
return;
|
1410
|
+
}
|
1411
|
+
for (var i = 0, len = cacheListData.pens.length; i < len; i++) {
|
1412
|
+
var id = cacheListData.pens[i].id;
|
1413
|
+
if (needPenMap[id]) {
|
1414
|
+
cacheListData.pens[i] = needPenMap[id];
|
1415
|
+
}
|
1416
|
+
}
|
1417
|
+
}
|
1418
|
+
};
|
1419
|
+
Topology.prototype.undo = function (noRedo) {
|
1420
|
+
if (noRedo === void 0) {
|
1421
|
+
noRedo = false;
|
1422
|
+
}
|
1423
|
+
if (this.data.locked || this.caches.index < 1) {
|
1424
|
+
return;
|
1425
|
+
}
|
1426
|
+
this.divLayer.clear();
|
1427
|
+
var data = new TopologyData(this.caches.list[--this.caches.index]);
|
1428
|
+
this.data.pens.splice(0, this.data.pens.length);
|
1429
|
+
this.data.pens.push.apply(this.data.pens, data.pens);
|
1430
|
+
this.render(true);
|
1431
|
+
this.divLayer.render();
|
1432
|
+
if (noRedo) {
|
1433
|
+
this.caches.list.splice(this.caches.index + 1, this.caches.list.length - this.caches.index - 1);
|
1434
|
+
}
|
1435
|
+
this.dispatch('undo', this.data);
|
1436
|
+
};
|
1437
|
+
Topology.prototype.redo = function () {
|
1438
|
+
if (this.data.locked || this.caches.index > this.caches.list.length - 2) {
|
1439
|
+
return;
|
1440
|
+
}
|
1441
|
+
this.divLayer.clear();
|
1442
|
+
var data = new TopologyData(this.caches.list[++this.caches.index]);
|
1443
|
+
this.data.pens.splice(0, this.data.pens.length);
|
1444
|
+
this.data.pens.push.apply(this.data.pens, data.pens);
|
1445
|
+
this.render(true);
|
1446
|
+
this.divLayer.render();
|
1447
|
+
this.dispatch('redo', this.data);
|
1448
|
+
};
|
1449
|
+
Topology.prototype.toImage = function (type, quality, callback, padding, thumbnail) {
|
1450
|
+
if (thumbnail === void 0) {
|
1451
|
+
thumbnail = true;
|
1452
|
+
}
|
1453
|
+
var rect = new Rect(0, 0, this.canvas.width, this.canvas.height);
|
1454
|
+
if (thumbnail) {
|
1455
|
+
rect = this.getRect();
|
1456
|
+
}
|
1457
|
+
if (!padding) {
|
1458
|
+
padding = {
|
1459
|
+
left: 10,
|
1460
|
+
top: 10,
|
1461
|
+
right: 10,
|
1462
|
+
bottom: 10,
|
1463
|
+
};
|
1464
|
+
}
|
1465
|
+
rect.x -= padding.left;
|
1466
|
+
rect.y -= padding.top;
|
1467
|
+
rect.width += padding.left + padding.right;
|
1468
|
+
rect.height += padding.top + padding.bottom;
|
1469
|
+
rect.round();
|
1470
|
+
var srcRect = rect.clone();
|
1471
|
+
srcRect.scale(this.offscreen.getDpiRatio(), new Point(0, 0));
|
1472
|
+
srcRect.round();
|
1473
|
+
var canvas = document.createElement('canvas');
|
1474
|
+
canvas.width = srcRect.width;
|
1475
|
+
canvas.height = srcRect.height;
|
1476
|
+
canvas.style.width = rect.width + 'px';
|
1477
|
+
canvas.style.height = rect.height + 'px';
|
1478
|
+
var ctx = canvas.getContext('2d');
|
1479
|
+
if (type && type !== 'image/png') {
|
1480
|
+
ctx.fillStyle = '#fff';
|
1481
|
+
ctx.fillRect(0, 0, canvas.width, canvas.height);
|
1482
|
+
}
|
1483
|
+
ctx.drawImage(this.canvas.canvas, srcRect.x, srcRect.y, srcRect.width, srcRect.height, 0, 0, srcRect.width, srcRect.height);
|
1484
|
+
if (callback) {
|
1485
|
+
canvas.toBlob(callback);
|
1486
|
+
return '';
|
1487
|
+
}
|
1488
|
+
return canvas.toDataURL(type, quality);
|
1489
|
+
};
|
1490
|
+
Topology.prototype.saveAsImage = function (name, type, quality, padding, thumbnail) {
|
1491
|
+
if (thumbnail === void 0) {
|
1492
|
+
thumbnail = true;
|
1493
|
+
}
|
1494
|
+
var a = document.createElement('a');
|
1495
|
+
a.setAttribute('download', name || 'le5le.topology.png');
|
1496
|
+
a.setAttribute('href', this.toImage(type, quality, null, padding, thumbnail));
|
1497
|
+
var evt = document.createEvent('MouseEvents');
|
1498
|
+
evt.initEvent('click', true, true);
|
1499
|
+
a.dispatchEvent(evt);
|
1500
|
+
};
|
1501
|
+
Topology.prototype.delete = function (force, nodes) {
|
1502
|
+
var pens = [];
|
1503
|
+
const deleteNodes = nodes ? nodes : this.activeLayer.pens;
|
1504
|
+
for (var i = 0; i < deleteNodes.length; i++) {
|
1505
|
+
var pen = deleteNodes[i];
|
1506
|
+
if (!force && pen.locked) {
|
1507
|
+
continue;
|
1508
|
+
}
|
1509
|
+
var found = this.findIndex(pen);
|
1510
|
+
if (found > -1) {
|
1511
|
+
if (this.data.pens[found].type === PenType.Node) {
|
1512
|
+
this.divLayer.removeDiv(this.data.pens[found]);
|
1513
|
+
}
|
1514
|
+
if (this.options.disableEmptyLine) {
|
1515
|
+
this.delEmptyLines(pen.id);
|
1516
|
+
}
|
1517
|
+
pens.push.apply(pens, this.data.pens.splice(found, 1));
|
1518
|
+
this.setSwitchTabData(pen, found, 'delete');
|
1519
|
+
--i;
|
1520
|
+
}
|
1521
|
+
this.animateLayer.pens.delete(pen.id);
|
1522
|
+
}
|
1523
|
+
if (!pens.length) {
|
1524
|
+
return;
|
1525
|
+
}
|
1526
|
+
this.render(true);
|
1527
|
+
this.cache();
|
1528
|
+
this.dispatch('delete', pens);
|
1529
|
+
};
|
1530
|
+
Topology.prototype.delEmptyLines = function (deleteedId) {
|
1531
|
+
for (var i = 0; i < this.data.pens.length; i++) {
|
1532
|
+
if (this.data.pens[i].type !== PenType.Line) {
|
1533
|
+
continue;
|
1534
|
+
}
|
1535
|
+
var line = this.data.pens[i];
|
1536
|
+
if (!line.from.id ||
|
1537
|
+
!line.to.id ||
|
1538
|
+
line.from.id === deleteedId ||
|
1539
|
+
line.to.id === deleteedId) {
|
1540
|
+
this.data.pens.splice(i, 1);
|
1541
|
+
this.animateLayer.pens.delete(line.id);
|
1542
|
+
--i;
|
1543
|
+
}
|
1544
|
+
}
|
1545
|
+
};
|
1546
|
+
Topology.prototype.removeNode = function (node) {
|
1547
|
+
var i = this.findIndex(node);
|
1548
|
+
if (i > -1) {
|
1549
|
+
this.divLayer.removeDiv(this.data.pens[i]);
|
1550
|
+
var nodes = this.data.pens.splice(i, 1);
|
1551
|
+
this.dispatch('delete', nodes);
|
1552
|
+
}
|
1553
|
+
this.render(true);
|
1554
|
+
this.cache();
|
1555
|
+
};
|
1556
|
+
Topology.prototype.removeLine = function (line) {
|
1557
|
+
var i = this.findIndex(line);
|
1558
|
+
if (i > -1) {
|
1559
|
+
var lines = this.data.pens.splice(i, 1);
|
1560
|
+
this.dispatch('delete', lines);
|
1561
|
+
}
|
1562
|
+
this.render(true);
|
1563
|
+
this.cache();
|
1564
|
+
};
|
1565
|
+
Topology.prototype.cut = function () {
|
1566
|
+
if (this.data.locked) {
|
1567
|
+
return;
|
1568
|
+
}
|
1569
|
+
this.clipboard = new TopologyData({
|
1570
|
+
pens: [],
|
1571
|
+
});
|
1572
|
+
for (var i = 0; i < this.activeLayer.pens.length; i++) {
|
1573
|
+
var pen = this.activeLayer.pens[i];
|
1574
|
+
this.clipboard.pens.push(pen.clone());
|
1575
|
+
var found = this.findIndex(pen);
|
1576
|
+
if (found > -1) {
|
1577
|
+
if (pen.type === PenType.Node) {
|
1578
|
+
this.divLayer.removeDiv(this.data.pens[found]);
|
1579
|
+
}
|
1580
|
+
this.data.pens.splice(found, 1);
|
1581
|
+
--i;
|
1582
|
+
}
|
1583
|
+
}
|
1584
|
+
this.cache();
|
1585
|
+
this.activeLayer.clear();
|
1586
|
+
this.hoverLayer.node = null;
|
1587
|
+
this.moveIn.hoverLine = null;
|
1588
|
+
this.moveIn.hoverNode = null;
|
1589
|
+
this.render();
|
1590
|
+
this.dispatch('delete', this.clipboard.pens);
|
1591
|
+
};
|
1592
|
+
Topology.prototype.copy = function () {
|
1593
|
+
let isAnimate = this.activeLayer.pens.find((item) => {
|
1594
|
+
return item.animatePlay;
|
1595
|
+
});
|
1596
|
+
if(isAnimate) return false;
|
1597
|
+
this.clipboard = new TopologyData({
|
1598
|
+
pens: [],
|
1599
|
+
});
|
1600
|
+
for (var _i = 0, _a = this.activeLayer.pens; _i < _a.length; _i++) {
|
1601
|
+
var pen = _a[_i];
|
1602
|
+
this.clipboard.pens.push(pen.clone());
|
1603
|
+
};
|
1604
|
+
return true;
|
1605
|
+
};
|
1606
|
+
Topology.prototype.paste = function () {
|
1607
|
+
if (!this.clipboard || this.data.locked) {
|
1608
|
+
return;
|
1609
|
+
}
|
1610
|
+
this.hoverLayer.node = null;
|
1611
|
+
this.hoverLayer.line = null;
|
1612
|
+
this.activeLayer.pens = [];
|
1613
|
+
var idMaps = {};
|
1614
|
+
const clipboardPens = JSON.parse(JSON.stringify(this.clipboard.pens));
|
1615
|
+
for (var _i = 0, _a = clipboardPens; _i < _a.length; _i++) {
|
1616
|
+
const pen = new Node(_a[_i]);
|
1617
|
+
if (pen.type === PenType.Node) {
|
1618
|
+
this.newId(pen, idMaps);
|
1619
|
+
pen.rect.x += 20;
|
1620
|
+
pen.rect.ex += 20;
|
1621
|
+
pen.rect.y += 20;
|
1622
|
+
pen.rect.ey += 20;
|
1623
|
+
const rectType = ['rect', 'textRect', 'fullTextRect', 'iconRect', 'fullIconRect']
|
1624
|
+
if (pen.subName && pen.subName == 'temp') {
|
1625
|
+
// 温湿度元件
|
1626
|
+
rectType.forEach((type) => {
|
1627
|
+
pen.children.forEach((item) => {
|
1628
|
+
item[type].x += 20;
|
1629
|
+
item[type].ex += 20;
|
1630
|
+
item[type].y += 20;
|
1631
|
+
item[type].ey += 20;
|
1632
|
+
})
|
1633
|
+
})
|
1634
|
+
}
|
1635
|
+
//pen.init();
|
1636
|
+
}
|
1637
|
+
if (pen instanceof Line) {
|
1638
|
+
pen.id = s8();
|
1639
|
+
pen.from = new Point(pen.from.x + 20, pen.from.y + 20, pen.from.direction, pen.from.anchorIndex, idMaps[pen.from.id]);
|
1640
|
+
pen.to = new Point(pen.to.x + 20, pen.to.y + 20, pen.to.direction, pen.to.anchorIndex, idMaps[pen.to.id]);
|
1641
|
+
var controlPoints = [];
|
1642
|
+
for (var _b = 0, _c = pen.controlPoints; _b < _c.length; _b++) {
|
1643
|
+
var pt = _c[_b];
|
1644
|
+
controlPoints.push(new Point(pt.x + 20, pt.y + 20));
|
1645
|
+
}
|
1646
|
+
pen.controlPoints = controlPoints;
|
1647
|
+
}
|
1648
|
+
this.data.pens.push(pen);
|
1649
|
+
this.activeLayer.add(pen);
|
1650
|
+
this.setSwitchTabData(pen, this.data.pens.length-1);
|
1651
|
+
}
|
1652
|
+
this.render();
|
1653
|
+
this.animate(true);
|
1654
|
+
this.cache();
|
1655
|
+
this.copy();
|
1656
|
+
if (this.clipboard.pens.length > 1) {
|
1657
|
+
this.dispatch('multi', {
|
1658
|
+
pens: this.clipboard.pens,
|
1659
|
+
});
|
1660
|
+
} else if (this.activeLayer.pens.length > 0) {
|
1661
|
+
if (this.activeLayer.pens[0].type === PenType.Node) {
|
1662
|
+
this.dispatch('addNode', this.activeLayer.pens[0]);
|
1663
|
+
} else if (this.activeLayer.pens[0].type === PenType.Line) {
|
1664
|
+
this.dispatch('addLine', this.activeLayer.pens[0]);
|
1665
|
+
}
|
1666
|
+
}
|
1667
|
+
};
|
1668
|
+
Topology.prototype.bind = function (item, exite, dataType, index) {
|
1669
|
+
this.clipboard = new TopologyData({
|
1670
|
+
pens: [],
|
1671
|
+
});
|
1672
|
+
for (var _i = 0, _a = this.activeLayer.pens; _i < _a.length; _i++) {
|
1673
|
+
var pen = _a[_i];
|
1674
|
+
pen.data = []
|
1675
|
+
this.bindInfo(item, pen, dataType, index)
|
1676
|
+
this.clipboard.pens.push(pen.clone());
|
1677
|
+
}
|
1678
|
+
if (exite == true) {
|
1679
|
+
this.paste();
|
1680
|
+
}
|
1681
|
+
};
|
1682
|
+
Topology.prototype.bindInfo = async function (item, pen, type, index) {
|
1683
|
+
if (type == 0) {
|
1684
|
+
pen.data.push({
|
1685
|
+
"key": "tagId",
|
1686
|
+
"value": item.tagId,
|
1687
|
+
"isControlDis": item.isControlDis,
|
1688
|
+
"type": item.tagType,
|
1689
|
+
"tagVal": item.value,
|
1690
|
+
"valExplain": item.valExplain,
|
1691
|
+
"tagId": item.tagId
|
1692
|
+
}, {
|
1693
|
+
"key": "测点名称",
|
1694
|
+
"value": item.tagName
|
1695
|
+
})
|
1696
|
+
let obj = {
|
1697
|
+
"key": "threeCategoryId",
|
1698
|
+
"value": item.threeCategoryId
|
1699
|
+
}
|
1700
|
+
// 绑定悬浮文字
|
1701
|
+
pen.title = item.touchpname
|
1702
|
+
if (!JSON.stringify(pen.data).includes(JSON.stringify(obj))) {
|
1703
|
+
pen.data.push(obj)
|
1704
|
+
}
|
1705
|
+
} else if (type == 1) {
|
1706
|
+
pen.data.push({
|
1707
|
+
"key": "kpiAddr",
|
1708
|
+
"value": item.kpiId + '_' + item.kpiAddr,
|
1709
|
+
"isControlDis": item.isControlDis,
|
1710
|
+
"type": item.tagType
|
1711
|
+
}, {
|
1712
|
+
"key": "指标名称",
|
1713
|
+
"value": item.kpiName
|
1714
|
+
})
|
1715
|
+
} else if (type == 2) {
|
1716
|
+
pen.data.push({
|
1717
|
+
"key": "assetId",
|
1718
|
+
"value": item.id
|
1719
|
+
}, {
|
1720
|
+
"key": "资产名称",
|
1721
|
+
"value": item.name
|
1722
|
+
})
|
1723
|
+
// 绑定悬浮文字
|
1724
|
+
pen.title = item.bak
|
1725
|
+
if (pen.subName && pen.subName == 'temp') {
|
1726
|
+
// 温湿度元件
|
1727
|
+
// 通讯状态
|
1728
|
+
pen.children[0].data = []
|
1729
|
+
if (index > 0) {
|
1730
|
+
pen.children[0].text = index + 1 + '#'
|
1731
|
+
}
|
1732
|
+
this.bindInfo(item, pen.children[0], type);
|
1733
|
+
// 温度/湿度
|
1734
|
+
const _type = 0
|
1735
|
+
const ret = await axios.post('/asset/touch_css3000_api/findlist', {assetIds: item.id})
|
1736
|
+
ret.data.data.forEach((elem) => {
|
1737
|
+
// if(elem.kpiName=='通讯状态'){
|
1738
|
+
// }else
|
1739
|
+
if (elem.kpiName == '温度') {
|
1740
|
+
pen.children[1].data = []
|
1741
|
+
this.bindInfo(elem, pen.children[1], _type);
|
1742
|
+
} else if (elem.kpiName == '湿度') {
|
1743
|
+
pen.children[2].data = []
|
1744
|
+
this.bindInfo(elem, pen.children[2], _type);
|
1745
|
+
}
|
1746
|
+
})
|
1747
|
+
pen.children.forEach((item) => {
|
1748
|
+
item.events = [{
|
1749
|
+
"type": 3,
|
1750
|
+
"action": 2,
|
1751
|
+
"value": "",
|
1752
|
+
"show": true
|
1753
|
+
}]
|
1754
|
+
})
|
1755
|
+
}
|
1756
|
+
} else if (type == 3) {
|
1757
|
+
pen.data.push({
|
1758
|
+
"key": "areaId",
|
1759
|
+
"value": item.id
|
1760
|
+
}, {
|
1761
|
+
"key": "区域名称",
|
1762
|
+
"value": item.name
|
1763
|
+
})
|
1764
|
+
}
|
1765
|
+
// let str = JSON.stringify(pen.events)
|
1766
|
+
// pen.events.forEach((_item) => {
|
1767
|
+
// if(_item.action==0 && _item.dcimDetailPage && _item.dcimDetailPage != '' && item.devId){
|
1768
|
+
// str = str.replace(new RegExp(_item.dcimAssetValue,'g'), item.devId)
|
1769
|
+
// }
|
1770
|
+
// });
|
1771
|
+
// pen.events = JSON.parse(str)
|
1772
|
+
return pen
|
1773
|
+
};
|
1774
|
+
Topology.prototype.newId = function (node, idMaps) {
|
1775
|
+
var old = node.id;
|
1776
|
+
node.id = s8();
|
1777
|
+
idMaps[old] = node.id;
|
1778
|
+
if (node.children) {
|
1779
|
+
for (var _i = 0, _a = node.children; _i < _a.length; _i++) {
|
1780
|
+
var item = _a[_i];
|
1781
|
+
this.newId(item, idMaps);
|
1782
|
+
}
|
1783
|
+
}
|
1784
|
+
};
|
1785
|
+
Topology.prototype.updateProps = function (cache, pens) {
|
1786
|
+
if (cache === void 0) {
|
1787
|
+
cache = true;
|
1788
|
+
}
|
1789
|
+
if (!pens) {
|
1790
|
+
pens = this.activeLayer.pens;
|
1791
|
+
}
|
1792
|
+
for (var _i = 0, pens_1 = pens; _i < pens_1.length; _i++) {
|
1793
|
+
var pen = pens_1[_i];
|
1794
|
+
if (pen instanceof Node) {
|
1795
|
+
let isRotateBug = false
|
1796
|
+
if (pen.rotate === 0) {
|
1797
|
+
pen.rotate = 360
|
1798
|
+
isRotateBug = true
|
1799
|
+
}
|
1800
|
+
pen.init();
|
1801
|
+
pen.initRect();
|
1802
|
+
if (isRotateBug === true) {
|
1803
|
+
pen.rotate = 0
|
1804
|
+
}
|
1805
|
+
if (!pen.strokeStyle) {
|
1806
|
+
pen.strokeStyle = 'transparent'
|
1807
|
+
}
|
1808
|
+
}
|
1809
|
+
}
|
1810
|
+
this.activeLayer.updateLines(pens);
|
1811
|
+
this.activeLayer.calcControlPoints();
|
1812
|
+
this.activeLayer.saveNodeRects();
|
1813
|
+
this.render();
|
1814
|
+
// tslint:disable-next-line: no-unused-expression
|
1815
|
+
cache && this.cache();
|
1816
|
+
};
|
1817
|
+
Topology.prototype.lock = function (lock) {
|
1818
|
+
this.data.locked = lock;
|
1819
|
+
for (var _i = 0, _a = this.data.pens; _i < _a.length; _i++) {
|
1820
|
+
var item = _a[_i];
|
1821
|
+
item.addToDiv && item.addToDiv();
|
1822
|
+
}
|
1823
|
+
this.dispatch('locked', this.data.locked);
|
1824
|
+
};
|
1825
|
+
Topology.prototype.lockPens = function (pens, lock) {
|
1826
|
+
for (var _i = 0, _a = this.data.pens; _i < _a.length; _i++) {
|
1827
|
+
var item = _a[_i];
|
1828
|
+
for (var _b = 0, pens_2 = pens; _b < pens_2.length; _b++) {
|
1829
|
+
var pen = pens_2[_b];
|
1830
|
+
if (item.id === pen.id) {
|
1831
|
+
item.locked = lock;
|
1832
|
+
item.addToDiv && item.addToDiv();
|
1833
|
+
break;
|
1834
|
+
}
|
1835
|
+
}
|
1836
|
+
}
|
1837
|
+
this.dispatch('lockPens', {
|
1838
|
+
pens: pens,
|
1839
|
+
lock: lock,
|
1840
|
+
});
|
1841
|
+
};
|
1842
|
+
Topology.prototype.up = function (pen) {
|
1843
|
+
var i = this.findIndex(pen);
|
1844
|
+
if (i > -1 && i !== this.data.pens.length - 1) {
|
1845
|
+
this.data.pens.splice(i + 2, 0, this.data.pens[i]);
|
1846
|
+
this.data.pens.splice(i, 1);
|
1847
|
+
}
|
1848
|
+
};
|
1849
|
+
Topology.prototype.top = function (pen) {
|
1850
|
+
var i = this.findIndex(pen);
|
1851
|
+
if (i > -1) {
|
1852
|
+
this.data.pens.push(this.data.pens[i]);
|
1853
|
+
this.data.pens.splice(i, 1);
|
1854
|
+
}
|
1855
|
+
};
|
1856
|
+
Topology.prototype.down = function (pen) {
|
1857
|
+
var i = this.findIndex(pen);
|
1858
|
+
if (i > -1 && i !== 0) {
|
1859
|
+
this.data.pens.splice(i - 1, 0, this.data.pens[i]);
|
1860
|
+
this.data.pens.splice(i + 1, 1);
|
1861
|
+
}
|
1862
|
+
};
|
1863
|
+
Topology.prototype.bottom = function (pen) {
|
1864
|
+
var i = this.findIndex(pen);
|
1865
|
+
if (i > -1) {
|
1866
|
+
this.data.pens.unshift(this.data.pens[i]);
|
1867
|
+
this.data.pens.splice(i + 1, 1);
|
1868
|
+
}
|
1869
|
+
};
|
1870
|
+
Topology.prototype.combine = function (pens, stand, temp) {
|
1871
|
+
if (stand === void 0) {
|
1872
|
+
stand = false;
|
1873
|
+
}
|
1874
|
+
if (!pens) {
|
1875
|
+
pens = this.activeLayer.pens;
|
1876
|
+
}
|
1877
|
+
const converPens = JSON.parse(JSON.stringify(pens));
|
1878
|
+
var rect = this.getRect(converPens);
|
1879
|
+
for (var _i = 0, pens_3 = converPens; _i < pens_3.length; _i++) {
|
1880
|
+
var item = pens_3[_i];
|
1881
|
+
var i = this.findIndex(item);
|
1882
|
+
if (i > -1) {
|
1883
|
+
this.data.pens.splice(i, 1);
|
1884
|
+
}
|
1885
|
+
}
|
1886
|
+
var node = new Node({
|
1887
|
+
name: 'combine',
|
1888
|
+
rect: new Rect(rect.x, rect.y, rect.width, rect.height),
|
1889
|
+
text: '',
|
1890
|
+
paddingLeft: 0,
|
1891
|
+
paddingRight: 0,
|
1892
|
+
paddingTop: 0,
|
1893
|
+
paddingBottom: 0,
|
1894
|
+
strokeStyle: 'transparent',
|
1895
|
+
children: [],
|
1896
|
+
});
|
1897
|
+
if (temp) {
|
1898
|
+
node.subName = temp
|
1899
|
+
}
|
1900
|
+
for (var _a = 0, pens_4 = converPens; _a < pens_4.length; _a++) {
|
1901
|
+
var item = new Node(pens_4[_a]);
|
1902
|
+
item.stand = stand;
|
1903
|
+
item.parentId = node.id;
|
1904
|
+
item.animatePlay = false;
|
1905
|
+
item.calcRectInParent(node);
|
1906
|
+
node.children.push(item);
|
1907
|
+
}
|
1908
|
+
this.data.pens.push(node);
|
1909
|
+
this.activeLayer.setPens([node]);
|
1910
|
+
this.dispatch('node', node);
|
1911
|
+
this.cache();
|
1912
|
+
};
|
1913
|
+
Topology.prototype.uncombine = function (node) {
|
1914
|
+
if (!node) {
|
1915
|
+
node = this.activeLayer.pens[0];
|
1916
|
+
}
|
1917
|
+
if (!(node instanceof Node)) {
|
1918
|
+
return;
|
1919
|
+
}
|
1920
|
+
const nodeChildren = JSON.parse(JSON.stringify(node));
|
1921
|
+
for (var _i = 0, _a = nodeChildren.children; _i < _a.length; _i++) {
|
1922
|
+
var item = new Node(_a[_i]);
|
1923
|
+
item.parentId = undefined;
|
1924
|
+
item.rectInParent = undefined;
|
1925
|
+
item.locked = Lock.None;
|
1926
|
+
this.data.pens.push(item);
|
1927
|
+
}
|
1928
|
+
var i = this.findIndex(nodeChildren);
|
1929
|
+
if (i > -1 && nodeChildren.name === 'combine') {
|
1930
|
+
this.data.pens.splice(i, 1);
|
1931
|
+
} else {
|
1932
|
+
nodeChildren.children = null;
|
1933
|
+
}
|
1934
|
+
this.cache();
|
1935
|
+
this.activeLayer.clear();
|
1936
|
+
this.hoverLayer.clear();
|
1937
|
+
};
|
1938
|
+
Topology.prototype.find = function (idOrTag, pens) {
|
1939
|
+
var _this = this;
|
1940
|
+
if (!pens) {
|
1941
|
+
pens = this.data.pens;
|
1942
|
+
}
|
1943
|
+
var result = [];
|
1944
|
+
pens.forEach(function (item) {
|
1945
|
+
if (item.id === idOrTag || item.tags.indexOf(idOrTag) > -1) {
|
1946
|
+
result.push(item);
|
1947
|
+
}
|
1948
|
+
if (item.children) {
|
1949
|
+
result.push.apply(result, _this.find(idOrTag, item.children));
|
1950
|
+
}
|
1951
|
+
});
|
1952
|
+
if (result.length === 1) {
|
1953
|
+
return result[0];
|
1954
|
+
}
|
1955
|
+
return result;
|
1956
|
+
};
|
1957
|
+
Topology.prototype.findIndex = function (pen) {
|
1958
|
+
for (var i = 0; i < this.data.pens.length; ++i) {
|
1959
|
+
if (pen.id === this.data.pens[i].id) {
|
1960
|
+
return i;
|
1961
|
+
}
|
1962
|
+
}
|
1963
|
+
return -1;
|
1964
|
+
};
|
1965
|
+
Topology.prototype.anchor = function (anchor) {
|
1966
|
+
this.options.hideAnchor = anchor
|
1967
|
+
this.dispatch('hideAnchor', anchor);
|
1968
|
+
};
|
1969
|
+
// scale for scaled canvas:
|
1970
|
+
// > 1, expand
|
1971
|
+
// < 1, reduce
|
1972
|
+
Topology.prototype.scale = function (scale, center, w, h) {
|
1973
|
+
if (this.data.scale * scale < this.options.minScale ||
|
1974
|
+
this.data.scale * scale > this.options.maxScale) {
|
1975
|
+
return;
|
1976
|
+
}
|
1977
|
+
this.data.scale *= scale;
|
1978
|
+
!center && (center = this.getRect().center);
|
1979
|
+
for (var _i = 0, _a = this.data.pens; _i < _a.length; _i++) {
|
1980
|
+
var item = _a[_i];
|
1981
|
+
item.scale(scale, center, w, h);
|
1982
|
+
}
|
1983
|
+
this.animateLayer.pens.forEach(function (pen) {
|
1984
|
+
if (pen instanceof Line) {
|
1985
|
+
pen.scale(scale, center);
|
1986
|
+
}
|
1987
|
+
});
|
1988
|
+
Store.set(this.generateStoreKey('LT:scale'), this.data.scale);
|
1989
|
+
this.render();
|
1990
|
+
this.cache();
|
1991
|
+
this.dispatch('scale', this.data.scale);
|
1992
|
+
};
|
1993
|
+
// scale for origin canvas:
|
1994
|
+
Topology.prototype.scaleTo = function (scale) {
|
1995
|
+
this.scale(scale / this.data.scale);
|
1996
|
+
this.data.scale = scale;
|
1997
|
+
};
|
1998
|
+
Topology.prototype.round = function () {
|
1999
|
+
for (var _i = 0, _a = this.data.pens; _i < _a.length; _i++) {
|
2000
|
+
var item = _a[_i];
|
2001
|
+
if (item instanceof Node) {
|
2002
|
+
item.round();
|
2003
|
+
}
|
2004
|
+
}
|
2005
|
+
}
|
2006
|
+
Topology.prototype.fitView = function (viewPadding) {
|
2007
|
+
if (!this.hasView())
|
2008
|
+
return;
|
2009
|
+
// 1. 重置画布尺寸为容器尺寸
|
2010
|
+
var parentElem = this.canvas.parentElem;
|
2011
|
+
var width = parentElem.offsetWidth, height = parentElem.offsetHeight;
|
2012
|
+
this.resize({
|
2013
|
+
width: width,
|
2014
|
+
height: height,
|
2015
|
+
});
|
2016
|
+
// 2. 图形居中
|
2017
|
+
this.centerView(viewPadding);
|
2018
|
+
// 3. 获取设置的留白值
|
2019
|
+
var padding = formatPadding(viewPadding || this.options.viewPadding);
|
2020
|
+
// 4. 获取图形尺寸
|
2021
|
+
var rect = this.getRect();
|
2022
|
+
// 6. 计算缩放比
|
2023
|
+
var w = (width - padding[1] - padding[3]) / rect.width;
|
2024
|
+
var h = (height - padding[0] - padding[2]) / rect.height;
|
2025
|
+
var ratio = w;
|
2026
|
+
if (w > h) {
|
2027
|
+
ratio = h;
|
2028
|
+
}
|
2029
|
+
this.scale(ratio);
|
2030
|
+
};
|
2031
|
+
Topology.prototype.showTipText = function (data, pos) {
|
2032
|
+
if (this.data.locked && data.title) {
|
2033
|
+
this.divLayer.canvas.title = data.title;
|
2034
|
+
this.tip = data.id;
|
2035
|
+
}
|
2036
|
+
};
|
2037
|
+
Topology.prototype.scroll = function (x, y) {
|
2038
|
+
var _this = this;
|
2039
|
+
if (this.scrolling) {
|
2040
|
+
return;
|
2041
|
+
}
|
2042
|
+
this.scrolling = true;
|
2043
|
+
this.parentElem.scrollLeft += x;
|
2044
|
+
this.parentElem.scrollTop += y;
|
2045
|
+
setTimeout(function () {
|
2046
|
+
_this.scrolling = false;
|
2047
|
+
}, 700);
|
2048
|
+
};
|
2049
|
+
Topology.prototype.toComponent = function (pens) {
|
2050
|
+
if (!pens) {
|
2051
|
+
pens = this.data.pens;
|
2052
|
+
}
|
2053
|
+
var rect = this.getRect(pens);
|
2054
|
+
var node = new Node({
|
2055
|
+
name: 'combine',
|
2056
|
+
rect: new Rect(rect.x, rect.y, rect.width, rect.height),
|
2057
|
+
text: '',
|
2058
|
+
paddingLeft: 0,
|
2059
|
+
paddingRight: 0,
|
2060
|
+
paddingTop: 0,
|
2061
|
+
paddingBottom: 0,
|
2062
|
+
strokeStyle: 'transparent',
|
2063
|
+
children: [],
|
2064
|
+
});
|
2065
|
+
for (var _i = 0, pens_5 = pens; _i < pens_5.length; _i++) {
|
2066
|
+
var item = pens_5[_i];
|
2067
|
+
if (item.type === PenType.Node &&
|
2068
|
+
rect.width === item.rect.width &&
|
2069
|
+
rect.height === item.rect.height) {
|
2070
|
+
node = item;
|
2071
|
+
if (!node.children) {
|
2072
|
+
node.children = [];
|
2073
|
+
}
|
2074
|
+
break;
|
2075
|
+
}
|
2076
|
+
}
|
2077
|
+
for (var _a = 0, pens_6 = pens; _a < pens_6.length; _a++) {
|
2078
|
+
var item = pens_6[_a];
|
2079
|
+
if (item !== node) {
|
2080
|
+
item.parentId = node.id;
|
2081
|
+
item.calcRectInParent(node);
|
2082
|
+
node.children.push(item);
|
2083
|
+
}
|
2084
|
+
}
|
2085
|
+
return node;
|
2086
|
+
};
|
2087
|
+
Topology.prototype.getValue = function (idOrTag, attr) {
|
2088
|
+
if (attr === void 0) {
|
2089
|
+
attr = 'text';
|
2090
|
+
}
|
2091
|
+
var pen;
|
2092
|
+
this.data.pens.forEach(function (item) {
|
2093
|
+
if (item.id === idOrTag || item.tags.indexOf(idOrTag) > -1) {
|
2094
|
+
pen = item;
|
2095
|
+
}
|
2096
|
+
});
|
2097
|
+
return pen[attr];
|
2098
|
+
};
|
2099
|
+
Topology.prototype.setValue = function (idOrTag, val, attr) {
|
2100
|
+
if (attr === void 0) {
|
2101
|
+
attr = 'text';
|
2102
|
+
}
|
2103
|
+
var pen;
|
2104
|
+
this.data.pens.forEach(function (item) {
|
2105
|
+
if (item.id === idOrTag || item.tags.indexOf(idOrTag) > -1) {
|
2106
|
+
pen = item;
|
2107
|
+
}
|
2108
|
+
});
|
2109
|
+
pen[attr] = val;
|
2110
|
+
};
|
2111
|
+
Topology.prototype.createGrid = function () {
|
2112
|
+
this.gridElem.style.position = 'absolute';
|
2113
|
+
this.gridElem.style.display = 'none';
|
2114
|
+
this.gridElem.style.left = '0';
|
2115
|
+
this.gridElem.style.top = '0';
|
2116
|
+
this.gridElem.innerHTML = "<svg class=\"svg-grid\" width=\"100%\" height=\"100%\" style=\"position:absolute;left:0;right:0;top:0;bottom:0\"\n xmlns=\"http://www.w3.org/2000/svg\">\n <defs>\n <pattern id=\"grid\" width=\"10\" height=\"10\" patternUnits=\"userSpaceOnUse\">\n <path d=\"M 10 0 L 0 0 0 10\" fill=\"none\" stroke=\"#f3f3f3\" stroke-width=\"1\" />\n </pattern>\n </defs>\n <rect width=\"100%\" height=\"100%\" fill=\"url(#grid)\" />\n </svg>";
|
2117
|
+
this.parentElem.appendChild(this.gridElem);
|
2118
|
+
};
|
2119
|
+
Topology.prototype.showGrid = function (show) {
|
2120
|
+
if (show === undefined) {
|
2121
|
+
show = this.data.grid;
|
2122
|
+
}
|
2123
|
+
this.gridElem.style.width = this.canvas.width + 'px';
|
2124
|
+
this.gridElem.style.height = this.canvas.height + 'px';
|
2125
|
+
this.gridElem.style.display = show ? 'block' : 'none';
|
2126
|
+
};
|
2127
|
+
Topology.prototype.destroy = function () {
|
2128
|
+
this.subcribeAnimateMoved.unsubscribe();
|
2129
|
+
this.subcribeMediaEnd.unsubscribe();
|
2130
|
+
this.destroyStatic();
|
2131
|
+
this.hoverLayer = null;
|
2132
|
+
this.activeLayer = null;
|
2133
|
+
this.gridElem = null;
|
2134
|
+
this.onMouseMove = null;
|
2135
|
+
this.onmousedown = null;
|
2136
|
+
this.onmouseup = null;
|
2137
|
+
this.onkeydown = null;
|
2138
|
+
window.removeEventListener('resize', this.winResize);
|
2139
|
+
};
|
2140
|
+
Topology.prototype.handleAddArbitrary = function () {
|
2141
|
+
let _this = this;
|
2142
|
+
let graphData = _this.arbitrarygGraphData;
|
2143
|
+
let circles = graphData.circles;
|
2144
|
+
let points = graphData.points;
|
2145
|
+
let canvas = _this.canvas.canvas;
|
2146
|
+
let context = canvas.getContext('2d');
|
2147
|
+
for (var i = 0; i < circles.length; i++) {
|
2148
|
+
let circle = circles[i];
|
2149
|
+
var distanceFromCenter = Math.sqrt(Math.pow(circle.x - _this.mouseDown.x, 2)
|
2150
|
+
+ Math.pow(circle.y - _this.mouseDown.y, 2));
|
2151
|
+
|
2152
|
+
if (distanceFromCenter <= circle.radius) {
|
2153
|
+
|
2154
|
+
graphData.indexCircle = i;
|
2155
|
+
graphData.isDragging = true;
|
2156
|
+
return;
|
2157
|
+
}
|
2158
|
+
}
|
2159
|
+
let circle = new Circle(_this.mouseDown.x, _this.mouseDown.y);
|
2160
|
+
circles.push(circle);
|
2161
|
+
circles[0].color = "green";
|
2162
|
+
for (var i = 0; i < circles.length; i++) {
|
2163
|
+
let circle = circles[i];
|
2164
|
+
context.beginPath();
|
2165
|
+
context.arc(circle.x, circle.y, circle.radius, 0, Math.PI * 2);
|
2166
|
+
context.fillStyle = circle.color;
|
2167
|
+
context.strokeStyle = "black";
|
2168
|
+
context.fill();
|
2169
|
+
context.stroke();
|
2170
|
+
}
|
2171
|
+
var point = new Point(_this.mouseDown.x, _this.mouseDown.y);
|
2172
|
+
points.push(point);
|
2173
|
+
context.beginPath();
|
2174
|
+
context.lineWidth = 1;
|
2175
|
+
if (points.length > 1) {
|
2176
|
+
|
2177
|
+
var distanceFromStart = Math.sqrt(Math.pow(points[0].x - _this.mouseDown.x, 2)
|
2178
|
+
+ Math.pow(points[0].y - _this.mouseDown.y, 2));
|
2179
|
+
}
|
2180
|
+
|
2181
|
+
if (distanceFromStart <= 30) {
|
2182
|
+
graphData.oIndex = 1;
|
2183
|
+
}
|
2184
|
+
|
2185
|
+
context.moveTo(points[0].x, points[0].y);
|
2186
|
+
for (var i = 0; i < points.length; i++) {
|
2187
|
+
context.lineTo(points[i].x, points[i].y);
|
2188
|
+
}
|
2189
|
+
context.fillStyle = "rgb(0,0,0)";
|
2190
|
+
|
2191
|
+
if (graphData.oIndex == 1) {
|
2192
|
+
|
2193
|
+
context.lineTo(points[0].x, points[0].y);
|
2194
|
+
|
2195
|
+
_this.arbitrarygGraphData.close = true;
|
2196
|
+
|
2197
|
+
}
|
2198
|
+
context.strokeStyle = "#339fff";
|
2199
|
+
context.stroke();
|
2200
|
+
context.closePath();
|
2201
|
+
|
2202
|
+
};
|
2203
|
+
Topology.prototype.createCanvas = function () {
|
2204
|
+
if (document.getElementById('arbitraryCanvas')) return
|
2205
|
+
var canvas = document.createElement('canvas');
|
2206
|
+
canvas.width = 500;
|
2207
|
+
canvas.height = 500;
|
2208
|
+
canvas.style.width = 500 + 'px';
|
2209
|
+
canvas.style.height = 500 + 'px';
|
2210
|
+
canvas.style.zIndex = 1;
|
2211
|
+
canvas.setAttribute('id', 'arbitraryCanvas');
|
2212
|
+
this.parentElem.appendChild(canvas)
|
2213
|
+
};
|
2214
|
+
Topology.prototype.createArbitraryGraph = function () {
|
2215
|
+
|
2216
|
+
let _this = this;
|
2217
|
+
|
2218
|
+
if (_this.addingArbitraryGraph && _this.arbitrarygGraphData.close) {
|
2219
|
+
|
2220
|
+
let rectW = Math.max.apply(Math, _this.arbitrarygGraphData.circles.map((item) => {
|
2221
|
+
return item.x
|
2222
|
+
})) - Math.min.apply(Math, _this.arbitrarygGraphData.circles.map((item) => {
|
2223
|
+
return item.x
|
2224
|
+
}));
|
2225
|
+
|
2226
|
+
let rectH = Math.max.apply(Math, _this.arbitrarygGraphData.circles.map((item) => {
|
2227
|
+
return item.y
|
2228
|
+
})) - Math.min.apply(Math, _this.arbitrarygGraphData.circles.map((item) => {
|
2229
|
+
return item.y
|
2230
|
+
}));
|
2231
|
+
|
2232
|
+
let obj = {
|
2233
|
+
name: 'arbitraryGraph',
|
2234
|
+
rect: {
|
2235
|
+
width: rectW,
|
2236
|
+
height: rectH,
|
2237
|
+
x: _this.mouseDown.x,
|
2238
|
+
y: _this.mouseDown.y,
|
2239
|
+
circles: _this.arbitrarygGraphData.circles,
|
2240
|
+
points: _this.arbitrarygGraphData.points,
|
2241
|
+
}
|
2242
|
+
}
|
2243
|
+
|
2244
|
+
_this.dropNodes(Array.isArray(obj) ? obj : [obj], _this.mouseDown.x, _this.mouseDown.y);
|
2245
|
+
Store.set('addingArbitraryGraph', false);
|
2246
|
+
_this.dispatch('addingArbitraryGraph', false);
|
2247
|
+
_this.arbitrarygGraphData.circles = [];
|
2248
|
+
_this.arbitrarygGraphData.points = [];
|
2249
|
+
_this.arbitrarygGraphData.close = false;
|
2250
|
+
_this.arbitrarygGraphData.oIndex = -1;
|
2251
|
+
}
|
2252
|
+
};
|
2253
|
+
Topology.prototype.checkNodeOfClickType = function (node) {
|
2254
|
+
let isClickTpye = false
|
2255
|
+
const arr = node.events
|
2256
|
+
for (let i = 0; i < arr.length; i++) {
|
2257
|
+
if (arr[i].type === 0 || arr[i].type === 1) {
|
2258
|
+
isClickTpye = true
|
2259
|
+
break
|
2260
|
+
}
|
2261
|
+
}
|
2262
|
+
|
2263
|
+
if (window.location.pathname.includes('workspace') || (isClickTpye === true && !window.location.pathname.includes('workspace'))) {
|
2264
|
+
return false
|
2265
|
+
}
|
2266
|
+
|
2267
|
+
return true
|
2268
|
+
};
|
2269
|
+
return Topology;
|
2270
|
+
}(Common));
|
2271
|
+
|
2272
|
+
function Circle(x, y) {
|
2273
|
+
this.x = x;
|
2274
|
+
this.y = y;
|
2275
|
+
this.radius = 4;
|
2276
|
+
this.color = "#339fff";
|
2277
|
+
this.isSelected = false;
|
2278
|
+
}
|
2279
|
+
|
2280
|
+
export {Topology};
|
2281
|
+
//# sourceMappingURL=core.js.map
|