bpmn-js 0.20.6 → 0.22.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.eslintrc +33 -33
- package/.npmignore +8 -8
- package/.travis.yml +19 -17
- package/.wiredeps +88 -88
- package/CONTRIBUTING.md +55 -55
- package/Gruntfile.js +129 -129
- package/LICENSE +22 -22
- package/README.md +113 -113
- package/assets/bpmn-font/css/bpmn-embedded.css +159 -159
- package/assets/bpmn-font/css/bpmn.css +161 -161
- package/assets/bpmn-font/font/bpmn.svg +116 -116
- package/docs/architecture/overview.svg +48 -48
- package/docs/project/COMMIT_MESSAGES.md +82 -82
- package/docs/project/SETUP.md +66 -66
- package/docs/project/setup-alternative.sh +41 -41
- package/docs/project/setup.bat +45 -45
- package/docs/project/setup.sh +40 -40
- package/docs/translations.json +97 -97
- package/lib/Modeler.js +208 -208
- package/lib/NavigatedViewer.js +27 -27
- package/lib/Viewer.js +503 -503
- package/lib/core/index.js +5 -5
- package/lib/draw/BpmnRenderer.js +1934 -1934
- package/lib/draw/PathMap.js +478 -478
- package/lib/draw/index.js +5 -5
- package/lib/features/auto-resize/BpmnAutoResize.js +34 -34
- package/lib/features/auto-resize/BpmnAutoResizeProvider.js +51 -51
- package/lib/features/auto-resize/index.js +5 -5
- package/lib/features/context-pad/ContextPadProvider.js +374 -374
- package/lib/features/context-pad/index.js +11 -11
- package/lib/features/copy-paste/BpmnCopyPaste.js +157 -154
- package/lib/features/copy-paste/index.js +7 -7
- package/lib/features/distribute-elements/BpmnDistributeElements.js +34 -34
- package/lib/features/distribute-elements/index.js +7 -7
- package/lib/features/editor-actions/BpmnEditorActions.js +130 -130
- package/lib/features/editor-actions/index.js +15 -15
- package/lib/features/global-connect/BpmnGlobalConnect.js +49 -49
- package/lib/features/global-connect/index.js +7 -7
- package/lib/features/keyboard/BpmnKeyBindings.js +72 -72
- package/lib/features/keyboard/index.js +7 -7
- package/lib/features/label-editing/LabelEditingPreview.js +122 -0
- package/lib/features/label-editing/LabelEditingProvider.js +292 -193
- package/lib/features/label-editing/LabelUtil.js +43 -43
- package/lib/features/label-editing/cmd/UpdateLabelHandler.js +116 -112
- package/lib/features/label-editing/index.js +14 -9
- package/lib/features/modeling/BpmnFactory.js +97 -97
- package/lib/features/modeling/BpmnLayouter.js +191 -191
- package/lib/features/modeling/BpmnUpdater.js +692 -688
- package/lib/features/modeling/ElementFactory.js +218 -218
- package/lib/features/modeling/Modeling.js +183 -183
- package/lib/features/modeling/behavior/AppendBehavior.js +42 -42
- package/lib/features/modeling/behavior/CopyPasteBehavior.js +69 -69
- package/lib/features/modeling/behavior/CreateBoundaryEventBehavior.js +51 -51
- package/lib/features/modeling/behavior/CreateDataObjectBehavior.js +37 -37
- package/lib/features/modeling/behavior/CreateParticipantBehavior.js +91 -91
- package/lib/features/modeling/behavior/DataInputAssociationBehavior.js +151 -151
- package/lib/features/modeling/behavior/DeleteLaneBehavior.js +107 -107
- package/lib/features/modeling/behavior/DropOnFlowBehavior.js +165 -131
- package/lib/features/modeling/behavior/ImportDockingFix.js +80 -80
- package/lib/features/modeling/behavior/LabelBehavior.js +222 -222
- package/lib/features/modeling/behavior/ModelingFeedback.js +50 -50
- package/lib/features/modeling/behavior/RemoveElementBehavior.js +73 -73
- package/lib/features/modeling/behavior/RemoveParticipantBehavior.js +50 -50
- package/lib/features/modeling/behavior/ReplaceConnectionBehavior.js +128 -128
- package/lib/features/modeling/behavior/ReplaceElementBehaviour.js +118 -116
- package/lib/features/modeling/behavior/ResizeLaneBehavior.js +59 -59
- package/lib/features/modeling/behavior/ToggleElementCollapseBehaviour.js +138 -138
- package/lib/features/modeling/behavior/UnclaimIdBehavior.js +27 -27
- package/lib/features/modeling/behavior/UnsetDefaultFlowBehavior.js +54 -54
- package/lib/features/modeling/behavior/UpdateFlowNodeRefsBehavior.js +156 -156
- package/lib/features/modeling/behavior/index.js +44 -44
- package/lib/features/modeling/behavior/util/GeometricUtil.js +129 -129
- package/lib/features/modeling/behavior/util/LabelLayoutUtil.js +218 -218
- package/lib/features/modeling/behavior/util/LineAttachmentUtil.js +233 -233
- package/lib/features/modeling/behavior/util/LineIntersect.js +36 -36
- package/lib/features/modeling/cmd/AddLaneHandler.js +83 -83
- package/lib/features/modeling/cmd/IdClaimHandler.js +41 -41
- package/lib/features/modeling/cmd/ResizeLaneHandler.js +125 -125
- package/lib/features/modeling/cmd/SplitLaneHandler.js +82 -82
- package/lib/features/modeling/cmd/UpdateCanvasRootHandler.js +78 -78
- package/lib/features/modeling/cmd/UpdateFlowNodeRefsHandler.js +185 -185
- package/lib/features/modeling/cmd/UpdatePropertiesHandler.js +264 -264
- package/lib/features/modeling/index.js +23 -23
- package/lib/features/modeling/util/LaneUtil.js +157 -157
- package/lib/features/modeling/util/ModelingUtil.js +48 -48
- package/lib/features/ordering/BpmnOrderingProvider.js +147 -147
- package/lib/features/ordering/index.js +6 -6
- package/lib/features/palette/PaletteProvider.js +158 -158
- package/lib/features/palette/index.js +13 -13
- package/lib/features/popup-menu/ReplaceMenuProvider.js +479 -479
- package/lib/features/popup-menu/index.js +7 -7
- package/lib/features/popup-menu/util/TypeUtil.js +41 -41
- package/lib/features/replace/BpmnReplace.js +197 -197
- package/lib/features/replace/ReplaceOptions.js +787 -787
- package/lib/features/replace/index.js +7 -7
- package/lib/features/replace-preview/BpmnReplacePreview.js +113 -113
- package/lib/features/replace-preview/index.js +5 -5
- package/lib/features/rules/BpmnRules.js +807 -806
- package/lib/features/rules/index.js +7 -7
- package/lib/features/search/BpmnSearchProvider.js +128 -128
- package/lib/features/search/index.js +7 -7
- package/lib/features/snapping/BpmnSnapping.js +511 -495
- package/lib/features/snapping/BpmnSnappingUtil.js +159 -159
- package/lib/features/snapping/index.js +3 -3
- package/lib/import/BpmnImporter.js +302 -302
- package/lib/import/BpmnTreeWalker.js +445 -445
- package/lib/import/Importer.js +69 -69
- package/lib/import/Util.js +8 -8
- package/lib/import/index.js +5 -5
- package/lib/util/DiUtil.js +60 -60
- package/lib/util/LabelUtil.js +139 -139
- package/lib/util/ModelUtil.js +31 -31
- package/lib/util/PoweredByUtil.js +82 -82
- package/lib/util/model/ModelCloneHelper.js +201 -201
- package/lib/util/model/ModelCloneUtils.js +35 -35
- package/package.json +22 -22
- package/resources/initial.bpmn +12 -12
- package/resources/screencast.gif +0 -0
- package/tasks/banner.txt +11 -11
- package/tasks/bundle.js +162 -162
- package/test/TestHelper.js +17 -17
- package/test/config/karma.unit.js +46 -46
- package/test/config/translation-reporter.js +48 -48
- package/test/fixtures/bpmn/align-elements.bpmn +136 -136
- package/test/fixtures/bpmn/basic.bpmn +17 -17
- package/test/fixtures/bpmn/boundary-events.bpmn +59 -59
- package/test/fixtures/bpmn/collaboration/collaboration-empty-participant.bpmn +13 -13
- package/test/fixtures/bpmn/collaboration/collaboration-message-flows.bpmn +89 -89
- package/test/fixtures/bpmn/collaboration/collaboration-participant.bpmn +59 -59
- package/test/fixtures/bpmn/collaboration/process-empty.bpmn +6 -6
- package/test/fixtures/bpmn/collaboration/process.bpmn +47 -47
- package/test/fixtures/bpmn/collaboration-data-items.bpmn +81 -81
- package/test/fixtures/bpmn/collaboration-message-flows.bpmn +82 -82
- package/test/fixtures/bpmn/collaboration-sequence-flows.bpmn +83 -83
- package/test/fixtures/bpmn/collaboration.bpmn +50 -50
- package/test/fixtures/bpmn/complex.bpmn +2151 -2151
- package/test/fixtures/bpmn/conditions.bpmn +82 -82
- package/test/fixtures/bpmn/containers.bpmn +128 -128
- package/test/fixtures/bpmn/distribute-elements-filtering.bpmn +58 -58
- package/test/fixtures/bpmn/distribute-elements.bpmn +232 -232
- package/test/fixtures/bpmn/draw/activity-markers-combination.bpmn +141 -141
- package/test/fixtures/bpmn/draw/activity-markers-simple.bpmn +47 -47
- package/test/fixtures/bpmn/draw/activity-markers.bpmn +212 -212
- package/test/fixtures/bpmn/draw/associations.bpmn +55 -55
- package/test/fixtures/bpmn/draw/boundary-event-with-refnode.bpmn +81 -81
- package/test/fixtures/bpmn/draw/boundary-event-without-refnode.bpmn +81 -81
- package/test/fixtures/bpmn/draw/boundary-event-z-index.bpmn +82 -82
- package/test/fixtures/bpmn/draw/call-activity.bpmn +12 -12
- package/test/fixtures/bpmn/draw/colors.bpmn +411 -411
- package/test/fixtures/bpmn/draw/conditional-flow-default.bpmn +100 -100
- package/test/fixtures/bpmn/draw/conditional-flow-gateways.bpmn +72 -72
- package/test/fixtures/bpmn/draw/conditional-flow-typed-task.bpmn +33 -33
- package/test/fixtures/bpmn/draw/conditional-flow.bpmn +248 -248
- package/test/fixtures/bpmn/draw/data-objects.bpmn +265 -265
- package/test/fixtures/bpmn/draw/event-subprocesses-collapsed.bpmn +200 -200
- package/test/fixtures/bpmn/draw/event-subprocesses-expanded.bpmn +274 -274
- package/test/fixtures/bpmn/draw/events-interrupting.bpmn +370 -370
- package/test/fixtures/bpmn/draw/events.bpmn +374 -374
- package/test/fixtures/bpmn/draw/gateway-type-default.bpmn +45 -45
- package/test/fixtures/bpmn/draw/gateways.bpmn +61 -61
- package/test/fixtures/bpmn/draw/group.bpmn +24 -24
- package/test/fixtures/bpmn/draw/message-marker.bpmn +112 -112
- package/test/fixtures/bpmn/draw/pools-with-collection-marker.bpmn +104 -104
- package/test/fixtures/bpmn/draw/pools.bpmn +82 -82
- package/test/fixtures/bpmn/draw/task-types.bpmn +77 -77
- package/test/fixtures/bpmn/draw/text-annotation.bpmn +71 -71
- package/test/fixtures/bpmn/draw/xor.bpmn +45 -45
- package/test/fixtures/bpmn/empty-definitions.bpmn +4 -4
- package/test/fixtures/bpmn/error/categoryValue.bpmn +26 -26
- package/test/fixtures/bpmn/error/di-plane-no-bpmn-element.bpmn +9 -9
- package/test/fixtures/bpmn/error/duplicate-ids.bpmn +14 -14
- package/test/fixtures/bpmn/error/invalid-child.bpmn +6 -6
- package/test/fixtures/bpmn/error/missing-namespace.bpmn +12 -12
- package/test/fixtures/bpmn/event-sub-processes.bpmn +47 -47
- package/test/fixtures/bpmn/extension/camunda.bpmn +52 -52
- package/test/fixtures/bpmn/extension/custom-override.bpmn +53 -53
- package/test/fixtures/bpmn/extension/custom.bpmn +53 -53
- package/test/fixtures/bpmn/features/copy-paste/basic.bpmn +111 -111
- package/test/fixtures/bpmn/features/copy-paste/collaboration-multiple.bpmn +102 -102
- package/test/fixtures/bpmn/features/copy-paste/collaboration.bpmn +74 -74
- package/test/fixtures/bpmn/features/copy-paste/data-associations.bpmn +61 -61
- package/test/fixtures/bpmn/features/copy-paste/properties.bpmn +43 -43
- package/test/fixtures/bpmn/features/drop/drop.bpmn +41 -41
- package/test/fixtures/bpmn/features/drop/recursive-task.bpmn +37 -37
- package/test/fixtures/bpmn/features/label-editing/labels.bpmn +178 -248
- package/test/fixtures/bpmn/features/modeling/update-label.bpmn +24 -24
- package/test/fixtures/bpmn/features/replace/01_replace.bpmn +193 -193
- package/test/fixtures/bpmn/features/replace/association-gateways.bpmn +173 -173
- package/test/fixtures/bpmn/features/replace/cancel-events.bpmn +49 -49
- package/test/fixtures/bpmn/features/replace/clone-properties.bpmn +141 -141
- package/test/fixtures/bpmn/features/replace/connection.bpmn +42 -42
- package/test/fixtures/bpmn/features/rules/event-based-gateway-outgoing-edge.bpmn +72 -72
- package/test/fixtures/bpmn/features/rules/link-event.bpmn +35 -35
- package/test/fixtures/bpmn/features/rules/text-annotation-association.bpmn +30 -30
- package/test/fixtures/bpmn/flow-markers.bpmn +212 -212
- package/test/fixtures/bpmn/import/boundaryEvent.bpmn +33 -33
- package/test/fixtures/bpmn/import/collaboration.bpmn +50 -50
- package/test/fixtures/bpmn/import/collapsed/collaboration.bpmn +76 -76
- package/test/fixtures/bpmn/import/collapsed/process.bpmn +84 -84
- package/test/fixtures/bpmn/import/collapsed/processWithChildren.bpmn +273 -273
- package/test/fixtures/bpmn/import/default-attrs.bpmn +24 -24
- package/test/fixtures/bpmn/import/error/boundaryEvent-invalidAttachToRef.bpmn +30 -30
- package/test/fixtures/bpmn/import/error/boundaryEvent-missingAttachToRef.bpmn +33 -33
- package/test/fixtures/bpmn/import/error/dangling-process-message-flow.bpmn +81 -81
- package/test/fixtures/bpmn/import/error/invalid-flow-element.bpmn +35 -35
- package/test/fixtures/bpmn/import/error/multiple-dis.bpmn +23 -23
- package/test/fixtures/bpmn/import/labels/collaboration-message-flows.bpmn +41 -41
- package/test/fixtures/bpmn/import/labels/collaboration.bpmn +72 -72
- package/test/fixtures/bpmn/import/labels/embedded.bpmn +39 -39
- package/test/fixtures/bpmn/import/labels/external-no-di.bpmn +42 -42
- package/test/fixtures/bpmn/import/labels/external.bpmn +69 -69
- package/test/fixtures/bpmn/import/position/position-testcase.bpmn +57 -57
- package/test/fixtures/bpmn/import/process.bpmn +60 -60
- package/test/fixtures/bpmn/nested-subprocesses.bpmn +118 -118
- package/test/fixtures/bpmn/sequence-flows.bpmn +60 -60
- package/test/fixtures/bpmn/simple-cropping.bpmn +84 -84
- package/test/fixtures/bpmn/simple-resizable.bpmn +50 -50
- package/test/fixtures/bpmn/simple.bpmn +60 -60
- package/test/fixtures/json/model/camunda.json +1042 -1042
- package/test/fixtures/json/model/custom-override.json +39 -39
- package/test/fixtures/json/model/custom.json +39 -39
- package/test/helper/TranslationCollector.js +17 -17
- package/test/helper/index.js +249 -249
- package/test/integration/CustomElementsSpec.js +223 -223
- package/test/integration/ReimportSpec.js +89 -89
- package/test/integration/SimpleModelingSpec.js +29 -29
- package/test/integration/custom-elements/CustomElementFactory.js +77 -77
- package/test/integration/custom-elements/CustomRenderer.js +151 -151
- package/test/integration/custom-elements/CustomRules.js +148 -148
- package/test/integration/custom-elements/CustomUpdater.js +115 -115
- package/test/integration/custom-elements/index.js +7 -7
- package/test/integration/model/BpmnModdleSpec.js +65 -65
- package/test/matchers/JSONMatcher.js +19 -19
- package/test/spec/ModelerSpec.js +401 -401
- package/test/spec/NavigatedViewerSpec.js +58 -58
- package/test/spec/ViewerSpec.js +977 -977
- package/test/spec/draw/BpmnRendererSpec.js +311 -311
- package/test/spec/environment/MockingSpec.js +53 -53
- package/test/spec/features/align-elements/BpmnAlignElementsSpec.js +137 -137
- package/test/spec/features/auto-resize/AutoResize.lanes.bpmn +54 -54
- package/test/spec/features/auto-resize/AutoResize.multi-selection.bpmn +22 -22
- package/test/spec/features/auto-resize/AutoResize.nested-sub-processes.bpmn +47 -47
- package/test/spec/features/auto-resize/AutoResize.participant.bpmn +38 -38
- package/test/spec/features/auto-resize/AutoResize.space-tool.bpmn +38 -38
- package/test/spec/features/auto-resize/AutoResize.sub-processes.bpmn +37 -37
- package/test/spec/features/auto-resize/AutoResizeSpec.js +607 -607
- package/test/spec/features/context-pad/ContextPad.activation.bpmn +51 -51
- package/test/spec/features/context-pad/ContextPadProviderSpec.js +440 -440
- package/test/spec/features/copy-paste/BpmnCopyPasteSpec.js +763 -725
- package/test/spec/features/copy-paste/DescriptorTree.js +58 -58
- package/test/spec/features/distribute-elements/BpmnDistributeElementsSpec.js +113 -113
- package/test/spec/features/editor-actions/BpmnEditorActionsSpec.js +72 -72
- package/test/spec/features/global-connect/BpmnGlobalConnectSpec.js +61 -61
- package/test/spec/features/keyboard/BpmnKeyBindingsSpec.js +142 -142
- package/test/spec/features/label-editing/LabelEditingPreviewSpec.js +133 -0
- package/test/spec/features/label-editing/LabelEditingProviderSpec.js +636 -601
- package/test/spec/features/label-editing/TouchIntegrationSpec.js +40 -40
- package/test/spec/features/modeling/AppendShapeSpec.js +332 -332
- package/test/spec/features/modeling/BendpointsSpec.js +25 -25
- package/test/spec/features/modeling/BpmnFactorySpec.js +73 -73
- package/test/spec/features/modeling/BpmnUpdater.bpmn +99 -99
- package/test/spec/features/modeling/BpmnUpdaterSpec.js +79 -79
- package/test/spec/features/modeling/CreateConnectionSpec.js +171 -171
- package/test/spec/features/modeling/DeleteConnectionSpec.js +75 -75
- package/test/spec/features/modeling/DeleteParticipantSpec.js +97 -97
- package/test/spec/features/modeling/DeleteShapeSpec.js +75 -75
- package/test/spec/features/modeling/DropSpec.js +123 -123
- package/test/spec/features/modeling/IdClaim.bpmn +13 -13
- package/test/spec/features/modeling/IdClaimSpec.js +50 -50
- package/test/spec/features/modeling/LabelBoundsSpec.js +342 -340
- package/test/spec/features/modeling/LabelBoundsSpec.simple.bpmn +27 -27
- package/test/spec/features/modeling/LabelLayouting.initial.bpmn +37 -37
- package/test/spec/features/modeling/LabelLayouting.move.bpmn +99 -99
- package/test/spec/features/modeling/LabelLayouting.special.bpmn +76 -76
- package/test/spec/features/modeling/LabelLayoutingSpec.js +603 -603
- package/test/spec/features/modeling/MoveConnectionSpec.js +101 -101
- package/test/spec/features/modeling/MoveElements.flow-collaboration.bpmn +45 -45
- package/test/spec/features/modeling/MoveElementsSpec.js +70 -70
- package/test/spec/features/modeling/MoveRulesSpec.js +151 -151
- package/test/spec/features/modeling/MoveShapeSpec.js +353 -353
- package/test/spec/features/modeling/ResizeShapeSpec.js +73 -73
- package/test/spec/features/modeling/SpaceToolSpec.js +251 -251
- package/test/spec/features/modeling/UpdateAttachmentSpec.js +96 -96
- package/test/spec/features/modeling/UpdateLabelSpec.js +130 -130
- package/test/spec/features/modeling/UpdatePropertiesSpec.js +503 -503
- package/test/spec/features/modeling/append/TextAnnotationSpec.js +136 -136
- package/test/spec/features/modeling/behavior/CompensationAssociationBehavior.bpmn +26 -26
- package/test/spec/features/modeling/behavior/CompensationAssociationBehaviorSpec.js +43 -43
- package/test/spec/features/modeling/behavior/CreateBoundaryEventBehaviorSpec.js +58 -58
- package/test/spec/features/modeling/behavior/CreateParticipantBehaviorSpec.js +224 -224
- package/test/spec/features/modeling/behavior/DataInputAssociationBehavior.bpmn +33 -33
- package/test/spec/features/modeling/behavior/DataInputAssociationBehaviorSpec.js +146 -146
- package/test/spec/features/modeling/behavior/DataObjectBehavior.create-data-association.bpmn +21 -21
- package/test/spec/features/modeling/behavior/DataObjectBehavior.data-object-reference.bpmn +13 -13
- package/test/spec/features/modeling/behavior/DataObjectBehavior.remove-data-association.bpmn +41 -41
- package/test/spec/features/modeling/behavior/DataObjectBehaviorSpec.js +297 -297
- package/test/spec/features/modeling/behavior/DataStoreBehavior.bpmn +26 -26
- package/test/spec/features/modeling/behavior/DataStoreBehavior.connect.bpmn +57 -57
- package/test/spec/features/modeling/behavior/DataStoreBehaviorSpec.js +228 -228
- package/test/spec/features/modeling/behavior/DropOnFlowBehavior.bpmn +71 -67
- package/test/spec/features/modeling/behavior/DropOnFlowBehaviorSpec.js +591 -418
- package/test/spec/features/modeling/behavior/ImportDockingFix.bpmn +61 -61
- package/test/spec/features/modeling/behavior/ImportDockingFixSpec.js +37 -37
- package/test/spec/features/modeling/behavior/LabelBehaviorSpec.js +277 -277
- package/test/spec/features/modeling/behavior/ReconnectConnection.data-association.bpmn +41 -41
- package/test/spec/features/modeling/behavior/ReconnectConnectionSpec.js +120 -120
- package/test/spec/features/modeling/behavior/RemoveElementBehavior.bpmn +181 -181
- package/test/spec/features/modeling/behavior/RemoveElementBehavior.perpendicular.bpmn +159 -159
- package/test/spec/features/modeling/behavior/RemoveElementBehaviorSpec.js +251 -251
- package/test/spec/features/modeling/behavior/RemoveParticipantBehaviorSpec.js +125 -125
- package/test/spec/features/modeling/behavior/ReplaceConnectionBehavior.association.bpmn +26 -26
- package/test/spec/features/modeling/behavior/ReplaceConnectionBehavior.boundary-events.bpmn +40 -40
- package/test/spec/features/modeling/behavior/ReplaceConnectionBehavior.message-sequence-flow.bpmn +121 -121
- package/test/spec/features/modeling/behavior/ReplaceConnectionBehaviorSpec.js +439 -439
- package/test/spec/features/modeling/behavior/ReplaceElementBehaviourSpec.js +450 -450
- package/test/spec/features/modeling/behavior/ToggleElementCollapseBehaviourSpec.js +653 -653
- package/test/spec/features/modeling/behavior/UnsetDefaultFlowBehaviorSpec.bpmn +48 -48
- package/test/spec/features/modeling/behavior/UnsetDefaultFlowBehaviorSpec.js +77 -77
- package/test/spec/features/modeling/behavior/util/GeometricUtilSpec.js +127 -127
- package/test/spec/features/modeling/behavior/util/LabelLayoutUtilSpec.js +75 -75
- package/test/spec/features/modeling/behavior/util/LineAttachmentUtilSpec.js +294 -294
- package/test/spec/features/modeling/behavior/util/LineIntersectSpec.js +32 -32
- package/test/spec/features/modeling/lanes/AddLaneSpec.js +263 -263
- package/test/spec/features/modeling/lanes/DeleteLaneSpec.js +126 -126
- package/test/spec/features/modeling/lanes/ResizeLaneSpec.js +366 -366
- package/test/spec/features/modeling/lanes/SplitLaneSpec.js +216 -216
- package/test/spec/features/modeling/lanes/UpdateFlowNodeRefsSpec.js +271 -271
- package/test/spec/features/modeling/lanes/flowNodeRefs.bpmn +56 -56
- package/test/spec/features/modeling/lanes/lanes.bpmn +83 -83
- package/test/spec/features/modeling/lanes/participant-lane.bpmn +27 -27
- package/test/spec/features/modeling/lanes/participant-no-lane.bpmn +22 -22
- package/test/spec/features/modeling/layout/Helper.js +64 -64
- package/test/spec/features/modeling/layout/LayoutAssociationSpec.js +101 -101
- package/test/spec/features/modeling/layout/LayoutConnectionSpec.js +98 -98
- package/test/spec/features/modeling/layout/LayoutDataAssociationSpec.js +98 -98
- package/test/spec/features/modeling/layout/LayoutMessageFlowSpec.bpmn +119 -119
- package/test/spec/features/modeling/layout/LayoutMessageFlowSpec.js +313 -313
- package/test/spec/features/modeling/layout/LayoutSequenceFlowSpec.boundaryEvents.bpmn +65 -65
- package/test/spec/features/modeling/layout/LayoutSequenceFlowSpec.flowElements.bpmn +70 -70
- package/test/spec/features/modeling/layout/LayoutSequenceFlowSpec.js +323 -323
- package/test/spec/features/ordering/BpmnOrderingProviderSpec.js +231 -231
- package/test/spec/features/ordering/Helper.js +185 -185
- package/test/spec/features/ordering/ordering-start-event.bpmn +17 -17
- package/test/spec/features/ordering/ordering-subprocesses.bpmn +41 -41
- package/test/spec/features/ordering/ordering.bpmn +105 -105
- package/test/spec/features/palette/PaletteProviderSpec.js +33 -33
- package/test/spec/features/popup-menu/ReplaceMenuProvider.collapsedSubProcess.bpmn +13 -13
- package/test/spec/features/popup-menu/ReplaceMenuProvider.compensation-activity.bpmn +12 -12
- package/test/spec/features/popup-menu/ReplaceMenuProvider.conditionalFlows.bpmn +66 -66
- package/test/spec/features/popup-menu/ReplaceMenuProvider.defaultFlows.bpmn +126 -126
- package/test/spec/features/popup-menu/ReplaceMenuProvider.defaultFlowsFromComplexGateways.bpmn +48 -48
- package/test/spec/features/popup-menu/ReplaceMenuProvider.defaultFlowsFromInclusiveGateways.bpmn +48 -48
- package/test/spec/features/popup-menu/ReplaceMenuProviderSpec.js +1957 -1957
- package/test/spec/features/replace/BpmnReplace.collaboration.bpmn +70 -70
- package/test/spec/features/replace/BpmnReplace.compensation.bpmn +12 -12
- package/test/spec/features/replace/BpmnReplace.eventSubProcesses.bpmn +126 -126
- package/test/spec/features/replace/BpmnReplaceSpec.js +1302 -1302
- package/test/spec/features/replace/ReplaceRulesSpec.js +78 -78
- package/test/spec/features/replace/SubProcess-collapsed.bpmn +36 -36
- package/test/spec/features/replace-preview/BpmnReplacePreviewSpec.js +304 -304
- package/test/spec/features/rules/BpmnRules.boundaryEvent.bpmn +93 -93
- package/test/spec/features/rules/BpmnRules.collaboration-dataAssociation.bpmn +35 -35
- package/test/spec/features/rules/BpmnRules.collaboration-lanes.bpmn +79 -79
- package/test/spec/features/rules/BpmnRules.collaboration.bpmn +138 -138
- package/test/spec/features/rules/BpmnRules.compensation.bpmn +65 -65
- package/test/spec/features/rules/BpmnRules.dataAssociation.bpmn +33 -33
- package/test/spec/features/rules/BpmnRules.eventBasedGateway.bpmn +82 -82
- package/test/spec/features/rules/BpmnRules.messageFlow.bpmn +27 -27
- package/test/spec/features/rules/BpmnRules.multiSelectionPools.bpmn +37 -37
- package/test/spec/features/rules/BpmnRules.process.bpmn +91 -91
- package/test/spec/features/rules/BpmnRules.subProcess-dataAssociation.bpmn +44 -44
- package/test/spec/features/rules/BpmnRulesSpec.js +1468 -1424
- package/test/spec/features/rules/Helper.js +82 -82
- package/test/spec/features/search/BpmnSearchProviderSpec.js +158 -158
- package/test/spec/features/search/bpmn-search-collaboration.bpmn +106 -106
- package/test/spec/features/search/bpmn-search.bpmn +100 -100
- package/test/spec/features/snapping/BpmnSnapping.connect.bpmn +36 -36
- package/test/spec/features/snapping/BpmnSnapping.labels.bpmn +27 -27
- package/test/spec/features/snapping/BpmnSnapping.lanes-resize.bpmn +43 -43
- package/test/spec/features/snapping/BpmnSnapping.participant-resize.bpmn +50 -50
- package/test/spec/features/snapping/BpmnSnapping.sequenceFlow.bpmn +41 -0
- package/test/spec/features/snapping/BpmnSnapping.subProcess-resize.bpmn +21 -21
- package/test/spec/features/snapping/BpmnSnapping.textAnnotation-resize.bpmn +22 -22
- package/test/spec/features/snapping/BpmnSnappingSpec.js +824 -758
- package/test/spec/features/snapping/BpmnSnappingUtil.lanes-flowNodes.bpmn +82 -82
- package/test/spec/features/snapping/BpmnSnappingUtil.lanes.bpmn +35 -35
- package/test/spec/features/snapping/BpmnSnappingUtilSpec.js +285 -285
- package/test/spec/i18n/custom-translate/custom-translate.js +14 -14
- package/test/spec/i18n/custom-translate/index.js +2 -2
- package/test/spec/i18n/translateSpec.js +56 -56
- package/test/spec/import/ImporterSpec.js +428 -428
- package/test/spec/import/ModelWiringSpec.js +194 -194
- package/test/spec/import/elements/AssociationSpec.collaboration.bpmn +51 -51
- package/test/spec/import/elements/AssociationSpec.compensation.bpmn +28 -28
- package/test/spec/import/elements/AssociationSpec.data-association.bpmn +39 -39
- package/test/spec/import/elements/AssociationSpec.data-input-output.bpmn +40 -40
- package/test/spec/import/elements/AssociationSpec.events.bpmn +51 -51
- package/test/spec/import/elements/AssociationSpec.js +175 -175
- package/test/spec/import/elements/AssociationSpec.text-annotation.bpmn +37 -37
- package/test/spec/import/elements/CollapsedSpec.js +118 -118
- package/test/spec/import/elements/LabelSpec.js +85 -85
- package/test/spec/import/lane-flowNodes.bpmn +44 -44
- package/test/spec/import/lane-missing-flowNodeRef.bpmn +24 -24
- package/test/spec/util/ModelCloneHelperSpec.js +381 -381
- package/test/spec/util/ModelUtilSpec.js +65 -65
- package/test/spec/util/camunda-moddle.js +70 -70
- package/test/util/MockEvents.js +62 -62
- package/test/util/ModelingUtil.js +117 -117
- package/test/util/custom-rules/CustomRules.js +18 -18
- package/test/util/custom-rules/index.js +4 -4
package/lib/draw/PathMap.js
CHANGED
|
@@ -1,478 +1,478 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* Map containing SVG paths needed by BpmnRenderer.
|
|
5
|
-
*/
|
|
6
|
-
|
|
7
|
-
function PathMap() {
|
|
8
|
-
|
|
9
|
-
/**
|
|
10
|
-
* Contains a map of path elements
|
|
11
|
-
*
|
|
12
|
-
* <h1>Path definition</h1>
|
|
13
|
-
* A parameterized path is defined like this:
|
|
14
|
-
* <pre>
|
|
15
|
-
* 'GATEWAY_PARALLEL': {
|
|
16
|
-
* d: 'm {mx},{my} {e.x0},0 0,{e.x1} {e.x1},0 0,{e.y0} -{e.x1},0 0,{e.y1} ' +
|
|
17
|
-
'-{e.x0},0 0,-{e.y1} -{e.x1},0 0,-{e.y0} {e.x1},0 z',
|
|
18
|
-
* height: 17.5,
|
|
19
|
-
* width: 17.5,
|
|
20
|
-
* heightElements: [2.5, 7.5],
|
|
21
|
-
* widthElements: [2.5, 7.5]
|
|
22
|
-
* }
|
|
23
|
-
* </pre>
|
|
24
|
-
* <p>It's important to specify a correct <b>height and width</b> for the path as the scaling
|
|
25
|
-
* is based on the ratio between the specified height and width in this object and the
|
|
26
|
-
* height and width that is set as scale target (Note x,y coordinates will be scaled with
|
|
27
|
-
* individual ratios).</p>
|
|
28
|
-
* <p>The '<b>heightElements</b>' and '<b>widthElements</b>' array must contain the values that will be scaled.
|
|
29
|
-
* The scaling is based on the computed ratios.
|
|
30
|
-
* Coordinates on the y axis should be in the <b>heightElement</b>'s array, they will be scaled using
|
|
31
|
-
* the computed ratio coefficient.
|
|
32
|
-
* In the parameterized path the scaled values can be accessed through the 'e' object in {} brackets.
|
|
33
|
-
* <ul>
|
|
34
|
-
* <li>The values for the y axis can be accessed in the path string using {e.y0}, {e.y1}, ....</li>
|
|
35
|
-
* <li>The values for the x axis can be accessed in the path string using {e.x0}, {e.x1}, ....</li>
|
|
36
|
-
* </ul>
|
|
37
|
-
* The numbers x0, x1 respectively y0, y1, ... map to the corresponding array index.
|
|
38
|
-
* </p>
|
|
39
|
-
*/
|
|
40
|
-
this.pathMap = {
|
|
41
|
-
'EVENT_MESSAGE': {
|
|
42
|
-
d: 'm {mx},{my} l 0,{e.y1} l {e.x1},0 l 0,-{e.y1} z l {e.x0},{e.y0} l {e.x0},-{e.y0}',
|
|
43
|
-
height: 36,
|
|
44
|
-
width: 36,
|
|
45
|
-
heightElements: [6, 14],
|
|
46
|
-
widthElements: [10.5, 21]
|
|
47
|
-
},
|
|
48
|
-
'EVENT_SIGNAL': {
|
|
49
|
-
d: 'M {mx},{my} l {e.x0},{e.y0} l -{e.x1},0 Z',
|
|
50
|
-
height: 36,
|
|
51
|
-
width: 36,
|
|
52
|
-
heightElements: [18],
|
|
53
|
-
widthElements: [10, 20]
|
|
54
|
-
},
|
|
55
|
-
'EVENT_ESCALATION': {
|
|
56
|
-
d: 'M {mx},{my} l {e.x0},{e.y0} l -{e.x0},-{e.y1} l -{e.x0},{e.y1} Z',
|
|
57
|
-
height: 36,
|
|
58
|
-
width: 36,
|
|
59
|
-
heightElements: [20, 7],
|
|
60
|
-
widthElements: [8]
|
|
61
|
-
},
|
|
62
|
-
'EVENT_CONDITIONAL': {
|
|
63
|
-
d: 'M {e.x0},{e.y0} l {e.x1},0 l 0,{e.y2} l -{e.x1},0 Z ' +
|
|
64
|
-
'M {e.x2},{e.y3} l {e.x0},0 ' +
|
|
65
|
-
'M {e.x2},{e.y4} l {e.x0},0 ' +
|
|
66
|
-
'M {e.x2},{e.y5} l {e.x0},0 ' +
|
|
67
|
-
'M {e.x2},{e.y6} l {e.x0},0 ' +
|
|
68
|
-
'M {e.x2},{e.y7} l {e.x0},0 ' +
|
|
69
|
-
'M {e.x2},{e.y8} l {e.x0},0 ',
|
|
70
|
-
height: 36,
|
|
71
|
-
width: 36,
|
|
72
|
-
heightElements: [8.5, 14.5, 18, 11.5, 14.5, 17.5, 20.5, 23.5, 26.5],
|
|
73
|
-
widthElements: [10.5, 14.5, 12.5]
|
|
74
|
-
},
|
|
75
|
-
'EVENT_LINK': {
|
|
76
|
-
d: 'm {mx},{my} 0,{e.y0} -{e.x1},0 0,{e.y1} {e.x1},0 0,{e.y0} {e.x0},-{e.y2} -{e.x0},-{e.y2} z',
|
|
77
|
-
height: 36,
|
|
78
|
-
width: 36,
|
|
79
|
-
heightElements: [4.4375, 6.75, 7.8125],
|
|
80
|
-
widthElements: [9.84375, 13.5]
|
|
81
|
-
},
|
|
82
|
-
'EVENT_ERROR': {
|
|
83
|
-
d: 'm {mx},{my} {e.x0},-{e.y0} {e.x1},-{e.y1} {e.x2},{e.y2} {e.x3},-{e.y3} -{e.x4},{e.y4} -{e.x5},-{e.y5} z',
|
|
84
|
-
height: 36,
|
|
85
|
-
width: 36,
|
|
86
|
-
heightElements: [0.023, 8.737, 8.151, 16.564, 10.591, 8.714],
|
|
87
|
-
widthElements: [0.085, 6.672, 6.97, 4.273, 5.337, 6.636]
|
|
88
|
-
},
|
|
89
|
-
'EVENT_CANCEL_45': {
|
|
90
|
-
d: 'm {mx},{my} -{e.x1},0 0,{e.x0} {e.x1},0 0,{e.y1} {e.x0},0 ' +
|
|
91
|
-
'0,-{e.y1} {e.x1},0 0,-{e.y0} -{e.x1},0 0,-{e.y1} -{e.x0},0 z',
|
|
92
|
-
height: 36,
|
|
93
|
-
width: 36,
|
|
94
|
-
heightElements: [4.75, 8.5],
|
|
95
|
-
widthElements: [4.75, 8.5]
|
|
96
|
-
},
|
|
97
|
-
'EVENT_COMPENSATION': {
|
|
98
|
-
d: 'm {mx},{my} {e.x0},-{e.y0} 0,{e.y1} z m {e.x1},-{e.y2} {e.x2},-{e.y3} 0,{e.y1} -{e.x2},-{e.y3} z',
|
|
99
|
-
height: 36,
|
|
100
|
-
width: 36,
|
|
101
|
-
heightElements: [6.5, 13, 0.4, 6.1],
|
|
102
|
-
widthElements: [9, 9.3, 8.7]
|
|
103
|
-
},
|
|
104
|
-
'EVENT_TIMER_WH': {
|
|
105
|
-
d: 'M {mx},{my} l {e.x0},-{e.y0} m -{e.x0},{e.y0} l {e.x1},{e.y1} ',
|
|
106
|
-
height: 36,
|
|
107
|
-
width: 36,
|
|
108
|
-
heightElements: [10, 2],
|
|
109
|
-
widthElements: [3, 7]
|
|
110
|
-
},
|
|
111
|
-
'EVENT_TIMER_LINE': {
|
|
112
|
-
d: 'M {mx},{my} ' +
|
|
113
|
-
'm {e.x0},{e.y0} l -{e.x1},{e.y1} ',
|
|
114
|
-
height: 36,
|
|
115
|
-
width: 36,
|
|
116
|
-
heightElements: [10, 3],
|
|
117
|
-
widthElements: [0, 0]
|
|
118
|
-
},
|
|
119
|
-
'EVENT_MULTIPLE': {
|
|
120
|
-
d:'m {mx},{my} {e.x1},-{e.y0} {e.x1},{e.y0} -{e.x0},{e.y1} -{e.x2},0 z',
|
|
121
|
-
height: 36,
|
|
122
|
-
width: 36,
|
|
123
|
-
heightElements: [6.28099, 12.56199],
|
|
124
|
-
widthElements: [3.1405, 9.42149, 12.56198]
|
|
125
|
-
},
|
|
126
|
-
'EVENT_PARALLEL_MULTIPLE': {
|
|
127
|
-
d:'m {mx},{my} {e.x0},0 0,{e.y1} {e.x1},0 0,{e.y0} -{e.x1},0 0,{e.y1} ' +
|
|
128
|
-
'-{e.x0},0 0,-{e.y1} -{e.x1},0 0,-{e.y0} {e.x1},0 z',
|
|
129
|
-
height: 36,
|
|
130
|
-
width: 36,
|
|
131
|
-
heightElements: [2.56228, 7.68683],
|
|
132
|
-
widthElements: [2.56228, 7.68683]
|
|
133
|
-
},
|
|
134
|
-
'GATEWAY_EXCLUSIVE': {
|
|
135
|
-
d:'m {mx},{my} {e.x0},{e.y0} {e.x1},{e.y0} {e.x2},0 {e.x4},{e.y2} ' +
|
|
136
|
-
'{e.x4},{e.y1} {e.x2},0 {e.x1},{e.y3} {e.x0},{e.y3} ' +
|
|
137
|
-
'{e.x3},0 {e.x5},{e.y1} {e.x5},{e.y2} {e.x3},0 z',
|
|
138
|
-
height: 17.5,
|
|
139
|
-
width: 17.5,
|
|
140
|
-
heightElements: [8.5, 6.5312, -6.5312, -8.5],
|
|
141
|
-
widthElements: [6.5, -6.5, 3, -3, 5, -5]
|
|
142
|
-
},
|
|
143
|
-
'GATEWAY_PARALLEL': {
|
|
144
|
-
d:'m {mx},{my} 0,{e.y1} -{e.x1},0 0,{e.y0} {e.x1},0 0,{e.y1} {e.x0},0 ' +
|
|
145
|
-
'0,-{e.y1} {e.x1},0 0,-{e.y0} -{e.x1},0 0,-{e.y1} -{e.x0},0 z',
|
|
146
|
-
height: 30,
|
|
147
|
-
width: 30,
|
|
148
|
-
heightElements: [5, 12.5],
|
|
149
|
-
widthElements: [5, 12.5]
|
|
150
|
-
},
|
|
151
|
-
'GATEWAY_EVENT_BASED': {
|
|
152
|
-
d:'m {mx},{my} {e.x0},{e.y0} {e.x0},{e.y1} {e.x1},{e.y2} {e.x2},0 z',
|
|
153
|
-
height: 11,
|
|
154
|
-
width: 11,
|
|
155
|
-
heightElements: [-6, 6, 12, -12],
|
|
156
|
-
widthElements: [9, -3, -12]
|
|
157
|
-
},
|
|
158
|
-
'GATEWAY_COMPLEX': {
|
|
159
|
-
d:'m {mx},{my} 0,{e.y0} -{e.x0},-{e.y1} -{e.x1},{e.y2} {e.x0},{e.y1} -{e.x2},0 0,{e.y3} ' +
|
|
160
|
-
'{e.x2},0 -{e.x0},{e.y1} l {e.x1},{e.y2} {e.x0},-{e.y1} 0,{e.y0} {e.x3},0 0,-{e.y0} {e.x0},{e.y1} ' +
|
|
161
|
-
'{e.x1},-{e.y2} -{e.x0},-{e.y1} {e.x2},0 0,-{e.y3} -{e.x2},0 {e.x0},-{e.y1} -{e.x1},-{e.y2} ' +
|
|
162
|
-
'-{e.x0},{e.y1} 0,-{e.y0} -{e.x3},0 z',
|
|
163
|
-
height: 17.125,
|
|
164
|
-
width: 17.125,
|
|
165
|
-
heightElements: [4.875, 3.4375, 2.125, 3],
|
|
166
|
-
widthElements: [3.4375, 2.125, 4.875, 3]
|
|
167
|
-
},
|
|
168
|
-
'DATA_OBJECT_PATH': {
|
|
169
|
-
d:'m 0,0 {e.x1},0 {e.x0},{e.y0} 0,{e.y1} -{e.x2},0 0,-{e.y2} {e.x1},0 0,{e.y0} {e.x0},0',
|
|
170
|
-
height: 61,
|
|
171
|
-
width: 51,
|
|
172
|
-
heightElements: [10, 50, 60],
|
|
173
|
-
widthElements: [10, 40, 50, 60]
|
|
174
|
-
},
|
|
175
|
-
'DATA_OBJECT_COLLECTION_PATH': {
|
|
176
|
-
d:'m {mx}, {my} ' +
|
|
177
|
-
'm 0 15 l 0 -15 ' +
|
|
178
|
-
'm 4 15 l 0 -15 ' +
|
|
179
|
-
'm 4 15 l 0 -15 ',
|
|
180
|
-
height: 61,
|
|
181
|
-
width: 51,
|
|
182
|
-
heightElements: [12],
|
|
183
|
-
widthElements: [1, 6, 12, 15]
|
|
184
|
-
},
|
|
185
|
-
'DATA_ARROW': {
|
|
186
|
-
d:'m 5,9 9,0 0,-3 5,5 -5,5 0,-3 -9,0 z',
|
|
187
|
-
height: 61,
|
|
188
|
-
width: 51,
|
|
189
|
-
heightElements: [],
|
|
190
|
-
widthElements: []
|
|
191
|
-
},
|
|
192
|
-
'DATA_STORE': {
|
|
193
|
-
d:'m {mx},{my} ' +
|
|
194
|
-
'l 0,{e.y2} ' +
|
|
195
|
-
'c {e.x0},{e.y1} {e.x1},{e.y1} {e.x2},0 ' +
|
|
196
|
-
'l 0,-{e.y2} ' +
|
|
197
|
-
'c -{e.x0},-{e.y1} -{e.x1},-{e.y1} -{e.x2},0' +
|
|
198
|
-
'c {e.x0},{e.y1} {e.x1},{e.y1} {e.x2},0 ' +
|
|
199
|
-
'm -{e.x2},{e.y0}' +
|
|
200
|
-
'c {e.x0},{e.y1} {e.x1},{e.y1} {e.x2},0' +
|
|
201
|
-
'm -{e.x2},{e.y0}' +
|
|
202
|
-
'c {e.x0},{e.y1} {e.x1},{e.y1} {e.x2},0',
|
|
203
|
-
height: 61,
|
|
204
|
-
width: 61,
|
|
205
|
-
heightElements: [7, 10, 45],
|
|
206
|
-
widthElements: [2, 58, 60]
|
|
207
|
-
},
|
|
208
|
-
'TEXT_ANNOTATION': {
|
|
209
|
-
d: 'm {mx}, {my} m 10,0 l -10,0 l 0,{e.y0} l 10,0',
|
|
210
|
-
height: 30,
|
|
211
|
-
width: 10,
|
|
212
|
-
heightElements: [30],
|
|
213
|
-
widthElements: [10]
|
|
214
|
-
},
|
|
215
|
-
'MARKER_SUB_PROCESS': {
|
|
216
|
-
d: 'm{mx},{my} m 7,2 l 0,10 m -5,-5 l 10,0',
|
|
217
|
-
height: 10,
|
|
218
|
-
width: 10,
|
|
219
|
-
heightElements: [],
|
|
220
|
-
widthElements: []
|
|
221
|
-
},
|
|
222
|
-
'MARKER_PARALLEL': {
|
|
223
|
-
d: 'm{mx},{my} m 3,2 l 0,10 m 3,-10 l 0,10 m 3,-10 l 0,10',
|
|
224
|
-
height: 10,
|
|
225
|
-
width: 10,
|
|
226
|
-
heightElements: [],
|
|
227
|
-
widthElements: []
|
|
228
|
-
},
|
|
229
|
-
'MARKER_SEQUENTIAL': {
|
|
230
|
-
d: 'm{mx},{my} m 0,3 l 10,0 m -10,3 l 10,0 m -10,3 l 10,0',
|
|
231
|
-
height: 10,
|
|
232
|
-
width: 10,
|
|
233
|
-
heightElements: [],
|
|
234
|
-
widthElements: []
|
|
235
|
-
},
|
|
236
|
-
'MARKER_COMPENSATION': {
|
|
237
|
-
d: 'm {mx},{my} 7,-5 0,10 z m 7.1,-0.3 6.9,-4.7 0,10 -6.9,-4.7 z',
|
|
238
|
-
height: 10,
|
|
239
|
-
width: 21,
|
|
240
|
-
heightElements: [],
|
|
241
|
-
widthElements: []
|
|
242
|
-
},
|
|
243
|
-
'MARKER_LOOP': {
|
|
244
|
-
d: 'm {mx},{my} c 3.526979,0 6.386161,-2.829858 6.386161,-6.320661 0,-3.490806 -2.859182,-6.320661 ' +
|
|
245
|
-
'-6.386161,-6.320661 -3.526978,0 -6.38616,2.829855 -6.38616,6.320661 0,1.745402 ' +
|
|
246
|
-
'0.714797,3.325567 1.870463,4.469381 0.577834,0.571908 1.265885,1.034728 2.029916,1.35457 ' +
|
|
247
|
-
'l -0.718163,-3.909793 m 0.718163,3.909793 -3.885211,0.802902',
|
|
248
|
-
height: 13.9,
|
|
249
|
-
width: 13.7,
|
|
250
|
-
heightElements: [],
|
|
251
|
-
widthElements: []
|
|
252
|
-
},
|
|
253
|
-
'MARKER_ADHOC': {
|
|
254
|
-
d: 'm {mx},{my} m 0.84461,2.64411 c 1.05533,-1.23780996 2.64337,-2.07882 4.29653,-1.97997996 2.05163,0.0805 ' +
|
|
255
|
-
'3.85579,1.15803 5.76082,1.79107 1.06385,0.34139996 2.24454,0.1438 3.18759,-0.43767 0.61743,-0.33642 ' +
|
|
256
|
-
'1.2775,-0.64078 1.7542,-1.17511 0,0.56023 0,1.12046 0,1.6807 -0.98706,0.96237996 -2.29792,1.62393996 ' +
|
|
257
|
-
'-3.6918,1.66181996 -1.24459,0.0927 -2.46671,-0.2491 -3.59505,-0.74812 -1.35789,-0.55965 ' +
|
|
258
|
-
'-2.75133,-1.33436996 -4.27027,-1.18121996 -1.37741,0.14601 -2.41842,1.13685996 -3.44288,1.96782996 z',
|
|
259
|
-
height: 4,
|
|
260
|
-
width: 15,
|
|
261
|
-
heightElements: [],
|
|
262
|
-
widthElements: []
|
|
263
|
-
},
|
|
264
|
-
'TASK_TYPE_SEND': {
|
|
265
|
-
d: 'm {mx},{my} l 0,{e.y1} l {e.x1},0 l 0,-{e.y1} z l {e.x0},{e.y0} l {e.x0},-{e.y0}',
|
|
266
|
-
height: 14,
|
|
267
|
-
width: 21,
|
|
268
|
-
heightElements: [6, 14],
|
|
269
|
-
widthElements: [10.5, 21]
|
|
270
|
-
},
|
|
271
|
-
'TASK_TYPE_SCRIPT': {
|
|
272
|
-
d: 'm {mx},{my} c 9.966553,-6.27276 -8.000926,-7.91932 2.968968,-14.938 l -8.802728,0 ' +
|
|
273
|
-
'c -10.969894,7.01868 6.997585,8.66524 -2.968967,14.938 z ' +
|
|
274
|
-
'm -7,-12 l 5,0 ' +
|
|
275
|
-
'm -4.5,3 l 4.5,0 ' +
|
|
276
|
-
'm -3,3 l 5,0' +
|
|
277
|
-
'm -4,3 l 5,0',
|
|
278
|
-
height: 15,
|
|
279
|
-
width: 12.6,
|
|
280
|
-
heightElements: [6, 14],
|
|
281
|
-
widthElements: [10.5, 21]
|
|
282
|
-
},
|
|
283
|
-
'TASK_TYPE_USER_1': {
|
|
284
|
-
d: 'm {mx},{my} c 0.909,-0.845 1.594,-2.049 1.594,-3.385 0,-2.554 -1.805,-4.62199999 ' +
|
|
285
|
-
'-4.357,-4.62199999 -2.55199998,0 -4.28799998,2.06799999 -4.28799998,4.62199999 0,1.348 ' +
|
|
286
|
-
'0.974,2.562 1.89599998,3.405 -0.52899998,0.187 -5.669,2.097 -5.794,4.7560005 v 6.718 ' +
|
|
287
|
-
'h 17 v -6.718 c 0,-2.2980005 -5.5279996,-4.5950005 -6.0509996,-4.7760005 z' +
|
|
288
|
-
'm -8,6 l 0,5.5 m 11,0 l 0,-5'
|
|
289
|
-
},
|
|
290
|
-
'TASK_TYPE_USER_2': {
|
|
291
|
-
d: 'm {mx},{my} m 2.162,1.009 c 0,2.4470005 -2.158,4.4310005 -4.821,4.4310005 ' +
|
|
292
|
-
'-2.66499998,0 -4.822,-1.981 -4.822,-4.4310005 '
|
|
293
|
-
},
|
|
294
|
-
'TASK_TYPE_USER_3': {
|
|
295
|
-
d: 'm {mx},{my} m -6.9,-3.80 c 0,0 2.25099998,-2.358 4.27399998,-1.177 2.024,1.181 4.221,1.537 ' +
|
|
296
|
-
'4.124,0.965 -0.098,-0.57 -0.117,-3.79099999 -4.191,-4.13599999 -3.57499998,0.001 ' +
|
|
297
|
-
'-4.20799998,3.36699999 -4.20699998,4.34799999 z'
|
|
298
|
-
},
|
|
299
|
-
'TASK_TYPE_MANUAL': {
|
|
300
|
-
d: 'm {mx},{my} c 0.234,-0.01 5.604,0.008 8.029,0.004 0.808,0 1.271,-0.172 1.417,-0.752 0.227,-0.898 ' +
|
|
301
|
-
'-0.334,-1.314 -1.338,-1.316 -2.467,-0.01 -7.886,-0.004 -8.108,-0.004 -0.014,-0.079 0.016,-0.533 0,-0.61 ' +
|
|
302
|
-
'0.195,-0.042 8.507,0.006 9.616,0.002 0.877,-0.007 1.35,-0.438 1.353,-1.208 0.003,-0.768 -0.479,-1.09 ' +
|
|
303
|
-
'-1.35,-1.091 -2.968,-0.002 -9.619,-0.013 -9.619,-0.013 v -0.591 c 0,0 5.052,-0.016 7.225,-0.016 ' +
|
|
304
|
-
'0.888,-0.002 1.354,-0.416 1.351,-1.193 -0.006,-0.761 -0.492,-1.196 -1.361,-1.196 -3.473,-0.005 ' +
|
|
305
|
-
'-10.86,-0.003 -11.0829995,-0.003 -0.022,-0.047 -0.045,-0.094 -0.069,-0.139 0.3939995,-0.319 ' +
|
|
306
|
-
'2.0409995,-1.626 2.4149995,-2.017 0.469,-0.4870005 0.519,-1.1650005 0.162,-1.6040005 -0.414,-0.511 ' +
|
|
307
|
-
'-0.973,-0.5 -1.48,-0.236 -1.4609995,0.764 -6.5999995,3.6430005 -7.7329995,4.2710005 -0.9,0.499 ' +
|
|
308
|
-
'-1.516,1.253 -1.882,2.19 -0.37000002,0.95 -0.17,2.01 -0.166,2.979 0.004,0.718 -0.27300002,1.345 ' +
|
|
309
|
-
'-0.055,2.063 0.629,2.087 2.425,3.312 4.859,3.318 4.6179995,0.014 9.2379995,-0.139 13.8569995,-0.158 ' +
|
|
310
|
-
'0.755,-0.004 1.171,-0.301 1.182,-1.033 0.012,-0.754 -0.423,-0.969 -1.183,-0.973 -1.778,-0.01 ' +
|
|
311
|
-
'-5.824,-0.004 -6.04,-0.004 10e-4,-0.084 0.003,-0.586 10e-4,-0.67 z'
|
|
312
|
-
},
|
|
313
|
-
'TASK_TYPE_INSTANTIATING_SEND': {
|
|
314
|
-
d: 'm {mx},{my} l 0,8.4 l 12.6,0 l 0,-8.4 z l 6.3,3.6 l 6.3,-3.6'
|
|
315
|
-
},
|
|
316
|
-
'TASK_TYPE_SERVICE': {
|
|
317
|
-
d: 'm {mx},{my} v -1.71335 c 0.352326,-0.0705 0.703932,-0.17838 1.047628,-0.32133 ' +
|
|
318
|
-
'0.344416,-0.14465 0.665822,-0.32133 0.966377,-0.52145 l 1.19431,1.18005 1.567487,-1.57688 ' +
|
|
319
|
-
'-1.195028,-1.18014 c 0.403376,-0.61394 0.683079,-1.29908 0.825447,-2.01824 l 1.622133,-0.01 ' +
|
|
320
|
-
'v -2.2196 l -1.636514,0.01 c -0.07333,-0.35153 -0.178319,-0.70024 -0.323564,-1.04372 ' +
|
|
321
|
-
'-0.145244,-0.34406 -0.321407,-0.6644 -0.522735,-0.96217 l 1.131035,-1.13631 -1.583305,-1.56293 ' +
|
|
322
|
-
'-1.129598,1.13589 c -0.614052,-0.40108 -1.302883,-0.68093 -2.022633,-0.82247 l 0.0093,-1.61852 ' +
|
|
323
|
-
'h -2.241173 l 0.0042,1.63124 c -0.353763,0.0736 -0.705369,0.17977 -1.049785,0.32371 -0.344415,0.14437 ' +
|
|
324
|
-
'-0.665102,0.32092 -0.9635006,0.52046 l -1.1698628,-1.15823 -1.5667691,1.5792 1.1684265,1.15669 ' +
|
|
325
|
-
'c -0.4026573,0.61283 -0.68308,1.29797 -0.8247287,2.01713 l -1.6588041,0.003 v 2.22174 ' +
|
|
326
|
-
'l 1.6724648,-0.006 c 0.073327,0.35077 0.1797598,0.70243 0.3242851,1.04472 0.1452428,0.34448 ' +
|
|
327
|
-
'0.3214064,0.6644 0.5227339,0.96066 l -1.1993431,1.19723 1.5840256,1.56011 1.1964668,-1.19348 ' +
|
|
328
|
-
'c 0.6140517,0.40346 1.3028827,0.68232 2.0233517,0.82331 l 7.19e-4,1.69892 h 2.226848 z ' +
|
|
329
|
-
'm 0.221462,-3.9957 c -1.788948,0.7502 -3.8576,-0.0928 -4.6097055,-1.87438 -0.7521065,-1.78321 ' +
|
|
330
|
-
'0.090598,-3.84627 1.8802645,-4.59604 1.78823,-0.74936 3.856881,0.0929 4.608987,1.87437 ' +
|
|
331
|
-
'0.752106,1.78165 -0.0906,3.84612 -1.879546,4.59605 z'
|
|
332
|
-
},
|
|
333
|
-
'TASK_TYPE_SERVICE_FILL': {
|
|
334
|
-
d: 'm {mx},{my} c -1.788948,0.7502 -3.8576,-0.0928 -4.6097055,-1.87438 -0.7521065,-1.78321 ' +
|
|
335
|
-
'0.090598,-3.84627 1.8802645,-4.59604 1.78823,-0.74936 3.856881,0.0929 4.608987,1.87437 ' +
|
|
336
|
-
'0.752106,1.78165 -0.0906,3.84612 -1.879546,4.59605 z'
|
|
337
|
-
},
|
|
338
|
-
'TASK_TYPE_BUSINESS_RULE_HEADER': {
|
|
339
|
-
d: 'm {mx},{my} 0,4 20,0 0,-4 z'
|
|
340
|
-
},
|
|
341
|
-
'TASK_TYPE_BUSINESS_RULE_MAIN': {
|
|
342
|
-
d: 'm {mx},{my} 0,12 20,0 0,-12 z' +
|
|
343
|
-
'm 0,8 l 20,0 ' +
|
|
344
|
-
'm -13,-4 l 0,8'
|
|
345
|
-
},
|
|
346
|
-
'MESSAGE_FLOW_MARKER': {
|
|
347
|
-
d: 'm {mx},{my} m -10.5 ,-7 l 0,14 l 21,0 l 0,-14 z l 10.5,6 l 10.5,-6'
|
|
348
|
-
}
|
|
349
|
-
};
|
|
350
|
-
|
|
351
|
-
this.getRawPath = function getRawPath(pathId) {
|
|
352
|
-
return this.pathMap[pathId].d;
|
|
353
|
-
};
|
|
354
|
-
|
|
355
|
-
/**
|
|
356
|
-
* Scales the path to the given height and width.
|
|
357
|
-
* <h1>Use case</h1>
|
|
358
|
-
* <p>Use case is to scale the content of elements (event, gateways) based
|
|
359
|
-
* on the element bounding box's size.
|
|
360
|
-
* </p>
|
|
361
|
-
* <h1>Why not transform</h1>
|
|
362
|
-
* <p>Scaling a path with transform() will also scale the stroke and IE does not support
|
|
363
|
-
* the option 'non-scaling-stroke' to prevent this.
|
|
364
|
-
* Also there are use cases where only some parts of a path should be
|
|
365
|
-
* scaled.</p>
|
|
366
|
-
*
|
|
367
|
-
* @param {String} pathId The ID of the path.
|
|
368
|
-
* @param {Object} param <p>
|
|
369
|
-
* Example param object scales the path to 60% size of the container (data.width, data.height).
|
|
370
|
-
* <pre>
|
|
371
|
-
* {
|
|
372
|
-
* xScaleFactor: 0.6,
|
|
373
|
-
* yScaleFactor:0.6,
|
|
374
|
-
* containerWidth: data.width,
|
|
375
|
-
* containerHeight: data.height,
|
|
376
|
-
* position: {
|
|
377
|
-
* mx: 0.46,
|
|
378
|
-
* my: 0.2,
|
|
379
|
-
* }
|
|
380
|
-
* }
|
|
381
|
-
* </pre>
|
|
382
|
-
* <ul>
|
|
383
|
-
* <li>targetpathwidth = xScaleFactor * containerWidth</li>
|
|
384
|
-
* <li>targetpathheight = yScaleFactor * containerHeight</li>
|
|
385
|
-
* <li>Position is used to set the starting coordinate of the path. M is computed:
|
|
386
|
-
* <ul>
|
|
387
|
-
* <li>position.x * containerWidth</li>
|
|
388
|
-
* <li>position.y * containerHeight</li>
|
|
389
|
-
* </ul>
|
|
390
|
-
* Center of the container <pre> position: {
|
|
391
|
-
* mx: 0.5,
|
|
392
|
-
* my: 0.5,
|
|
393
|
-
* }</pre>
|
|
394
|
-
* Upper left corner of the container
|
|
395
|
-
* <pre> position: {
|
|
396
|
-
* mx: 0.0,
|
|
397
|
-
* my: 0.0,
|
|
398
|
-
* }</pre>
|
|
399
|
-
* </li>
|
|
400
|
-
* </ul>
|
|
401
|
-
* </p>
|
|
402
|
-
*
|
|
403
|
-
*/
|
|
404
|
-
this.getScaledPath = function getScaledPath(pathId, param) {
|
|
405
|
-
var rawPath = this.pathMap[pathId];
|
|
406
|
-
|
|
407
|
-
// positioning
|
|
408
|
-
// compute the start point of the path
|
|
409
|
-
var mx, my;
|
|
410
|
-
|
|
411
|
-
if (param.abspos) {
|
|
412
|
-
mx = param.abspos.x;
|
|
413
|
-
my = param.abspos.y;
|
|
414
|
-
} else {
|
|
415
|
-
mx = param.containerWidth * param.position.mx;
|
|
416
|
-
my = param.containerHeight * param.position.my;
|
|
417
|
-
}
|
|
418
|
-
|
|
419
|
-
var coordinates = {}; //map for the scaled coordinates
|
|
420
|
-
if (param.position) {
|
|
421
|
-
|
|
422
|
-
// path
|
|
423
|
-
var heightRatio = (param.containerHeight / rawPath.height) * param.yScaleFactor;
|
|
424
|
-
var widthRatio = (param.containerWidth / rawPath.width) * param.xScaleFactor;
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
//Apply height ratio
|
|
428
|
-
for (var heightIndex = 0; heightIndex < rawPath.heightElements.length; heightIndex++) {
|
|
429
|
-
coordinates['y' + heightIndex] = rawPath.heightElements[heightIndex] * heightRatio;
|
|
430
|
-
}
|
|
431
|
-
|
|
432
|
-
//Apply width ratio
|
|
433
|
-
for (var widthIndex = 0; widthIndex < rawPath.widthElements.length; widthIndex++) {
|
|
434
|
-
coordinates['x' + widthIndex] = rawPath.widthElements[widthIndex] * widthRatio;
|
|
435
|
-
}
|
|
436
|
-
}
|
|
437
|
-
|
|
438
|
-
//Apply value to raw path
|
|
439
|
-
var path = format(
|
|
440
|
-
rawPath.d, {
|
|
441
|
-
mx: mx,
|
|
442
|
-
my: my,
|
|
443
|
-
e: coordinates
|
|
444
|
-
}
|
|
445
|
-
);
|
|
446
|
-
return path;
|
|
447
|
-
};
|
|
448
|
-
}
|
|
449
|
-
|
|
450
|
-
module.exports = PathMap;
|
|
451
|
-
|
|
452
|
-
////////// helpers //////////
|
|
453
|
-
|
|
454
|
-
// copied from https://github.com/adobe-webplatform/Snap.svg/blob/master/src/svg.js
|
|
455
|
-
var tokenRegex = /\{([^\}]+)\}/g,
|
|
456
|
-
objNotationRegex = /(?:(?:^|\.)(.+?)(?=\[|\.|$|\()|\[('|")(.+?)\2\])(\(\))?/g; // matches .xxxxx or ["xxxxx"] to run over object properties
|
|
457
|
-
|
|
458
|
-
function replacer(all, key, obj) {
|
|
459
|
-
var res = obj;
|
|
460
|
-
key.replace(objNotationRegex, function(all, name, quote, quotedName, isFunc) {
|
|
461
|
-
name = name || quotedName;
|
|
462
|
-
if (res) {
|
|
463
|
-
if (name in res) {
|
|
464
|
-
res = res[name];
|
|
465
|
-
}
|
|
466
|
-
typeof res == 'function' && isFunc && (res = res());
|
|
467
|
-
}
|
|
468
|
-
});
|
|
469
|
-
res = (res == null || res == obj ? all : res) + '';
|
|
470
|
-
|
|
471
|
-
return res;
|
|
472
|
-
}
|
|
473
|
-
|
|
474
|
-
function format(str, obj) {
|
|
475
|
-
return String(str).replace(tokenRegex, function(all, key) {
|
|
476
|
-
return replacer(all, key, obj);
|
|
477
|
-
});
|
|
478
|
-
}
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Map containing SVG paths needed by BpmnRenderer.
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
function PathMap() {
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* Contains a map of path elements
|
|
11
|
+
*
|
|
12
|
+
* <h1>Path definition</h1>
|
|
13
|
+
* A parameterized path is defined like this:
|
|
14
|
+
* <pre>
|
|
15
|
+
* 'GATEWAY_PARALLEL': {
|
|
16
|
+
* d: 'm {mx},{my} {e.x0},0 0,{e.x1} {e.x1},0 0,{e.y0} -{e.x1},0 0,{e.y1} ' +
|
|
17
|
+
'-{e.x0},0 0,-{e.y1} -{e.x1},0 0,-{e.y0} {e.x1},0 z',
|
|
18
|
+
* height: 17.5,
|
|
19
|
+
* width: 17.5,
|
|
20
|
+
* heightElements: [2.5, 7.5],
|
|
21
|
+
* widthElements: [2.5, 7.5]
|
|
22
|
+
* }
|
|
23
|
+
* </pre>
|
|
24
|
+
* <p>It's important to specify a correct <b>height and width</b> for the path as the scaling
|
|
25
|
+
* is based on the ratio between the specified height and width in this object and the
|
|
26
|
+
* height and width that is set as scale target (Note x,y coordinates will be scaled with
|
|
27
|
+
* individual ratios).</p>
|
|
28
|
+
* <p>The '<b>heightElements</b>' and '<b>widthElements</b>' array must contain the values that will be scaled.
|
|
29
|
+
* The scaling is based on the computed ratios.
|
|
30
|
+
* Coordinates on the y axis should be in the <b>heightElement</b>'s array, they will be scaled using
|
|
31
|
+
* the computed ratio coefficient.
|
|
32
|
+
* In the parameterized path the scaled values can be accessed through the 'e' object in {} brackets.
|
|
33
|
+
* <ul>
|
|
34
|
+
* <li>The values for the y axis can be accessed in the path string using {e.y0}, {e.y1}, ....</li>
|
|
35
|
+
* <li>The values for the x axis can be accessed in the path string using {e.x0}, {e.x1}, ....</li>
|
|
36
|
+
* </ul>
|
|
37
|
+
* The numbers x0, x1 respectively y0, y1, ... map to the corresponding array index.
|
|
38
|
+
* </p>
|
|
39
|
+
*/
|
|
40
|
+
this.pathMap = {
|
|
41
|
+
'EVENT_MESSAGE': {
|
|
42
|
+
d: 'm {mx},{my} l 0,{e.y1} l {e.x1},0 l 0,-{e.y1} z l {e.x0},{e.y0} l {e.x0},-{e.y0}',
|
|
43
|
+
height: 36,
|
|
44
|
+
width: 36,
|
|
45
|
+
heightElements: [6, 14],
|
|
46
|
+
widthElements: [10.5, 21]
|
|
47
|
+
},
|
|
48
|
+
'EVENT_SIGNAL': {
|
|
49
|
+
d: 'M {mx},{my} l {e.x0},{e.y0} l -{e.x1},0 Z',
|
|
50
|
+
height: 36,
|
|
51
|
+
width: 36,
|
|
52
|
+
heightElements: [18],
|
|
53
|
+
widthElements: [10, 20]
|
|
54
|
+
},
|
|
55
|
+
'EVENT_ESCALATION': {
|
|
56
|
+
d: 'M {mx},{my} l {e.x0},{e.y0} l -{e.x0},-{e.y1} l -{e.x0},{e.y1} Z',
|
|
57
|
+
height: 36,
|
|
58
|
+
width: 36,
|
|
59
|
+
heightElements: [20, 7],
|
|
60
|
+
widthElements: [8]
|
|
61
|
+
},
|
|
62
|
+
'EVENT_CONDITIONAL': {
|
|
63
|
+
d: 'M {e.x0},{e.y0} l {e.x1},0 l 0,{e.y2} l -{e.x1},0 Z ' +
|
|
64
|
+
'M {e.x2},{e.y3} l {e.x0},0 ' +
|
|
65
|
+
'M {e.x2},{e.y4} l {e.x0},0 ' +
|
|
66
|
+
'M {e.x2},{e.y5} l {e.x0},0 ' +
|
|
67
|
+
'M {e.x2},{e.y6} l {e.x0},0 ' +
|
|
68
|
+
'M {e.x2},{e.y7} l {e.x0},0 ' +
|
|
69
|
+
'M {e.x2},{e.y8} l {e.x0},0 ',
|
|
70
|
+
height: 36,
|
|
71
|
+
width: 36,
|
|
72
|
+
heightElements: [8.5, 14.5, 18, 11.5, 14.5, 17.5, 20.5, 23.5, 26.5],
|
|
73
|
+
widthElements: [10.5, 14.5, 12.5]
|
|
74
|
+
},
|
|
75
|
+
'EVENT_LINK': {
|
|
76
|
+
d: 'm {mx},{my} 0,{e.y0} -{e.x1},0 0,{e.y1} {e.x1},0 0,{e.y0} {e.x0},-{e.y2} -{e.x0},-{e.y2} z',
|
|
77
|
+
height: 36,
|
|
78
|
+
width: 36,
|
|
79
|
+
heightElements: [4.4375, 6.75, 7.8125],
|
|
80
|
+
widthElements: [9.84375, 13.5]
|
|
81
|
+
},
|
|
82
|
+
'EVENT_ERROR': {
|
|
83
|
+
d: 'm {mx},{my} {e.x0},-{e.y0} {e.x1},-{e.y1} {e.x2},{e.y2} {e.x3},-{e.y3} -{e.x4},{e.y4} -{e.x5},-{e.y5} z',
|
|
84
|
+
height: 36,
|
|
85
|
+
width: 36,
|
|
86
|
+
heightElements: [0.023, 8.737, 8.151, 16.564, 10.591, 8.714],
|
|
87
|
+
widthElements: [0.085, 6.672, 6.97, 4.273, 5.337, 6.636]
|
|
88
|
+
},
|
|
89
|
+
'EVENT_CANCEL_45': {
|
|
90
|
+
d: 'm {mx},{my} -{e.x1},0 0,{e.x0} {e.x1},0 0,{e.y1} {e.x0},0 ' +
|
|
91
|
+
'0,-{e.y1} {e.x1},0 0,-{e.y0} -{e.x1},0 0,-{e.y1} -{e.x0},0 z',
|
|
92
|
+
height: 36,
|
|
93
|
+
width: 36,
|
|
94
|
+
heightElements: [4.75, 8.5],
|
|
95
|
+
widthElements: [4.75, 8.5]
|
|
96
|
+
},
|
|
97
|
+
'EVENT_COMPENSATION': {
|
|
98
|
+
d: 'm {mx},{my} {e.x0},-{e.y0} 0,{e.y1} z m {e.x1},-{e.y2} {e.x2},-{e.y3} 0,{e.y1} -{e.x2},-{e.y3} z',
|
|
99
|
+
height: 36,
|
|
100
|
+
width: 36,
|
|
101
|
+
heightElements: [6.5, 13, 0.4, 6.1],
|
|
102
|
+
widthElements: [9, 9.3, 8.7]
|
|
103
|
+
},
|
|
104
|
+
'EVENT_TIMER_WH': {
|
|
105
|
+
d: 'M {mx},{my} l {e.x0},-{e.y0} m -{e.x0},{e.y0} l {e.x1},{e.y1} ',
|
|
106
|
+
height: 36,
|
|
107
|
+
width: 36,
|
|
108
|
+
heightElements: [10, 2],
|
|
109
|
+
widthElements: [3, 7]
|
|
110
|
+
},
|
|
111
|
+
'EVENT_TIMER_LINE': {
|
|
112
|
+
d: 'M {mx},{my} ' +
|
|
113
|
+
'm {e.x0},{e.y0} l -{e.x1},{e.y1} ',
|
|
114
|
+
height: 36,
|
|
115
|
+
width: 36,
|
|
116
|
+
heightElements: [10, 3],
|
|
117
|
+
widthElements: [0, 0]
|
|
118
|
+
},
|
|
119
|
+
'EVENT_MULTIPLE': {
|
|
120
|
+
d:'m {mx},{my} {e.x1},-{e.y0} {e.x1},{e.y0} -{e.x0},{e.y1} -{e.x2},0 z',
|
|
121
|
+
height: 36,
|
|
122
|
+
width: 36,
|
|
123
|
+
heightElements: [6.28099, 12.56199],
|
|
124
|
+
widthElements: [3.1405, 9.42149, 12.56198]
|
|
125
|
+
},
|
|
126
|
+
'EVENT_PARALLEL_MULTIPLE': {
|
|
127
|
+
d:'m {mx},{my} {e.x0},0 0,{e.y1} {e.x1},0 0,{e.y0} -{e.x1},0 0,{e.y1} ' +
|
|
128
|
+
'-{e.x0},0 0,-{e.y1} -{e.x1},0 0,-{e.y0} {e.x1},0 z',
|
|
129
|
+
height: 36,
|
|
130
|
+
width: 36,
|
|
131
|
+
heightElements: [2.56228, 7.68683],
|
|
132
|
+
widthElements: [2.56228, 7.68683]
|
|
133
|
+
},
|
|
134
|
+
'GATEWAY_EXCLUSIVE': {
|
|
135
|
+
d:'m {mx},{my} {e.x0},{e.y0} {e.x1},{e.y0} {e.x2},0 {e.x4},{e.y2} ' +
|
|
136
|
+
'{e.x4},{e.y1} {e.x2},0 {e.x1},{e.y3} {e.x0},{e.y3} ' +
|
|
137
|
+
'{e.x3},0 {e.x5},{e.y1} {e.x5},{e.y2} {e.x3},0 z',
|
|
138
|
+
height: 17.5,
|
|
139
|
+
width: 17.5,
|
|
140
|
+
heightElements: [8.5, 6.5312, -6.5312, -8.5],
|
|
141
|
+
widthElements: [6.5, -6.5, 3, -3, 5, -5]
|
|
142
|
+
},
|
|
143
|
+
'GATEWAY_PARALLEL': {
|
|
144
|
+
d:'m {mx},{my} 0,{e.y1} -{e.x1},0 0,{e.y0} {e.x1},0 0,{e.y1} {e.x0},0 ' +
|
|
145
|
+
'0,-{e.y1} {e.x1},0 0,-{e.y0} -{e.x1},0 0,-{e.y1} -{e.x0},0 z',
|
|
146
|
+
height: 30,
|
|
147
|
+
width: 30,
|
|
148
|
+
heightElements: [5, 12.5],
|
|
149
|
+
widthElements: [5, 12.5]
|
|
150
|
+
},
|
|
151
|
+
'GATEWAY_EVENT_BASED': {
|
|
152
|
+
d:'m {mx},{my} {e.x0},{e.y0} {e.x0},{e.y1} {e.x1},{e.y2} {e.x2},0 z',
|
|
153
|
+
height: 11,
|
|
154
|
+
width: 11,
|
|
155
|
+
heightElements: [-6, 6, 12, -12],
|
|
156
|
+
widthElements: [9, -3, -12]
|
|
157
|
+
},
|
|
158
|
+
'GATEWAY_COMPLEX': {
|
|
159
|
+
d:'m {mx},{my} 0,{e.y0} -{e.x0},-{e.y1} -{e.x1},{e.y2} {e.x0},{e.y1} -{e.x2},0 0,{e.y3} ' +
|
|
160
|
+
'{e.x2},0 -{e.x0},{e.y1} l {e.x1},{e.y2} {e.x0},-{e.y1} 0,{e.y0} {e.x3},0 0,-{e.y0} {e.x0},{e.y1} ' +
|
|
161
|
+
'{e.x1},-{e.y2} -{e.x0},-{e.y1} {e.x2},0 0,-{e.y3} -{e.x2},0 {e.x0},-{e.y1} -{e.x1},-{e.y2} ' +
|
|
162
|
+
'-{e.x0},{e.y1} 0,-{e.y0} -{e.x3},0 z',
|
|
163
|
+
height: 17.125,
|
|
164
|
+
width: 17.125,
|
|
165
|
+
heightElements: [4.875, 3.4375, 2.125, 3],
|
|
166
|
+
widthElements: [3.4375, 2.125, 4.875, 3]
|
|
167
|
+
},
|
|
168
|
+
'DATA_OBJECT_PATH': {
|
|
169
|
+
d:'m 0,0 {e.x1},0 {e.x0},{e.y0} 0,{e.y1} -{e.x2},0 0,-{e.y2} {e.x1},0 0,{e.y0} {e.x0},0',
|
|
170
|
+
height: 61,
|
|
171
|
+
width: 51,
|
|
172
|
+
heightElements: [10, 50, 60],
|
|
173
|
+
widthElements: [10, 40, 50, 60]
|
|
174
|
+
},
|
|
175
|
+
'DATA_OBJECT_COLLECTION_PATH': {
|
|
176
|
+
d:'m {mx}, {my} ' +
|
|
177
|
+
'm 0 15 l 0 -15 ' +
|
|
178
|
+
'm 4 15 l 0 -15 ' +
|
|
179
|
+
'm 4 15 l 0 -15 ',
|
|
180
|
+
height: 61,
|
|
181
|
+
width: 51,
|
|
182
|
+
heightElements: [12],
|
|
183
|
+
widthElements: [1, 6, 12, 15]
|
|
184
|
+
},
|
|
185
|
+
'DATA_ARROW': {
|
|
186
|
+
d:'m 5,9 9,0 0,-3 5,5 -5,5 0,-3 -9,0 z',
|
|
187
|
+
height: 61,
|
|
188
|
+
width: 51,
|
|
189
|
+
heightElements: [],
|
|
190
|
+
widthElements: []
|
|
191
|
+
},
|
|
192
|
+
'DATA_STORE': {
|
|
193
|
+
d:'m {mx},{my} ' +
|
|
194
|
+
'l 0,{e.y2} ' +
|
|
195
|
+
'c {e.x0},{e.y1} {e.x1},{e.y1} {e.x2},0 ' +
|
|
196
|
+
'l 0,-{e.y2} ' +
|
|
197
|
+
'c -{e.x0},-{e.y1} -{e.x1},-{e.y1} -{e.x2},0' +
|
|
198
|
+
'c {e.x0},{e.y1} {e.x1},{e.y1} {e.x2},0 ' +
|
|
199
|
+
'm -{e.x2},{e.y0}' +
|
|
200
|
+
'c {e.x0},{e.y1} {e.x1},{e.y1} {e.x2},0' +
|
|
201
|
+
'm -{e.x2},{e.y0}' +
|
|
202
|
+
'c {e.x0},{e.y1} {e.x1},{e.y1} {e.x2},0',
|
|
203
|
+
height: 61,
|
|
204
|
+
width: 61,
|
|
205
|
+
heightElements: [7, 10, 45],
|
|
206
|
+
widthElements: [2, 58, 60]
|
|
207
|
+
},
|
|
208
|
+
'TEXT_ANNOTATION': {
|
|
209
|
+
d: 'm {mx}, {my} m 10,0 l -10,0 l 0,{e.y0} l 10,0',
|
|
210
|
+
height: 30,
|
|
211
|
+
width: 10,
|
|
212
|
+
heightElements: [30],
|
|
213
|
+
widthElements: [10]
|
|
214
|
+
},
|
|
215
|
+
'MARKER_SUB_PROCESS': {
|
|
216
|
+
d: 'm{mx},{my} m 7,2 l 0,10 m -5,-5 l 10,0',
|
|
217
|
+
height: 10,
|
|
218
|
+
width: 10,
|
|
219
|
+
heightElements: [],
|
|
220
|
+
widthElements: []
|
|
221
|
+
},
|
|
222
|
+
'MARKER_PARALLEL': {
|
|
223
|
+
d: 'm{mx},{my} m 3,2 l 0,10 m 3,-10 l 0,10 m 3,-10 l 0,10',
|
|
224
|
+
height: 10,
|
|
225
|
+
width: 10,
|
|
226
|
+
heightElements: [],
|
|
227
|
+
widthElements: []
|
|
228
|
+
},
|
|
229
|
+
'MARKER_SEQUENTIAL': {
|
|
230
|
+
d: 'm{mx},{my} m 0,3 l 10,0 m -10,3 l 10,0 m -10,3 l 10,0',
|
|
231
|
+
height: 10,
|
|
232
|
+
width: 10,
|
|
233
|
+
heightElements: [],
|
|
234
|
+
widthElements: []
|
|
235
|
+
},
|
|
236
|
+
'MARKER_COMPENSATION': {
|
|
237
|
+
d: 'm {mx},{my} 7,-5 0,10 z m 7.1,-0.3 6.9,-4.7 0,10 -6.9,-4.7 z',
|
|
238
|
+
height: 10,
|
|
239
|
+
width: 21,
|
|
240
|
+
heightElements: [],
|
|
241
|
+
widthElements: []
|
|
242
|
+
},
|
|
243
|
+
'MARKER_LOOP': {
|
|
244
|
+
d: 'm {mx},{my} c 3.526979,0 6.386161,-2.829858 6.386161,-6.320661 0,-3.490806 -2.859182,-6.320661 ' +
|
|
245
|
+
'-6.386161,-6.320661 -3.526978,0 -6.38616,2.829855 -6.38616,6.320661 0,1.745402 ' +
|
|
246
|
+
'0.714797,3.325567 1.870463,4.469381 0.577834,0.571908 1.265885,1.034728 2.029916,1.35457 ' +
|
|
247
|
+
'l -0.718163,-3.909793 m 0.718163,3.909793 -3.885211,0.802902',
|
|
248
|
+
height: 13.9,
|
|
249
|
+
width: 13.7,
|
|
250
|
+
heightElements: [],
|
|
251
|
+
widthElements: []
|
|
252
|
+
},
|
|
253
|
+
'MARKER_ADHOC': {
|
|
254
|
+
d: 'm {mx},{my} m 0.84461,2.64411 c 1.05533,-1.23780996 2.64337,-2.07882 4.29653,-1.97997996 2.05163,0.0805 ' +
|
|
255
|
+
'3.85579,1.15803 5.76082,1.79107 1.06385,0.34139996 2.24454,0.1438 3.18759,-0.43767 0.61743,-0.33642 ' +
|
|
256
|
+
'1.2775,-0.64078 1.7542,-1.17511 0,0.56023 0,1.12046 0,1.6807 -0.98706,0.96237996 -2.29792,1.62393996 ' +
|
|
257
|
+
'-3.6918,1.66181996 -1.24459,0.0927 -2.46671,-0.2491 -3.59505,-0.74812 -1.35789,-0.55965 ' +
|
|
258
|
+
'-2.75133,-1.33436996 -4.27027,-1.18121996 -1.37741,0.14601 -2.41842,1.13685996 -3.44288,1.96782996 z',
|
|
259
|
+
height: 4,
|
|
260
|
+
width: 15,
|
|
261
|
+
heightElements: [],
|
|
262
|
+
widthElements: []
|
|
263
|
+
},
|
|
264
|
+
'TASK_TYPE_SEND': {
|
|
265
|
+
d: 'm {mx},{my} l 0,{e.y1} l {e.x1},0 l 0,-{e.y1} z l {e.x0},{e.y0} l {e.x0},-{e.y0}',
|
|
266
|
+
height: 14,
|
|
267
|
+
width: 21,
|
|
268
|
+
heightElements: [6, 14],
|
|
269
|
+
widthElements: [10.5, 21]
|
|
270
|
+
},
|
|
271
|
+
'TASK_TYPE_SCRIPT': {
|
|
272
|
+
d: 'm {mx},{my} c 9.966553,-6.27276 -8.000926,-7.91932 2.968968,-14.938 l -8.802728,0 ' +
|
|
273
|
+
'c -10.969894,7.01868 6.997585,8.66524 -2.968967,14.938 z ' +
|
|
274
|
+
'm -7,-12 l 5,0 ' +
|
|
275
|
+
'm -4.5,3 l 4.5,0 ' +
|
|
276
|
+
'm -3,3 l 5,0' +
|
|
277
|
+
'm -4,3 l 5,0',
|
|
278
|
+
height: 15,
|
|
279
|
+
width: 12.6,
|
|
280
|
+
heightElements: [6, 14],
|
|
281
|
+
widthElements: [10.5, 21]
|
|
282
|
+
},
|
|
283
|
+
'TASK_TYPE_USER_1': {
|
|
284
|
+
d: 'm {mx},{my} c 0.909,-0.845 1.594,-2.049 1.594,-3.385 0,-2.554 -1.805,-4.62199999 ' +
|
|
285
|
+
'-4.357,-4.62199999 -2.55199998,0 -4.28799998,2.06799999 -4.28799998,4.62199999 0,1.348 ' +
|
|
286
|
+
'0.974,2.562 1.89599998,3.405 -0.52899998,0.187 -5.669,2.097 -5.794,4.7560005 v 6.718 ' +
|
|
287
|
+
'h 17 v -6.718 c 0,-2.2980005 -5.5279996,-4.5950005 -6.0509996,-4.7760005 z' +
|
|
288
|
+
'm -8,6 l 0,5.5 m 11,0 l 0,-5'
|
|
289
|
+
},
|
|
290
|
+
'TASK_TYPE_USER_2': {
|
|
291
|
+
d: 'm {mx},{my} m 2.162,1.009 c 0,2.4470005 -2.158,4.4310005 -4.821,4.4310005 ' +
|
|
292
|
+
'-2.66499998,0 -4.822,-1.981 -4.822,-4.4310005 '
|
|
293
|
+
},
|
|
294
|
+
'TASK_TYPE_USER_3': {
|
|
295
|
+
d: 'm {mx},{my} m -6.9,-3.80 c 0,0 2.25099998,-2.358 4.27399998,-1.177 2.024,1.181 4.221,1.537 ' +
|
|
296
|
+
'4.124,0.965 -0.098,-0.57 -0.117,-3.79099999 -4.191,-4.13599999 -3.57499998,0.001 ' +
|
|
297
|
+
'-4.20799998,3.36699999 -4.20699998,4.34799999 z'
|
|
298
|
+
},
|
|
299
|
+
'TASK_TYPE_MANUAL': {
|
|
300
|
+
d: 'm {mx},{my} c 0.234,-0.01 5.604,0.008 8.029,0.004 0.808,0 1.271,-0.172 1.417,-0.752 0.227,-0.898 ' +
|
|
301
|
+
'-0.334,-1.314 -1.338,-1.316 -2.467,-0.01 -7.886,-0.004 -8.108,-0.004 -0.014,-0.079 0.016,-0.533 0,-0.61 ' +
|
|
302
|
+
'0.195,-0.042 8.507,0.006 9.616,0.002 0.877,-0.007 1.35,-0.438 1.353,-1.208 0.003,-0.768 -0.479,-1.09 ' +
|
|
303
|
+
'-1.35,-1.091 -2.968,-0.002 -9.619,-0.013 -9.619,-0.013 v -0.591 c 0,0 5.052,-0.016 7.225,-0.016 ' +
|
|
304
|
+
'0.888,-0.002 1.354,-0.416 1.351,-1.193 -0.006,-0.761 -0.492,-1.196 -1.361,-1.196 -3.473,-0.005 ' +
|
|
305
|
+
'-10.86,-0.003 -11.0829995,-0.003 -0.022,-0.047 -0.045,-0.094 -0.069,-0.139 0.3939995,-0.319 ' +
|
|
306
|
+
'2.0409995,-1.626 2.4149995,-2.017 0.469,-0.4870005 0.519,-1.1650005 0.162,-1.6040005 -0.414,-0.511 ' +
|
|
307
|
+
'-0.973,-0.5 -1.48,-0.236 -1.4609995,0.764 -6.5999995,3.6430005 -7.7329995,4.2710005 -0.9,0.499 ' +
|
|
308
|
+
'-1.516,1.253 -1.882,2.19 -0.37000002,0.95 -0.17,2.01 -0.166,2.979 0.004,0.718 -0.27300002,1.345 ' +
|
|
309
|
+
'-0.055,2.063 0.629,2.087 2.425,3.312 4.859,3.318 4.6179995,0.014 9.2379995,-0.139 13.8569995,-0.158 ' +
|
|
310
|
+
'0.755,-0.004 1.171,-0.301 1.182,-1.033 0.012,-0.754 -0.423,-0.969 -1.183,-0.973 -1.778,-0.01 ' +
|
|
311
|
+
'-5.824,-0.004 -6.04,-0.004 10e-4,-0.084 0.003,-0.586 10e-4,-0.67 z'
|
|
312
|
+
},
|
|
313
|
+
'TASK_TYPE_INSTANTIATING_SEND': {
|
|
314
|
+
d: 'm {mx},{my} l 0,8.4 l 12.6,0 l 0,-8.4 z l 6.3,3.6 l 6.3,-3.6'
|
|
315
|
+
},
|
|
316
|
+
'TASK_TYPE_SERVICE': {
|
|
317
|
+
d: 'm {mx},{my} v -1.71335 c 0.352326,-0.0705 0.703932,-0.17838 1.047628,-0.32133 ' +
|
|
318
|
+
'0.344416,-0.14465 0.665822,-0.32133 0.966377,-0.52145 l 1.19431,1.18005 1.567487,-1.57688 ' +
|
|
319
|
+
'-1.195028,-1.18014 c 0.403376,-0.61394 0.683079,-1.29908 0.825447,-2.01824 l 1.622133,-0.01 ' +
|
|
320
|
+
'v -2.2196 l -1.636514,0.01 c -0.07333,-0.35153 -0.178319,-0.70024 -0.323564,-1.04372 ' +
|
|
321
|
+
'-0.145244,-0.34406 -0.321407,-0.6644 -0.522735,-0.96217 l 1.131035,-1.13631 -1.583305,-1.56293 ' +
|
|
322
|
+
'-1.129598,1.13589 c -0.614052,-0.40108 -1.302883,-0.68093 -2.022633,-0.82247 l 0.0093,-1.61852 ' +
|
|
323
|
+
'h -2.241173 l 0.0042,1.63124 c -0.353763,0.0736 -0.705369,0.17977 -1.049785,0.32371 -0.344415,0.14437 ' +
|
|
324
|
+
'-0.665102,0.32092 -0.9635006,0.52046 l -1.1698628,-1.15823 -1.5667691,1.5792 1.1684265,1.15669 ' +
|
|
325
|
+
'c -0.4026573,0.61283 -0.68308,1.29797 -0.8247287,2.01713 l -1.6588041,0.003 v 2.22174 ' +
|
|
326
|
+
'l 1.6724648,-0.006 c 0.073327,0.35077 0.1797598,0.70243 0.3242851,1.04472 0.1452428,0.34448 ' +
|
|
327
|
+
'0.3214064,0.6644 0.5227339,0.96066 l -1.1993431,1.19723 1.5840256,1.56011 1.1964668,-1.19348 ' +
|
|
328
|
+
'c 0.6140517,0.40346 1.3028827,0.68232 2.0233517,0.82331 l 7.19e-4,1.69892 h 2.226848 z ' +
|
|
329
|
+
'm 0.221462,-3.9957 c -1.788948,0.7502 -3.8576,-0.0928 -4.6097055,-1.87438 -0.7521065,-1.78321 ' +
|
|
330
|
+
'0.090598,-3.84627 1.8802645,-4.59604 1.78823,-0.74936 3.856881,0.0929 4.608987,1.87437 ' +
|
|
331
|
+
'0.752106,1.78165 -0.0906,3.84612 -1.879546,4.59605 z'
|
|
332
|
+
},
|
|
333
|
+
'TASK_TYPE_SERVICE_FILL': {
|
|
334
|
+
d: 'm {mx},{my} c -1.788948,0.7502 -3.8576,-0.0928 -4.6097055,-1.87438 -0.7521065,-1.78321 ' +
|
|
335
|
+
'0.090598,-3.84627 1.8802645,-4.59604 1.78823,-0.74936 3.856881,0.0929 4.608987,1.87437 ' +
|
|
336
|
+
'0.752106,1.78165 -0.0906,3.84612 -1.879546,4.59605 z'
|
|
337
|
+
},
|
|
338
|
+
'TASK_TYPE_BUSINESS_RULE_HEADER': {
|
|
339
|
+
d: 'm {mx},{my} 0,4 20,0 0,-4 z'
|
|
340
|
+
},
|
|
341
|
+
'TASK_TYPE_BUSINESS_RULE_MAIN': {
|
|
342
|
+
d: 'm {mx},{my} 0,12 20,0 0,-12 z' +
|
|
343
|
+
'm 0,8 l 20,0 ' +
|
|
344
|
+
'm -13,-4 l 0,8'
|
|
345
|
+
},
|
|
346
|
+
'MESSAGE_FLOW_MARKER': {
|
|
347
|
+
d: 'm {mx},{my} m -10.5 ,-7 l 0,14 l 21,0 l 0,-14 z l 10.5,6 l 10.5,-6'
|
|
348
|
+
}
|
|
349
|
+
};
|
|
350
|
+
|
|
351
|
+
this.getRawPath = function getRawPath(pathId) {
|
|
352
|
+
return this.pathMap[pathId].d;
|
|
353
|
+
};
|
|
354
|
+
|
|
355
|
+
/**
|
|
356
|
+
* Scales the path to the given height and width.
|
|
357
|
+
* <h1>Use case</h1>
|
|
358
|
+
* <p>Use case is to scale the content of elements (event, gateways) based
|
|
359
|
+
* on the element bounding box's size.
|
|
360
|
+
* </p>
|
|
361
|
+
* <h1>Why not transform</h1>
|
|
362
|
+
* <p>Scaling a path with transform() will also scale the stroke and IE does not support
|
|
363
|
+
* the option 'non-scaling-stroke' to prevent this.
|
|
364
|
+
* Also there are use cases where only some parts of a path should be
|
|
365
|
+
* scaled.</p>
|
|
366
|
+
*
|
|
367
|
+
* @param {String} pathId The ID of the path.
|
|
368
|
+
* @param {Object} param <p>
|
|
369
|
+
* Example param object scales the path to 60% size of the container (data.width, data.height).
|
|
370
|
+
* <pre>
|
|
371
|
+
* {
|
|
372
|
+
* xScaleFactor: 0.6,
|
|
373
|
+
* yScaleFactor:0.6,
|
|
374
|
+
* containerWidth: data.width,
|
|
375
|
+
* containerHeight: data.height,
|
|
376
|
+
* position: {
|
|
377
|
+
* mx: 0.46,
|
|
378
|
+
* my: 0.2,
|
|
379
|
+
* }
|
|
380
|
+
* }
|
|
381
|
+
* </pre>
|
|
382
|
+
* <ul>
|
|
383
|
+
* <li>targetpathwidth = xScaleFactor * containerWidth</li>
|
|
384
|
+
* <li>targetpathheight = yScaleFactor * containerHeight</li>
|
|
385
|
+
* <li>Position is used to set the starting coordinate of the path. M is computed:
|
|
386
|
+
* <ul>
|
|
387
|
+
* <li>position.x * containerWidth</li>
|
|
388
|
+
* <li>position.y * containerHeight</li>
|
|
389
|
+
* </ul>
|
|
390
|
+
* Center of the container <pre> position: {
|
|
391
|
+
* mx: 0.5,
|
|
392
|
+
* my: 0.5,
|
|
393
|
+
* }</pre>
|
|
394
|
+
* Upper left corner of the container
|
|
395
|
+
* <pre> position: {
|
|
396
|
+
* mx: 0.0,
|
|
397
|
+
* my: 0.0,
|
|
398
|
+
* }</pre>
|
|
399
|
+
* </li>
|
|
400
|
+
* </ul>
|
|
401
|
+
* </p>
|
|
402
|
+
*
|
|
403
|
+
*/
|
|
404
|
+
this.getScaledPath = function getScaledPath(pathId, param) {
|
|
405
|
+
var rawPath = this.pathMap[pathId];
|
|
406
|
+
|
|
407
|
+
// positioning
|
|
408
|
+
// compute the start point of the path
|
|
409
|
+
var mx, my;
|
|
410
|
+
|
|
411
|
+
if (param.abspos) {
|
|
412
|
+
mx = param.abspos.x;
|
|
413
|
+
my = param.abspos.y;
|
|
414
|
+
} else {
|
|
415
|
+
mx = param.containerWidth * param.position.mx;
|
|
416
|
+
my = param.containerHeight * param.position.my;
|
|
417
|
+
}
|
|
418
|
+
|
|
419
|
+
var coordinates = {}; //map for the scaled coordinates
|
|
420
|
+
if (param.position) {
|
|
421
|
+
|
|
422
|
+
// path
|
|
423
|
+
var heightRatio = (param.containerHeight / rawPath.height) * param.yScaleFactor;
|
|
424
|
+
var widthRatio = (param.containerWidth / rawPath.width) * param.xScaleFactor;
|
|
425
|
+
|
|
426
|
+
|
|
427
|
+
//Apply height ratio
|
|
428
|
+
for (var heightIndex = 0; heightIndex < rawPath.heightElements.length; heightIndex++) {
|
|
429
|
+
coordinates['y' + heightIndex] = rawPath.heightElements[heightIndex] * heightRatio;
|
|
430
|
+
}
|
|
431
|
+
|
|
432
|
+
//Apply width ratio
|
|
433
|
+
for (var widthIndex = 0; widthIndex < rawPath.widthElements.length; widthIndex++) {
|
|
434
|
+
coordinates['x' + widthIndex] = rawPath.widthElements[widthIndex] * widthRatio;
|
|
435
|
+
}
|
|
436
|
+
}
|
|
437
|
+
|
|
438
|
+
//Apply value to raw path
|
|
439
|
+
var path = format(
|
|
440
|
+
rawPath.d, {
|
|
441
|
+
mx: mx,
|
|
442
|
+
my: my,
|
|
443
|
+
e: coordinates
|
|
444
|
+
}
|
|
445
|
+
);
|
|
446
|
+
return path;
|
|
447
|
+
};
|
|
448
|
+
}
|
|
449
|
+
|
|
450
|
+
module.exports = PathMap;
|
|
451
|
+
|
|
452
|
+
////////// helpers //////////
|
|
453
|
+
|
|
454
|
+
// copied from https://github.com/adobe-webplatform/Snap.svg/blob/master/src/svg.js
|
|
455
|
+
var tokenRegex = /\{([^\}]+)\}/g,
|
|
456
|
+
objNotationRegex = /(?:(?:^|\.)(.+?)(?=\[|\.|$|\()|\[('|")(.+?)\2\])(\(\))?/g; // matches .xxxxx or ["xxxxx"] to run over object properties
|
|
457
|
+
|
|
458
|
+
function replacer(all, key, obj) {
|
|
459
|
+
var res = obj;
|
|
460
|
+
key.replace(objNotationRegex, function(all, name, quote, quotedName, isFunc) {
|
|
461
|
+
name = name || quotedName;
|
|
462
|
+
if (res) {
|
|
463
|
+
if (name in res) {
|
|
464
|
+
res = res[name];
|
|
465
|
+
}
|
|
466
|
+
typeof res == 'function' && isFunc && (res = res());
|
|
467
|
+
}
|
|
468
|
+
});
|
|
469
|
+
res = (res == null || res == obj ? all : res) + '';
|
|
470
|
+
|
|
471
|
+
return res;
|
|
472
|
+
}
|
|
473
|
+
|
|
474
|
+
function format(str, obj) {
|
|
475
|
+
return String(str).replace(tokenRegex, function(all, key) {
|
|
476
|
+
return replacer(all, key, obj);
|
|
477
|
+
});
|
|
478
|
+
}
|