@fmsim/board 0.0.49
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/.storybook/main.js +3 -0
- package/.storybook/server.mjs +8 -0
- package/custom-elements.json +6500 -0
- package/demo/index-modeller.html +102 -0
- package/demo/index-player.html +101 -0
- package/demo/index-viewer.html +101 -0
- package/demo/index.html +101 -0
- package/dist/src/component/etc.d.ts +2 -0
- package/dist/src/component/etc.js +104 -0
- package/dist/src/component/etc.js.map +1 -0
- package/dist/src/component/index.d.ts +1 -0
- package/dist/src/component/index.js +2 -0
- package/dist/src/component/index.js.map +1 -0
- package/dist/src/component/register-default-groups.d.ts +1 -0
- package/dist/src/component/register-default-groups.js +6 -0
- package/dist/src/component/register-default-groups.js.map +1 -0
- package/dist/src/data-storage/data-storage.d.ts +8 -0
- package/dist/src/data-storage/data-storage.js +28 -0
- package/dist/src/data-storage/data-storage.js.map +1 -0
- package/dist/src/graphql/board.d.ts +6 -0
- package/dist/src/graphql/board.js +139 -0
- package/dist/src/graphql/board.js.map +1 -0
- package/dist/src/graphql/data-subscription.d.ts +5 -0
- package/dist/src/graphql/data-subscription.js +24 -0
- package/dist/src/graphql/data-subscription.js.map +1 -0
- package/dist/src/graphql/favorite-board.d.ts +1 -0
- package/dist/src/graphql/favorite-board.js +23 -0
- package/dist/src/graphql/favorite-board.js.map +1 -0
- package/dist/src/graphql/group.d.ts +7 -0
- package/dist/src/graphql/group.js +125 -0
- package/dist/src/graphql/group.js.map +1 -0
- package/dist/src/graphql/index.d.ts +4 -0
- package/dist/src/graphql/index.js +5 -0
- package/dist/src/graphql/index.js.map +1 -0
- package/dist/src/graphql/play-group.d.ts +8 -0
- package/dist/src/graphql/play-group.js +173 -0
- package/dist/src/graphql/play-group.js.map +1 -0
- package/dist/src/graphql/scenario.d.ts +6 -0
- package/dist/src/graphql/scenario.js +69 -0
- package/dist/src/graphql/scenario.js.map +1 -0
- package/dist/src/index.d.ts +6 -0
- package/dist/src/index.js +7 -0
- package/dist/src/index.js.map +1 -0
- package/dist/src/layers/bouncing-arrow-decorator.d.ts +1 -0
- package/dist/src/layers/bouncing-arrow-decorator.js +40 -0
- package/dist/src/layers/bouncing-arrow-decorator.js.map +1 -0
- package/dist/src/layers/event-handlers.d.ts +1 -0
- package/dist/src/layers/event-handlers.js +70 -0
- package/dist/src/layers/event-handlers.js.map +1 -0
- package/dist/src/layers/mcs-event-handlers.d.ts +1 -0
- package/dist/src/layers/mcs-event-handlers.js +73 -0
- package/dist/src/layers/mcs-event-handlers.js.map +1 -0
- package/dist/src/layers/movement-layer.d.ts +27 -0
- package/dist/src/layers/movement-layer.js +109 -0
- package/dist/src/layers/movement-layer.js.map +1 -0
- package/dist/src/layers/ox-mini-map.d.ts +1 -0
- package/dist/src/layers/ox-mini-map.js +189 -0
- package/dist/src/layers/ox-mini-map.js.map +1 -0
- package/dist/src/layers/scroll-layer.d.ts +24 -0
- package/dist/src/layers/scroll-layer.js +125 -0
- package/dist/src/layers/scroll-layer.js.map +1 -0
- package/dist/src/layers/shift-handler.d.ts +1 -0
- package/dist/src/layers/shift-handler.js +38 -0
- package/dist/src/layers/shift-handler.js.map +1 -0
- package/dist/src/layers/zoom-handler.d.ts +1 -0
- package/dist/src/layers/zoom-handler.js +36 -0
- package/dist/src/layers/zoom-handler.js.map +1 -0
- package/dist/src/modeller/component-toolbar/component-detail.d.ts +12 -0
- package/dist/src/modeller/component-toolbar/component-detail.js +53 -0
- package/dist/src/modeller/component-toolbar/component-detail.js.map +1 -0
- package/dist/src/modeller/component-toolbar/component-menu.d.ts +27 -0
- package/dist/src/modeller/component-toolbar/component-menu.js +192 -0
- package/dist/src/modeller/component-toolbar/component-menu.js.map +1 -0
- package/dist/src/modeller/component-toolbar/component-toolbar.d.ts +30 -0
- package/dist/src/modeller/component-toolbar/component-toolbar.js +188 -0
- package/dist/src/modeller/component-toolbar/component-toolbar.js.map +1 -0
- package/dist/src/modeller/component-toolbar/mode-icons.d.ts +2 -0
- package/dist/src/modeller/component-toolbar/mode-icons.js +86 -0
- package/dist/src/modeller/component-toolbar/mode-icons.js.map +1 -0
- package/dist/src/modeller/edit-toolbar-style.d.ts +4 -0
- package/dist/src/modeller/edit-toolbar-style.js +227 -0
- package/dist/src/modeller/edit-toolbar-style.js.map +1 -0
- package/dist/src/modeller/edit-toolbar.d.ts +61 -0
- package/dist/src/modeller/edit-toolbar.js +646 -0
- package/dist/src/modeller/edit-toolbar.js.map +1 -0
- package/dist/src/modeller/property-sidebar/abstract-property.d.ts +10 -0
- package/dist/src/modeller/property-sidebar/abstract-property.js +55 -0
- package/dist/src/modeller/property-sidebar/abstract-property.js.map +1 -0
- package/dist/src/modeller/property-sidebar/data-binding/data-binding-mapper.d.ts +54 -0
- package/dist/src/modeller/property-sidebar/data-binding/data-binding-mapper.js +392 -0
- package/dist/src/modeller/property-sidebar/data-binding/data-binding-mapper.js.map +1 -0
- package/dist/src/modeller/property-sidebar/data-binding/data-binding-value-map.d.ts +6 -0
- package/dist/src/modeller/property-sidebar/data-binding/data-binding-value-map.js +19 -0
- package/dist/src/modeller/property-sidebar/data-binding/data-binding-value-map.js.map +1 -0
- package/dist/src/modeller/property-sidebar/data-binding/data-binding-value-range.d.ts +6 -0
- package/dist/src/modeller/property-sidebar/data-binding/data-binding-value-range.js +19 -0
- package/dist/src/modeller/property-sidebar/data-binding/data-binding-value-range.js.map +1 -0
- package/dist/src/modeller/property-sidebar/data-binding/data-binding.d.ts +43 -0
- package/dist/src/modeller/property-sidebar/data-binding/data-binding.js +416 -0
- package/dist/src/modeller/property-sidebar/data-binding/data-binding.js.map +1 -0
- package/dist/src/modeller/property-sidebar/effects/effects-shared-style.d.ts +4 -0
- package/dist/src/modeller/property-sidebar/effects/effects-shared-style.js +61 -0
- package/dist/src/modeller/property-sidebar/effects/effects-shared-style.js.map +1 -0
- package/dist/src/modeller/property-sidebar/effects/effects.d.ts +22 -0
- package/dist/src/modeller/property-sidebar/effects/effects.js +46 -0
- package/dist/src/modeller/property-sidebar/effects/effects.js.map +1 -0
- package/dist/src/modeller/property-sidebar/effects/property-event-hover.d.ts +20 -0
- package/dist/src/modeller/property-sidebar/effects/property-event-hover.js +128 -0
- package/dist/src/modeller/property-sidebar/effects/property-event-hover.js.map +1 -0
- package/dist/src/modeller/property-sidebar/effects/property-event-tap.d.ts +28 -0
- package/dist/src/modeller/property-sidebar/effects/property-event-tap.js +190 -0
- package/dist/src/modeller/property-sidebar/effects/property-event-tap.js.map +1 -0
- package/dist/src/modeller/property-sidebar/effects/property-event.d.ts +22 -0
- package/dist/src/modeller/property-sidebar/effects/property-event.js +55 -0
- package/dist/src/modeller/property-sidebar/effects/property-event.js.map +1 -0
- package/dist/src/modeller/property-sidebar/effects/property-shadow.d.ts +23 -0
- package/dist/src/modeller/property-sidebar/effects/property-shadow.js +103 -0
- package/dist/src/modeller/property-sidebar/effects/property-shadow.js.map +1 -0
- package/dist/src/modeller/property-sidebar/effects/value-converter.d.ts +1 -0
- package/dist/src/modeller/property-sidebar/effects/value-converter.js +21 -0
- package/dist/src/modeller/property-sidebar/effects/value-converter.js.map +1 -0
- package/dist/src/modeller/property-sidebar/inspector/inspector.d.ts +29 -0
- package/dist/src/modeller/property-sidebar/inspector/inspector.js +334 -0
- package/dist/src/modeller/property-sidebar/inspector/inspector.js.map +1 -0
- package/dist/src/modeller/property-sidebar/property-shared-style.d.ts +4 -0
- package/dist/src/modeller/property-sidebar/property-shared-style.js +135 -0
- package/dist/src/modeller/property-sidebar/property-shared-style.js.map +1 -0
- package/dist/src/modeller/property-sidebar/property-sidebar.d.ts +47 -0
- package/dist/src/modeller/property-sidebar/property-sidebar.js +324 -0
- package/dist/src/modeller/property-sidebar/property-sidebar.js.map +1 -0
- package/dist/src/modeller/property-sidebar/shapes/box-padding-editor-styles.d.ts +1 -0
- package/dist/src/modeller/property-sidebar/shapes/box-padding-editor-styles.js +94 -0
- package/dist/src/modeller/property-sidebar/shapes/box-padding-editor-styles.js.map +1 -0
- package/dist/src/modeller/property-sidebar/shapes/shapes.d.ts +25 -0
- package/dist/src/modeller/property-sidebar/shapes/shapes.js +354 -0
- package/dist/src/modeller/property-sidebar/shapes/shapes.js.map +1 -0
- package/dist/src/modeller/property-sidebar/specifics/specific-properties-builder.d.ts +16 -0
- package/dist/src/modeller/property-sidebar/specifics/specific-properties-builder.js +132 -0
- package/dist/src/modeller/property-sidebar/specifics/specific-properties-builder.js.map +1 -0
- package/dist/src/modeller/property-sidebar/specifics/specifics.d.ts +28 -0
- package/dist/src/modeller/property-sidebar/specifics/specifics.js +129 -0
- package/dist/src/modeller/property-sidebar/specifics/specifics.js.map +1 -0
- package/dist/src/modeller/property-sidebar/styles/styles.d.ts +21 -0
- package/dist/src/modeller/property-sidebar/styles/styles.js +559 -0
- package/dist/src/modeller/property-sidebar/styles/styles.js.map +1 -0
- package/dist/src/modeller/scene-viewer/confidential-overlay.d.ts +4 -0
- package/dist/src/modeller/scene-viewer/confidential-overlay.js +14 -0
- package/dist/src/modeller/scene-viewer/confidential-overlay.js.map +1 -0
- package/dist/src/modeller/scene-viewer/ox-scene-handler.d.ts +11 -0
- package/dist/src/modeller/scene-viewer/ox-scene-handler.js +36 -0
- package/dist/src/modeller/scene-viewer/ox-scene-handler.js.map +1 -0
- package/dist/src/modeller/scene-viewer/ox-scene-layer.d.ts +10 -0
- package/dist/src/modeller/scene-viewer/ox-scene-layer.js +42 -0
- package/dist/src/modeller/scene-viewer/ox-scene-layer.js.map +1 -0
- package/dist/src/modeller/scene-viewer/ox-scene-property.d.ts +6 -0
- package/dist/src/modeller/scene-viewer/ox-scene-property.js +19 -0
- package/dist/src/modeller/scene-viewer/ox-scene-property.js.map +1 -0
- package/dist/src/modeller/scene-viewer/ox-scene-viewer.d.ts +40 -0
- package/dist/src/modeller/scene-viewer/ox-scene-viewer.js +253 -0
- package/dist/src/modeller/scene-viewer/ox-scene-viewer.js.map +1 -0
- package/dist/src/ox-board-list.d.ts +2 -0
- package/dist/src/ox-board-list.js +425 -0
- package/dist/src/ox-board-list.js.map +1 -0
- package/dist/src/ox-board-modeller.d.ts +57 -0
- package/dist/src/ox-board-modeller.js +401 -0
- package/dist/src/ox-board-modeller.js.map +1 -0
- package/dist/src/ox-board-viewer-backup.d.ts +64 -0
- package/dist/src/ox-board-viewer-backup.js +529 -0
- package/dist/src/ox-board-viewer-backup.js.map +1 -0
- package/dist/src/ox-board-viewer-other.d.ts +19 -0
- package/dist/src/ox-board-viewer-other.js +82 -0
- package/dist/src/ox-board-viewer-other.js.map +1 -0
- package/dist/src/ox-board-viewer.d.ts +60 -0
- package/dist/src/ox-board-viewer.js +503 -0
- package/dist/src/ox-board-viewer.js.map +1 -0
- package/dist/src/ox-editor-board-selector.d.ts +15 -0
- package/dist/src/ox-editor-board-selector.js +85 -0
- package/dist/src/ox-editor-board-selector.js.map +1 -0
- package/dist/src/ox-property-editor-board-selector.d.ts +4 -0
- package/dist/src/ox-property-editor-board-selector.js +22 -0
- package/dist/src/ox-property-editor-board-selector.js.map +1 -0
- package/dist/src/ox-property-editor-theme.d.ts +19 -0
- package/dist/src/ox-property-editor-theme.js +111 -0
- package/dist/src/ox-property-editor-theme.js.map +1 -0
- package/dist/src/selector/board-creation-popup.d.ts +19 -0
- package/dist/src/selector/board-creation-popup.js +100 -0
- package/dist/src/selector/board-creation-popup.js.map +1 -0
- package/dist/src/selector/board-thumbnail-card.d.ts +15 -0
- package/dist/src/selector/board-thumbnail-card.js +168 -0
- package/dist/src/selector/board-thumbnail-card.js.map +1 -0
- package/dist/src/selector/ox-board-creation-card.d.ts +14 -0
- package/dist/src/selector/ox-board-creation-card.js +84 -0
- package/dist/src/selector/ox-board-creation-card.js.map +1 -0
- package/dist/src/selector/ox-board-selector.d.ts +45 -0
- package/dist/src/selector/ox-board-selector.js +273 -0
- package/dist/src/selector/ox-board-selector.js.map +1 -0
- package/dist/src/types.d.ts +37 -0
- package/dist/src/types.js +2 -0
- package/dist/src/types.js.map +1 -0
- package/dist/stories/index.stories.d.ts +33 -0
- package/dist/stories/index.stories.js +33 -0
- package/dist/stories/index.stories.js.map +1 -0
- package/dist/tsconfig.tsbuildinfo +1 -0
- package/icons/components/dash.png +0 -0
- package/icons/components/ellipse.png +0 -0
- package/icons/components/line.png +0 -0
- package/icons/components/no-image.png +0 -0
- package/icons/components/popup.png +0 -0
- package/icons/components/rect.png +0 -0
- package/icons/icon-collapse-active.png +0 -0
- package/icons/icon-collapse.png +0 -0
- package/icons/icon-fullscreen.png +0 -0
- package/icons/icon-htoolbar.png +0 -0
- package/icons/icon-properties-arrow-type.png +0 -0
- package/icons/icon-properties-gradient-direction.png +0 -0
- package/icons/icon-properties-label.png +0 -0
- package/icons/icon-properties-line-type.png +0 -0
- package/icons/icon-properties-padding.png +0 -0
- package/icons/icon-properties-ratio.png +0 -0
- package/icons/icon-properties-table.png +0 -0
- package/icons/icon-properties.png +0 -0
- package/icons/icon-shell-inspector.png +0 -0
- package/package.json +149 -0
- package/stories/index.stories.ts +52 -0
- package/web-dev-server.config.mjs +30 -0
- package/web-test-runner.config.mjs +29 -0
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
import { Component, Layer } from '@hatiolab/things-scene';
|
|
2
|
+
export default class ScrollLayer extends Layer {
|
|
3
|
+
constructor() {
|
|
4
|
+
super(...arguments);
|
|
5
|
+
this.vscroller = null;
|
|
6
|
+
this.hscroller = null;
|
|
7
|
+
}
|
|
8
|
+
get capturable() {
|
|
9
|
+
return true;
|
|
10
|
+
}
|
|
11
|
+
render(ctx) {
|
|
12
|
+
const { scrolling } = this.state;
|
|
13
|
+
ctx.save();
|
|
14
|
+
ctx.beginPath();
|
|
15
|
+
ctx.fillStyle = '#777';
|
|
16
|
+
if (this.vscroller) {
|
|
17
|
+
const { left, top, width, height } = this.vscroller;
|
|
18
|
+
ctx.globalAlpha = scrolling == 'v' ? 1 : 0.3;
|
|
19
|
+
ctx.fillRect(left, top, width, height);
|
|
20
|
+
}
|
|
21
|
+
if (this.hscroller) {
|
|
22
|
+
const { left, top, width, height } = this.hscroller;
|
|
23
|
+
ctx.globalAlpha = scrolling == 'h' ? 1 : 0.3;
|
|
24
|
+
ctx.fillRect(left, top, width, height);
|
|
25
|
+
}
|
|
26
|
+
ctx.stroke();
|
|
27
|
+
ctx.restore();
|
|
28
|
+
}
|
|
29
|
+
contains(x, y) {
|
|
30
|
+
const vscroller = this.vscroller;
|
|
31
|
+
const hscroller = this.hscroller;
|
|
32
|
+
this.setState('scrolling', vscroller &&
|
|
33
|
+
x >= vscroller.left &&
|
|
34
|
+
x <= vscroller.left + vscroller.width &&
|
|
35
|
+
y >= vscroller.top &&
|
|
36
|
+
y <= vscroller.top + vscroller.height
|
|
37
|
+
? 'v'
|
|
38
|
+
: hscroller &&
|
|
39
|
+
x >= hscroller.left &&
|
|
40
|
+
x <= hscroller.left + hscroller.width &&
|
|
41
|
+
y >= hscroller.top &&
|
|
42
|
+
y <= hscroller.top + hscroller.height
|
|
43
|
+
? 'h'
|
|
44
|
+
: null);
|
|
45
|
+
return !!this.getState('scrolling');
|
|
46
|
+
}
|
|
47
|
+
get eventMap() {
|
|
48
|
+
return {
|
|
49
|
+
'(root)': {
|
|
50
|
+
'model-layer': {
|
|
51
|
+
change: this.onchangeModelLayer
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
};
|
|
55
|
+
}
|
|
56
|
+
onchange(after) {
|
|
57
|
+
if ('scrolling' in after) {
|
|
58
|
+
this.invalidate();
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
ondragstart(e, hint) {
|
|
62
|
+
this.lastPosition = { x: e.offsetX, y: e.offsetY };
|
|
63
|
+
}
|
|
64
|
+
ondragmove(e, hint) {
|
|
65
|
+
const root = this.root;
|
|
66
|
+
const { clientWidth: cw, clientHeight: ch } = this.canvas; /* canvas width, height */
|
|
67
|
+
const { width: mw, height: mh } = this.rootModel.model; /* model width, height */
|
|
68
|
+
const { x, y } = { x: e.offsetX, y: e.offsetY };
|
|
69
|
+
const { x: sx, y: sy } = this._scale;
|
|
70
|
+
const { scrolling } = this.state;
|
|
71
|
+
const vx = mw / cw;
|
|
72
|
+
const vy = mh / ch;
|
|
73
|
+
if (scrolling)
|
|
74
|
+
// 모델레이어의 원점을 움직인다.
|
|
75
|
+
root.rootModel.move({
|
|
76
|
+
x: scrolling == 'h' ? (-x + this.lastPosition.x) * sx * vx : 0,
|
|
77
|
+
y: scrolling == 'v' ? (-y + this.lastPosition.y) * sy * vy : 0
|
|
78
|
+
}, false /* moving with relative position */);
|
|
79
|
+
this.lastPosition = { x: e.offsetX, y: e.offsetY };
|
|
80
|
+
}
|
|
81
|
+
ondragend() {
|
|
82
|
+
delete this.lastPosition;
|
|
83
|
+
this.setState({
|
|
84
|
+
scrolling: null
|
|
85
|
+
});
|
|
86
|
+
}
|
|
87
|
+
calcScrollerBounds() {
|
|
88
|
+
// const DPPX = Scene.DPPX
|
|
89
|
+
var { clientWidth: cw, clientHeight: ch } = this.canvas; /* canvas width, height */
|
|
90
|
+
const { width: mw, height: mh } = this.rootModel.model; /* model width, height */
|
|
91
|
+
const { x: sx = 1, y: sy = 1 } = this._scale || {};
|
|
92
|
+
const { x: tx = 0, y: ty = 0 } = this._translate || {};
|
|
93
|
+
const vx = mw / cw;
|
|
94
|
+
const vy = mh / ch;
|
|
95
|
+
var bounds = {
|
|
96
|
+
left: -tx / sx / vx,
|
|
97
|
+
top: ch - 10,
|
|
98
|
+
width: cw / sx / vx,
|
|
99
|
+
height: 10
|
|
100
|
+
};
|
|
101
|
+
this.hscroller = bounds.left > 1 || bounds.width + bounds.left < cw - 1 ? bounds : null;
|
|
102
|
+
bounds = {
|
|
103
|
+
left: cw - 10,
|
|
104
|
+
top: -ty / sy / vy,
|
|
105
|
+
width: 10,
|
|
106
|
+
height: ch / sy / vy
|
|
107
|
+
};
|
|
108
|
+
this.vscroller = bounds.top > 1 || bounds.height + bounds.top < ch - 1 ? bounds : null;
|
|
109
|
+
this.invalidate();
|
|
110
|
+
}
|
|
111
|
+
onchangeModelLayer(after, before, hint) {
|
|
112
|
+
if (after.scale) {
|
|
113
|
+
const { x = 1, y = 1 } = (after === null || after === void 0 ? void 0 : after.scale) || {};
|
|
114
|
+
this._scale = { x, y };
|
|
115
|
+
this.calcScrollerBounds();
|
|
116
|
+
}
|
|
117
|
+
if (after.translate) {
|
|
118
|
+
const { x = 0, y = 0 } = after.translate || {};
|
|
119
|
+
this._translate = { x, y };
|
|
120
|
+
this.calcScrollerBounds();
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
Component.register('scroll-layer', ScrollLayer);
|
|
125
|
+
//# sourceMappingURL=scroll-layer.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"scroll-layer.js","sourceRoot":"","sources":["../../../src/layers/scroll-layer.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,KAAK,EAAqB,MAAM,wBAAwB,CAAA;AAE5E,MAAM,CAAC,OAAO,OAAO,WAAY,SAAQ,KAAK;IAA9C;;QASU,cAAS,GAAwE,IAAI,CAAA;QACrF,cAAS,GAAwE,IAAI,CAAA;IAmJ/F,CAAC;IA5JC,IAAI,UAAU;QACZ,OAAO,IAAI,CAAA;IACb,CAAC;IASD,MAAM,CAAC,GAA6B;QAClC,MAAM,EAAE,SAAS,EAAE,GAAG,IAAI,CAAC,KAAK,CAAA;QAEhC,GAAG,CAAC,IAAI,EAAE,CAAA;QACV,GAAG,CAAC,SAAS,EAAE,CAAA;QAEf,GAAG,CAAC,SAAS,GAAG,MAAM,CAAA;QAEtB,IAAI,IAAI,CAAC,SAAS,EAAE;YAClB,MAAM,EAAE,IAAI,EAAE,GAAG,EAAE,KAAK,EAAE,MAAM,EAAE,GAAG,IAAI,CAAC,SAAU,CAAA;YAEpD,GAAG,CAAC,WAAW,GAAG,SAAS,IAAI,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,CAAA;YAC5C,GAAG,CAAC,QAAQ,C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,CAAC,SAAS,IAAI,EAAE,CAAA;YAC9C,IAAI,CAAC,UAAU,GAAG,EAAE,CAAC,EAAE,CAAC,EAAE,CAAA;YAE1B,IAAI,CAAC,kBAAkB,EAAE,CAAA;SAC1B;IACH,CAAC;CACF;AAED,SAAS,CAAC,QAAQ,CAAC,cAAc,EAAE,WAAW,CAAC,CAAA","sourcesContent":["import { Component, Layer, Properties, Scene } from '@hatiolab/things-scene'\n\nexport default class ScrollLayer extends Layer {\n get capturable() {\n return true\n }\n\n private _scale?: { x: number; y: number }\n private _translate?: { x: number; y: number }\n private lastPosition?: { x: number; y: number }\n\n private vscroller: { left: number; top: number; width: number; height: number } | null = null\n private hscroller: { left: number; top: number; width: number; height: number } | null = null\n\n render(ctx: CanvasRenderingContext2D) {\n const { scrolling } = this.state\n\n ctx.save()\n ctx.beginPath()\n\n ctx.fillStyle = '#777'\n\n if (this.vscroller) {\n const { left, top, width, height } = this.vscroller!\n\n ctx.globalAlpha = scrolling == 'v' ? 1 : 0.3\n ctx.fillRect(left, top, width, height)\n }\n\n if (this.hscroller) {\n const { left, top, width, height } = this.hscroller!\n\n ctx.globalAlpha = scrolling == 'h' ? 1 : 0.3\n ctx.fillRect(left, top, width, height)\n }\n\n ctx.stroke()\n ctx.restore()\n }\n\n contains(x: number, y: number) {\n const vscroller = this.vscroller\n const hscroller = this.hscroller\n\n this.setState(\n 'scrolling',\n vscroller &&\n x >= vscroller.left &&\n x <= vscroller.left + vscroller.width &&\n y >= vscroller.top &&\n y <= vscroller.top + vscroller.height\n ? 'v'\n : hscroller &&\n x >= hscroller.left &&\n x <= hscroller.left + hscroller.width &&\n y >= hscroller.top &&\n y <= hscroller.top + hscroller.height\n ? 'h'\n : null\n )\n\n return !!this.getState('scrolling')\n }\n\n get eventMap() {\n return {\n '(root)': {\n 'model-layer': {\n change: this.onchangeModelLayer\n }\n }\n }\n }\n\n onchange(after: Properties) {\n if ('scrolling' in after) {\n this.invalidate()\n }\n }\n\n ondragstart(e: DragEvent, hint: any) {\n this.lastPosition = { x: e.offsetX, y: e.offsetY }\n }\n\n ondragmove(e: DragEvent, hint: any) {\n const root = this.root\n\n const { clientWidth: cw, clientHeight: ch } = this.canvas! /* canvas width, height */\n const { width: mw, height: mh } = this.rootModel.model /* model width, height */\n const { x, y } = { x: e.offsetX, y: e.offsetY }\n const { x: sx, y: sy } = this._scale!\n const { scrolling } = this.state\n const vx = mw / cw\n const vy = mh / ch\n\n if (scrolling)\n // 모델레이어의 원점을 움직인다.\n root.rootModel.move(\n {\n x: scrolling == 'h' ? (-x + this.lastPosition!.x) * sx * vx : 0,\n y: scrolling == 'v' ? (-y + this.lastPosition!.y) * sy * vy : 0\n },\n false /* moving with relative position */\n )\n\n this.lastPosition = { x: e.offsetX, y: e.offsetY }\n }\n\n ondragend() {\n delete this.lastPosition\n this.setState({\n scrolling: null\n })\n }\n\n calcScrollerBounds() {\n // const DPPX = Scene.DPPX\n var { clientWidth: cw, clientHeight: ch } = this.canvas! /* canvas width, height */\n const { width: mw, height: mh } = this.rootModel.model /* model width, height */\n const { x: sx = 1, y: sy = 1 } = this._scale || {}\n const { x: tx = 0, y: ty = 0 } = this._translate || {}\n\n const vx = mw / cw\n const vy = mh / ch\n\n var bounds = {\n left: -tx / sx / vx,\n top: ch - 10,\n width: cw / sx / vx,\n height: 10\n }\n this.hscroller = bounds.left > 1 || bounds.width + bounds.left < cw - 1 ? bounds : null\n\n bounds = {\n left: cw - 10,\n top: -ty / sy / vy,\n width: 10,\n height: ch / sy / vy\n }\n this.vscroller = bounds.top > 1 || bounds.height + bounds.top < ch - 1 ? bounds : null\n\n this.invalidate()\n }\n\n onchangeModelLayer(after: any, before: any, hint: any) {\n if (after.scale) {\n const { x = 1, y = 1 } = after?.scale || {}\n this._scale = { x, y }\n\n this.calcScrollerBounds()\n }\n\n if (after.translate) {\n const { x = 0, y = 0 } = after.translate || {}\n this._translate = { x, y }\n\n this.calcScrollerBounds()\n }\n }\n}\n\nComponent.register('scroll-layer', ScrollLayer)\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { EventMap } from '@hatiolab/things-scene';
|
|
2
|
+
import throttle from 'lodash-es/throttle';
|
|
3
|
+
var last_position;
|
|
4
|
+
var weakref;
|
|
5
|
+
var position;
|
|
6
|
+
const throttledMove = throttle(() => {
|
|
7
|
+
const { x, y } = position;
|
|
8
|
+
const target = weakref.deref();
|
|
9
|
+
if (!target) {
|
|
10
|
+
return;
|
|
11
|
+
}
|
|
12
|
+
// 모델레이어의 원점을 움직인다.
|
|
13
|
+
target.rootModel.move({
|
|
14
|
+
x: x - last_position.x,
|
|
15
|
+
y: y - last_position.y
|
|
16
|
+
}, false);
|
|
17
|
+
last_position = { x, y };
|
|
18
|
+
}, 60, {
|
|
19
|
+
leading: true,
|
|
20
|
+
trailing: true
|
|
21
|
+
});
|
|
22
|
+
function ondragstart(e, hint) {
|
|
23
|
+
last_position = { x: e.offsetX, y: e.offsetY };
|
|
24
|
+
}
|
|
25
|
+
function ondragmove(e, hint) {
|
|
26
|
+
weakref = new WeakRef(hint.deliverer);
|
|
27
|
+
position = { x: e.offsetX, y: e.offsetY };
|
|
28
|
+
throttledMove();
|
|
29
|
+
}
|
|
30
|
+
EventMap.register('shift-handler', {
|
|
31
|
+
'model-layer': {
|
|
32
|
+
'(all)': {
|
|
33
|
+
dragstart: ondragstart,
|
|
34
|
+
dragmove: ondragmove
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
});
|
|
38
|
+
//# sourceMappingURL=shift-handler.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"shift-handler.js","sourceRoot":"","sources":["../../../src/layers/shift-handler.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,wBAAwB,CAAA;AACjD,OAAO,QAAQ,MAAM,oBAAoB,CAAA;AAEzC,IAAI,aAAuC,CAAA;AAC3C,IAAI,OAAY,CAAA;AAChB,IAAI,QAAkC,CAAA;AAEtC,MAAM,aAAa,GAAG,QAAQ,CAC5B,GAAG,EAAE;IACH,MAAM,EAAE,CAAC,EAAE,CAAC,EAAE,GAAG,QAAS,CAAA;IAC1B,MAAM,MAAM,GAAG,OAAO,CAAC,KAAK,EAAE,CAAA;IAE9B,IAAI,CAAC,MAAM,EAAE;QACX,OAAM;KACP;IAED,mBAAmB;IACnB,MAAM,CAAC,SAAS,CAAC,IAAI,CACnB;QACE,CAAC,EAAE,CAAC,GAAG,aAAa,CAAC,CAAC;QACtB,CAAC,EAAE,CAAC,GAAG,aAAa,CAAC,CAAC;KACvB,EACD,KAAK,CACN,CAAA;IAED,aAAa,GAAG,EAAE,CAAC,EAAE,CAAC,EAAE,CAAA;AAC1B,CAAC,EACD,EAAE,EACF;IACE,OAAO,EAAE,IAAI;IACb,QAAQ,EAAE,IAAI;CACf,CACF,CAAA;AAED,SAAS,WAAW,CAAC,CAAY,EAAE,IAAS;IAC1C,aAAa,GAAG,EAAE,CAAC,EAAE,CAAC,CAAC,OAAO,EAAE,CAAC,EAAE,CAAC,CAAC,OAAO,EAAE,CAAA;AAChD,CAAC;AAED,SAAS,UAAU,CAAC,CAAY,EAAE,IAAS;IACzC,OAAO,GAAG,IAAI,OAAO,CAAC,IAAI,CAAC,SAAS,CAAC,CAAA;IACrC,QAAQ,GAAG,EAAE,CAAC,EAAE,CAAC,CAAC,OAAO,EAAE,CAAC,EAAE,CAAC,CAAC,OAAO,EAAE,CAAA;IAEzC,aAAa,EAAE,CAAA;AACjB,CAAC;AAED,QAAQ,CAAC,QAAQ,CAAC,eAAe,EAAE;IACjC,aAAa,EAAE;QACb,OAAO,EAAE;YACP,SAAS,EAAE,WAAW;YACtB,QAAQ,EAAE,UAAU;SACrB;KACF;CACF,CAAC,CAAA","sourcesContent":["import { EventMap } from '@hatiolab/things-scene'\nimport throttle from 'lodash-es/throttle'\n\nvar last_position: { x: number; y: number }\nvar weakref: any\nvar position: { x: number; y: number }\n\nconst throttledMove = throttle(\n () => {\n const { x, y } = position!\n const target = weakref.deref()\n\n if (!target) {\n return\n }\n\n // 모델레이어의 원점을 움직인다.\n target.rootModel.move(\n {\n x: x - last_position.x,\n y: y - last_position.y\n },\n false\n )\n\n last_position = { x, y }\n },\n 60,\n {\n leading: true,\n trailing: true\n }\n)\n\nfunction ondragstart(e: DragEvent, hint: any) {\n last_position = { x: e.offsetX, y: e.offsetY }\n}\n\nfunction ondragmove(e: DragEvent, hint: any) {\n weakref = new WeakRef(hint.deliverer)\n position = { x: e.offsetX, y: e.offsetY }\n\n throttledMove()\n}\n\nEventMap.register('shift-handler', {\n 'model-layer': {\n '(all)': {\n dragstart: ondragstart,\n dragmove: ondragmove\n }\n }\n})\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { EventMap } from '@hatiolab/things-scene';
|
|
2
|
+
function onwheelscale(e, hint) {
|
|
3
|
+
/* shiftKey + wheel 은 deltaX 값을 변화시킨다. */
|
|
4
|
+
if (e.deltaY == 0 && e.deltaX == 0)
|
|
5
|
+
return;
|
|
6
|
+
var model_layer = hint.deliverer;
|
|
7
|
+
var dir = e.deltaY < 0 ? 1 : -1;
|
|
8
|
+
let scale = model_layer.get('scale') || { x: 1, y: 1 };
|
|
9
|
+
let translate = model_layer.get('translate');
|
|
10
|
+
let x = e.offsetX;
|
|
11
|
+
let y = e.offsetY;
|
|
12
|
+
let p = model_layer.transcoordC2S(x, y);
|
|
13
|
+
let delta = dir * 0.1;
|
|
14
|
+
let newscale = {
|
|
15
|
+
x: scale.x + delta,
|
|
16
|
+
y: scale.y + delta
|
|
17
|
+
};
|
|
18
|
+
if ((dir < 0 && scale.x < 0.2) || (dir > 0 && scale.x > 10))
|
|
19
|
+
return;
|
|
20
|
+
/* 휠을 밀면.. 확대 : zoom in */
|
|
21
|
+
/* 휠을 당기면.. 축소 : zoom out */
|
|
22
|
+
model_layer.set('scale', newscale);
|
|
23
|
+
let newp = model_layer.transcoordC2S(x, y);
|
|
24
|
+
model_layer.set('translate', {
|
|
25
|
+
x: translate.x + (newp.x - p.x) * newscale.x,
|
|
26
|
+
y: translate.y + (newp.y - p.y) * newscale.y
|
|
27
|
+
});
|
|
28
|
+
}
|
|
29
|
+
EventMap.register('zoom-handler', {
|
|
30
|
+
'model-layer': {
|
|
31
|
+
'(all)': {
|
|
32
|
+
wheel: onwheelscale
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
});
|
|
36
|
+
//# sourceMappingURL=zoom-handler.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"zoom-handler.js","sourceRoot":"","sources":["../../../src/layers/zoom-handler.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,wBAAwB,CAAA;AAEjD,SAAS,YAAY,CAAC,CAAa,EAAE,IAAS;IAC5C,yCAAyC;IACzC,IAAI,CAAC,CAAC,MAAM,IAAI,CAAC,IAAI,CAAC,CAAC,MAAM,IAAI,CAAC;QAAE,OAAM;IAE1C,IAAI,WAAW,GAAG,IAAI,CAAC,SAAS,CAAA;IAEhC,IAAI,GAAG,GAAG,CAAC,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAA;IAE/B,IAAI,KAAK,GAAG,WAAW,CAAC,GAAG,CAAC,OAAO,CAAC,IAAI,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAA;IACtD,IAAI,SAAS,GAAG,WAAW,CAAC,GAAG,CAAC,WAAW,CAAC,CAAA;IAC5C,IAAI,CAAC,GAAG,CAAC,CAAC,OAAO,CAAA;IACjB,IAAI,CAAC,GAAG,CAAC,CAAC,OAAO,CAAA;IAEjB,IAAI,CAAC,GAAG,WAAW,CAAC,aAAa,CAAC,CAAC,EAAE,CAAC,CAAC,CAAA;IACvC,IAAI,KAAK,GAAG,GAAG,GAAG,GAAG,CAAA;IAErB,IAAI,QAAQ,GAAG;QACb,CAAC,EAAE,KAAK,CAAC,CAAC,GAAG,KAAK;QAClB,CAAC,EAAE,KAAK,CAAC,CAAC,GAAG,KAAK;KACnB,CAAA;IAED,IAAI,CAAC,GAAG,GAAG,CAAC,IAAI,KAAK,CAAC,CAAC,GAAG,GAAG,CAAC,IAAI,CAAC,GAAG,GAAG,CAAC,IAAI,KAAK,CAAC,CAAC,GAAG,EAAE,CAAC;QAAE,OAAM;IAEnE,0BAA0B;IAC1B,4BAA4B;IAE5B,WAAW,CAAC,GAAG,CAAC,OAAO,EAAE,QAAQ,CAAC,CAAA;IAElC,IAAI,IAAI,GAAG,WAAW,CAAC,aAAa,CAAC,CAAC,EAAE,CAAC,CAAC,CAAA;IAE1C,WAAW,CAAC,GAAG,CAAC,WAAW,EAAE;QAC3B,CAAC,EAAE,SAAS,CAAC,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,QAAQ,CAAC,CAAC;QAC5C,CAAC,EAAE,SAAS,CAAC,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,QAAQ,CAAC,CAAC;KAC7C,CAAC,CAAA;AACJ,CAAC;AAED,QAAQ,CAAC,QAAQ,CAAC,cAAc,EAAE;IAChC,aAAa,EAAE;QACb,OAAO,EAAE;YACP,KAAK,EAAE,YAAY;SACpB;KACF;CACF,CAAC,CAAA","sourcesContent":["import { EventMap } from '@hatiolab/things-scene'\n\nfunction onwheelscale(e: WheelEvent, hint: any) {\n /* shiftKey + wheel 은 deltaX 값을 변화시킨다. */\n if (e.deltaY == 0 && e.deltaX == 0) return\n\n var model_layer = hint.deliverer\n\n var dir = e.deltaY < 0 ? 1 : -1\n\n let scale = model_layer.get('scale') || { x: 1, y: 1 }\n let translate = model_layer.get('translate')\n let x = e.offsetX\n let y = e.offsetY\n\n let p = model_layer.transcoordC2S(x, y)\n let delta = dir * 0.1\n\n let newscale = {\n x: scale.x + delta,\n y: scale.y + delta\n }\n\n if ((dir < 0 && scale.x < 0.2) || (dir > 0 && scale.x > 10)) return\n\n /* 휠을 밀면.. 확대 : zoom in */\n /* 휠을 당기면.. 축소 : zoom out */\n\n model_layer.set('scale', newscale)\n\n let newp = model_layer.transcoordC2S(x, y)\n\n model_layer.set('translate', {\n x: translate.x + (newp.x - p.x) * newscale.x,\n y: translate.y + (newp.y - p.y) * newscale.y\n })\n}\n\nEventMap.register('zoom-handler', {\n 'model-layer': {\n '(all)': {\n wheel: onwheelscale\n }\n }\n})\n"]}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license Copyright © HatioLab Inc. All rights reserved.
|
|
3
|
+
*/
|
|
4
|
+
import '@operato/markdown';
|
|
5
|
+
import { LitElement } from 'lit';
|
|
6
|
+
export declare class ComponentDetail extends LitElement {
|
|
7
|
+
static styles: import("lit").CSSResult[];
|
|
8
|
+
template: {
|
|
9
|
+
about: string;
|
|
10
|
+
} | null;
|
|
11
|
+
render(): import("lit-html").TemplateResult<1>;
|
|
12
|
+
}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license Copyright © HatioLab Inc. All rights reserved.
|
|
3
|
+
*/
|
|
4
|
+
import { __decorate } from "tslib";
|
|
5
|
+
import '@operato/markdown';
|
|
6
|
+
import { css, html, LitElement } from 'lit';
|
|
7
|
+
import { property } from 'lit/decorators.js';
|
|
8
|
+
import { ScrollbarStyles } from '@operato/styles';
|
|
9
|
+
export class ComponentDetail extends LitElement {
|
|
10
|
+
constructor() {
|
|
11
|
+
super(...arguments);
|
|
12
|
+
this.template = null;
|
|
13
|
+
}
|
|
14
|
+
render() {
|
|
15
|
+
const { about } = this.template || {};
|
|
16
|
+
return html ` <ox-markdown .src=${about}></ox-markdown> `;
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
ComponentDetail.styles = [
|
|
20
|
+
ScrollbarStyles,
|
|
21
|
+
css `
|
|
22
|
+
:host {
|
|
23
|
+
display: flex;
|
|
24
|
+
flex-direction: column;
|
|
25
|
+
align-content: stretch;
|
|
26
|
+
|
|
27
|
+
background-color: var(--component-detail-background-color, white);
|
|
28
|
+
margin: 0px;
|
|
29
|
+
padding: 10px;
|
|
30
|
+
|
|
31
|
+
width: 360px;
|
|
32
|
+
height: 100%;
|
|
33
|
+
|
|
34
|
+
overflow: hidden;
|
|
35
|
+
|
|
36
|
+
border: 2px solid var(--component-detail-border-color);
|
|
37
|
+
box-sizing: border-box;
|
|
38
|
+
|
|
39
|
+
position: absolute;
|
|
40
|
+
top: 0px;
|
|
41
|
+
|
|
42
|
+
z-index: 1;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
ox-markdown {
|
|
46
|
+
flex: 1;
|
|
47
|
+
}
|
|
48
|
+
`
|
|
49
|
+
];
|
|
50
|
+
__decorate([
|
|
51
|
+
property({ type: Object })
|
|
52
|
+
], ComponentDetail.prototype, "template", void 0);
|
|
53
|
+
//# sourceMappingURL=component-detail.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"component-detail.js","sourceRoot":"","sources":["../../../../src/modeller/component-toolbar/component-detail.ts"],"names":[],"mappings":"AAAA;;GAEG;;AAEH,OAAO,mBAAmB,CAAA;AAE1B,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,UAAU,EAAE,MAAM,KAAK,CAAA;AAC3C,OAAO,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAA;AAE5C,OAAO,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAA;AAEjD,MAAM,OAAO,eAAgB,SAAQ,UAAU;IAA/C;;QAiC8B,aAAQ,GAA6B,IAAI,CAAA;IAOvE,CAAC;IALC,MAAM;QACJ,MAAM,EAAE,KAAK,EAAE,GAAG,IAAI,CAAC,QAAQ,IAAI,EAAE,CAAA;QAErC,OAAO,IAAI,CAAA,sBAAsB,KAAK,kBAAkB,CAAA;IAC1D,CAAC;;AAtCM,sBAAM,GAAG;IACd,eAAe;IACf,GAAG,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;KA2BF;CACF,AA9BY,CA8BZ;AAE2B;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;iDAA0C","sourcesContent":["/**\n * @license Copyright © HatioLab Inc. All rights reserved.\n */\n\nimport '@operato/markdown'\n\nimport { css, html, LitElement } from 'lit'\nimport { property } from 'lit/decorators.js'\n\nimport { ScrollbarStyles } from '@operato/styles'\n\nexport class ComponentDetail extends LitElement {\n static styles = [\n ScrollbarStyles,\n css`\n :host {\n display: flex;\n flex-direction: column;\n align-content: stretch;\n\n background-color: var(--component-detail-background-color, white);\n margin: 0px;\n padding: 10px;\n\n width: 360px;\n height: 100%;\n\n overflow: hidden;\n\n border: 2px solid var(--component-detail-border-color);\n box-sizing: border-box;\n\n position: absolute;\n top: 0px;\n\n z-index: 1;\n }\n\n ox-markdown {\n flex: 1;\n }\n `\n ]\n\n @property({ type: Object }) template: { about: string } | null = null\n\n render() {\n const { about } = this.template || {}\n\n return html` <ox-markdown .src=${about}></ox-markdown> `\n }\n}\n"]}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license Copyright © HatioLab Inc. All rights reserved.
|
|
3
|
+
*/
|
|
4
|
+
import { LitElement, PropertyValues } from 'lit';
|
|
5
|
+
import { Scene } from '@hatiolab/things-scene';
|
|
6
|
+
import { Pallet, PalletItem } from '../../types';
|
|
7
|
+
import { ComponentDetail } from './component-detail';
|
|
8
|
+
declare const ComponentMenu_base: typeof LitElement & import("@open-wc/dedupe-mixin").Constructor<import("@open-wc/scoped-elements/types/src/types").ScopedElementsHost>;
|
|
9
|
+
export declare class ComponentMenu extends ComponentMenu_base {
|
|
10
|
+
static styles: import("lit").CSSResult[];
|
|
11
|
+
groups: Pallet[];
|
|
12
|
+
scene: Scene | null;
|
|
13
|
+
group: string | null;
|
|
14
|
+
templates: PalletItem[];
|
|
15
|
+
template: PalletItem | any;
|
|
16
|
+
detail: HTMLElement;
|
|
17
|
+
static get scopedElements(): {
|
|
18
|
+
'component-detail': typeof ComponentDetail;
|
|
19
|
+
};
|
|
20
|
+
render(): import("lit-html").TemplateResult<1>;
|
|
21
|
+
updated(changes: PropertyValues<this>): void;
|
|
22
|
+
findTemplate(type: string | null | undefined): void;
|
|
23
|
+
onHoverComponent(e: MouseEvent): void;
|
|
24
|
+
onClickTemplate(e: MouseEvent): void;
|
|
25
|
+
templateIcon(template: PalletItem): HTMLImageElement;
|
|
26
|
+
}
|
|
27
|
+
export {};
|
|
@@ -0,0 +1,192 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license Copyright © HatioLab Inc. All rights reserved.
|
|
3
|
+
*/
|
|
4
|
+
import { __decorate } from "tslib";
|
|
5
|
+
import { css, html, LitElement } from 'lit';
|
|
6
|
+
import { property, query, state } from 'lit/decorators.js';
|
|
7
|
+
import { ScopedElementsMixin } from '@open-wc/scoped-elements';
|
|
8
|
+
import { ScrollbarStyles } from '@operato/styles';
|
|
9
|
+
import { ComponentDetail } from './component-detail';
|
|
10
|
+
const noImage = new URL('../../../../icons/components/no-image.png', import.meta.url).href;
|
|
11
|
+
export class ComponentMenu extends ScopedElementsMixin(LitElement) {
|
|
12
|
+
constructor() {
|
|
13
|
+
super(...arguments);
|
|
14
|
+
this.groups = [];
|
|
15
|
+
this.scene = null;
|
|
16
|
+
this.group = '';
|
|
17
|
+
this.templates = [];
|
|
18
|
+
}
|
|
19
|
+
static get scopedElements() {
|
|
20
|
+
return {
|
|
21
|
+
'component-detail': ComponentDetail
|
|
22
|
+
};
|
|
23
|
+
}
|
|
24
|
+
render() {
|
|
25
|
+
return this.group
|
|
26
|
+
? html `
|
|
27
|
+
<h2 onclick=${(e) => e.stopPropagation()}>${this.group} list</h2>
|
|
28
|
+
|
|
29
|
+
<div templates @mouseover=${(e) => this.onHoverComponent(e)}>
|
|
30
|
+
${(this.templates || []).map(template => html `
|
|
31
|
+
<div @click=${this.onClickTemplate} data-type=${template.type} template>
|
|
32
|
+
<img src=${this.templateIcon(template)} />${template.type}
|
|
33
|
+
</div>
|
|
34
|
+
`)}
|
|
35
|
+
</div>
|
|
36
|
+
|
|
37
|
+
<component-detail
|
|
38
|
+
tabindex="-1"
|
|
39
|
+
@focusout=${() => {
|
|
40
|
+
this.template = null;
|
|
41
|
+
}}
|
|
42
|
+
.template=${this.template}
|
|
43
|
+
hidden
|
|
44
|
+
>
|
|
45
|
+
</component-detail>
|
|
46
|
+
`
|
|
47
|
+
: html ``;
|
|
48
|
+
}
|
|
49
|
+
updated(changes) {
|
|
50
|
+
var _a;
|
|
51
|
+
if (changes.has('group')) {
|
|
52
|
+
if (!this.group) {
|
|
53
|
+
this.templates = [];
|
|
54
|
+
this.setAttribute('hidden', '');
|
|
55
|
+
}
|
|
56
|
+
else {
|
|
57
|
+
this.templates = ((_a = this.groups.find((g) => g.name === this.group)) === null || _a === void 0 ? void 0 : _a.templates) || [];
|
|
58
|
+
this.removeAttribute('active');
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
if (changes.has('template')) {
|
|
62
|
+
this.template && this.template.about
|
|
63
|
+
? this.detail.removeAttribute('hidden')
|
|
64
|
+
: this.detail.setAttribute('hidden', '');
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
findTemplate(type) {
|
|
68
|
+
this.template = type && this.templates.find(template => template.type == type);
|
|
69
|
+
}
|
|
70
|
+
onHoverComponent(e) {
|
|
71
|
+
var _a;
|
|
72
|
+
const button = e.target;
|
|
73
|
+
this.findTemplate((_a = button.closest('[data-type]')) === null || _a === void 0 ? void 0 : _a.getAttribute('data-type'));
|
|
74
|
+
}
|
|
75
|
+
onClickTemplate(e) {
|
|
76
|
+
var _a;
|
|
77
|
+
var item = e.target;
|
|
78
|
+
var type = (_a = item.closest('[data-type]')) === null || _a === void 0 ? void 0 : _a.getAttribute('data-type');
|
|
79
|
+
if (!type) {
|
|
80
|
+
return;
|
|
81
|
+
}
|
|
82
|
+
if (this.scene) {
|
|
83
|
+
this.template = this.templates.find(template => template.type == type);
|
|
84
|
+
this.template && this.scene.startAddMode(JSON.parse(JSON.stringify(this.template.model)));
|
|
85
|
+
}
|
|
86
|
+
this.group = null;
|
|
87
|
+
}
|
|
88
|
+
templateIcon(template) {
|
|
89
|
+
return template.icon || noImage;
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
ComponentMenu.styles = [
|
|
93
|
+
ScrollbarStyles,
|
|
94
|
+
css `
|
|
95
|
+
:host {
|
|
96
|
+
display: flex;
|
|
97
|
+
flex-direction: column;
|
|
98
|
+
align-content: stretch;
|
|
99
|
+
|
|
100
|
+
background-color: var(--component-menu-background-color);
|
|
101
|
+
margin: 0px;
|
|
102
|
+
padding: 0px;
|
|
103
|
+
|
|
104
|
+
width: 180px;
|
|
105
|
+
height: 100%;
|
|
106
|
+
|
|
107
|
+
overflow: visible;
|
|
108
|
+
|
|
109
|
+
border: 2px solid var(--component-menu-border-color);
|
|
110
|
+
box-sizing: border-box;
|
|
111
|
+
|
|
112
|
+
position: absolute;
|
|
113
|
+
top: 0px;
|
|
114
|
+
|
|
115
|
+
z-index: 1;
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
h2 {
|
|
119
|
+
background-color: var(--component-menu-border-color);
|
|
120
|
+
padding: 1px 5px;
|
|
121
|
+
margin: 0;
|
|
122
|
+
font: var(--component-menu-title);
|
|
123
|
+
color: #fff;
|
|
124
|
+
text-transform: capitalize;
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
[templates] {
|
|
128
|
+
flex: 1;
|
|
129
|
+
|
|
130
|
+
display: block;
|
|
131
|
+
margin: 0;
|
|
132
|
+
padding: 0;
|
|
133
|
+
overflow-y: auto;
|
|
134
|
+
|
|
135
|
+
background-color: var(--component-menu-background-color);
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
[template] {
|
|
139
|
+
display: flex;
|
|
140
|
+
align-items: center;
|
|
141
|
+
min-height: var(--component-menu-item-icon-size);
|
|
142
|
+
padding: 0 5px 0 0;
|
|
143
|
+
border-bottom: 1px solid rgba(0, 0, 0, 0.1);
|
|
144
|
+
font-size: 11px;
|
|
145
|
+
color: var(--component-menu-item-color);
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
[template]:hover,
|
|
149
|
+
[template]:focus {
|
|
150
|
+
color: var(--component-menu-item-hover-color);
|
|
151
|
+
font-weight: bold;
|
|
152
|
+
cursor: pointer;
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
[template] img {
|
|
156
|
+
margin: 5px;
|
|
157
|
+
width: var(--component-menu-item-icon-size);
|
|
158
|
+
height: var(--component-menu-item-icon-size);
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
component-detail {
|
|
162
|
+
position: absolute;
|
|
163
|
+
top: 0;
|
|
164
|
+
left: 180px;
|
|
165
|
+
height: 100%;
|
|
166
|
+
outline: none;
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
component-detail[hidden] {
|
|
170
|
+
display: none;
|
|
171
|
+
}
|
|
172
|
+
`
|
|
173
|
+
];
|
|
174
|
+
__decorate([
|
|
175
|
+
property({ type: Object })
|
|
176
|
+
], ComponentMenu.prototype, "groups", void 0);
|
|
177
|
+
__decorate([
|
|
178
|
+
property({ type: Object })
|
|
179
|
+
], ComponentMenu.prototype, "scene", void 0);
|
|
180
|
+
__decorate([
|
|
181
|
+
property({ type: String })
|
|
182
|
+
], ComponentMenu.prototype, "group", void 0);
|
|
183
|
+
__decorate([
|
|
184
|
+
state()
|
|
185
|
+
], ComponentMenu.prototype, "templates", void 0);
|
|
186
|
+
__decorate([
|
|
187
|
+
state()
|
|
188
|
+
], ComponentMenu.prototype, "template", void 0);
|
|
189
|
+
__decorate([
|
|
190
|
+
query('component-detail')
|
|
191
|
+
], ComponentMenu.prototype, "detail", void 0);
|
|
192
|
+
//# sourceMappingURL=component-menu.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"component-menu.js","sourceRoot":"","sources":["../../../../src/modeller/component-toolbar/component-menu.ts"],"names":[],"mappings":"AAAA;;GAEG;;AAEH,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,UAAU,EAAkB,MAAM,KAAK,CAAA;AAC3D,OAAO,EAAE,QAAQ,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAA;AAG1D,OAAO,EAAE,mBAAmB,EAAE,MAAM,0BAA0B,CAAA;AAC9D,OAAO,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAA;AAGjD,OAAO,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAA;AAEpD,MAAM,OAAO,GAAG,IAAI,GAAG,CAAC,2CAA2C,EAAE,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,IAAI,CAAA;AAE1F,MAAM,OAAO,aAAc,SAAQ,mBAAmB,CAAC,UAAU,CAAC;IAAlE;;QAoF8B,WAAM,GAAa,EAAE,CAAA;QACrB,UAAK,GAAiB,IAAI,CAAA;QAC1B,UAAK,GAAkB,EAAE,CAAA;QAE5C,cAAS,GAAiB,EAAE,CAAA;IAqFvC,CAAC;IAhFC,MAAM,KAAK,cAAc;QACvB,OAAO;YACL,kBAAkB,EAAE,eAAe;SACpC,CAAA;IACH,CAAC;IAED,MAAM;QACJ,OAAO,IAAI,CAAC,KAAK;YACf,CAAC,CAAC,IAAI,CAAA;wBACY,CAAC,CAAa,EAAE,EAAE,CAAC,CAAC,CAAC,eAAe,EAAE,IAAI,IAAI,CAAC,KAAK;;sCAEtC,CAAC,CAAa,EAAE,EAAE,CAAC,IAAI,CAAC,gBAAgB,CAAC,CAAC,CAAC;cACnE,CAAC,IAAI,CAAC,SAAS,IAAI,EAAE,CAAC,CAAC,GAAG,CAC1B,QAAQ,CAAC,EAAE,CAAC,IAAI,CAAA;8BACA,IAAI,CAAC,eAA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C;4CAA2B;AAC1B;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;4CAA0B;AAE5C;IAAR,KAAK,EAAE;gDAA6B;AAC5B;IAAR,KAAK,EAAE;+CAA2B;AAER;IAA1B,KAAK,CAAC,kBAAkB,CAAC;6CAAqB","sourcesContent":["/**\n * @license Copyright © HatioLab Inc. All rights reserved.\n */\n\nimport { css, html, LitElement, PropertyValues } from 'lit'\nimport { property, query, state } from 'lit/decorators.js'\n\nimport { Scene } from '@hatiolab/things-scene'\nimport { ScopedElementsMixin } from '@open-wc/scoped-elements'\nimport { ScrollbarStyles } from '@operato/styles'\n\nimport { Pallet, PalletItem } from '../../types'\nimport { ComponentDetail } from './component-detail'\n\nconst noImage = new URL('../../../../icons/components/no-image.png', import.meta.url).href\n\nexport class ComponentMenu extends ScopedElementsMixin(LitElement) {\n static styles = [\n ScrollbarStyles,\n css`\n :host {\n display: flex;\n flex-direction: column;\n align-content: stretch;\n\n background-color: var(--component-menu-background-color);\n margin: 0px;\n padding: 0px;\n\n width: 180px;\n height: 100%;\n\n overflow: visible;\n\n border: 2px solid var(--component-menu-border-color);\n box-sizing: border-box;\n\n position: absolute;\n top: 0px;\n\n z-index: 1;\n }\n\n h2 {\n background-color: var(--component-menu-border-color);\n padding: 1px 5px;\n margin: 0;\n font: var(--component-menu-title);\n color: #fff;\n text-transform: capitalize;\n }\n\n [templates] {\n flex: 1;\n\n display: block;\n margin: 0;\n padding: 0;\n overflow-y: auto;\n\n background-color: var(--component-menu-background-color);\n }\n\n [template] {\n display: flex;\n align-items: center;\n min-height: var(--component-menu-item-icon-size);\n padding: 0 5px 0 0;\n border-bottom: 1px solid rgba(0, 0, 0, 0.1);\n font-size: 11px;\n color: var(--component-menu-item-color);\n }\n\n [template]:hover,\n [template]:focus {\n color: var(--component-menu-item-hover-color);\n font-weight: bold;\n cursor: pointer;\n }\n\n [template] img {\n margin: 5px;\n width: var(--component-menu-item-icon-size);\n height: var(--component-menu-item-icon-size);\n }\n\n component-detail {\n position: absolute;\n top: 0;\n left: 180px;\n height: 100%;\n outline: none;\n }\n\n component-detail[hidden] {\n display: none;\n }\n `\n ]\n\n @property({ type: Object }) groups: Pallet[] = []\n @property({ type: Object }) scene: Scene | null = null\n @property({ type: String }) group: string | null = ''\n\n @state() templates: PalletItem[] = []\n @state() template: PalletItem | any\n\n @query('component-detail') detail!: HTMLElement\n\n static get scopedElements() {\n return {\n 'component-detail': ComponentDetail\n }\n }\n\n render() {\n return this.group\n ? html`\n <h2 onclick=${(e: MouseEvent) => e.stopPropagation()}>${this.group} list</h2>\n\n <div templates @mouseover=${(e: MouseEvent) => this.onHoverComponent(e)}>\n ${(this.templates || []).map(\n template => html`\n <div @click=${this.onClickTemplate} data-type=${template.type} template>\n <img src=${this.templateIcon(template)} />${template.type}\n </div>\n `\n )}\n </div>\n\n <component-detail\n tabindex=\"-1\"\n @focusout=${() => {\n this.template = null\n }}\n .template=${this.template}\n hidden\n >\n </component-detail>\n `\n : html``\n }\n\n updated(changes: PropertyValues<this>) {\n if (changes.has('group')) {\n if (!this.group) {\n this.templates = []\n this.setAttribute('hidden', '')\n } else {\n this.templates = this.groups.find((g: Pallet) => g.name === this.group)?.templates || []\n this.removeAttribute('active')\n }\n }\n\n if (changes.has('template')) {\n this.template && this.template.about\n ? this.detail.removeAttribute('hidden')\n : this.detail.setAttribute('hidden', '')\n }\n }\n\n findTemplate(type: string | null | undefined) {\n this.template = type && this.templates.find(template => template.type == type)\n }\n\n onHoverComponent(e: MouseEvent) {\n const button = e.target as HTMLElement\n this.findTemplate(button!.closest('[data-type]')?.getAttribute('data-type'))\n }\n\n onClickTemplate(e: MouseEvent) {\n var item = e.target as HTMLElement\n var type = item.closest('[data-type]')?.getAttribute('data-type')\n\n if (!type) {\n return\n }\n\n if (this.scene) {\n this.template = this.templates.find(template => template.type == type)\n this.template && this.scene.startAddMode(JSON.parse(JSON.stringify(this.template.model)))\n }\n\n this.group = null\n }\n\n templateIcon(template: PalletItem) {\n return template.icon || noImage\n }\n}\n"]}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license Copyright © HatioLab Inc. All rights reserved.
|
|
3
|
+
*/
|
|
4
|
+
import { LitElement, PropertyValues } from 'lit';
|
|
5
|
+
import { Scene, SCENE_MODE } from '@hatiolab/things-scene';
|
|
6
|
+
import { ComponentGroup } from '../../types';
|
|
7
|
+
import { ComponentMenu } from './component-menu.js';
|
|
8
|
+
declare const ComponentToolbar_base: typeof LitElement & import("@open-wc/dedupe-mixin").Constructor<import("@open-wc/scoped-elements/types/src/types").ScopedElementsHost>;
|
|
9
|
+
export declare class ComponentToolbar extends ComponentToolbar_base {
|
|
10
|
+
static styles: import("lit").CSSResult[];
|
|
11
|
+
componentGroupList: ComponentGroup[];
|
|
12
|
+
group?: string | null;
|
|
13
|
+
scene: Scene;
|
|
14
|
+
mode: SCENE_MODE;
|
|
15
|
+
shift: HTMLImageElement;
|
|
16
|
+
private menu;
|
|
17
|
+
private componentsContainer;
|
|
18
|
+
private groups;
|
|
19
|
+
private icons;
|
|
20
|
+
updated(changes: PropertyValues<this>): void;
|
|
21
|
+
static get scopedElements(): {
|
|
22
|
+
'component-menu': typeof ComponentMenu;
|
|
23
|
+
};
|
|
24
|
+
render(): import("lit-html").TemplateResult<1>;
|
|
25
|
+
onWheelEvent(e: Event): void;
|
|
26
|
+
_setMode(mode: SCENE_MODE): void;
|
|
27
|
+
_onClickShift(e: MouseEvent): void;
|
|
28
|
+
_onClickGroup(e: MouseEvent): Promise<void>;
|
|
29
|
+
}
|
|
30
|
+
export {};
|