@fmsim/board 1.0.47 → 1.0.51

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.
@@ -2,91 +2,6 @@
2
2
  "schemaVersion": "1.0.0",
3
3
  "readme": "",
4
4
  "modules": [
5
- {
6
- "kind": "javascript-module",
7
- "path": "stories/restful-attachment-selector.stories.ts",
8
- "declarations": [
9
- {
10
- "kind": "variable",
11
- "name": "meta",
12
- "default": "{ title: 'Components/RestfulAttachmentSelector', component: 'restful-attachment-selector', argTypes: { category: { control: 'select', options: ['', 'audio', 'video', 'image', 'text', 'application'], description: '첨부파일 카테고리' }, creatable: { control: 'boolean', description: '파일 업로드 가능 여부' }, userName: { control: 'text', description: '사용자 이름' } }, parameters: { layout: 'centered' } } satisfies Meta"
13
- },
14
- {
15
- "kind": "variable",
16
- "name": "Default",
17
- "type": {
18
- "text": "Story"
19
- },
20
- "default": "{ render: args => html` <restful-attachment-selector .category=${args.category} .creatable=${args.creatable} .userName=${args.userName} style=\"width: 800px; height: 600px;\" ></restful-attachment-selector> `, args: { category: '', creatable: true, userName: 'testUser' } }"
21
- },
22
- {
23
- "kind": "variable",
24
- "name": "WithCategory",
25
- "type": {
26
- "text": "Story"
27
- },
28
- "default": "{ ...Default, args: { ...Default.args, category: 'document' } }"
29
- },
30
- {
31
- "kind": "variable",
32
- "name": "ReadOnly",
33
- "type": {
34
- "text": "Story"
35
- },
36
- "default": "{ ...Default, args: { ...Default.args, creatable: false } }"
37
- },
38
- {
39
- "kind": "variable",
40
- "name": "WithTestData",
41
- "type": {
42
- "text": "Story"
43
- },
44
- "default": "{ ...Default, args: { ...Default.args, category: 'document' }, play: async ({ canvasElement }) => { const selector = canvasElement.querySelector('restful-attachment-selector') as RestfulAttachmentSelector if (selector) { // 테스트 데이터 주입 selector.attachments = [ { id: 'test-1', name: 'test1.txt', description: 'Test file 1', mimetype: 'text/plain', encoding: '7bit', category: 'document', path: 'test1.txt', bulk: '27', createdAt: new Date().toISOString(), updatedAt: new Date().toISOString(), creatorId: 'testUser', updaterId: 'testUser', fullpath: 'http://localhost:16060/mcs/lv/images/test1.txt', download: 'http://localhost:16060/mcs/lv/downloadFile/test1.txt' }, { id: 'test-2', name: 'test2.jpg', description: 'Test image', mimetype: 'image/jpeg', encoding: '7bit', category: 'image', path: 'test2.jpg', bulk: '1024', createdAt: new Date().toISOString(), updatedAt: new Date().toISOString(), creatorId: 'testUser', updaterId: 'testUser', fullpath: 'http://localhost:16060/mcs/lv/images/test2.jpg', download: 'http://localhost:16060/mcs/lv/downloadFile/test2.jpg' } ] } } }"
45
- }
46
- ],
47
- "exports": [
48
- {
49
- "kind": "js",
50
- "name": "default",
51
- "declaration": {
52
- "name": "meta",
53
- "module": "stories/restful-attachment-selector.stories.ts"
54
- }
55
- },
56
- {
57
- "kind": "js",
58
- "name": "Default",
59
- "declaration": {
60
- "name": "Default",
61
- "module": "stories/restful-attachment-selector.stories.ts"
62
- }
63
- },
64
- {
65
- "kind": "js",
66
- "name": "WithCategory",
67
- "declaration": {
68
- "name": "WithCategory",
69
- "module": "stories/restful-attachment-selector.stories.ts"
70
- }
71
- },
72
- {
73
- "kind": "js",
74
- "name": "ReadOnly",
75
- "declaration": {
76
- "name": "ReadOnly",
77
- "module": "stories/restful-attachment-selector.stories.ts"
78
- }
79
- },
80
- {
81
- "kind": "js",
82
- "name": "WithTestData",
83
- "declaration": {
84
- "name": "WithTestData",
85
- "module": "stories/restful-attachment-selector.stories.ts"
86
- }
87
- }
88
- ]
89
- },
90
5
  {
91
6
  "kind": "javascript-module",
92
7
  "path": "src/index.ts",
@@ -1731,92 +1646,85 @@
1731
1646
  },
1732
1647
  {
1733
1648
  "kind": "javascript-module",
1734
- "path": "src/data-storage/data-storage.ts",
1649
+ "path": "stories/restful-attachment-selector.stories.ts",
1735
1650
  "declarations": [
1736
1651
  {
1737
- "kind": "class",
1738
- "description": "",
1739
- "name": "DataStorage",
1740
- "members": [
1741
- {
1742
- "kind": "field",
1743
- "name": "id",
1744
- "type": {
1745
- "text": "string"
1746
- },
1747
- "privacy": "private",
1748
- "default": "id"
1749
- },
1750
- {
1751
- "kind": "method",
1752
- "name": "load",
1753
- "privacy": "public",
1754
- "return": {
1755
- "type": {
1756
- "text": "Promise<any>"
1757
- }
1758
- },
1759
- "parameters": [
1760
- {
1761
- "name": "key",
1762
- "type": {
1763
- "text": "Component"
1764
- }
1765
- }
1766
- ]
1767
- },
1768
- {
1769
- "kind": "method",
1770
- "name": "save",
1771
- "privacy": "public",
1772
- "return": {
1773
- "type": {
1774
- "text": "Promise<void>"
1775
- }
1776
- },
1777
- "parameters": [
1778
- {
1779
- "name": "key",
1780
- "type": {
1781
- "text": "Component"
1782
- }
1783
- },
1784
- {
1785
- "name": "value",
1786
- "type": {
1787
- "text": "any"
1788
- }
1789
- }
1790
- ]
1791
- },
1792
- {
1793
- "kind": "method",
1794
- "name": "clear",
1795
- "privacy": "public",
1796
- "return": {
1797
- "type": {
1798
- "text": "Promise<void>"
1799
- }
1800
- },
1801
- "parameters": [
1802
- {
1803
- "name": "key",
1804
- "type": {
1805
- "text": "Component"
1806
- }
1807
- }
1808
- ]
1809
- }
1810
- ]
1652
+ "kind": "variable",
1653
+ "name": "meta",
1654
+ "default": "{ title: 'Components/RestfulAttachmentSelector', component: 'restful-attachment-selector', argTypes: { category: { control: 'select', options: ['', 'audio', 'video', 'image', 'text', 'application'], description: '첨부파일 카테고리' }, creatable: { control: 'boolean', description: '파일 업로드 가능 여부' }, userName: { control: 'text', description: '사용자 이름' } }, parameters: { layout: 'centered' } } satisfies Meta"
1655
+ },
1656
+ {
1657
+ "kind": "variable",
1658
+ "name": "Default",
1659
+ "type": {
1660
+ "text": "Story"
1661
+ },
1662
+ "default": "{ render: args => html` <restful-attachment-selector .category=${args.category} .creatable=${args.creatable} .userName=${args.userName} style=\"width: 800px; height: 600px;\" ></restful-attachment-selector> `, args: { category: '', creatable: true, userName: 'testUser' } }"
1663
+ },
1664
+ {
1665
+ "kind": "variable",
1666
+ "name": "WithCategory",
1667
+ "type": {
1668
+ "text": "Story"
1669
+ },
1670
+ "default": "{ ...Default, args: { ...Default.args, category: 'document' } }"
1671
+ },
1672
+ {
1673
+ "kind": "variable",
1674
+ "name": "ReadOnly",
1675
+ "type": {
1676
+ "text": "Story"
1677
+ },
1678
+ "default": "{ ...Default, args: { ...Default.args, creatable: false } }"
1679
+ },
1680
+ {
1681
+ "kind": "variable",
1682
+ "name": "WithTestData",
1683
+ "type": {
1684
+ "text": "Story"
1685
+ },
1686
+ "default": "{ ...Default, args: { ...Default.args, category: 'document' }, play: async ({ canvasElement }) => { const selector = canvasElement.querySelector('restful-attachment-selector') as RestfulAttachmentSelector if (selector) { // 테스트 데이터 주입 selector.attachments = [ { id: 'test-1', name: 'test1.txt', description: 'Test file 1', mimetype: 'text/plain', encoding: '7bit', category: 'document', path: 'test1.txt', bulk: '27', createdAt: new Date().toISOString(), updatedAt: new Date().toISOString(), creatorId: 'testUser', updaterId: 'testUser', fullpath: 'http://localhost:16060/mcs/lv/images/test1.txt', download: 'http://localhost:16060/mcs/lv/downloadFile/test1.txt' }, { id: 'test-2', name: 'test2.jpg', description: 'Test image', mimetype: 'image/jpeg', encoding: '7bit', category: 'image', path: 'test2.jpg', bulk: '1024', createdAt: new Date().toISOString(), updatedAt: new Date().toISOString(), creatorId: 'testUser', updaterId: 'testUser', fullpath: 'http://localhost:16060/mcs/lv/images/test2.jpg', download: 'http://localhost:16060/mcs/lv/downloadFile/test2.jpg' } ] } } }"
1811
1687
  }
1812
1688
  ],
1813
1689
  "exports": [
1814
1690
  {
1815
1691
  "kind": "js",
1816
- "name": "DataStorage",
1692
+ "name": "default",
1817
1693
  "declaration": {
1818
- "name": "DataStorage",
1819
- "module": "src/data-storage/data-storage.ts"
1694
+ "name": "meta",
1695
+ "module": "stories/restful-attachment-selector.stories.ts"
1696
+ }
1697
+ },
1698
+ {
1699
+ "kind": "js",
1700
+ "name": "Default",
1701
+ "declaration": {
1702
+ "name": "Default",
1703
+ "module": "stories/restful-attachment-selector.stories.ts"
1704
+ }
1705
+ },
1706
+ {
1707
+ "kind": "js",
1708
+ "name": "WithCategory",
1709
+ "declaration": {
1710
+ "name": "WithCategory",
1711
+ "module": "stories/restful-attachment-selector.stories.ts"
1712
+ }
1713
+ },
1714
+ {
1715
+ "kind": "js",
1716
+ "name": "ReadOnly",
1717
+ "declaration": {
1718
+ "name": "ReadOnly",
1719
+ "module": "stories/restful-attachment-selector.stories.ts"
1720
+ }
1721
+ },
1722
+ {
1723
+ "kind": "js",
1724
+ "name": "WithTestData",
1725
+ "declaration": {
1726
+ "name": "WithTestData",
1727
+ "module": "stories/restful-attachment-selector.stories.ts"
1820
1728
  }
1821
1729
  }
1822
1730
  ]
@@ -2923,6 +2831,98 @@
2923
2831
  }
2924
2832
  ]
2925
2833
  },
2834
+ {
2835
+ "kind": "javascript-module",
2836
+ "path": "src/data-storage/data-storage.ts",
2837
+ "declarations": [
2838
+ {
2839
+ "kind": "class",
2840
+ "description": "",
2841
+ "name": "DataStorage",
2842
+ "members": [
2843
+ {
2844
+ "kind": "field",
2845
+ "name": "id",
2846
+ "type": {
2847
+ "text": "string"
2848
+ },
2849
+ "privacy": "private",
2850
+ "default": "id"
2851
+ },
2852
+ {
2853
+ "kind": "method",
2854
+ "name": "load",
2855
+ "privacy": "public",
2856
+ "return": {
2857
+ "type": {
2858
+ "text": "Promise<any>"
2859
+ }
2860
+ },
2861
+ "parameters": [
2862
+ {
2863
+ "name": "key",
2864
+ "type": {
2865
+ "text": "Component"
2866
+ }
2867
+ }
2868
+ ]
2869
+ },
2870
+ {
2871
+ "kind": "method",
2872
+ "name": "save",
2873
+ "privacy": "public",
2874
+ "return": {
2875
+ "type": {
2876
+ "text": "Promise<void>"
2877
+ }
2878
+ },
2879
+ "parameters": [
2880
+ {
2881
+ "name": "key",
2882
+ "type": {
2883
+ "text": "Component"
2884
+ }
2885
+ },
2886
+ {
2887
+ "name": "value",
2888
+ "type": {
2889
+ "text": "any"
2890
+ }
2891
+ }
2892
+ ]
2893
+ },
2894
+ {
2895
+ "kind": "method",
2896
+ "name": "clear",
2897
+ "privacy": "public",
2898
+ "return": {
2899
+ "type": {
2900
+ "text": "Promise<void>"
2901
+ }
2902
+ },
2903
+ "parameters": [
2904
+ {
2905
+ "name": "key",
2906
+ "type": {
2907
+ "text": "Component"
2908
+ }
2909
+ }
2910
+ ]
2911
+ }
2912
+ ]
2913
+ }
2914
+ ],
2915
+ "exports": [
2916
+ {
2917
+ "kind": "js",
2918
+ "name": "DataStorage",
2919
+ "declaration": {
2920
+ "name": "DataStorage",
2921
+ "module": "src/data-storage/data-storage.ts"
2922
+ }
2923
+ }
2924
+ ]
2925
+ },
2926
2926
  {
2927
2927
  "kind": "javascript-module",
2928
2928
  "path": "src/layers/mcs-mouse-event-handler.ts",
@@ -2946,6 +2946,10 @@
2946
2946
  "kind": "field",
2947
2947
  "name": "clickComponentHandler"
2948
2948
  },
2949
+ {
2950
+ "kind": "field",
2951
+ "name": "onchangeTarget"
2952
+ },
2949
2953
  {
2950
2954
  "kind": "method",
2951
2955
  "name": "ready"
@@ -3030,6 +3034,33 @@
3030
3034
  }
3031
3035
  ]
3032
3036
  },
3037
+ {
3038
+ "kind": "field",
3039
+ "name": "monitoringTargets",
3040
+ "type": {
3041
+ "text": "Component[]"
3042
+ },
3043
+ "privacy": "private",
3044
+ "default": "[]"
3045
+ },
3046
+ {
3047
+ "kind": "method",
3048
+ "name": "clearMonitoringTargets",
3049
+ "privacy": "private"
3050
+ },
3051
+ {
3052
+ "kind": "method",
3053
+ "name": "addMonitoringTarget",
3054
+ "privacy": "private",
3055
+ "parameters": [
3056
+ {
3057
+ "name": "targets",
3058
+ "type": {
3059
+ "text": "Component[]"
3060
+ }
3061
+ }
3062
+ ]
3063
+ },
3033
3064
  {
3034
3065
  "kind": "field",
3035
3066
  "name": "eventMap",
@@ -3042,13 +3073,13 @@
3042
3073
  {
3043
3074
  "name": "after",
3044
3075
  "type": {
3045
- "text": "any"
3076
+ "text": "Properties"
3046
3077
  }
3047
3078
  },
3048
3079
  {
3049
3080
  "name": "before",
3050
3081
  "type": {
3051
- "text": "any"
3082
+ "text": "Properties"
3052
3083
  }
3053
3084
  },
3054
3085
  {
@@ -3100,46 +3131,6 @@
3100
3131
  }
3101
3132
  ]
3102
3133
  },
3103
- {
3104
- "kind": "javascript-module",
3105
- "path": "src/layers/tooltip-decorator.ts",
3106
- "declarations": [
3107
- {
3108
- "kind": "function",
3109
- "name": "tooltipDecorator",
3110
- "parameters": [
3111
- {
3112
- "name": "component",
3113
- "type": {
3114
- "text": "Component"
3115
- }
3116
- },
3117
- {
3118
- "name": "context",
3119
- "type": {
3120
- "text": "CanvasRenderingContext2D"
3121
- }
3122
- },
3123
- {
3124
- "name": "delta",
3125
- "type": {
3126
- "text": "number"
3127
- }
3128
- }
3129
- ]
3130
- }
3131
- ],
3132
- "exports": [
3133
- {
3134
- "kind": "js",
3135
- "name": "default",
3136
- "declaration": {
3137
- "name": "tooltipDecorator",
3138
- "module": "src/layers/tooltip-decorator.ts"
3139
- }
3140
- }
3141
- ]
3142
- },
3143
3134
  {
3144
3135
  "kind": "javascript-module",
3145
3136
  "path": "src/modeller/edit-toolbar-style.ts",
@@ -79,10 +79,9 @@
79
79
  model: JSON.parse(JSON.stringify(board.model)),
80
80
  mode: 0,
81
81
  refProvider: provider,
82
- handlers: ['mcs-event-handler', 'zoom-handler', 'shift-handler', 'animator-handler'],
82
+ handlers: ['mcs-event-handler', 'zoom-handler', 'shift-handler'],
83
83
  layers: [
84
- { type: 'decotag-layer' },
85
- { type: 'reaction-layer' },
84
+ { type: 'decorator-layer' },
86
85
  { type: 'scroll-layer' },
87
86
  { type: 'movement-layer', id: 'movement-layer' }
88
87
  ]
@@ -79,10 +79,9 @@
79
79
  model: JSON.parse(JSON.stringify(board.model)),
80
80
  mode: 0,
81
81
  refProvider: provider,
82
- handlers: ['mcs-event-handler', 'zoom-handler', 'shift-handler', 'animator-handler'],
82
+ handlers: ['mcs-event-handler', 'zoom-handler', 'shift-handler'],
83
83
  layers: [
84
- { type: 'decotag-layer' },
85
- { type: 'reaction-layer' },
84
+ { type: 'decorator-layer' },
86
85
  { type: 'scroll-layer' },
87
86
  { type: 'movement-layer', id: 'movement-layer' }
88
87
  ]
package/demo/index.html CHANGED
@@ -79,10 +79,9 @@
79
79
  model: JSON.parse(JSON.stringify(board.model)),
80
80
  mode: 0,
81
81
  refProvider: provider,
82
- handlers: ['mcs-event-handler', 'zoom-handler', 'shift-handler', 'animator-handler'],
82
+ handlers: ['mcs-event-handler', 'zoom-handler', 'shift-handler'],
83
83
  layers: [
84
- { type: 'decotag-layer' },
85
- { type: 'reaction-layer' },
84
+ { type: 'decorator-layer' },
86
85
  { type: 'scroll-layer' },
87
86
  { type: 'movement-layer', id: 'movement-layer' }
88
87
  ]
@@ -22,7 +22,7 @@ function dispatchFetchLvModelDataByMouseEvent(type, event, target) {
22
22
  }));
23
23
  return parent || target;
24
24
  }
25
- else if (parent) {
25
+ else if (parent && parent.getState('id')) {
26
26
  window.dispatchEvent(new CustomEvent('fetchLvModelDataByMouseEvent', {
27
27
  detail: {
28
28
  value: {
@@ -36,11 +36,11 @@ function dispatchFetchLvModelDataByMouseEvent(type, event, target) {
36
36
  return parent;
37
37
  }
38
38
  }
39
- function onmouseenter(event, hint) {
40
- const target = hint.origin;
41
- event.stopPropagation();
42
- dispatchFetchLvModelDataByMouseEvent('hover', event, target);
43
- }
39
+ // function onmouseenter(event: MouseEvent, hint: any) {
40
+ // const target = hint.origin
41
+ // event.stopPropagation()
42
+ // dispatchFetchLvModelDataByMouseEvent('hover', event, target)
43
+ // }
44
44
  function onclick(event, hint) {
45
45
  const target = hint.origin;
46
46
  event.stopPropagation();
@@ -1 +1 @@
1
- {"version":3,"file":"mcs-mouse-event-handler.js","sourceRoot":"","sources":["../../../src/layers/mcs-mouse-event-handler.ts"],"names":[],"mappings":"AAAA,OAAO,EAAa,QAAQ,EAAE,MAAM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AAM,MAAM,GAAG,IAAI,CAAC,MAAM,CAAA;IAE1B,KAAK,CAAC,eAAe,EAAE,CAAA;IAEvB,UAAU,CAAC,GAAG,EAAE;QACd,IAAI,MAAM,CAAC,YAAY,KAAK,UAAU,EAAE,CAAC;YACvC,MAAM,UAAU,GAAG,oCAAoC,CAAC,OAAO,EAAE,KAAK,EAAE,MAAM,CAAC,CAAA;YAE/E,MAAM,CAAC,aAAa,CAClB,IAAI,WAAW,CAAC,gBAAgB,EAAE;gBAChC,MAAM,EAAE,UAAU,IAAI,MAAM;aAC7B,CAAC,CACH,CAAA;QACH,CAAC;IACH,CAAC,EAAE,GAAG,CAAC,CAAA;AACT,CAAC;AAED,SAAS,UAAU,CAAC,KAAiB,EAAE,IAAS;IAC9C,MAAM,MAAM,GAAG,IAAI,CAAC,MAAM,CAAA;IAE1B,UAAU,CAAC,GAAG,EAAE;QACd,MAAM,CAAC,YAAY,GAAG,EAAE,CAAA;IAC1B,CAAC,EAAE,GAAG,CAAC,CAAA;IAEP,KAAK,CAAC,eAAe,EAAE,CAAA;IAEvB,MAAM,CAAC,YAAY,GAAG,UAAU,CAAA;IAEhC,oCAAoC,CAAC,UAAU,EAAE,KAAK,EAAE,MAAM,CAAC,CAAA;AACjE,CAAC;AAED,QAAQ,CAAC,QAAQ,CAAC,mBAAmB,EAAE;IACrC,aAAa,EAAE;QACb,OAAO,EAAE;YACP,6CAA6C;YAC7C,KAAK,EAAE,OAAO;YACd,QAAQ,EAAE,UAAU;SACrB;KACF;CACF,CAAC,CAAA","sourcesContent":["import { Component, EventMap } from '@hatiolab/things-scene'\n\nfunction dispatchFetchLvModelDataByMouseEvent(\n type: 'hover' | 'click' | 'dblclick',\n event: MouseEvent,\n target: Component & { parentObject?: Component }\n): Component | undefined {\n const parent = target.parentObject\n\n if (target.getState('id')) {\n window.dispatchEvent(\n new CustomEvent('fetchLvModelDataByMouseEvent', {\n detail: {\n value: {\n type,\n event,\n model: {\n ...target.state,\n parentObject: parent\n ? {\n id: parent.get('id'),\n type: parent.get('type')\n }\n : null\n },\n data: target.data\n }\n }\n })\n )\n\n return parent || target\n } else if (parent) {\n window.dispatchEvent(\n new CustomEvent('fetchLvModelDataByMouseEvent', {\n detail: {\n value: {\n type,\n event,\n model: parent.state,\n data: parent.data\n }\n }\n })\n )\n\n return parent\n }\n}\n\nfunction onmouseenter(event: MouseEvent, hint: any) {\n const target = hint.origin\n\n event.stopPropagation()\n\n dispatchFetchLvModelDataByMouseEvent('hover', event, target)\n}\n\nfunction onclick(event: MouseEvent, hint: any) {\n const target = hint.origin\n\n event.stopPropagation()\n\n setTimeout(() => {\n if (target.currentEvent !== 'dblclick') {\n const realTarget = dispatchFetchLvModelDataByMouseEvent('click', event, target)\n\n window.dispatchEvent(\n new CustomEvent('clickComponent', {\n detail: realTarget || target\n })\n )\n }\n }, 300)\n}\n\nfunction ondblclick(event: MouseEvent, hint: any) {\n const target = hint.origin\n\n setTimeout(() => {\n target.currentEvent = ''\n }, 500)\n\n event.stopPropagation()\n\n target.currentEvent = 'dblclick'\n\n dispatchFetchLvModelDataByMouseEvent('dblclick', event, target)\n}\n\nEventMap.register('mcs-event-handler', {\n 'model-layer': {\n '(all)': {\n // mouseenter: onmouseenter, /* 사용되지 않고 있음 */\n click: onclick,\n dblclick: ondblclick\n }\n }\n})\n"]}
1
+ {"version":3,"file":"mcs-mouse-event-handler.js","sourceRoot":"","sources":["../../../src/layers/mcs-mouse-event-handler.ts"],"names":[],"mappings":"AAAA,OAAO,EAAa,QAAQ,EAAE,MAAM,wBAAwB,CAAA;AAE5D,SAAS,oCAAoC,CAC3C,IAAoC,EACpC,KAAiB,EACjB,MAAgD;IAEhD,MAAM,MAAM,GAAG,MAAM,CAAC,YAAY,CAAA;IAElC,IAAI,MAAM,CAAC,QAAQ,CAAC,IAAI,CAAC,EAAE,CAAC;QAC1B,MAAM,CAAC,aAAa,CAClB,IAAI,WAAW,CAAC,8BAA8B,EAAE;YAC9C,MAAM,EAAE;gBACN,KAA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QACH,CAAC;IACH,CAAC,EAAE,GAAG,CAAC,CAAA;AACT,CAAC;AAED,SAAS,UAAU,CAAC,KAAiB,EAAE,IAAS;IAC9C,MAAM,MAAM,GAAG,IAAI,CAAC,MAAM,CAAA;IAE1B,UAAU,CAAC,GAAG,EAAE;QACd,MAAM,CAAC,YAAY,GAAG,EAAE,CAAA;IAC1B,CAAC,EAAE,GAAG,CAAC,CAAA;IAEP,KAAK,CAAC,eAAe,EAAE,CAAA;IAEvB,MAAM,CAAC,YAAY,GAAG,UAAU,CAAA;IAEhC,oCAAoC,CAAC,UAAU,EAAE,KAAK,EAAE,MAAM,CAAC,CAAA;AACjE,CAAC;AAED,QAAQ,CAAC,QAAQ,CAAC,mBAAmB,EAAE;IACrC,aAAa,EAAE;QACb,OAAO,EAAE;YACP,6CAA6C;YAC7C,KAAK,EAAE,OAAO;YACd,QAAQ,EAAE,UAAU;SACrB;KACF;CACF,CAAC,CAAA","sourcesContent":["import { Component, EventMap } from '@hatiolab/things-scene'\n\nfunction dispatchFetchLvModelDataByMouseEvent(\n type: 'hover' | 'click' | 'dblclick',\n event: MouseEvent,\n target: Component & { parentObject?: Component }\n): Component | undefined {\n const parent = target.parentObject\n\n if (target.getState('id')) {\n window.dispatchEvent(\n new CustomEvent('fetchLvModelDataByMouseEvent', {\n detail: {\n value: {\n type,\n event,\n model: {\n ...target.state,\n parentObject: parent\n ? {\n id: parent.get('id'),\n type: parent.get('type')\n }\n : null\n },\n data: target.data\n }\n }\n })\n )\n\n return parent || target\n } else if (parent && parent.getState('id')) {\n window.dispatchEvent(\n new CustomEvent('fetchLvModelDataByMouseEvent', {\n detail: {\n value: {\n type,\n event,\n model: parent.state,\n data: parent.data\n }\n }\n })\n )\n\n return parent\n }\n}\n\n// function onmouseenter(event: MouseEvent, hint: any) {\n// const target = hint.origin\n\n// event.stopPropagation()\n\n// dispatchFetchLvModelDataByMouseEvent('hover', event, target)\n// }\n\nfunction onclick(event: MouseEvent, hint: any) {\n const target = hint.origin\n\n event.stopPropagation()\n\n setTimeout(() => {\n if (target.currentEvent !== 'dblclick') {\n const realTarget = dispatchFetchLvModelDataByMouseEvent('click', event, target)\n\n window.dispatchEvent(\n new CustomEvent('clickComponent', {\n detail: realTarget || target\n })\n )\n }\n }, 300)\n}\n\nfunction ondblclick(event: MouseEvent, hint: any) {\n const target = hint.origin\n\n setTimeout(() => {\n target.currentEvent = ''\n }, 500)\n\n event.stopPropagation()\n\n target.currentEvent = 'dblclick'\n\n dispatchFetchLvModelDataByMouseEvent('dblclick', event, target)\n}\n\nEventMap.register('mcs-event-handler', {\n 'model-layer': {\n '(all)': {\n // mouseenter: onmouseenter, /* 사용되지 않고 있음 */\n click: onclick,\n dblclick: ondblclick\n }\n }\n})\n"]}
@@ -38,20 +38,24 @@ export type MOVEMENT = PATH[];
38
38
  export default class MovementLayer extends Layer {
39
39
  drawInstructionHandler: (e: Event) => void;
40
40
  clickComponentHandler: (e: Event) => void;
41
+ onchangeTarget: (after: Properties, before: Properties) => void;
41
42
  ready(): void;
42
43
  dispose(): void;
43
44
  get pointerEvents(): string;
44
45
  get capturable(): boolean;
45
46
  drawArrow(ctx: CanvasRenderingContext2D, p1: POINT, p2: POINT, pathType: PathType, pathStatus: PathStatus, label: string, styles?: PathStyles): void;
46
47
  findSourceAndTarget(path: PATH): [Component?, Component?];
48
+ private monitoringTargets;
49
+ private clearMonitoringTargets;
50
+ private addMonitoringTarget;
47
51
  render(ctx: CanvasRenderingContext2D): void;
48
52
  get eventMap(): {
49
53
  'model-layer': {
50
54
  '(self)': {
51
- change: (after: any, before: any, hint: any) => void;
55
+ change: (after: Properties, before: Properties, hint: any) => void;
52
56
  };
53
57
  };
54
58
  };
55
- onchangeModelLayer(after: any, before: any, hint: any): void;
59
+ onchangeModelLayer(after: Properties, before: Properties, hint: any): void;
56
60
  onchangeData(after: Properties, before: Properties): void;
57
61
  }
@@ -22,6 +22,10 @@ export default class MovementLayer extends Layer {
22
22
  return;
23
23
  }
24
24
  };
25
+ this.onchangeTarget = (after, before) => {
26
+ this.invalidate();
27
+ };
28
+ this.monitoringTargets = [];
25
29
  }
26
30
  ready() {
27
31
  const handler = (e) => {
@@ -34,6 +38,7 @@ export default class MovementLayer extends Layer {
34
38
  dispose() {
35
39
  window.removeEventListener('drawInstruction', this.drawInstructionHandler);
36
40
  window.removeEventListener('clickComponent', this.clickComponentHandler);
41
+ this.clearMonitoringTargets();
37
42
  super.dispose && super.dispose();
38
43
  }
39
44
  get pointerEvents() {
@@ -96,15 +101,36 @@ export default class MovementLayer extends Layer {
96
101
  }
97
102
  return [src, dest];
98
103
  }
104
+ clearMonitoringTargets() {
105
+ this.monitoringTargets.forEach(target => {
106
+ target.off('change', this.onchangeTarget);
107
+ });
108
+ this.monitoringTargets = [];
109
+ }
110
+ addMonitoringTarget(targets) {
111
+ targets.forEach(target => {
112
+ if (this.monitoringTargets.includes(target)) {
113
+ return;
114
+ }
115
+ this.monitoringTargets.push(target);
116
+ target.on('change', this.onchangeTarget);
117
+ });
118
+ }
99
119
  render(ctx) {
100
120
  const root = this.root;
101
- const movement = (this.data instanceof Array && this.data) || [];
121
+ const movement = this.data instanceof Array
122
+ ? this.data
123
+ : this.data && typeof this.data === 'object'
124
+ ? [this.data]
125
+ : [];
126
+ this.clearMonitoringTargets();
102
127
  ctx.save();
103
128
  movement.forEach(path => {
104
129
  const [src, dest] = this.findSourceAndTarget(path);
105
130
  if (!src || !dest) {
106
131
  return;
107
132
  }
133
+ this.addMonitoringTarget([src, dest]);
108
134
  const [srcCenter, destCenter] = [src.center, dest.center];
109
135
  const [srcPos, destPos] = [
110
136
  src.transcoordS2C(srcCenter.x, srcCenter.y, root),