@hatiolab/things-scene 9.0.0-beta.2 → 9.0.0-beta.21
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/db.sqlite +0 -0
- package/dist/animation/animate.d.ts +4 -0
- package/dist/animation/animations/animation.d.ts +14 -0
- package/dist/animation/animations/fade.d.ts +4 -0
- package/dist/animation/animations/heartbeat.d.ts +4 -0
- package/dist/animation/animations/moving.d.ts +4 -0
- package/dist/animation/animations/outline.d.ts +10 -0
- package/dist/animation/animations/rotation.d.ts +4 -0
- package/dist/animation/animations/vibration.d.ts +4 -0
- package/dist/animation/compile.d.ts +1 -0
- package/dist/animation/delta.d.ts +19 -0
- package/dist/animation/index.d.ts +1 -0
- package/dist/command/command-change.d.ts +7 -0
- package/dist/command/command-migrate.d.ts +4 -0
- package/dist/command/command-migrate.js +85 -0
- package/dist/command/command-migrate.js.map +1 -0
- package/dist/command/command.d.ts +5 -0
- package/dist/command/snapshot-commander.d.ts +15 -0
- package/dist/components/anchor/anchor.d.ts +128 -0
- package/dist/components/anchor/ellipse-anchors.d.ts +2 -0
- package/dist/components/anchor/ellipse-anchors.js +38 -0
- package/dist/components/anchor/ellipse-anchors.js.map +1 -0
- package/dist/components/anchor/rect-anchors.d.ts +10 -0
- package/dist/components/audio.d.ts +25 -0
- package/dist/components/audio.js +141 -0
- package/dist/components/audio.js.map +1 -0
- package/dist/components/cloud.d.ts +13 -0
- package/dist/components/cloud.js +31 -0
- package/dist/components/cloud.js.map +1 -0
- package/dist/components/component.d.ts +227 -0
- package/dist/components/component.js +912 -0
- package/dist/components/component.js.map +1 -0
- package/dist/components/container-abstract.d.ts +51 -0
- package/dist/components/container-abstract.js +372 -0
- package/dist/components/container-abstract.js.map +1 -0
- package/dist/components/container.d.ts +38 -0
- package/dist/components/container.js +75 -0
- package/dist/components/container.js.map +1 -0
- package/dist/components/data/data-mapping.d.ts +16 -0
- package/dist/components/data/data.d.ts +8 -0
- package/dist/components/data/evaluator.d.ts +1 -0
- package/dist/components/donut.d.ts +15 -0
- package/dist/components/donut.js +74 -0
- package/dist/components/donut.js.map +1 -0
- package/dist/components/drawer/draw-image-pendable.d.ts +1 -0
- package/dist/components/drawer/effect.d.ts +1 -0
- package/dist/components/drawer/fill.d.ts +14 -0
- package/dist/components/drawer/format.d.ts +1 -0
- package/dist/components/drawer/line.d.ts +3 -0
- package/dist/components/drawer/stroke.d.ts +1 -0
- package/dist/components/drawer/text-wrapper.d.ts +10 -0
- package/dist/components/drawer/text.d.ts +3 -0
- package/dist/components/ellipse.d.ts +35 -0
- package/dist/components/ellipse.js +99 -0
- package/dist/components/ellipse.js.map +1 -0
- package/dist/components/file/ondropfile.d.ts +1 -0
- package/dist/components/fit/fit.d.ts +15 -0
- package/dist/components/geometry/transcoord.d.ts +41 -0
- package/dist/components/geometry/union.d.ts +6 -0
- package/dist/components/gif-view.d.ts +18 -0
- package/dist/components/gif-view.js +116 -0
- package/dist/components/gif-view.js.map +1 -0
- package/dist/components/global-ref.d.ts +36 -0
- package/dist/components/global-ref.js +128 -0
- package/dist/components/global-ref.js.map +1 -0
- package/dist/components/group.d.ts +15 -0
- package/dist/components/group.js +145 -0
- package/dist/components/group.js.map +1 -0
- package/dist/components/html/elements.d.ts +2 -0
- package/dist/components/html/fill.d.ts +1 -0
- package/dist/components/html/reposition.d.ts +1 -0
- package/dist/components/html/shadow.d.ts +1 -0
- package/dist/components/html-overlay-container.d.ts +27 -0
- package/dist/components/html-overlay-container.js +14 -0
- package/dist/components/html-overlay-container.js.map +1 -0
- package/dist/components/html-overlay-element.d.ts +25 -0
- package/dist/components/html-overlay-element.js +9 -0
- package/dist/components/html-overlay-element.js.map +1 -0
- package/dist/components/image-view.d.ts +19 -0
- package/dist/components/image-view.js +180 -0
- package/dist/components/image-view.js.map +1 -0
- package/dist/components/index.d.ts +32 -0
- package/dist/components/index.js +39 -0
- package/dist/components/index.js.map +1 -0
- package/dist/components/info-window.d.ts +41 -0
- package/dist/components/info-window.js +425 -0
- package/dist/components/info-window.js.map +1 -0
- package/dist/components/line.d.ts +91 -0
- package/dist/components/line.js +303 -0
- package/dist/components/line.js.map +1 -0
- package/dist/components/local-ref.d.ts +47 -0
- package/dist/components/local-ref.js +103 -0
- package/dist/components/local-ref.js.map +1 -0
- package/dist/components/mixins/connectable.d.ts +45 -0
- package/dist/components/mixins/data-source.d.ts +9 -0
- package/dist/components/mixins/html-element.d.ts +24 -0
- package/dist/components/mixins/move-handle.d.ts +11 -0
- package/dist/components/mixins/rect-path.d.ts +13 -0
- package/dist/components/mixins/value-holder.d.ts +18 -0
- package/dist/components/mutater/bounds.d.ts +10 -0
- package/dist/components/mutater/path.d.ts +5 -0
- package/dist/components/ortholine.d.ts +21 -0
- package/dist/components/ortholine.js +814 -0
- package/dist/components/ortholine.js.map +1 -0
- package/dist/components/outline/ellipse-outline.d.ts +4 -0
- package/dist/components/outline/ellipse-outline.js +11 -0
- package/dist/components/outline/ellipse-outline.js.map +1 -0
- package/dist/components/outline/path-outline.d.ts +1 -0
- package/dist/components/path.d.ts +5 -0
- package/dist/components/path.js +40 -0
- package/dist/components/path.js.map +1 -0
- package/dist/components/polygon.d.ts +40 -0
- package/dist/components/polygon.js +157 -0
- package/dist/components/polygon.js.map +1 -0
- package/dist/components/polyline.d.ts +18 -0
- package/dist/components/polyline.js +102 -0
- package/dist/components/polyline.js.map +1 -0
- package/dist/components/popup.d.ts +48 -0
- package/dist/components/popup.js +138 -0
- package/dist/components/popup.js.map +1 -0
- package/dist/components/rect.d.ts +26 -0
- package/dist/components/rect.js +91 -0
- package/dist/components/rect.js.map +1 -0
- package/dist/components/retention/retention-manager.d.ts +8 -0
- package/dist/components/root-container.d.ts +90 -0
- package/dist/components/root-container.js +478 -0
- package/dist/components/root-container.js.map +1 -0
- package/dist/components/ruler.d.ts +16 -0
- package/dist/components/ruler.js +77 -0
- package/dist/components/ruler.js.map +1 -0
- package/dist/components/shape.d.ts +25 -0
- package/dist/components/shape.js +80 -0
- package/dist/components/shape.js.map +1 -0
- package/dist/components/star.d.ts +13 -0
- package/dist/components/star.js +80 -0
- package/dist/components/star.js.map +1 -0
- package/dist/components/text/substitutor.d.ts +3 -0
- package/dist/components/text.d.ts +8 -0
- package/dist/components/text.js +15 -0
- package/dist/components/text.js.map +1 -0
- package/dist/components/three-container.d.ts +60 -0
- package/dist/components/three-container.js +515 -0
- package/dist/components/three-container.js.map +1 -0
- package/dist/components/triangle.d.ts +15 -0
- package/dist/components/triangle.js +76 -0
- package/dist/components/triangle.js.map +1 -0
- package/dist/const.d.ts +39 -0
- package/dist/core/collection.d.ts +8 -0
- package/dist/core/debug.d.ts +1 -0
- package/dist/core/deep-equals.d.ts +1 -0
- package/dist/core/dom-to-image.d.ts +127 -0
- package/dist/core/event.d.ts +92 -0
- package/dist/core/index.d.ts +2 -0
- package/dist/core/list.d.ts +32 -0
- package/dist/core/logger.d.ts +3 -0
- package/dist/core/memoize.d.ts +6 -0
- package/dist/core/mixin.d.ts +1 -0
- package/dist/core/obj-accessor.d.ts +1 -0
- package/dist/core/reference-map.d.ts +14 -0
- package/dist/core/round-rect.d.ts +19 -0
- package/dist/core/script-loader.d.ts +3 -0
- package/dist/core/snapshot-taker.d.ts +12 -0
- package/dist/core/stack.d.ts +2 -0
- package/dist/core/timecapsule.d.ts +18 -0
- package/dist/core/utils.d.ts +9 -0
- package/dist/decorator/anchors-decorator.d.ts +31 -0
- package/dist/decorator/data-spread-decorator.d.ts +1 -0
- package/dist/decorator/decotag-decorator.d.ts +1 -0
- package/dist/decorator/index.d.ts +2 -0
- package/dist/decorator/link-decorator.d.ts +1 -0
- package/dist/effect/gradation.d.ts +1 -0
- package/dist/effect/index.d.ts +1 -0
- package/dist/effect/shadow.d.ts +2 -0
- package/dist/effect/turn.d.ts +1 -0
- package/dist/event/event-engine.d.ts +12 -0
- package/dist/event/event-pump.d.ts +11 -0
- package/dist/event/event-tracker.d.ts +21 -0
- package/dist/event/index.d.ts +2 -0
- package/dist/event/ua-event-handler.d.ts +32 -0
- package/dist/event-map/event-map.d.ts +9 -0
- package/dist/event-map/index.d.ts +1 -0
- package/dist/event-map/move-handler.d.ts +1 -0
- package/dist/event-map/text-editor-lite.d.ts +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +3 -0
- package/dist/index.js.map +1 -0
- package/dist/layer/action/emphasize.d.ts +2 -0
- package/dist/layer/action/popup.d.ts +5 -0
- package/dist/layer/action/pressed.d.ts +2 -0
- package/dist/layer/add-layer.d.ts +42 -0
- package/dist/layer/add-layer.js +142 -0
- package/dist/layer/add-layer.js.map +1 -0
- package/dist/layer/decotag-layer.d.ts +27 -0
- package/dist/layer/decotag-layer.js +105 -0
- package/dist/layer/decotag-layer.js.map +1 -0
- package/dist/layer/guide-layer.d.ts +44 -0
- package/dist/layer/guide-layer.js +261 -0
- package/dist/layer/guide-layer.js.map +1 -0
- package/dist/layer/index.d.ts +7 -0
- package/dist/layer/index.js +11 -0
- package/dist/layer/index.js.map +1 -0
- package/dist/layer/layer.d.ts +32 -0
- package/dist/layer/layer.js +155 -0
- package/dist/layer/layer.js.map +1 -0
- package/dist/layer/model-layer.d.ts +46 -0
- package/dist/layer/model-layer.js +402 -0
- package/dist/layer/model-layer.js.map +1 -0
- package/dist/layer/modeler/anchor-handler.d.ts +36 -0
- package/dist/layer/modeler/control-handler.d.ts +18 -0
- package/dist/layer/modeler/focus-outline.d.ts +5 -0
- package/dist/layer/modeler/group-outline.d.ts +5 -0
- package/dist/layer/modeler/index.d.ts +7 -0
- package/dist/layer/modeler/path-handler.d.ts +22 -0
- package/dist/layer/modeler/resizer.d.ts +13 -0
- package/dist/layer/modeler/rotator.d.ts +15 -0
- package/dist/layer/modeler/rotator.js +120 -0
- package/dist/layer/modeler/rotator.js.map +1 -0
- package/dist/layer/modeling-layer.d.ts +66 -0
- package/dist/layer/modeling-layer.js +451 -0
- package/dist/layer/modeling-layer.js.map +1 -0
- package/dist/layer/selection/selected-finder.d.ts +1 -0
- package/dist/layer/selection-layer.d.ts +42 -0
- package/dist/layer/selection-layer.js +307 -0
- package/dist/layer/selection-layer.js.map +1 -0
- package/dist/layer/shift-layer.d.ts +18 -0
- package/dist/layer/shift-layer.js +61 -0
- package/dist/layer/shift-layer.js.map +1 -0
- package/dist/layout/absolute.d.ts +8 -0
- package/dist/layout/card.d.ts +7 -0
- package/dist/layout/html-absolute.d.ts +8 -0
- package/dist/layout/index.d.ts +8 -0
- package/dist/layout/index.js +12 -0
- package/dist/layout/index.js.map +1 -0
- package/dist/layout/layout.d.ts +11 -0
- package/dist/layout/linear-horizontal.d.ts +7 -0
- package/dist/layout/linear-vertical.d.ts +7 -0
- package/dist/layout/table.d.ts +9 -0
- package/dist/layout/three.d.ts +8 -0
- package/dist/layout/three.js +20 -0
- package/dist/layout/three.js.map +1 -0
- package/dist/license/license.d.ts +18 -0
- package/dist/model/compile.d.ts +1 -0
- package/dist/model/compile.js +28 -0
- package/dist/model/compile.js.map +1 -0
- package/dist/model/duplicate.d.ts +1 -0
- package/dist/model/index.d.ts +3 -0
- package/dist/model/selector.d.ts +2 -0
- package/dist/style/compile.d.ts +1 -0
- package/dist/style/index.d.ts +1 -0
- package/dist/things-scene/api/add-start.d.ts +1 -0
- package/dist/things-scene/api/add.d.ts +5 -0
- package/dist/things-scene/api/align.d.ts +1 -0
- package/dist/things-scene/api/change.d.ts +2 -0
- package/dist/things-scene/api/clipboard.d.ts +3 -0
- package/dist/things-scene/api/distribute.d.ts +1 -0
- package/dist/things-scene/api/duplicate.d.ts +4 -0
- package/dist/things-scene/api/fullscreen.d.ts +1 -0
- package/dist/things-scene/api/group.d.ts +8 -0
- package/dist/things-scene/api/group.js +78 -0
- package/dist/things-scene/api/group.js.map +1 -0
- package/dist/things-scene/api/ids.d.ts +4 -0
- package/dist/things-scene/api/index.d.ts +15 -0
- package/dist/things-scene/api/listener.d.ts +3 -0
- package/dist/things-scene/api/remove.d.ts +4 -0
- package/dist/things-scene/api/symmetry.d.ts +2 -0
- package/dist/things-scene/api/symmetry.js +39 -0
- package/dist/things-scene/api/symmetry.js.map +1 -0
- package/dist/things-scene/api/to-data-url.d.ts +1 -0
- package/dist/things-scene/api/to-data-url.js +69 -0
- package/dist/things-scene/api/to-data-url.js.map +1 -0
- package/dist/things-scene/api/zorder.d.ts +2 -0
- package/dist/things-scene/application-context.d.ts +40 -0
- package/dist/things-scene/config.d.ts +4 -0
- package/dist/things-scene/create.d.ts +20 -0
- package/dist/things-scene/fps.d.ts +1 -0
- package/dist/things-scene/index.d.ts +17 -0
- package/dist/things-scene/index.js +23 -0
- package/dist/things-scene/index.js.map +1 -0
- package/dist/things-scene/polyfill.d.ts +2 -0
- package/dist/things-scene/scene.d.ts +155 -0
- package/dist/things-scene/version.d.ts +2 -0
- package/dist/threed/common.d.ts +22 -0
- package/dist/threed/control/three-controls.d.ts +11 -0
- package/dist/threed/control/three-controls.js +620 -0
- package/dist/threed/control/three-controls.js.map +1 -0
- package/dist/threed/html/elements.d.ts +2 -0
- package/dist/threed/real-object-camera-meshed.d.ts +12 -0
- package/dist/threed/real-object-camera-meshed.js +49 -0
- package/dist/threed/real-object-camera-meshed.js.map +1 -0
- package/dist/threed/real-object-camera.d.ts +9 -0
- package/dist/threed/real-object-camera.js +31 -0
- package/dist/threed/real-object-camera.js.map +1 -0
- package/dist/threed/real-object-dom-element.d.ts +20 -0
- package/dist/threed/real-object-dom-element.js +78 -0
- package/dist/threed/real-object-dom-element.js.map +1 -0
- package/dist/threed/real-object-dummy.d.ts +6 -0
- package/dist/threed/real-object-dummy.js +11 -0
- package/dist/threed/real-object-dummy.js.map +1 -0
- package/dist/threed/real-object-extrude.d.ts +19 -0
- package/dist/threed/real-object-extrude.js +171 -0
- package/dist/threed/real-object-extrude.js.map +1 -0
- package/dist/threed/real-object-gltf.d.ts +15 -0
- package/dist/threed/real-object-gltf.js +97 -0
- package/dist/threed/real-object-gltf.js.map +1 -0
- package/dist/threed/real-object-group.d.ts +5 -0
- package/dist/threed/real-object-group.js +11 -0
- package/dist/threed/real-object-group.js.map +1 -0
- package/dist/threed/real-object-mesh.d.ts +11 -0
- package/dist/threed/real-object-mesh.js +55 -0
- package/dist/threed/real-object-mesh.js.map +1 -0
- package/dist/threed/real-object-plane.d.ts +6 -0
- package/dist/threed/real-object-plane.js +23 -0
- package/dist/threed/real-object-plane.js.map +1 -0
- package/dist/threed/real-object-scene.d.ts +21 -0
- package/dist/threed/real-object-scene.js +89 -0
- package/dist/threed/real-object-scene.js.map +1 -0
- package/dist/threed/real-object-sprite.d.ts +12 -0
- package/dist/threed/real-object-sprite.js +35 -0
- package/dist/threed/real-object-sprite.js.map +1 -0
- package/dist/threed/real-object-text.d.ts +16 -0
- package/dist/threed/real-object-text.js +70 -0
- package/dist/threed/real-object-text.js.map +1 -0
- package/dist/threed/real-object.d.ts +48 -0
- package/dist/threed/real-object.js +199 -0
- package/dist/threed/real-object.js.map +1 -0
- package/dist/threed/texture/text-texture.d.ts +8 -0
- package/dist/threed/three-dimensional-container.d.ts +7 -0
- package/dist/threed/three-dimensional-container.js +2 -0
- package/dist/threed/three-dimensional-container.js.map +1 -0
- package/dist/threed/utils/bound-uv-generator.d.ts +16 -0
- package/dist/types.d.ts +53 -0
- package/dist/types.js +368 -0
- package/dist/types.js.map +1 -0
- package/package.json +5 -2
- package/schema.graphql +5 -0
- package/things-scene-ie.js +1 -1
- package/things-scene-ie.js.LICENSE.txt +22 -0
- package/things-scene-min.js +1 -1
- package/things-scene-min.js.LICENSE.txt +22 -0
- package/things-scene.d.ts +13 -1
- package/things-scene.mjs +34 -14
|
@@ -0,0 +1,814 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright © HatioLab Inc. All rights reserved.
|
|
3
|
+
*/
|
|
4
|
+
import Component from './component';
|
|
5
|
+
import Line, { SOUTH, NORTH, EAST, WEST } from './line';
|
|
6
|
+
const FROM = 0;
|
|
7
|
+
const TO = 1;
|
|
8
|
+
const NATURE = {
|
|
9
|
+
mutable: false,
|
|
10
|
+
resizable: false,
|
|
11
|
+
rotatable: false,
|
|
12
|
+
properties: [
|
|
13
|
+
{
|
|
14
|
+
type: 'number',
|
|
15
|
+
label: 'round',
|
|
16
|
+
name: 'round',
|
|
17
|
+
property: {
|
|
18
|
+
min: 0,
|
|
19
|
+
max: 100,
|
|
20
|
+
step: 1
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
],
|
|
24
|
+
help: 'scene/component/ortholine'
|
|
25
|
+
};
|
|
26
|
+
export default class OrthoLine extends Line {
|
|
27
|
+
get pathExtendable() {
|
|
28
|
+
return false;
|
|
29
|
+
}
|
|
30
|
+
get drawPath() {
|
|
31
|
+
const fromPosition = this.path[0];
|
|
32
|
+
const toPosition = this.path[1];
|
|
33
|
+
const { component: fromComponent, direction: fromDirection, boundaryPosition: fromBoundaryPosition = fromPosition } = this.fromEnd || {};
|
|
34
|
+
const { component: toComponent, direction: toDirection, boundaryPosition: toBoundaryPosition = toPosition } = this.toEnd || {};
|
|
35
|
+
var boundaryPositions = [fromBoundaryPosition, toBoundaryPosition];
|
|
36
|
+
var path = [];
|
|
37
|
+
if (fromBoundaryPosition) {
|
|
38
|
+
path.push(fromBoundaryPosition);
|
|
39
|
+
}
|
|
40
|
+
/* 두 컴포넌트의 확장된 바운드를 구한다. */
|
|
41
|
+
var fromOriginBounds = fromComponent === null || fromComponent === void 0 ? void 0 : fromComponent.bounds;
|
|
42
|
+
if (fromOriginBounds) {
|
|
43
|
+
var transcoorded = fromComponent.transcoordS2T(fromOriginBounds.left, fromOriginBounds.top);
|
|
44
|
+
transcoorded = this.transcoordT2P(transcoorded.x, transcoorded.y);
|
|
45
|
+
fromOriginBounds = {
|
|
46
|
+
...fromOriginBounds,
|
|
47
|
+
left: transcoorded.x,
|
|
48
|
+
top: transcoorded.y
|
|
49
|
+
};
|
|
50
|
+
}
|
|
51
|
+
var fromBounds = fromOriginBounds
|
|
52
|
+
? {
|
|
53
|
+
left: fromOriginBounds.left - 20,
|
|
54
|
+
top: fromOriginBounds.top - 20,
|
|
55
|
+
width: fromOriginBounds.width + 40,
|
|
56
|
+
height: fromOriginBounds.height + 40
|
|
57
|
+
}
|
|
58
|
+
: {
|
|
59
|
+
left: fromBoundaryPosition.x,
|
|
60
|
+
top: fromBoundaryPosition.y,
|
|
61
|
+
width: 0,
|
|
62
|
+
height: 0
|
|
63
|
+
};
|
|
64
|
+
fromOriginBounds = fromOriginBounds || fromBounds;
|
|
65
|
+
var toOriginBounds = toComponent === null || toComponent === void 0 ? void 0 : toComponent.bounds;
|
|
66
|
+
if (toOriginBounds) {
|
|
67
|
+
var transcoorded = toComponent.transcoordS2T(toOriginBounds.left, toOriginBounds.top);
|
|
68
|
+
transcoorded = this.transcoordT2P(transcoorded.x, transcoorded.y);
|
|
69
|
+
toOriginBounds = {
|
|
70
|
+
...toOriginBounds,
|
|
71
|
+
left: transcoorded.x,
|
|
72
|
+
top: transcoorded.y
|
|
73
|
+
};
|
|
74
|
+
}
|
|
75
|
+
var toBounds = toOriginBounds
|
|
76
|
+
? {
|
|
77
|
+
left: toOriginBounds.left - 20,
|
|
78
|
+
top: toOriginBounds.top - 20,
|
|
79
|
+
width: toOriginBounds.width + 40,
|
|
80
|
+
height: toOriginBounds.height + 40
|
|
81
|
+
}
|
|
82
|
+
: {
|
|
83
|
+
left: toBoundaryPosition.x,
|
|
84
|
+
top: toBoundaryPosition.y,
|
|
85
|
+
width: 0,
|
|
86
|
+
height: 0
|
|
87
|
+
};
|
|
88
|
+
toOriginBounds = toOriginBounds || toBounds;
|
|
89
|
+
var fromToBounds = [fromBounds, toBounds];
|
|
90
|
+
const leftMost = fromBounds.left > toBounds.left ? toBounds.left : fromBounds.left;
|
|
91
|
+
const topMost = fromBounds.top > toBounds.top ? toBounds.top : fromBounds.top;
|
|
92
|
+
var unionBounds = {
|
|
93
|
+
left: leftMost,
|
|
94
|
+
top: topMost,
|
|
95
|
+
width: fromBounds.left + fromBounds.width > toBounds.left + toBounds.width
|
|
96
|
+
? fromBounds.left + fromBounds.width - leftMost
|
|
97
|
+
: toBounds.left + toBounds.width - leftMost,
|
|
98
|
+
height: fromBounds.top + fromBounds.height > toBounds.top + toBounds.height
|
|
99
|
+
? fromBounds.top + fromBounds.height - topMost
|
|
100
|
+
: toBounds.top + toBounds.height - topMost
|
|
101
|
+
};
|
|
102
|
+
/* 두 컴포넌트 바운드의 센터를 찾는다. */
|
|
103
|
+
var centerX, centerY, centerWidth = 0, centerHeight = 0;
|
|
104
|
+
var upperComponent, leftComponent, rightComponent, lowerComponent;
|
|
105
|
+
var upperComponentDirection, lowerComponentDirection;
|
|
106
|
+
var leftComponentDirection, rightComponentDirection;
|
|
107
|
+
if (fromOriginBounds.left + fromOriginBounds.width < toOriginBounds.left) {
|
|
108
|
+
leftComponent = FROM;
|
|
109
|
+
rightComponent = TO;
|
|
110
|
+
leftComponentDirection = fromDirection;
|
|
111
|
+
rightComponentDirection = toDirection;
|
|
112
|
+
centerX = (fromOriginBounds.left + fromOriginBounds.width + toOriginBounds.left) / 2;
|
|
113
|
+
centerWidth = toOriginBounds.left - centerX;
|
|
114
|
+
}
|
|
115
|
+
else if (toOriginBounds.left + toOriginBounds.width < fromOriginBounds.left) {
|
|
116
|
+
leftComponent = TO;
|
|
117
|
+
rightComponent = FROM;
|
|
118
|
+
leftComponentDirection = toDirection;
|
|
119
|
+
rightComponentDirection = fromDirection;
|
|
120
|
+
centerX = (fromOriginBounds.left + toOriginBounds.width + toOriginBounds.left) / 2;
|
|
121
|
+
centerWidth = fromOriginBounds.left - centerX;
|
|
122
|
+
}
|
|
123
|
+
if (fromOriginBounds.top + fromOriginBounds.height < toOriginBounds.top) {
|
|
124
|
+
upperComponent = FROM;
|
|
125
|
+
lowerComponent = TO;
|
|
126
|
+
upperComponentDirection = fromDirection;
|
|
127
|
+
lowerComponentDirection = toDirection;
|
|
128
|
+
centerY = (fromOriginBounds.top + fromOriginBounds.height + toOriginBounds.top) / 2;
|
|
129
|
+
centerHeight = toOriginBounds.top - centerY;
|
|
130
|
+
}
|
|
131
|
+
else if (toOriginBounds.top + toOriginBounds.height < fromOriginBounds.top) {
|
|
132
|
+
upperComponent = TO;
|
|
133
|
+
lowerComponent = FROM;
|
|
134
|
+
upperComponentDirection = toDirection;
|
|
135
|
+
lowerComponentDirection = fromDirection;
|
|
136
|
+
centerY = (fromOriginBounds.top + toOriginBounds.height + toOriginBounds.top) / 2;
|
|
137
|
+
centerHeight = fromOriginBounds.top - centerY;
|
|
138
|
+
}
|
|
139
|
+
/* 각 LinkEnd의 방향별 패스 구하기 */
|
|
140
|
+
var lpath = [];
|
|
141
|
+
if (centerX && centerWidth > centerHeight) {
|
|
142
|
+
switch (rightComponentDirection) {
|
|
143
|
+
case WEST:
|
|
144
|
+
switch (leftComponentDirection) {
|
|
145
|
+
case EAST:
|
|
146
|
+
lpath.push({
|
|
147
|
+
x: centerX,
|
|
148
|
+
y: boundaryPositions[leftComponent].y
|
|
149
|
+
});
|
|
150
|
+
lpath.push({
|
|
151
|
+
x: centerX,
|
|
152
|
+
y: boundaryPositions[rightComponent].y
|
|
153
|
+
});
|
|
154
|
+
break;
|
|
155
|
+
case WEST:
|
|
156
|
+
var leftComponentCenterY = fromToBounds[leftComponent].top + fromToBounds[leftComponent].height / 2;
|
|
157
|
+
var leftY = leftComponentCenterY > boundaryPositions[rightComponent].y
|
|
158
|
+
? Math.min(fromToBounds[leftComponent].top, boundaryPositions[rightComponent].y)
|
|
159
|
+
: Math.max(fromToBounds[leftComponent].top + fromToBounds[leftComponent].height, boundaryPositions[rightComponent].y);
|
|
160
|
+
lpath.push({
|
|
161
|
+
x: boundaryPositions[leftComponent].x,
|
|
162
|
+
y: leftY
|
|
163
|
+
});
|
|
164
|
+
lpath.push({
|
|
165
|
+
x: centerX,
|
|
166
|
+
y: leftY
|
|
167
|
+
});
|
|
168
|
+
lpath.push({
|
|
169
|
+
x: centerX,
|
|
170
|
+
y: boundaryPositions[rightComponent].y
|
|
171
|
+
});
|
|
172
|
+
break;
|
|
173
|
+
case NORTH:
|
|
174
|
+
case SOUTH:
|
|
175
|
+
var leftY = leftComponentDirection === SOUTH
|
|
176
|
+
? Math.max(boundaryPositions[leftComponent].y, boundaryPositions[rightComponent].y)
|
|
177
|
+
: Math.min(boundaryPositions[leftComponent].y, boundaryPositions[rightComponent].y);
|
|
178
|
+
lpath.push({
|
|
179
|
+
x: boundaryPositions[leftComponent].x,
|
|
180
|
+
y: leftY
|
|
181
|
+
});
|
|
182
|
+
lpath.push({
|
|
183
|
+
x: centerX,
|
|
184
|
+
y: leftY
|
|
185
|
+
});
|
|
186
|
+
lpath.push({
|
|
187
|
+
x: centerX,
|
|
188
|
+
y: boundaryPositions[rightComponent].y
|
|
189
|
+
});
|
|
190
|
+
break;
|
|
191
|
+
default:
|
|
192
|
+
return this.path;
|
|
193
|
+
}
|
|
194
|
+
break;
|
|
195
|
+
case EAST:
|
|
196
|
+
switch (leftComponentDirection) {
|
|
197
|
+
case EAST:
|
|
198
|
+
var leftY = boundaryPositions[leftComponent].y < boundaryPositions[rightComponent].y
|
|
199
|
+
? Math.min(fromToBounds[rightComponent].top, boundaryPositions[leftComponent].y)
|
|
200
|
+
: Math.max(fromToBounds[rightComponent].top + fromToBounds[rightComponent].height, boundaryPositions[leftComponent].y);
|
|
201
|
+
var rightY = leftY;
|
|
202
|
+
break;
|
|
203
|
+
case WEST:
|
|
204
|
+
var leftY = centerY !== undefined
|
|
205
|
+
? centerY
|
|
206
|
+
: boundaryPositions[leftComponent].y < boundaryPositions[rightComponent].y
|
|
207
|
+
? unionBounds.top - centerWidth * 0.5
|
|
208
|
+
: unionBounds.top + unionBounds.height + centerWidth * 0.5;
|
|
209
|
+
var rightY = leftY;
|
|
210
|
+
break;
|
|
211
|
+
case SOUTH:
|
|
212
|
+
var leftY = centerY !== undefined
|
|
213
|
+
? Math.max(centerY, boundaryPositions[leftComponent].y)
|
|
214
|
+
: unionBounds.top + unionBounds.height;
|
|
215
|
+
var rightY = leftY;
|
|
216
|
+
break;
|
|
217
|
+
case NORTH:
|
|
218
|
+
var leftY = centerY ? Math.min(centerY, fromToBounds[leftComponent].top) : unionBounds.top;
|
|
219
|
+
var rightY = leftY;
|
|
220
|
+
break;
|
|
221
|
+
default:
|
|
222
|
+
return this.path;
|
|
223
|
+
}
|
|
224
|
+
lpath.push({
|
|
225
|
+
x: boundaryPositions[leftComponent].x,
|
|
226
|
+
y: leftY
|
|
227
|
+
});
|
|
228
|
+
lpath.push({
|
|
229
|
+
x: centerX,
|
|
230
|
+
y: leftY
|
|
231
|
+
});
|
|
232
|
+
lpath.push({
|
|
233
|
+
x: centerX,
|
|
234
|
+
y: rightY
|
|
235
|
+
});
|
|
236
|
+
lpath.push({
|
|
237
|
+
x: boundaryPositions[rightComponent].x,
|
|
238
|
+
y: rightY
|
|
239
|
+
});
|
|
240
|
+
break;
|
|
241
|
+
case SOUTH:
|
|
242
|
+
switch (leftComponentDirection) {
|
|
243
|
+
case EAST:
|
|
244
|
+
var leftY = boundaryPositions[leftComponent].y;
|
|
245
|
+
var rightY = boundaryPositions[leftComponent].y > boundaryPositions[rightComponent].y
|
|
246
|
+
? boundaryPositions[leftComponent].y
|
|
247
|
+
: fromToBounds[rightComponent].top + fromToBounds[rightComponent].height;
|
|
248
|
+
break;
|
|
249
|
+
case WEST:
|
|
250
|
+
var leftY = centerY
|
|
251
|
+
? Math.max(centerY, fromToBounds[rightComponent].top + fromToBounds[rightComponent].height)
|
|
252
|
+
: unionBounds.top + unionBounds.height;
|
|
253
|
+
var rightY = leftY;
|
|
254
|
+
break;
|
|
255
|
+
case SOUTH:
|
|
256
|
+
var leftY = unionBounds.top + unionBounds.height;
|
|
257
|
+
var rightY = leftY;
|
|
258
|
+
break;
|
|
259
|
+
case NORTH:
|
|
260
|
+
var leftY = centerY ? Math.min(centerY, fromToBounds[leftComponent].top) : fromToBounds[leftComponent].top;
|
|
261
|
+
var rightY = centerY
|
|
262
|
+
? Math.max(centerY, fromToBounds[rightComponent].top + fromToBounds[rightComponent].height)
|
|
263
|
+
: fromToBounds[rightComponent].top + fromToBounds[rightComponent].height;
|
|
264
|
+
break;
|
|
265
|
+
default:
|
|
266
|
+
return this.path;
|
|
267
|
+
}
|
|
268
|
+
lpath.push({
|
|
269
|
+
x: boundaryPositions[leftComponent].x,
|
|
270
|
+
y: leftY
|
|
271
|
+
});
|
|
272
|
+
lpath.push({
|
|
273
|
+
x: centerX,
|
|
274
|
+
y: leftY
|
|
275
|
+
});
|
|
276
|
+
lpath.push({
|
|
277
|
+
x: centerX,
|
|
278
|
+
y: rightY
|
|
279
|
+
});
|
|
280
|
+
lpath.push({
|
|
281
|
+
x: boundaryPositions[rightComponent].x,
|
|
282
|
+
y: rightY
|
|
283
|
+
});
|
|
284
|
+
break;
|
|
285
|
+
case NORTH:
|
|
286
|
+
switch (leftComponentDirection) {
|
|
287
|
+
case EAST:
|
|
288
|
+
var leftY = boundaryPositions[leftComponent].y;
|
|
289
|
+
var rightY = boundaryPositions[leftComponent].y < boundaryPositions[rightComponent].y
|
|
290
|
+
? boundaryPositions[leftComponent].y
|
|
291
|
+
: fromToBounds[rightComponent].top;
|
|
292
|
+
break;
|
|
293
|
+
case WEST:
|
|
294
|
+
var leftY = centerY ? Math.min(centerY, fromToBounds[rightComponent].top) : unionBounds.top;
|
|
295
|
+
var rightY = leftY;
|
|
296
|
+
break;
|
|
297
|
+
case SOUTH:
|
|
298
|
+
var leftY = centerY !== undefined
|
|
299
|
+
? Math.max(centerY, boundaryPositions[leftComponent].y)
|
|
300
|
+
: boundaryPositions[leftComponent].y;
|
|
301
|
+
var rightY = centerY !== undefined
|
|
302
|
+
? Math.min(centerY, boundaryPositions[rightComponent].y)
|
|
303
|
+
: boundaryPositions[rightComponent].y;
|
|
304
|
+
break;
|
|
305
|
+
case NORTH:
|
|
306
|
+
var leftY = unionBounds.top;
|
|
307
|
+
var rightY = leftY;
|
|
308
|
+
break;
|
|
309
|
+
default:
|
|
310
|
+
return this.path;
|
|
311
|
+
}
|
|
312
|
+
lpath.push({
|
|
313
|
+
x: boundaryPositions[leftComponent].x,
|
|
314
|
+
y: leftY
|
|
315
|
+
});
|
|
316
|
+
lpath.push({
|
|
317
|
+
x: centerX,
|
|
318
|
+
y: leftY
|
|
319
|
+
});
|
|
320
|
+
lpath.push({
|
|
321
|
+
x: centerX,
|
|
322
|
+
y: rightY
|
|
323
|
+
});
|
|
324
|
+
lpath.push({
|
|
325
|
+
x: boundaryPositions[rightComponent].x,
|
|
326
|
+
y: rightY
|
|
327
|
+
});
|
|
328
|
+
break;
|
|
329
|
+
default:
|
|
330
|
+
return this.path;
|
|
331
|
+
}
|
|
332
|
+
path.push(...(leftComponent === FROM ? lpath : lpath.reverse()));
|
|
333
|
+
}
|
|
334
|
+
else if (centerY) {
|
|
335
|
+
switch (lowerComponentDirection) {
|
|
336
|
+
case NORTH:
|
|
337
|
+
switch (upperComponentDirection) {
|
|
338
|
+
case SOUTH:
|
|
339
|
+
lpath.push({
|
|
340
|
+
x: boundaryPositions[upperComponent].x,
|
|
341
|
+
y: centerY
|
|
342
|
+
});
|
|
343
|
+
lpath.push({
|
|
344
|
+
x: boundaryPositions[lowerComponent].x,
|
|
345
|
+
y: centerY
|
|
346
|
+
});
|
|
347
|
+
break;
|
|
348
|
+
case NORTH:
|
|
349
|
+
var upperComponentCenterX = fromToBounds[upperComponent].left + fromToBounds[upperComponent].width / 2;
|
|
350
|
+
var upperX = upperComponentCenterX > boundaryPositions[lowerComponent].x
|
|
351
|
+
? Math.min(fromToBounds[upperComponent].left, boundaryPositions[lowerComponent].x)
|
|
352
|
+
: Math.max(fromToBounds[upperComponent].left + fromToBounds[upperComponent].width, boundaryPositions[lowerComponent].x);
|
|
353
|
+
lpath.push({
|
|
354
|
+
x: upperX,
|
|
355
|
+
y: boundaryPositions[upperComponent].y
|
|
356
|
+
});
|
|
357
|
+
lpath.push({
|
|
358
|
+
x: upperX,
|
|
359
|
+
y: centerY
|
|
360
|
+
});
|
|
361
|
+
lpath.push({
|
|
362
|
+
x: boundaryPositions[lowerComponent].x,
|
|
363
|
+
y: centerY
|
|
364
|
+
});
|
|
365
|
+
break;
|
|
366
|
+
case WEST:
|
|
367
|
+
var upperX = Math.min(boundaryPositions[upperComponent].x, boundaryPositions[lowerComponent].x);
|
|
368
|
+
lpath.push({
|
|
369
|
+
x: upperX,
|
|
370
|
+
y: boundaryPositions[upperComponent].y
|
|
371
|
+
});
|
|
372
|
+
lpath.push({
|
|
373
|
+
x: upperX,
|
|
374
|
+
y: centerY
|
|
375
|
+
});
|
|
376
|
+
lpath.push({
|
|
377
|
+
x: boundaryPositions[lowerComponent].x,
|
|
378
|
+
y: centerY
|
|
379
|
+
});
|
|
380
|
+
break;
|
|
381
|
+
case EAST:
|
|
382
|
+
var upperX = Math.max(boundaryPositions[upperComponent].x, boundaryPositions[lowerComponent].x);
|
|
383
|
+
lpath.push({
|
|
384
|
+
x: upperX,
|
|
385
|
+
y: boundaryPositions[upperComponent].y
|
|
386
|
+
});
|
|
387
|
+
lpath.push({
|
|
388
|
+
x: upperX,
|
|
389
|
+
y: centerY
|
|
390
|
+
});
|
|
391
|
+
lpath.push({
|
|
392
|
+
x: boundaryPositions[lowerComponent].x,
|
|
393
|
+
y: centerY
|
|
394
|
+
});
|
|
395
|
+
break;
|
|
396
|
+
default:
|
|
397
|
+
return this.path;
|
|
398
|
+
}
|
|
399
|
+
break;
|
|
400
|
+
case SOUTH:
|
|
401
|
+
switch (upperComponentDirection) {
|
|
402
|
+
case WEST:
|
|
403
|
+
var upperX = unionBounds.left;
|
|
404
|
+
var lowerX = upperX;
|
|
405
|
+
break;
|
|
406
|
+
case EAST:
|
|
407
|
+
var upperX = centerX !== undefined
|
|
408
|
+
? Math.max(centerX, boundaryPositions[upperComponent].x)
|
|
409
|
+
: unionBounds.left + unionBounds.width;
|
|
410
|
+
var lowerX = upperX;
|
|
411
|
+
break;
|
|
412
|
+
case NORTH:
|
|
413
|
+
var upperX = centerX !== undefined
|
|
414
|
+
? centerX
|
|
415
|
+
: boundaryPositions[upperComponent].x < boundaryPositions[lowerComponent].x
|
|
416
|
+
? unionBounds.left - centerHeight * 0.5
|
|
417
|
+
: unionBounds.left + unionBounds.width + centerHeight * 0.5;
|
|
418
|
+
var lowerX = upperX;
|
|
419
|
+
break;
|
|
420
|
+
case SOUTH:
|
|
421
|
+
var upperX = boundaryPositions[upperComponent].x;
|
|
422
|
+
var lowerX = boundaryPositions[upperComponent].x < boundaryPositions[lowerComponent].x
|
|
423
|
+
? Math.min(fromToBounds[lowerComponent].left, boundaryPositions[upperComponent].x)
|
|
424
|
+
: Math.max(fromToBounds[lowerComponent].left + fromToBounds[lowerComponent].width, boundaryPositions[upperComponent].x);
|
|
425
|
+
break;
|
|
426
|
+
default:
|
|
427
|
+
return this.path;
|
|
428
|
+
}
|
|
429
|
+
lpath.push({
|
|
430
|
+
x: upperX,
|
|
431
|
+
y: boundaryPositions[upperComponent].y
|
|
432
|
+
});
|
|
433
|
+
lpath.push({
|
|
434
|
+
x: upperX,
|
|
435
|
+
y: centerY
|
|
436
|
+
});
|
|
437
|
+
lpath.push({
|
|
438
|
+
x: lowerX,
|
|
439
|
+
y: centerY
|
|
440
|
+
});
|
|
441
|
+
lpath.push({
|
|
442
|
+
x: lowerX,
|
|
443
|
+
y: boundaryPositions[lowerComponent].y
|
|
444
|
+
});
|
|
445
|
+
break;
|
|
446
|
+
case EAST:
|
|
447
|
+
switch (upperComponentDirection) {
|
|
448
|
+
case WEST:
|
|
449
|
+
var upperX = centerX !== undefined
|
|
450
|
+
? Math.min(centerX, boundaryPositions[upperComponent].x)
|
|
451
|
+
: boundaryPositions[upperComponent].x;
|
|
452
|
+
var lowerX = centerX !== undefined
|
|
453
|
+
? Math.max(centerX, boundaryPositions[lowerComponent].x)
|
|
454
|
+
: boundaryPositions[lowerComponent].x;
|
|
455
|
+
break;
|
|
456
|
+
case EAST:
|
|
457
|
+
var upperX = unionBounds.left + unionBounds.width;
|
|
458
|
+
var lowerX = upperX;
|
|
459
|
+
break;
|
|
460
|
+
case NORTH:
|
|
461
|
+
var upperX = centerX !== undefined
|
|
462
|
+
? Math.max(centerX, boundaryPositions[lowerComponent].x)
|
|
463
|
+
: unionBounds.left + unionBounds.width;
|
|
464
|
+
var lowerX = upperX;
|
|
465
|
+
break;
|
|
466
|
+
case SOUTH:
|
|
467
|
+
var upperX = boundaryPositions[upperComponent].x;
|
|
468
|
+
var lowerX = Math.max(fromToBounds[lowerComponent].left + fromToBounds[lowerComponent].width, boundaryPositions[upperComponent].x);
|
|
469
|
+
break;
|
|
470
|
+
default:
|
|
471
|
+
return this.path;
|
|
472
|
+
}
|
|
473
|
+
lpath.push({
|
|
474
|
+
x: upperX,
|
|
475
|
+
y: boundaryPositions[upperComponent].y
|
|
476
|
+
});
|
|
477
|
+
lpath.push({
|
|
478
|
+
x: upperX,
|
|
479
|
+
y: centerY
|
|
480
|
+
});
|
|
481
|
+
lpath.push({
|
|
482
|
+
x: lowerX,
|
|
483
|
+
y: centerY
|
|
484
|
+
});
|
|
485
|
+
lpath.push({
|
|
486
|
+
x: lowerX,
|
|
487
|
+
y: boundaryPositions[lowerComponent].y
|
|
488
|
+
});
|
|
489
|
+
break;
|
|
490
|
+
case WEST:
|
|
491
|
+
switch (upperComponentDirection) {
|
|
492
|
+
case WEST:
|
|
493
|
+
var upperX = unionBounds.left;
|
|
494
|
+
var lowerX = upperX;
|
|
495
|
+
break;
|
|
496
|
+
case EAST:
|
|
497
|
+
var upperX = centerX !== undefined
|
|
498
|
+
? Math.max(centerX, boundaryPositions[upperComponent].x)
|
|
499
|
+
: boundaryPositions[upperComponent].x;
|
|
500
|
+
var lowerX = centerX !== undefined
|
|
501
|
+
? Math.min(centerX, boundaryPositions[lowerComponent].x)
|
|
502
|
+
: boundaryPositions[lowerComponent].x;
|
|
503
|
+
break;
|
|
504
|
+
case NORTH:
|
|
505
|
+
var upperX = unionBounds.left;
|
|
506
|
+
var lowerX = upperX;
|
|
507
|
+
break;
|
|
508
|
+
case SOUTH:
|
|
509
|
+
var upperX = boundaryPositions[upperComponent].x < boundaryPositions[lowerComponent].x
|
|
510
|
+
? Math.min(fromToBounds[lowerComponent].left, boundaryPositions[upperComponent].x)
|
|
511
|
+
: boundaryPositions[upperComponent].x;
|
|
512
|
+
var lowerX = Math.min(upperX, boundaryPositions[lowerComponent].x);
|
|
513
|
+
break;
|
|
514
|
+
default:
|
|
515
|
+
return this.path;
|
|
516
|
+
}
|
|
517
|
+
lpath.push({
|
|
518
|
+
x: upperX,
|
|
519
|
+
y: boundaryPositions[upperComponent].y
|
|
520
|
+
});
|
|
521
|
+
lpath.push({
|
|
522
|
+
x: upperX,
|
|
523
|
+
y: centerY
|
|
524
|
+
});
|
|
525
|
+
lpath.push({
|
|
526
|
+
x: lowerX,
|
|
527
|
+
y: centerY
|
|
528
|
+
});
|
|
529
|
+
lpath.push({
|
|
530
|
+
x: lowerX,
|
|
531
|
+
y: boundaryPositions[lowerComponent].y
|
|
532
|
+
});
|
|
533
|
+
break;
|
|
534
|
+
default:
|
|
535
|
+
return this.path;
|
|
536
|
+
}
|
|
537
|
+
path.push(...(upperComponent === FROM ? lpath : lpath.reverse()));
|
|
538
|
+
}
|
|
539
|
+
else {
|
|
540
|
+
switch (fromDirection) {
|
|
541
|
+
case NORTH:
|
|
542
|
+
switch (toDirection) {
|
|
543
|
+
case NORTH:
|
|
544
|
+
var y = unionBounds.top;
|
|
545
|
+
path.push({
|
|
546
|
+
x: boundaryPositions[FROM].x,
|
|
547
|
+
y
|
|
548
|
+
});
|
|
549
|
+
path.push({
|
|
550
|
+
x: boundaryPositions[TO].x,
|
|
551
|
+
y
|
|
552
|
+
});
|
|
553
|
+
break;
|
|
554
|
+
case SOUTH:
|
|
555
|
+
var x = unionBounds.left + unionBounds.width;
|
|
556
|
+
path.push({
|
|
557
|
+
x,
|
|
558
|
+
y: boundaryPositions[FROM].y
|
|
559
|
+
});
|
|
560
|
+
path.push({
|
|
561
|
+
x,
|
|
562
|
+
y: unionBounds.top + unionBounds.height
|
|
563
|
+
});
|
|
564
|
+
path.push({
|
|
565
|
+
x: boundaryPositions[TO].x,
|
|
566
|
+
y: unionBounds.top + unionBounds.height
|
|
567
|
+
});
|
|
568
|
+
break;
|
|
569
|
+
case EAST:
|
|
570
|
+
var x = boundaryPositions[TO].y < boundaryPositions[FROM].y &&
|
|
571
|
+
boundaryPositions[TO].x < boundaryPositions[FROM].x
|
|
572
|
+
? boundaryPositions[FROM].x
|
|
573
|
+
: unionBounds.left + unionBounds.width;
|
|
574
|
+
path.push({
|
|
575
|
+
x,
|
|
576
|
+
y: boundaryPositions[FROM].y
|
|
577
|
+
});
|
|
578
|
+
path.push({
|
|
579
|
+
x,
|
|
580
|
+
y: boundaryPositions[TO].y
|
|
581
|
+
});
|
|
582
|
+
break;
|
|
583
|
+
case WEST:
|
|
584
|
+
var x = unionBounds.left;
|
|
585
|
+
path.push({
|
|
586
|
+
x,
|
|
587
|
+
y: boundaryPositions[FROM].y
|
|
588
|
+
});
|
|
589
|
+
path.push({
|
|
590
|
+
x,
|
|
591
|
+
y: boundaryPositions[TO].y
|
|
592
|
+
});
|
|
593
|
+
break;
|
|
594
|
+
default:
|
|
595
|
+
return this.path;
|
|
596
|
+
}
|
|
597
|
+
break;
|
|
598
|
+
case SOUTH:
|
|
599
|
+
switch (toDirection) {
|
|
600
|
+
case NORTH:
|
|
601
|
+
var x = unionBounds.left + unionBounds.width;
|
|
602
|
+
path.push({
|
|
603
|
+
x,
|
|
604
|
+
y: boundaryPositions[FROM].y
|
|
605
|
+
});
|
|
606
|
+
path.push({
|
|
607
|
+
x,
|
|
608
|
+
y: unionBounds.top
|
|
609
|
+
});
|
|
610
|
+
path.push({
|
|
611
|
+
x: boundaryPositions[TO].x,
|
|
612
|
+
y: unionBounds.top
|
|
613
|
+
});
|
|
614
|
+
break;
|
|
615
|
+
case SOUTH:
|
|
616
|
+
var y = unionBounds.top + unionBounds.height;
|
|
617
|
+
path.push({
|
|
618
|
+
x: boundaryPositions[FROM].x,
|
|
619
|
+
y
|
|
620
|
+
});
|
|
621
|
+
path.push({
|
|
622
|
+
x: boundaryPositions[TO].x,
|
|
623
|
+
y
|
|
624
|
+
});
|
|
625
|
+
break;
|
|
626
|
+
case EAST:
|
|
627
|
+
var y = unionBounds.top + unionBounds.height;
|
|
628
|
+
path.push({
|
|
629
|
+
x: boundaryPositions[FROM].x,
|
|
630
|
+
y
|
|
631
|
+
});
|
|
632
|
+
path.push({
|
|
633
|
+
x: boundaryPositions[TO].x,
|
|
634
|
+
y
|
|
635
|
+
});
|
|
636
|
+
break;
|
|
637
|
+
case WEST:
|
|
638
|
+
var y = unionBounds.top + unionBounds.height;
|
|
639
|
+
path.push({
|
|
640
|
+
x: boundaryPositions[FROM].x,
|
|
641
|
+
y
|
|
642
|
+
});
|
|
643
|
+
path.push({
|
|
644
|
+
x: boundaryPositions[TO].x,
|
|
645
|
+
y
|
|
646
|
+
});
|
|
647
|
+
break;
|
|
648
|
+
default:
|
|
649
|
+
return this.path;
|
|
650
|
+
}
|
|
651
|
+
break;
|
|
652
|
+
case WEST:
|
|
653
|
+
switch (toDirection) {
|
|
654
|
+
case NORTH:
|
|
655
|
+
var x = boundaryPositions[FROM].x > boundaryPositions[TO].x &&
|
|
656
|
+
boundaryPositions[FROM].y < boundaryPositions[TO].y
|
|
657
|
+
? boundaryPositions[TO].x
|
|
658
|
+
: unionBounds.left;
|
|
659
|
+
var y = boundaryPositions[FROM].x > boundaryPositions[TO].x &&
|
|
660
|
+
boundaryPositions[FROM].y < boundaryPositions[TO].y
|
|
661
|
+
? boundaryPositions[TO].y
|
|
662
|
+
: Math.min(unionBounds.top, boundaryPositions[FROM].y);
|
|
663
|
+
path.push({
|
|
664
|
+
x,
|
|
665
|
+
y: boundaryPositions[FROM].y
|
|
666
|
+
});
|
|
667
|
+
path.push({
|
|
668
|
+
x,
|
|
669
|
+
y
|
|
670
|
+
});
|
|
671
|
+
path.push({
|
|
672
|
+
x: boundaryPositions[TO].x,
|
|
673
|
+
y
|
|
674
|
+
});
|
|
675
|
+
break;
|
|
676
|
+
case SOUTH:
|
|
677
|
+
var x = unionBounds.left;
|
|
678
|
+
var y = Math.max(unionBounds.top + unionBounds.height, boundaryPositions[FROM].y);
|
|
679
|
+
path.push({
|
|
680
|
+
x,
|
|
681
|
+
y: boundaryPositions[FROM].y
|
|
682
|
+
});
|
|
683
|
+
path.push({
|
|
684
|
+
x,
|
|
685
|
+
y
|
|
686
|
+
});
|
|
687
|
+
path.push({
|
|
688
|
+
x: boundaryPositions[TO].x,
|
|
689
|
+
y
|
|
690
|
+
});
|
|
691
|
+
break;
|
|
692
|
+
case EAST:
|
|
693
|
+
var x = unionBounds.left + unionBounds.width;
|
|
694
|
+
path.push({
|
|
695
|
+
x: boundaryPositions[FROM].x,
|
|
696
|
+
y: unionBounds.top
|
|
697
|
+
});
|
|
698
|
+
path.push({
|
|
699
|
+
x,
|
|
700
|
+
y: unionBounds.top
|
|
701
|
+
});
|
|
702
|
+
path.push({
|
|
703
|
+
x,
|
|
704
|
+
y: boundaryPositions[TO].y
|
|
705
|
+
});
|
|
706
|
+
break;
|
|
707
|
+
case WEST:
|
|
708
|
+
var x = unionBounds.left;
|
|
709
|
+
path.push({
|
|
710
|
+
x,
|
|
711
|
+
y: boundaryPositions[FROM].y
|
|
712
|
+
});
|
|
713
|
+
path.push({
|
|
714
|
+
x,
|
|
715
|
+
y: boundaryPositions[TO].y
|
|
716
|
+
});
|
|
717
|
+
break;
|
|
718
|
+
default:
|
|
719
|
+
return this.path;
|
|
720
|
+
}
|
|
721
|
+
break;
|
|
722
|
+
case EAST:
|
|
723
|
+
switch (toDirection) {
|
|
724
|
+
case NORTH:
|
|
725
|
+
var y = boundaryPositions[FROM].y < boundaryPositions[TO].y &&
|
|
726
|
+
boundaryPositions[FROM].x < boundaryPositions[TO].x
|
|
727
|
+
? boundaryPositions[FROM].y
|
|
728
|
+
: unionBounds.top;
|
|
729
|
+
path.push({
|
|
730
|
+
x: boundaryPositions[FROM].x,
|
|
731
|
+
y
|
|
732
|
+
});
|
|
733
|
+
path.push({
|
|
734
|
+
x: boundaryPositions[TO].x,
|
|
735
|
+
y
|
|
736
|
+
});
|
|
737
|
+
break;
|
|
738
|
+
case SOUTH:
|
|
739
|
+
var y = boundaryPositions[FROM].y > boundaryPositions[TO].y &&
|
|
740
|
+
boundaryPositions[FROM].x < boundaryPositions[TO].x
|
|
741
|
+
? boundaryPositions[FROM].y
|
|
742
|
+
: unionBounds.top + unionBounds.height;
|
|
743
|
+
path.push({
|
|
744
|
+
x: boundaryPositions[FROM].x,
|
|
745
|
+
y
|
|
746
|
+
});
|
|
747
|
+
path.push({
|
|
748
|
+
x: boundaryPositions[TO].x,
|
|
749
|
+
y
|
|
750
|
+
});
|
|
751
|
+
break;
|
|
752
|
+
case EAST:
|
|
753
|
+
var y = unionBounds.top + unionBounds.height;
|
|
754
|
+
path.push({
|
|
755
|
+
x: boundaryPositions[FROM].x,
|
|
756
|
+
y
|
|
757
|
+
});
|
|
758
|
+
path.push({
|
|
759
|
+
x: boundaryPositions[TO].x,
|
|
760
|
+
y
|
|
761
|
+
});
|
|
762
|
+
break;
|
|
763
|
+
case WEST:
|
|
764
|
+
var y = unionBounds.top + unionBounds.height;
|
|
765
|
+
path.push({
|
|
766
|
+
x: boundaryPositions[FROM].x,
|
|
767
|
+
y
|
|
768
|
+
});
|
|
769
|
+
path.push({
|
|
770
|
+
x: boundaryPositions[TO].x,
|
|
771
|
+
y
|
|
772
|
+
});
|
|
773
|
+
break;
|
|
774
|
+
default:
|
|
775
|
+
return this.path;
|
|
776
|
+
}
|
|
777
|
+
break;
|
|
778
|
+
default:
|
|
779
|
+
return this.path;
|
|
780
|
+
}
|
|
781
|
+
}
|
|
782
|
+
if (toBoundaryPosition) {
|
|
783
|
+
path.push(toBoundaryPosition);
|
|
784
|
+
}
|
|
785
|
+
/* following 2 filters not to be merged */
|
|
786
|
+
return [fromPosition, ...path, toPosition]
|
|
787
|
+
.filter((p, idx, path) => {
|
|
788
|
+
if (idx === 0) {
|
|
789
|
+
return true;
|
|
790
|
+
}
|
|
791
|
+
const prev = path[idx - 1];
|
|
792
|
+
if (p.x === prev.x && p.y === prev.y) {
|
|
793
|
+
return false;
|
|
794
|
+
}
|
|
795
|
+
return true;
|
|
796
|
+
})
|
|
797
|
+
.filter((p, idx, path) => {
|
|
798
|
+
if (idx === 0 || idx >= path.length - 1) {
|
|
799
|
+
return true;
|
|
800
|
+
}
|
|
801
|
+
const prev = path[idx - 1];
|
|
802
|
+
const next = path[idx + 1];
|
|
803
|
+
if ((p.x === prev.x && p.x === next.x) || (p.y === prev.y && p.y === next.y)) {
|
|
804
|
+
return false;
|
|
805
|
+
}
|
|
806
|
+
return true;
|
|
807
|
+
});
|
|
808
|
+
}
|
|
809
|
+
get nature() {
|
|
810
|
+
return NATURE;
|
|
811
|
+
}
|
|
812
|
+
}
|
|
813
|
+
Component.register('ortholine', OrthoLine);
|
|
814
|
+
//# sourceMappingURL=ortholine.js.map
|