@fmsim/board 0.0.61 → 0.0.63
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/custom-elements.json +1094 -647
- package/dist/src/layers/mcs-mouse-event-layer.d.ts +30 -0
- package/dist/src/layers/mcs-mouse-event-layer.js +114 -0
- package/dist/src/layers/mcs-mouse-event-layer.js.map +1 -0
- package/dist/src/layers/tooltip-decorator.d.ts +2 -0
- package/dist/src/layers/tooltip-decorator.js +41 -0
- package/dist/src/layers/tooltip-decorator.js.map +1 -0
- package/dist/src/ox-board-component-info.d.ts +21 -0
- package/dist/src/ox-board-component-info.js +218 -0
- package/dist/src/ox-board-component-info.js.map +1 -0
- package/dist/src/ox-board-modeller.js +0 -1
- package/dist/src/ox-board-modeller.js.map +1 -1
- package/dist/src/ox-board-viewer.d.ts +5 -1
- package/dist/src/ox-board-viewer.js +49 -3
- package/dist/src/ox-board-viewer.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +3 -3
- package/dist/src/graphql/board.d.ts +0 -6
- package/dist/src/graphql/board.js +0 -139
- package/dist/src/graphql/board.js.map +0 -1
- package/dist/src/graphql/data-subscription.d.ts +0 -5
- package/dist/src/graphql/data-subscription.js +0 -24
- package/dist/src/graphql/data-subscription.js.map +0 -1
- package/dist/src/graphql/favorite-board.d.ts +0 -1
- package/dist/src/graphql/favorite-board.js +0 -23
- package/dist/src/graphql/favorite-board.js.map +0 -1
- package/dist/src/graphql/group.d.ts +0 -7
- package/dist/src/graphql/group.js +0 -125
- package/dist/src/graphql/group.js.map +0 -1
- package/dist/src/graphql/index.d.ts +0 -4
- package/dist/src/graphql/index.js +0 -5
- package/dist/src/graphql/index.js.map +0 -1
- package/dist/src/graphql/play-group.d.ts +0 -8
- package/dist/src/graphql/play-group.js +0 -173
- package/dist/src/graphql/play-group.js.map +0 -1
- package/dist/src/graphql/scenario.d.ts +0 -6
- package/dist/src/graphql/scenario.js +0 -69
- package/dist/src/graphql/scenario.js.map +0 -1
- package/dist/src/layers/bouncing-arrow-decorator.d.ts +0 -1
- package/dist/src/layers/bouncing-arrow-decorator.js +0 -40
- package/dist/src/layers/bouncing-arrow-decorator.js.map +0 -1
- package/dist/src/layers/event-handlers.d.ts +0 -1
- package/dist/src/layers/event-handlers.js +0 -70
- package/dist/src/layers/event-handlers.js.map +0 -1
- package/dist/src/layers/mcs-event-handlers.d.ts +0 -1
- package/dist/src/layers/mcs-event-handlers.js +0 -73
- package/dist/src/layers/mcs-event-handlers.js.map +0 -1
- package/dist/src/layers/ox-mini-map.d.ts +0 -1
- package/dist/src/layers/ox-mini-map.js +0 -189
- package/dist/src/layers/ox-mini-map.js.map +0 -1
- package/dist/src/layers/scroll-layer.d.ts +0 -24
- package/dist/src/layers/scroll-layer.js +0 -125
- package/dist/src/layers/scroll-layer.js.map +0 -1
- package/dist/src/layers/shift-handler.d.ts +0 -1
- package/dist/src/layers/shift-handler.js +0 -38
- package/dist/src/layers/shift-handler.js.map +0 -1
- package/dist/src/layers/zoom-handler.d.ts +0 -1
- package/dist/src/layers/zoom-handler.js +0 -36
- package/dist/src/layers/zoom-handler.js.map +0 -1
- package/dist/src/ox-board-viewer-backup.d.ts +0 -64
- package/dist/src/ox-board-viewer-backup.js +0 -529
- package/dist/src/ox-board-viewer-backup.js.map +0 -1
- package/dist/src/ox-board-viewer-other.d.ts +0 -19
- package/dist/src/ox-board-viewer-other.js +0 -82
- package/dist/src/ox-board-viewer-other.js.map +0 -1
|
@@ -1,125 +0,0 @@
|
|
|
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
|
|
@@ -1 +0,0 @@
|
|
|
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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K,uBAAL,KAAK,CAAE,KAAK,KAAI,EAAE,CAAA;YAC3C,IAAI,CAAC,MAAM,GAAG,EAAE,CAAC,EAAE,CAAC,EAAE,CAAA;YAEtB,IAAI,CAAC,kBAAkB,EAAE,CAAA;SAC1B;QAED,IAAI,KAAK,CAAC,SAAS,EAAE;YACnB,MAAM,EAAE,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,CAAC,EAAE,GAAG,KAAK,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"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,38 +0,0 @@
|
|
|
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
|
|
@@ -1 +0,0 @@
|
|
|
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"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,36 +0,0 @@
|
|
|
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
|
|
@@ -1 +0,0 @@
|
|
|
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,E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ap } 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"]}
|
|
@@ -1,64 +0,0 @@
|
|
|
1
|
-
import '@material/mwc-fab';
|
|
2
|
-
import '@material/mwc-icon';
|
|
3
|
-
import { LitElement, PropertyValues } from 'lit';
|
|
4
|
-
import { Component, ReferenceProvider } from '@hatiolab/things-scene';
|
|
5
|
-
export declare class BoardViewer extends LitElement {
|
|
6
|
-
static styles: import("lit").CSSResult[];
|
|
7
|
-
baseUrl: string;
|
|
8
|
-
board: any;
|
|
9
|
-
provider: ReferenceProvider | null;
|
|
10
|
-
data: any;
|
|
11
|
-
values: any;
|
|
12
|
-
hideFullscreen: boolean;
|
|
13
|
-
hideNavigation: boolean;
|
|
14
|
-
_scene: any;
|
|
15
|
-
_forward: {
|
|
16
|
-
id: string;
|
|
17
|
-
scene: any;
|
|
18
|
-
}[];
|
|
19
|
-
_backward: {
|
|
20
|
-
id: string;
|
|
21
|
-
scene: any;
|
|
22
|
-
}[];
|
|
23
|
-
_oldtarget?: HTMLElement;
|
|
24
|
-
_fade_animations?: Array<Animation>;
|
|
25
|
-
currentBoardId?: string;
|
|
26
|
-
_target: HTMLElement;
|
|
27
|
-
_prev: HTMLElement;
|
|
28
|
-
_next: HTMLElement;
|
|
29
|
-
_fullscreen: HTMLElement;
|
|
30
|
-
render(): import("lit-html").TemplateResult<1>;
|
|
31
|
-
connectedCallback(): void;
|
|
32
|
-
disconnectedCallback(): void;
|
|
33
|
-
updated(changes: PropertyValues<this>): void;
|
|
34
|
-
initSceneAsync(): Promise<void>;
|
|
35
|
-
initScene(): void;
|
|
36
|
-
closeScene(): void;
|
|
37
|
-
releaseScene(): void;
|
|
38
|
-
setupScene({ id, scene }: {
|
|
39
|
-
id: string;
|
|
40
|
-
scene: any;
|
|
41
|
-
}): void;
|
|
42
|
-
showScene(boardId: string, bindingData?: any): Promise<void>;
|
|
43
|
-
bindSceneEvents(): void;
|
|
44
|
-
unbindSceneEvents(scene: any): void;
|
|
45
|
-
transientShowButtons(stop?: boolean): void;
|
|
46
|
-
onTapNext(): void;
|
|
47
|
-
onTapPrev(): void;
|
|
48
|
-
onTapFullscreen(): void;
|
|
49
|
-
onRunBoard(): void;
|
|
50
|
-
onLinkGoto(targetBoardId: string, options: any, fromComponent: any): void;
|
|
51
|
-
onLinkOpen(url: string, value: any, fromComponent: Component): void;
|
|
52
|
-
onLinkMove(url: string, value: any, fromComponent: Component): void;
|
|
53
|
-
onRoutePage(page: string): void;
|
|
54
|
-
onStartScenario(scenario: string, value: string | number | object, component: Component): Promise<void>;
|
|
55
|
-
onRunScenario(scenario: string, value: string | number | object, component: Component): Promise<void>;
|
|
56
|
-
getSceneData(): any;
|
|
57
|
-
getSceneValues(): any;
|
|
58
|
-
getSceneImageData(base64?: boolean): Promise<{
|
|
59
|
-
width: any;
|
|
60
|
-
height: any;
|
|
61
|
-
data: string | Uint8ClampedArray;
|
|
62
|
-
} | undefined>;
|
|
63
|
-
printTrick(image: string): Promise<void>;
|
|
64
|
-
}
|