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
@@ -0,0 +1,944 @@
|
|
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 { Pen, PenType } from './pen';
|
15
|
+
import { Rect } from './rect';
|
16
|
+
import { Point } from './point';
|
17
|
+
import { Line } from './line';
|
18
|
+
import { anchorsFns, iconRectFns, textRectFns, drawNodeFns } from '../middles';
|
19
|
+
import { defaultAnchors } from '../middles/default.anchor';
|
20
|
+
import { defaultIconRect, defaultTextRect } from '../middles/default.rect';
|
21
|
+
import { text, tableText, defaultText, iconfont } from '../middles/nodes/text';
|
22
|
+
import { Store } from 'le5le-store';
|
23
|
+
import { abs, s8, animateType, createChildrenDivByElementId } from '../utils';
|
24
|
+
export var images = {};
|
25
|
+
var Node = /** @class */ (function (_super) {
|
26
|
+
__extends(Node, _super);
|
27
|
+
function Node(json, noChild) {
|
28
|
+
if (noChild === void 0) { noChild = false; }
|
29
|
+
var _this = _super.call(this, json) || this;
|
30
|
+
_this.is3D = false;
|
31
|
+
_this.zRotate = 0;
|
32
|
+
_this.imageRatio = true;
|
33
|
+
_this.anchors = [];
|
34
|
+
_this.rotatedAnchors = [];
|
35
|
+
_this.animateDuration = 0;
|
36
|
+
_this.animateFrames = [];
|
37
|
+
_this.type = PenType.Node;
|
38
|
+
_this.is3D = json.is3D;
|
39
|
+
_this.z = json.z;
|
40
|
+
_this.zRotate = json.zRotate || 0;
|
41
|
+
_this.borderRadius = +json.borderRadius || 0;
|
42
|
+
_this.icon = json.icon;
|
43
|
+
_this.iconFamily = json.iconFamily;
|
44
|
+
_this.iconSize = +json.iconSize;
|
45
|
+
_this.iconColor = json.iconColor;
|
46
|
+
_this.image = json.image;
|
47
|
+
_this.floorImageIndex = json.floorImageIndex || false;
|
48
|
+
_this.formData = json.formData || null;
|
49
|
+
_this.formStyle = json.formStyle || null;
|
50
|
+
_this.formEvents = json.formEvents || [];
|
51
|
+
_this.paginationData = json.paginationData || null;
|
52
|
+
if (json.imgNaturalWidth) {
|
53
|
+
_this.imgNaturalWidth = json.imgNaturalWidth;
|
54
|
+
}
|
55
|
+
if (json.imgNaturalHeight) {
|
56
|
+
_this.imgNaturalHeight = json.imgNaturalHeight;
|
57
|
+
}
|
58
|
+
if (json.imageWidth) {
|
59
|
+
_this.imageWidth = json.imageWidth;
|
60
|
+
}
|
61
|
+
if (json.imageHeight) {
|
62
|
+
_this.imageHeight = json.imageHeight;
|
63
|
+
}
|
64
|
+
_this.imageRatio = json.imageRatio;
|
65
|
+
_this.imageAlign = json.imageAlign || 'center';
|
66
|
+
_this.bkType = json.bkType;
|
67
|
+
_this.gradientFromColor = json.gradientFromColor;
|
68
|
+
_this.gradientToColor = json.gradientToColor;
|
69
|
+
_this.gradientAngle = json.gradientAngle || 0;
|
70
|
+
_this.gradientRadius = json.gradientRadius || 0.01;
|
71
|
+
_this.paddingTop = json.paddingTop || 0;
|
72
|
+
_this.paddingBottom = json.paddingBottom || 0;
|
73
|
+
_this.paddingLeft = json.paddingLeft || 0;
|
74
|
+
_this.paddingRight = json.paddingRight || 0;
|
75
|
+
_this.onlySizeX = json.onlySizeX;
|
76
|
+
_this.onlySizeY = json.onlySizeY;
|
77
|
+
_this.appearance = json.appearance;
|
78
|
+
_this.leakageStart = json.leakageStart || 0;
|
79
|
+
_this.leakageEnd = json.leakageEnd || 0;
|
80
|
+
_this.leakageFillStyle = json.leakageFillStyle || '#ff0000';
|
81
|
+
_this.bindStaticId = json.bindStaticId || '';
|
82
|
+
_this.buttonCheckSlide = json.buttonCheckSlide || '';
|
83
|
+
_this.activeImgeIndex = json.activeImgeIndex || false;
|
84
|
+
_this.thBottomStrokeStyle = json.thBottomStrokeStyle || '#fff';
|
85
|
+
_this.thBottomLineWidth = json.thBottomLineWidth || 1;
|
86
|
+
// 兼容老数据
|
87
|
+
if (json.children && json.children[0] && json.children[0].parentRect) {
|
88
|
+
_this.paddingLeft = json.children[0].parentRect.offsetX;
|
89
|
+
_this.paddingRight = 0;
|
90
|
+
_this.paddingTop = json.children[0].parentRect.offsetY;
|
91
|
+
_this.paddingBottom = 0;
|
92
|
+
}
|
93
|
+
if (json.parentRect) {
|
94
|
+
_this.rectInParent = {
|
95
|
+
x: json.parentRect.x * 100 + '%',
|
96
|
+
y: json.parentRect.y * 100 + '%',
|
97
|
+
width: json.parentRect.width * 100 + '%',
|
98
|
+
height: json.parentRect.height * 100 + '%',
|
99
|
+
marginTop: 0,
|
100
|
+
marginRight: 0,
|
101
|
+
marginBottom: 0,
|
102
|
+
marginLeft: 0,
|
103
|
+
rotate: json.parentRect.rotate,
|
104
|
+
};
|
105
|
+
_this.paddingTop = json.parentRect.marginY;
|
106
|
+
_this.paddingBottom = json.parentRect.marginY;
|
107
|
+
_this.paddingLeft = json.parentRect.marginX;
|
108
|
+
_this.paddingRight = json.parentRect.marginX;
|
109
|
+
}
|
110
|
+
// 兼容老数据 end
|
111
|
+
if (json.animateFrames) {
|
112
|
+
_this.animateFrames = json.animateFrames;
|
113
|
+
for (var _i = 0, _a = _this.animateFrames; _i < _a.length; _i++) {
|
114
|
+
var item = _a[_i];
|
115
|
+
if (!item.state.init) {
|
116
|
+
item.state = new Node(item.state, true);
|
117
|
+
}
|
118
|
+
}
|
119
|
+
}
|
120
|
+
if (json.animateDuration) {
|
121
|
+
_this.animateDuration = json.animateDuration;
|
122
|
+
}
|
123
|
+
_this.animateType = json.animateType
|
124
|
+
? json.animateType
|
125
|
+
: json.animateDuration
|
126
|
+
? 'custom'
|
127
|
+
: '';
|
128
|
+
_this.animateAlone = json.animateAlone;
|
129
|
+
_this.iframe = json.iframe;
|
130
|
+
_this.elementId = json.elementId;
|
131
|
+
_this.audio = json.audio;
|
132
|
+
_this.video = json.video;
|
133
|
+
_this.play = json.play;
|
134
|
+
_this.nextPlay = json.nextPlay;
|
135
|
+
if (json.elementLoaded !== undefined) {
|
136
|
+
_this.elementId = null;
|
137
|
+
_this.elementLoaded = false;
|
138
|
+
}
|
139
|
+
if(this.name == 'arbitraryGraph') {
|
140
|
+
this.rect.circles = json.rect.circles;
|
141
|
+
//let {x, y} = this.centroid(json.rect.circles);
|
142
|
+
let minX = Math.min.apply(Math, json.rect.circles.map((item)=>{ return item.x}));
|
143
|
+
let minY = Math.min.apply(Math, json.rect.circles.map((item)=>{ return item.y}));
|
144
|
+
this.rect.x = minX;
|
145
|
+
this.rect.y = minY;
|
146
|
+
this.rect.ex = this.rect.x + this.rect.width;
|
147
|
+
this.rect.ey = this.rect.y + this.rect.height;
|
148
|
+
// this.rect.center.x = x;
|
149
|
+
// this.rect.center.y = y;
|
150
|
+
// console.log('this.rect', this.rect);
|
151
|
+
// console.log('this---node---', this);
|
152
|
+
}
|
153
|
+
if(json.name === 'formTable') _this.setFormTableData(json);
|
154
|
+
if(json.name === 'tablePagination') _this.setTablePagination(json);
|
155
|
+
_this.init();
|
156
|
+
if (!noChild) {
|
157
|
+
_this.setChild(json.children);
|
158
|
+
}
|
159
|
+
else {
|
160
|
+
_this.children = null;
|
161
|
+
}
|
162
|
+
|
163
|
+
return _this;
|
164
|
+
}
|
165
|
+
Node.cloneState = function (json) {
|
166
|
+
var n = new Node(json);
|
167
|
+
delete n.animateFrames;
|
168
|
+
return n;
|
169
|
+
};
|
170
|
+
Node.prototype.init = function () {
|
171
|
+
this.calcAbsPadding();
|
172
|
+
// Calc rect of text.
|
173
|
+
if (textRectFns[this.name]) {
|
174
|
+
textRectFns[this.name](this);
|
175
|
+
}
|
176
|
+
else {
|
177
|
+
defaultTextRect(this);
|
178
|
+
}
|
179
|
+
// Calc rect of icon.
|
180
|
+
if (iconRectFns[this.name]) {
|
181
|
+
iconRectFns[this.name](this);
|
182
|
+
}
|
183
|
+
else {
|
184
|
+
defaultIconRect(this);
|
185
|
+
}
|
186
|
+
this.calcAnchors();
|
187
|
+
this.elementRendered = false;
|
188
|
+
this.addToDiv();
|
189
|
+
};
|
190
|
+
Node.prototype.setFormTableData = function (json) {
|
191
|
+
if(!Store.get('FORM:tableData')){
|
192
|
+
Store.set('FORM:tableData', {
|
193
|
+
data: {
|
194
|
+
tableNodes: {},
|
195
|
+
paginationNodes: {},
|
196
|
+
pageRelevTableNodes: {}
|
197
|
+
}
|
198
|
+
})
|
199
|
+
}
|
200
|
+
const tableData = Store.get('FORM:tableData').data;
|
201
|
+
tableData.tableNodes[json.id] = json
|
202
|
+
Store.set('FORM:tableData', {
|
203
|
+
data: tableData
|
204
|
+
})
|
205
|
+
const fromData = Store.get('SYNC:tableData');
|
206
|
+
if(fromData) {
|
207
|
+
if(!fromData[json.id].loading){
|
208
|
+
this.formData.tableBody = fromData[json.id].tableBody;
|
209
|
+
this.formData.total = fromData[json.id].total;
|
210
|
+
}else {
|
211
|
+
this.formData.tableBody = null;
|
212
|
+
this.formData.total = 0;
|
213
|
+
}
|
214
|
+
}
|
215
|
+
};
|
216
|
+
Node.prototype.setTablePagination = function (json) {
|
217
|
+
if(!Store.get('FORM:tableData')){
|
218
|
+
Store.set('FORM:tableData', {
|
219
|
+
data: {
|
220
|
+
tableNodes: {},
|
221
|
+
paginationNodes: {},
|
222
|
+
pageRelevTableNodes: {}
|
223
|
+
}
|
224
|
+
})
|
225
|
+
}
|
226
|
+
const tableData = Store.get('FORM:tableData').data;
|
227
|
+
const fromData = Store.get('SYNC:tableData');
|
228
|
+
const tnode = fromData ? fromData[json.paginationData.bindFromTableId] : null;
|
229
|
+
if(tnode) json.paginationData.total = tnode.total;
|
230
|
+
tableData.paginationNodes[json.id] = json;
|
231
|
+
Store.set('FORM:tableData', {
|
232
|
+
data: tableData
|
233
|
+
})
|
234
|
+
};
|
235
|
+
Node.prototype.addToDiv = function (type) {
|
236
|
+
if (this.audio ||
|
237
|
+
this.video ||
|
238
|
+
this.iframe ||
|
239
|
+
this.elementId ||
|
240
|
+
this.hasGif()) {
|
241
|
+
if(type) {
|
242
|
+
// 复合Echarts初始化
|
243
|
+
createChildrenDivByElementId(this);
|
244
|
+
}else {
|
245
|
+
Store.set(this.generateStoreKey('LT:addDiv'), this);
|
246
|
+
}
|
247
|
+
}
|
248
|
+
};
|
249
|
+
Node.prototype.hasGif = function () {
|
250
|
+
if (this.gif) {
|
251
|
+
return true;
|
252
|
+
}
|
253
|
+
if (this.children) {
|
254
|
+
for (var _i = 0, _a = this.children; _i < _a.length; _i++) {
|
255
|
+
var item = _a[_i];
|
256
|
+
if (item.type === PenType.Node && item.hasGif()) {
|
257
|
+
return true;
|
258
|
+
}
|
259
|
+
}
|
260
|
+
}
|
261
|
+
return false;
|
262
|
+
};
|
263
|
+
Node.prototype.calcAbsPadding = function () {
|
264
|
+
this.paddingLeftNum = abs(this.rect.width, this.paddingLeft);
|
265
|
+
this.paddingRightNum = abs(this.rect.width, this.paddingRight);
|
266
|
+
this.paddingTopNum = abs(this.rect.height, this.paddingTop);
|
267
|
+
this.paddingBottomNum = abs(this.rect.height, this.paddingBottom);
|
268
|
+
};
|
269
|
+
Node.prototype.setChild = function (children) {
|
270
|
+
if (!children) {
|
271
|
+
return;
|
272
|
+
}
|
273
|
+
this.children = [];
|
274
|
+
for (var _i = 0, children_1 = children; _i < children_1.length; _i++) {
|
275
|
+
var item = children_1[_i];
|
276
|
+
var child = void 0;
|
277
|
+
switch (item.type) {
|
278
|
+
case PenType.Line:
|
279
|
+
child = new Line(item);
|
280
|
+
child.calcRectByParent(this);
|
281
|
+
break;
|
282
|
+
default:
|
283
|
+
child = new Node(item);
|
284
|
+
child.parentId = this.id;
|
285
|
+
child.calcRectByParent(this);
|
286
|
+
child.init();
|
287
|
+
child.setChild(item.children);
|
288
|
+
break;
|
289
|
+
}
|
290
|
+
this.children.push(child);
|
291
|
+
}
|
292
|
+
};
|
293
|
+
Node.prototype.clearChildrenIds = function () {
|
294
|
+
if (!this.children) {
|
295
|
+
return;
|
296
|
+
}
|
297
|
+
for (var _i = 0, _a = this.children; _i < _a.length; _i++) {
|
298
|
+
var item = _a[_i];
|
299
|
+
item.id = s8();
|
300
|
+
switch (item.type) {
|
301
|
+
case PenType.Node:
|
302
|
+
item.clearChildrenIds();
|
303
|
+
break;
|
304
|
+
}
|
305
|
+
}
|
306
|
+
};
|
307
|
+
Node.prototype.draw = function (ctx) {
|
308
|
+
if (!drawNodeFns[this.name]) {
|
309
|
+
return;
|
310
|
+
}
|
311
|
+
// DrawBk
|
312
|
+
switch (this.bkType) {
|
313
|
+
case 1:
|
314
|
+
this.drawBkLinearGradient(ctx);
|
315
|
+
break;
|
316
|
+
case 2:
|
317
|
+
this.drawBkRadialGradient(ctx);
|
318
|
+
break;
|
319
|
+
}
|
320
|
+
if(this.name === 'tablePagination') defaultText(ctx, this);
|
321
|
+
// Draw shape.
|
322
|
+
drawNodeFns[this.name](ctx, this);
|
323
|
+
// Draw text.
|
324
|
+
if(this.name === 'formTable') {
|
325
|
+
tableText(ctx, this);
|
326
|
+
}else {
|
327
|
+
if (this.name !== 'text' && this.text && !(this.image && this.floorImageIndex === true)) {
|
328
|
+
text(ctx, this);
|
329
|
+
}
|
330
|
+
}
|
331
|
+
// Draw image.
|
332
|
+
if (this.image) {
|
333
|
+
this.drawImg(ctx);
|
334
|
+
if (this.name !== 'text' && this.text && this.floorImageIndex === true) {
|
335
|
+
text(ctx, this);
|
336
|
+
}
|
337
|
+
return;
|
338
|
+
}
|
339
|
+
// Draw icon
|
340
|
+
if (this.icon) {
|
341
|
+
ctx.save();
|
342
|
+
ctx.shadowColor = '';
|
343
|
+
ctx.shadowBlur = 0;
|
344
|
+
iconfont(ctx, this);
|
345
|
+
ctx.restore();
|
346
|
+
}
|
347
|
+
|
348
|
+
};
|
349
|
+
Node.prototype.drawBkLinearGradient = function (ctx) {
|
350
|
+
var from = new Point(this.rect.x, this.rect.center.y);
|
351
|
+
var to = new Point(this.rect.ex, this.rect.center.y);
|
352
|
+
if (this.gradientAngle % 90 === 0 && this.gradientAngle % 180) {
|
353
|
+
if (this.gradientAngle % 270) {
|
354
|
+
from.x = this.rect.center.x;
|
355
|
+
from.y = this.rect.y;
|
356
|
+
to.x = this.rect.center.x;
|
357
|
+
to.y = this.rect.ey;
|
358
|
+
}
|
359
|
+
else {
|
360
|
+
from.x = this.rect.center.x;
|
361
|
+
from.y = this.rect.ey;
|
362
|
+
to.x = this.rect.center.x;
|
363
|
+
to.y = this.rect.y;
|
364
|
+
}
|
365
|
+
}
|
366
|
+
else if (this.gradientAngle) {
|
367
|
+
from.rotate(this.gradientAngle, this.rect.center);
|
368
|
+
to.rotate(this.gradientAngle, this.rect.center);
|
369
|
+
}
|
370
|
+
// contributor: https://github.com/sunnyguohua/topology
|
371
|
+
var grd = ctx.createLinearGradient(from.x, from.y, to.x, to.y);
|
372
|
+
grd.addColorStop(0, this.gradientFromColor);
|
373
|
+
grd.addColorStop(1, this.gradientToColor);
|
374
|
+
ctx.fillStyle = grd;
|
375
|
+
};
|
376
|
+
Node.prototype.drawBkRadialGradient = function (ctx) {
|
377
|
+
var r = this.rect.width;
|
378
|
+
if (r < this.rect.height) {
|
379
|
+
r = this.rect.height;
|
380
|
+
}
|
381
|
+
r *= 0.5;
|
382
|
+
var grd = ctx.createRadialGradient(this.rect.center.x, this.rect.center.y, r * this.gradientRadius, this.rect.center.x, this.rect.center.y, r);
|
383
|
+
grd.addColorStop(0, this.gradientFromColor);
|
384
|
+
grd.addColorStop(1, this.gradientToColor);
|
385
|
+
ctx.fillStyle = grd;
|
386
|
+
};
|
387
|
+
Node.prototype.drawImg = function (ctx) {
|
388
|
+
var _this = this;
|
389
|
+
if (this.lastImage !== this.image) {
|
390
|
+
this.img = null;
|
391
|
+
}
|
392
|
+
var gif = this.image.indexOf('.gif') > 0;
|
393
|
+
if (!gif && this.img) {
|
394
|
+
this.initDrawImg(ctx);
|
395
|
+
return;
|
396
|
+
}
|
397
|
+
//Load image and draw it.
|
398
|
+
if (!gif && images[this.image]) {
|
399
|
+
this.img = images[this.image].img;
|
400
|
+
++images[this.image].cnt;
|
401
|
+
this.lastImage = this.img
|
402
|
+
this.imgNaturalWidth = this.img.naturalWidth;
|
403
|
+
this.imgNaturalHeight = this.img.naturalHeight;
|
404
|
+
this.initDrawImg(ctx);
|
405
|
+
//this.drawImg(ctx);
|
406
|
+
return;
|
407
|
+
}
|
408
|
+
var img = new Image();
|
409
|
+
img.crossOrigin = 'anonymous';
|
410
|
+
img.src = this.image;
|
411
|
+
img.onload = function (e) {
|
412
|
+
_this.lastImage = _this.image;
|
413
|
+
_this.imgNaturalWidth = img.naturalWidth;
|
414
|
+
_this.imgNaturalHeight = img.naturalHeight;
|
415
|
+
_this.img = img;
|
416
|
+
images[_this.image] = {
|
417
|
+
img: img,
|
418
|
+
cnt: 1,
|
419
|
+
};
|
420
|
+
Store.set(_this.generateStoreKey('LT:imageLoaded'), true);
|
421
|
+
if (!_this.gif && gif) {
|
422
|
+
_this.gif = true;
|
423
|
+
Store.set(_this.generateStoreKey('LT:addDiv'), _this);
|
424
|
+
}
|
425
|
+
};
|
426
|
+
};
|
427
|
+
Node.prototype.initDrawImg = function (ctx){
|
428
|
+
var _this = this;
|
429
|
+
ctx.save();
|
430
|
+
ctx.shadowColor = '';
|
431
|
+
ctx.shadowBlur = 0;
|
432
|
+
var rect = this.getIconRect();
|
433
|
+
var x = rect.x;
|
434
|
+
var y = rect.y;
|
435
|
+
var w = rect.width;
|
436
|
+
var h = rect.height;
|
437
|
+
if (this.imageWidth) {
|
438
|
+
w = this.imageWidth;
|
439
|
+
}
|
440
|
+
if (this.imageHeight) {
|
441
|
+
h = this.imageHeight;
|
442
|
+
}
|
443
|
+
if (this.imageRatio) {
|
444
|
+
if (this.imageWidth) {
|
445
|
+
h = (this.imgNaturalHeight / this.imgNaturalWidth) * w;
|
446
|
+
}
|
447
|
+
else {
|
448
|
+
w = (this.imgNaturalWidth / this.imgNaturalHeight) * h;
|
449
|
+
}
|
450
|
+
}
|
451
|
+
if (this.name !== 'image') {
|
452
|
+
x += (rect.width - w) / 2;
|
453
|
+
y += (rect.height - h) / 2;
|
454
|
+
}
|
455
|
+
switch (this.imageAlign) {
|
456
|
+
case 'top':
|
457
|
+
y = rect.y;
|
458
|
+
break;
|
459
|
+
case 'bottom':
|
460
|
+
y = rect.ey - h;
|
461
|
+
break;
|
462
|
+
case 'left':
|
463
|
+
x = rect.x;
|
464
|
+
break;
|
465
|
+
case 'right':
|
466
|
+
x = rect.ex - w;
|
467
|
+
break;
|
468
|
+
case 'left-top':
|
469
|
+
x = rect.x;
|
470
|
+
y = rect.y;
|
471
|
+
break;
|
472
|
+
case 'right-top':
|
473
|
+
x = rect.ex - w;
|
474
|
+
y = rect.y;
|
475
|
+
break;
|
476
|
+
case 'left-bottom':
|
477
|
+
x = rect.x;
|
478
|
+
y = rect.ey - h;
|
479
|
+
break;
|
480
|
+
case 'right-bottom':
|
481
|
+
x = rect.ex - w;
|
482
|
+
y = rect.ey - h;
|
483
|
+
break;
|
484
|
+
}
|
485
|
+
if(!_this.activeImgeIndex) ctx.drawImage(this.img, x, y, w, h);
|
486
|
+
ctx.restore();
|
487
|
+
};
|
488
|
+
Node.prototype.calcAnchors = function () {
|
489
|
+
this.anchors = [];
|
490
|
+
if (anchorsFns[this.name]) {
|
491
|
+
anchorsFns[this.name](this);
|
492
|
+
}
|
493
|
+
else {
|
494
|
+
defaultAnchors(this);
|
495
|
+
}
|
496
|
+
this.calcRotateAnchors();
|
497
|
+
};
|
498
|
+
Node.prototype.calcRotateAnchors = function (angle) {
|
499
|
+
if (angle === undefined) {
|
500
|
+
angle = this.rotate;
|
501
|
+
}
|
502
|
+
this.rotatedAnchors = [];
|
503
|
+
for (var _i = 0, _a = this.anchors; _i < _a.length; _i++) {
|
504
|
+
var item = _a[_i];
|
505
|
+
this.rotatedAnchors.push(item.clone().rotate(angle, this.rect.center));
|
506
|
+
}
|
507
|
+
};
|
508
|
+
Node.prototype.getTextRect = function () {
|
509
|
+
var textRect = this.textRect;
|
510
|
+
if ((!this.icon && !this.image) || this.floorImageIndex === true) {
|
511
|
+
textRect = this.fullTextRect;
|
512
|
+
}
|
513
|
+
return textRect;
|
514
|
+
};
|
515
|
+
Node.prototype.getIconRect = function () {
|
516
|
+
var rect = this.iconRect;
|
517
|
+
if (!this.text || this.floorImageIndex === true) {
|
518
|
+
rect = this.fullIconRect || this.fullTextRect || this.rect;
|
519
|
+
}
|
520
|
+
return rect;
|
521
|
+
};
|
522
|
+
// 根据父节点rect计算自己(子节点)的rect
|
523
|
+
Node.prototype.calcRectByParent = function (parent) {
|
524
|
+
if (!this.rectInParent) {
|
525
|
+
return;
|
526
|
+
}
|
527
|
+
var parentW = parent.rect.width - parent.paddingLeftNum - parent.paddingRightNum;
|
528
|
+
var parentH = parent.rect.height - parent.paddingTopNum - parent.paddingBottomNum;
|
529
|
+
var x = parent.rect.x +
|
530
|
+
parent.paddingLeftNum +
|
531
|
+
abs(parentW, this.rectInParent.x) +
|
532
|
+
abs(parentW, this.rectInParent.marginLeft);
|
533
|
+
var y = parent.rect.y +
|
534
|
+
parent.paddingTopNum +
|
535
|
+
abs(parentH, this.rectInParent.y) +
|
536
|
+
abs(parentW, this.rectInParent.marginTop);
|
537
|
+
var w = abs(parentW, this.rectInParent.width);
|
538
|
+
var h = abs(parentH, this.rectInParent.height);
|
539
|
+
if (this.rectInParent.marginLeft === undefined &&
|
540
|
+
this.rectInParent.marginRight) {
|
541
|
+
x -= abs(parentW, this.rectInParent.marginRight);
|
542
|
+
}
|
543
|
+
if (this.rectInParent.marginTop === undefined &&
|
544
|
+
this.rectInParent.marginBottom) {
|
545
|
+
y -= abs(parentW, this.rectInParent.marginBottom);
|
546
|
+
}
|
547
|
+
this.rect = new Rect(x, y, w, h);
|
548
|
+
if (!this.rectInParent.rotate) {
|
549
|
+
this.rectInParent.rotate = 0;
|
550
|
+
}
|
551
|
+
var offsetR = parent.rotate + parent.offsetRotate;
|
552
|
+
this.rotate = this.rectInParent.rotate + offsetR;
|
553
|
+
if (!this.rectInParent.rect) {
|
554
|
+
this.rectInParent.rect = this.rect.clone();
|
555
|
+
}
|
556
|
+
};
|
557
|
+
Node.prototype.calcChildrenRect = function () {
|
558
|
+
if (!this.children) {
|
559
|
+
return;
|
560
|
+
}
|
561
|
+
for (var _i = 0, _a = this.children; _i < _a.length; _i++) {
|
562
|
+
var item = _a[_i];
|
563
|
+
item.calcRectByParent(this);
|
564
|
+
if (item.type === PenType.Node) {
|
565
|
+
item.init();
|
566
|
+
item.calcChildrenRect();
|
567
|
+
}
|
568
|
+
}
|
569
|
+
};
|
570
|
+
Node.prototype.calcRectInParent = function (parent) {
|
571
|
+
var parentW = parent.rect.width - parent.paddingLeftNum - parent.paddingRightNum;
|
572
|
+
var parentH = parent.rect.height - parent.paddingTopNum - parent.paddingBottomNum;
|
573
|
+
this.rectInParent = {
|
574
|
+
x: ((this.rect.x - parent.rect.x - parent.paddingLeftNum) * 100) /
|
575
|
+
parentW +
|
576
|
+
'%',
|
577
|
+
y: ((this.rect.y - parent.rect.y - parent.paddingTopNum) * 100) / parentH +
|
578
|
+
'%',
|
579
|
+
width: (this.rect.width * 100) / parentW + '%',
|
580
|
+
height: (this.rect.height * 100) / parentH + '%',
|
581
|
+
rotate: this.rectInParent
|
582
|
+
? this.rectInParent.rotate || 0
|
583
|
+
: this.rotate || 0,
|
584
|
+
rect: this.rect.clone(),
|
585
|
+
};
|
586
|
+
};
|
587
|
+
Node.prototype.getDockWatchers = function () {
|
588
|
+
this.dockWatchers = this.rect.toPoints();
|
589
|
+
this.dockWatchers.unshift(this.rect.center);
|
590
|
+
};
|
591
|
+
Node.prototype.initAnimateProps = function () {
|
592
|
+
var passed = 0;
|
593
|
+
for (var i = 0; i < this.animateFrames.length; ++i) {
|
594
|
+
this.animateFrames[i].start = passed;
|
595
|
+
passed += this.animateFrames[i].duration;
|
596
|
+
this.animateFrames[i].end = passed;
|
597
|
+
this.animateFrames[i].initState = Node.cloneState(i ? this.animateFrames[i - 1].state : this);
|
598
|
+
}
|
599
|
+
};
|
600
|
+
Node.prototype.animate = function (now) {
|
601
|
+
var timeline = now - this.animateStart;
|
602
|
+
if (timeline > this.animateDuration) {
|
603
|
+
if (++this.animateCycleIndex >= this.animateCycle &&
|
604
|
+
this.animateCycle > 0) {
|
605
|
+
this.animateStart = 0;
|
606
|
+
this.animateCycleIndex = 0;
|
607
|
+
var item = this.animateFrames[this.animateFrames.length - 1];
|
608
|
+
if (item) {
|
609
|
+
this.dash = item.state.dash;
|
610
|
+
this.strokeStyle = item.state.strokeStyle;
|
611
|
+
this.fillStyle = item.state.fillStyle;
|
612
|
+
this.text = item.state.text;
|
613
|
+
this.font = item.state.font;
|
614
|
+
this.lineWidth = item.state.lineWidth;
|
615
|
+
this.rotate = item.state.rotate;
|
616
|
+
this.globalAlpha = item.state.globalAlpha;
|
617
|
+
this.lineDashOffset = item.state.lineDashOffset || 0;
|
618
|
+
if (item.state.rect && item.state.rect.width) {
|
619
|
+
this.rect = new Rect(item.state.rect.x, item.state.rect.y, item.state.rect.width, item.state.rect.height);
|
620
|
+
this.init();
|
621
|
+
}
|
622
|
+
}
|
623
|
+
Store.set(this.generateStoreKey('animateEnd'), {
|
624
|
+
type: 'node',
|
625
|
+
data: this,
|
626
|
+
});
|
627
|
+
return;
|
628
|
+
}
|
629
|
+
this.animateStart = now;
|
630
|
+
timeline = 0;
|
631
|
+
}
|
632
|
+
var rectChanged = false;
|
633
|
+
for (var i = 0; i < this.animateFrames.length; ++i) {
|
634
|
+
var item = this.animateFrames[i];
|
635
|
+
if (timeline >= item.start && timeline < item.end) {
|
636
|
+
this.dash = item.state.dash;
|
637
|
+
this.strokeStyle = item.state.strokeStyle;
|
638
|
+
this.fillStyle = item.state.fillStyle;
|
639
|
+
this.text = item.state.text;
|
640
|
+
this.font = item.state.font;
|
641
|
+
var rate = (timeline - item.start) / item.duration;
|
642
|
+
if (item.linear) {
|
643
|
+
// 线条左右流动动画
|
644
|
+
if([animateType.LeftFlow, animateType.RightFlow].includes(this.animateType) && item.state.lineDashOffset){
|
645
|
+
const lineDashOffset = item.state.lineDashOffset;
|
646
|
+
if (lineDashOffset > 100) item.state.lineDashOffset = 1;
|
647
|
+
if (lineDashOffset < -100) item.state.lineDashOffset = -1;
|
648
|
+
lineDashOffset > 0 ? item.state.lineDashOffset++ : item.state.lineDashOffset--;
|
649
|
+
this.lineDashOffset = item.state.lineDashOffset;
|
650
|
+
}else if(([animateType.Show, animateType.Rotate].includes(this.animateType) || this.name === 'electricFan') && item.state.rotate !== item.initState.rotate) {
|
651
|
+
// 旋转动画,判断逻辑先这么写,日后将所有动画统一在编辑器中配置,再做优化
|
652
|
+
this.rotate =
|
653
|
+
item.initState.rotate +
|
654
|
+
(item.state.rotate - item.initState.rotate) * rate;
|
655
|
+
rectChanged = true;
|
656
|
+
}else {
|
657
|
+
|
658
|
+
if (item.state.rect.x !== item.initState.rect.x) {
|
659
|
+
this.rect.x =
|
660
|
+
item.initState.rect.x +
|
661
|
+
(item.state.rect.x - item.initState.rect.x) * rate;
|
662
|
+
rectChanged = true;
|
663
|
+
}
|
664
|
+
if (item.state.rect.y !== item.initState.rect.y) {
|
665
|
+
this.rect.y =
|
666
|
+
item.initState.rect.y +
|
667
|
+
(item.state.rect.y - item.initState.rect.y) * rate;
|
668
|
+
rectChanged = true;
|
669
|
+
}
|
670
|
+
if (item.state.rect.width !== item.initState.rect.width) {
|
671
|
+
this.rect.width =
|
672
|
+
item.initState.rect.width +
|
673
|
+
(item.state.rect.width - item.initState.rect.width) * rate;
|
674
|
+
rectChanged = true;
|
675
|
+
}
|
676
|
+
if (item.state.rect.height !== item.initState.rect.height) {
|
677
|
+
this.rect.height =
|
678
|
+
item.initState.rect.height +
|
679
|
+
(item.state.rect.height - item.initState.rect.height) * rate;
|
680
|
+
rectChanged = true;
|
681
|
+
}
|
682
|
+
this.rect.ex = this.rect.x + this.rect.width;
|
683
|
+
this.rect.ey = this.rect.y + this.rect.height;
|
684
|
+
this.rect.calcCenter();
|
685
|
+
if (item.initState.z !== undefined &&
|
686
|
+
item.state.z !== item.initState.z) {
|
687
|
+
this.z =
|
688
|
+
item.initState.z + (item.state.z - item.initState.z) * rate;
|
689
|
+
rectChanged = true;
|
690
|
+
}
|
691
|
+
if (item.state.borderRadius !== item.initState.borderRadius) {
|
692
|
+
this.borderRadius =
|
693
|
+
item.initState.borderRadius +
|
694
|
+
(item.state.borderRadius - item.initState.borderRadius) * rate;
|
695
|
+
}
|
696
|
+
if (item.state.lineWidth !== item.initState.lineWidth) {
|
697
|
+
this.lineWidth =
|
698
|
+
item.initState.lineWidth +
|
699
|
+
(item.state.lineWidth - item.initState.lineWidth) * rate;
|
700
|
+
}
|
701
|
+
if (item.state.globalAlpha !== item.initState.globalAlpha) {
|
702
|
+
this.globalAlpha =
|
703
|
+
item.initState.globalAlpha +
|
704
|
+
(item.state.globalAlpha - item.initState.globalAlpha) * rate;
|
705
|
+
}
|
706
|
+
}
|
707
|
+
}
|
708
|
+
else {
|
709
|
+
this.rect = item.state.rect;
|
710
|
+
this.lineWidth = item.state.lineWidth;
|
711
|
+
this.rotate = item.state.rotate;
|
712
|
+
this.globalAlpha = item.state.globalAlpha;
|
713
|
+
this.lineDashOffset = item.state.lineDashOffset;
|
714
|
+
}
|
715
|
+
}
|
716
|
+
}
|
717
|
+
// if (rectChanged) {
|
718
|
+
// this.init();
|
719
|
+
// if (!this.animateAlone) {
|
720
|
+
// Store.set(this.generateStoreKey('LT:rectChanged'), this);
|
721
|
+
// }
|
722
|
+
// }
|
723
|
+
};
|
724
|
+
Node.prototype.scale = function (scale, center, w, h) {
|
725
|
+
if (!center) {
|
726
|
+
center = this.rect.center;
|
727
|
+
}
|
728
|
+
if (!w) {
|
729
|
+
w = scale;
|
730
|
+
}
|
731
|
+
if (!h) {
|
732
|
+
h = scale;
|
733
|
+
}
|
734
|
+
this['oldRect'] = this.rect.clone();
|
735
|
+
if(this.rect.circles) {
|
736
|
+
for(let c=0, circles= this.rect.circles; c<circles.length; c++) {
|
737
|
+
circles[c].x = (center.x - (center.x - circles[c].x)) * w;
|
738
|
+
circles[c].y = (center.y - (center.y - circles[c].y)) * h + 15;
|
739
|
+
}
|
740
|
+
}else {
|
741
|
+
this.rect.x = center.x - (center.x - this.rect.x) * w;
|
742
|
+
if(this.rotate % 180) {
|
743
|
+
this.rect.x = this.rect.x + (this.rect.width * w - this.rect.width * h) / 2;
|
744
|
+
}
|
745
|
+
this.rect.y = center.y - (center.y - this.rect.y) * h;
|
746
|
+
}
|
747
|
+
this.z *= scale;
|
748
|
+
this.rect.width *= this.rotate % 180 ? h : w;
|
749
|
+
this.rect.height *= h;
|
750
|
+
this.rect.ex = this.rect.x + this.rect.width;
|
751
|
+
this.rect.ey = this.rect.y + this.rect.height;
|
752
|
+
if (this.imageWidth) {
|
753
|
+
this.imageWidth *= w;
|
754
|
+
}
|
755
|
+
if (this.imageHeight) {
|
756
|
+
this.imageHeight *= h;
|
757
|
+
}
|
758
|
+
this.lastImage = null;
|
759
|
+
this.font.fontSize *= scale;
|
760
|
+
this.iconSize *= scale;
|
761
|
+
if (typeof this.paddingLeft === 'number') {
|
762
|
+
this.paddingLeft *= scale;
|
763
|
+
}
|
764
|
+
if (typeof this.paddingTop === 'number') {
|
765
|
+
this.paddingTop *= scale;
|
766
|
+
}
|
767
|
+
if (typeof this.paddingRight === 'number') {
|
768
|
+
this.paddingRight *= scale;
|
769
|
+
}
|
770
|
+
if (typeof this.paddingBottom === 'number') {
|
771
|
+
this.paddingBottom *= scale;
|
772
|
+
}
|
773
|
+
if (this.rectInParent) {
|
774
|
+
if (typeof this.rectInParent.x === 'number') {
|
775
|
+
this.rectInParent.x *= scale;
|
776
|
+
}
|
777
|
+
if (typeof this.rectInParent.y === 'number') {
|
778
|
+
this.rectInParent.y *= scale;
|
779
|
+
}
|
780
|
+
if (typeof this.rectInParent.width === 'number') {
|
781
|
+
this.rectInParent.width *= scale;
|
782
|
+
}
|
783
|
+
if (typeof this.rectInParent.height === 'number') {
|
784
|
+
this.rectInParent.height *= scale;
|
785
|
+
}
|
786
|
+
if (typeof this.rectInParent.marginLeft === 'number') {
|
787
|
+
this.rectInParent.marginLeft *= scale;
|
788
|
+
}
|
789
|
+
if (typeof this.rectInParent.marginTop === 'number') {
|
790
|
+
this.rectInParent.marginTop *= scale;
|
791
|
+
}
|
792
|
+
if (typeof this.rectInParent.marginRight === 'number') {
|
793
|
+
this.rectInParent.marginRight *= scale;
|
794
|
+
}
|
795
|
+
if (typeof this.rectInParent.marginBottom === 'number') {
|
796
|
+
this.rectInParent.marginBottom *= scale;
|
797
|
+
}
|
798
|
+
}
|
799
|
+
this.rect.calcCenter();
|
800
|
+
if (this.animateFrames && this.animateFrames.length) {
|
801
|
+
for (var _i = 0, _a = this.animateFrames; _i < _a.length; _i++) {
|
802
|
+
var item = _a[_i];
|
803
|
+
if (item.initState) {
|
804
|
+
if (!item.initState.scale) {
|
805
|
+
item.initState = new Node(item.initState);
|
806
|
+
}
|
807
|
+
item.initState.scale(scale, center, w, h);
|
808
|
+
}
|
809
|
+
if (item.state) {
|
810
|
+
if (!item.state.scale) {
|
811
|
+
item.state = new Node(item.state);
|
812
|
+
}
|
813
|
+
item.state.scale(scale, center, w, h);
|
814
|
+
}
|
815
|
+
if (item.initState && item.state) {
|
816
|
+
item.state.fontSize = item.initState.fontSize;
|
817
|
+
}
|
818
|
+
}
|
819
|
+
}
|
820
|
+
this.scalePoints(scale, scale);
|
821
|
+
this.elementRendered = false;
|
822
|
+
this.init();
|
823
|
+
if (this.children) {
|
824
|
+
for (var _b = 0, _c = this.children; _b < _c.length; _b++) {
|
825
|
+
var item = _c[_b];
|
826
|
+
item.scale(scale, center, w, h);
|
827
|
+
}
|
828
|
+
}
|
829
|
+
};
|
830
|
+
Node.prototype.scalePoints = function (scaleX, scaleY) {
|
831
|
+
var _this = this;
|
832
|
+
if ((this.points || this.manualAnchors) && this['oldRect']) {
|
833
|
+
if (!scaleX) {
|
834
|
+
scaleX = this.rect.width / this['oldRect'].width;
|
835
|
+
}
|
836
|
+
if (!scaleY) {
|
837
|
+
scaleY = this.rect.height / this['oldRect'].height;
|
838
|
+
}
|
839
|
+
if (this.points) {
|
840
|
+
this.points.forEach(function (pt) {
|
841
|
+
pt.x = _this.rect.x + (pt.x - _this['oldRect'].x) * scaleX;
|
842
|
+
pt.y = _this.rect.y + (pt.y - _this['oldRect'].y) * scaleY;
|
843
|
+
});
|
844
|
+
}
|
845
|
+
if (this.manualAnchors) {
|
846
|
+
this.manualAnchors.forEach(function (pt) {
|
847
|
+
pt.x = _this.rect.x + (pt.x - _this['oldRect'].x) * scaleX;
|
848
|
+
pt.y = _this.rect.y + (pt.y - _this['oldRect'].y) * scaleY;
|
849
|
+
});
|
850
|
+
}
|
851
|
+
}
|
852
|
+
};
|
853
|
+
Node.prototype.translate = function (x, y) {
|
854
|
+
this.rect.x += x;
|
855
|
+
this.rect.y += y;
|
856
|
+
this.rect.ex = this.rect.x + this.rect.width;
|
857
|
+
this.rect.ey = this.rect.y + this.rect.height;
|
858
|
+
this.rect.calcCenter();
|
859
|
+
if (this.animateFrames && this.animateFrames.length) {
|
860
|
+
for (var _i = 0, _a = this.animateFrames; _i < _a.length; _i++) {
|
861
|
+
var frame = _a[_i];
|
862
|
+
var initState = frame.initState, state = frame.state;
|
863
|
+
if (initState && initState.translate) {
|
864
|
+
initState.translate(x, y);
|
865
|
+
}
|
866
|
+
if (state && state.translate) {
|
867
|
+
state.translate(x, y);
|
868
|
+
}
|
869
|
+
}
|
870
|
+
}
|
871
|
+
this.init();
|
872
|
+
if (this.children) {
|
873
|
+
for (var _b = 0, _c = this.children; _b < _c.length; _b++) {
|
874
|
+
var item = _c[_b];
|
875
|
+
item.translate(x, y);
|
876
|
+
}
|
877
|
+
}
|
878
|
+
};
|
879
|
+
Node.prototype.initRect = function () {
|
880
|
+
this.rect.init();
|
881
|
+
if (this.children) {
|
882
|
+
this.calcChildrenRect();
|
883
|
+
for (var _i = 0, _a = this.children; _i < _a.length; _i++) {
|
884
|
+
var item = _a[_i];
|
885
|
+
if (item instanceof Node) {
|
886
|
+
item.initRect();
|
887
|
+
}
|
888
|
+
}
|
889
|
+
}
|
890
|
+
};
|
891
|
+
Node.prototype.round = function () {
|
892
|
+
this.rect.round();
|
893
|
+
if (this.children) {
|
894
|
+
for (var _i = 0, _a = this.children; _i < _a.length; _i++) {
|
895
|
+
var item = _a[_i];
|
896
|
+
item.rect.round();
|
897
|
+
}
|
898
|
+
}
|
899
|
+
};
|
900
|
+
Node.prototype.clone = function () {
|
901
|
+
var n = new Node(this);
|
902
|
+
n.clearChildrenIds();
|
903
|
+
return n;
|
904
|
+
};
|
905
|
+
//新增属性
|
906
|
+
Node.prototype.area = function(pts) {
|
907
|
+
var area = 0;
|
908
|
+
var pts = pts;
|
909
|
+
var nPts = pts.length;
|
910
|
+
var j = nPts - 1;
|
911
|
+
var p1;
|
912
|
+
var p2;
|
913
|
+
for (var i = 0; i < nPts; j = i++) {
|
914
|
+
p1 = pts[i];
|
915
|
+
p2 = pts[j];
|
916
|
+
area += p1.x * p2.y;
|
917
|
+
area -= p1.y * p2.x;
|
918
|
+
}
|
919
|
+
area /= 2;
|
920
|
+
return area;
|
921
|
+
};
|
922
|
+
Node.prototype.centroid = function(pts) {
|
923
|
+
var pts = pts;
|
924
|
+
var nPts = pts.length;
|
925
|
+
var x = 0;
|
926
|
+
var y = 0;
|
927
|
+
var f;
|
928
|
+
var j = nPts - 1;
|
929
|
+
var p1;
|
930
|
+
var p2;
|
931
|
+
for (var i = 0; i < nPts; j = i++) {
|
932
|
+
p1 = pts[i];
|
933
|
+
p2 = pts[j];
|
934
|
+
f = p1.x * p2.y - p2.x * p1.y;
|
935
|
+
x += (p1.x + p2.x) * f;
|
936
|
+
y += (p1.y + p2.y) * f;
|
937
|
+
}
|
938
|
+
f = this.area(pts) * 6;
|
939
|
+
return new Point(x / f, y / f);
|
940
|
+
}
|
941
|
+
return Node;
|
942
|
+
}(Pen));
|
943
|
+
export { Node };
|
944
|
+
//# sourceMappingURL=node.js.map
|