@operato/scene-google-map 1.3.6
Sign up to get free protection for your applications and to get access to all the features.
- package/CHANGELOG.md +11 -0
- package/README.md +15 -0
- package/assets/favicon.ico +0 -0
- package/assets/images/spinner.png +0 -0
- package/dist/gmap-marker.d.ts +67 -0
- package/dist/gmap-marker.js +230 -0
- package/dist/gmap-marker.js.map +1 -0
- package/dist/gmap-path.d.ts +54 -0
- package/dist/gmap-path.js +296 -0
- package/dist/gmap-path.js.map +1 -0
- package/dist/google-map.d.ts +49 -0
- package/dist/google-map.js +178 -0
- package/dist/google-map.js.map +1 -0
- package/dist/index.d.ts +5 -0
- package/dist/index.js +8 -0
- package/dist/index.js.map +1 -0
- package/dist/templates/gmap-marker.d.ts +18 -0
- package/dist/templates/gmap-marker.js +20 -0
- package/dist/templates/gmap-marker.js.map +1 -0
- package/dist/templates/gmap-path.d.ts +21 -0
- package/dist/templates/gmap-path.js +25 -0
- package/dist/templates/gmap-path.js.map +1 -0
- package/dist/templates/google-map.d.ts +18 -0
- package/dist/templates/google-map.js +20 -0
- package/dist/templates/google-map.js.map +1 -0
- package/dist/templates/index.d.ts +53 -0
- package/dist/templates/index.js +5 -0
- package/dist/templates/index.js.map +1 -0
- package/helps/scene/component/gmap-map.ko.md +3 -0
- package/helps/scene/component/gmap-map.md +3 -0
- package/helps/scene/component/gmap-map.zh.md +3 -0
- package/helps/scene/component/gmap-marker.ko.md +3 -0
- package/helps/scene/component/gmap-marker.md +3 -0
- package/helps/scene/component/gmap-marker.zh.md +3 -0
- package/helps/scene/component/gmap-path.ko.md +3 -0
- package/helps/scene/component/gmap-path.md +3 -0
- package/helps/scene/component/gmap-path.zh.md +3 -0
- package/icons/gmap-marker.png +0 -0
- package/icons/gmap-path.png +0 -0
- package/icons/google-map.png +0 -0
- package/logs/.08636eb59927f12972f6774f5947c8507b3564c2-audit.json +15 -0
- package/logs/.5e5d741d8b7784a2fbad65eedc0fd46946aaf6f2-audit.json +15 -0
- package/logs/application-2024-01-01-16.log +9 -0
- package/logs/connections-2024-01-01-16.log +41 -0
- package/package.json +62 -0
- package/schema.graphql +3966 -0
- package/src/gmap-marker.ts +306 -0
- package/src/gmap-path.ts +365 -0
- package/src/google-map.ts +215 -0
- package/src/index.ts +8 -0
- package/src/templates/gmap-marker.ts +20 -0
- package/src/templates/gmap-path.ts +25 -0
- package/src/templates/google-map.ts +20 -0
- package/src/templates/index.ts +5 -0
- package/test/basic-test.html +67 -0
- package/test/index.html +24 -0
- package/test/unit/test-google-map.js +33 -0
- package/test/unit/util.js +22 -0
- package/things-scene.config.js +5 -0
- package/translations/en.json +6 -0
- package/translations/ja.json +6 -0
- package/translations/ko.json +6 -0
- package/translations/zh.json +6 -0
- package/tsconfig.json +22 -0
- package/tsconfig.tsbuildinfo +1 -0
@@ -0,0 +1,296 @@
|
|
1
|
+
/*
|
2
|
+
* Copyright © HatioLab Inc. All rights reserved.
|
3
|
+
*/
|
4
|
+
import { Component, RectPath, Shape } from '@hatiolab/things-scene';
|
5
|
+
const NATURE = {
|
6
|
+
mutable: false,
|
7
|
+
resizable: true,
|
8
|
+
rotatable: true,
|
9
|
+
properties: [
|
10
|
+
{
|
11
|
+
type: 'id-input',
|
12
|
+
label: 'target-map',
|
13
|
+
name: 'targetMap',
|
14
|
+
property: {
|
15
|
+
component: 'google-map'
|
16
|
+
}
|
17
|
+
},
|
18
|
+
{
|
19
|
+
type: 'checkbox',
|
20
|
+
label: 'show-path',
|
21
|
+
name: 'showPath'
|
22
|
+
},
|
23
|
+
{
|
24
|
+
type: 'checkbox',
|
25
|
+
label: 'show-intermediate-markers',
|
26
|
+
name: 'showIntermediateMarkers'
|
27
|
+
},
|
28
|
+
{
|
29
|
+
type: 'checkbox',
|
30
|
+
label: 'start-end-marker-different-design',
|
31
|
+
name: 'startEndMarkerDifferentDesign'
|
32
|
+
}
|
33
|
+
],
|
34
|
+
'value-property': 'latlngs'
|
35
|
+
// help: 'scene/component/gmap-path'
|
36
|
+
};
|
37
|
+
const EMPTY_MARKER_PATH = 'M 0,0 C -2,-20 -10,-22 -10,-30 A 10,10 0 1,1 10,-30 C 10,-22 2,-20 0,0 z';
|
38
|
+
const END_MARKER_PATH = 'M 0,0 C -2,-20 -10,-22 -10,-30 A 10,10 0 1,1 10,-30 C 10,-22 2,-20 0,0 z M -2,-30 a 2,2 0 1,1 4,0 2,2 0 1,1 -4,0';
|
39
|
+
const START_MARKER_PATH = 'M 0,0 C -2,-20 -10,-22 -10,-30 A 10,10 0 1,1 10,-30 C 10,-22 2,-20 0,0 z m -3,-34 l 0,8 l 8,-4 l -8,-4 z m -0,-0 l 0,8 l 8,-4 l -8,-4';
|
40
|
+
export default class GMapPath extends RectPath(Shape) {
|
41
|
+
constructor() {
|
42
|
+
super(...arguments);
|
43
|
+
this._markers = [];
|
44
|
+
}
|
45
|
+
dispose() {
|
46
|
+
this.markers && this.markers.forEach(marker => marker.setMap(null));
|
47
|
+
this.markers = [];
|
48
|
+
delete this._infoWindow;
|
49
|
+
super.dispose();
|
50
|
+
}
|
51
|
+
ready() {
|
52
|
+
super.ready();
|
53
|
+
if (this.isTemplate()) {
|
54
|
+
return;
|
55
|
+
}
|
56
|
+
this.onchangeTargetMap();
|
57
|
+
}
|
58
|
+
get map() {
|
59
|
+
return this._map;
|
60
|
+
}
|
61
|
+
findInfoWindow(type) {
|
62
|
+
var eventSetting = (this.state.event && this.state.event[type]) || {};
|
63
|
+
var infoWindow =
|
64
|
+
/* event spec v1.0 */ eventSetting.infoWindow ||
|
65
|
+
/* event spec v1.1 */ (eventSetting.action == 'infoWindow' && eventSetting.target);
|
66
|
+
if (infoWindow) {
|
67
|
+
return this.root.findById(infoWindow);
|
68
|
+
}
|
69
|
+
}
|
70
|
+
getInfoContent(sceneInfoWindow, index) {
|
71
|
+
var tpl = Component.template(sceneInfoWindow.model.frontSideTemplate);
|
72
|
+
return (`<style>${sceneInfoWindow.model.style}</style>` +
|
73
|
+
tpl({
|
74
|
+
data: this.data,
|
75
|
+
index
|
76
|
+
}));
|
77
|
+
}
|
78
|
+
openInfoWindow(iw, index) {
|
79
|
+
var content = this.getInfoContent(iw, index);
|
80
|
+
if (!this.map)
|
81
|
+
return;
|
82
|
+
var infoWindow = new google.maps.InfoWindow();
|
83
|
+
infoWindow.setContent(content);
|
84
|
+
infoWindow.open(this.map, this.markers[index]);
|
85
|
+
return infoWindow;
|
86
|
+
}
|
87
|
+
buildMarkers() {
|
88
|
+
if (!this.map) {
|
89
|
+
return;
|
90
|
+
}
|
91
|
+
let { latlngs = [], fillStyle: fillColor, alpha: fillOpacity = 1, strokeStyle: strokeColor, lineWidth: strokeWeight, showIntermediateMarkers = false, startEndMarkerDifferentDesign = true, showPath = false } = this.state;
|
92
|
+
if (showIntermediateMarkers) {
|
93
|
+
var markers = latlngs.map(({ lat, lng }, index) => {
|
94
|
+
if (startEndMarkerDifferentDesign) {
|
95
|
+
return new google.maps.Marker({
|
96
|
+
position: {
|
97
|
+
lat: Number(lat) || 0,
|
98
|
+
lng: Number(lng) || 0
|
99
|
+
},
|
100
|
+
map: this.map,
|
101
|
+
icon: {
|
102
|
+
path: index == 0 ? START_MARKER_PATH : index + 1 == latlngs.length ? END_MARKER_PATH : EMPTY_MARKER_PATH,
|
103
|
+
fillColor,
|
104
|
+
fillOpacity,
|
105
|
+
strokeColor,
|
106
|
+
strokeWeight
|
107
|
+
}
|
108
|
+
});
|
109
|
+
}
|
110
|
+
else {
|
111
|
+
return new google.maps.Marker({
|
112
|
+
position: {
|
113
|
+
lat: Number(lat) || 0,
|
114
|
+
lng: Number(lng) || 0
|
115
|
+
},
|
116
|
+
map: this.map,
|
117
|
+
icon: {
|
118
|
+
path: EMPTY_MARKER_PATH,
|
119
|
+
fillColor,
|
120
|
+
fillOpacity,
|
121
|
+
strokeColor,
|
122
|
+
strokeWeight
|
123
|
+
}
|
124
|
+
});
|
125
|
+
}
|
126
|
+
});
|
127
|
+
}
|
128
|
+
else {
|
129
|
+
var spots = latlngs.length > 1 ? [latlngs[0], latlngs[latlngs.length - 1]] : latlngs.length == 1 ? [latlngs[0]] : [];
|
130
|
+
var markers = spots.map(({ lat, lng }, index) => {
|
131
|
+
if (startEndMarkerDifferentDesign) {
|
132
|
+
return new google.maps.Marker({
|
133
|
+
position: {
|
134
|
+
lat: Number(lat) || 0,
|
135
|
+
lng: Number(lng) || 0
|
136
|
+
},
|
137
|
+
map: this.map,
|
138
|
+
icon: {
|
139
|
+
path: index == 0 ? START_MARKER_PATH : END_MARKER_PATH,
|
140
|
+
fillColor,
|
141
|
+
fillOpacity,
|
142
|
+
strokeColor,
|
143
|
+
strokeWeight
|
144
|
+
}
|
145
|
+
});
|
146
|
+
}
|
147
|
+
else {
|
148
|
+
return new google.maps.Marker({
|
149
|
+
position: {
|
150
|
+
lat: Number(lat) || 0,
|
151
|
+
lng: Number(lng) || 0
|
152
|
+
},
|
153
|
+
map: this.map,
|
154
|
+
icon: {
|
155
|
+
path: EMPTY_MARKER_PATH,
|
156
|
+
fillColor,
|
157
|
+
fillOpacity,
|
158
|
+
strokeColor,
|
159
|
+
strokeWeight
|
160
|
+
}
|
161
|
+
});
|
162
|
+
}
|
163
|
+
});
|
164
|
+
}
|
165
|
+
if (showPath) {
|
166
|
+
this.trackPath = new google.maps.Polyline({
|
167
|
+
path: latlngs,
|
168
|
+
geodesic: true,
|
169
|
+
strokeColor: '#FF0000',
|
170
|
+
strokeOpacity: 1,
|
171
|
+
strokeWeight: 4,
|
172
|
+
map: this.map
|
173
|
+
});
|
174
|
+
}
|
175
|
+
var infowindows = new Array(markers.length);
|
176
|
+
markers.forEach((marker, index) => {
|
177
|
+
marker.addListener('click', (e) => {
|
178
|
+
var iw = this.findInfoWindow('tap');
|
179
|
+
iw && this.openInfoWindow(iw, index);
|
180
|
+
this.trigger('click', e);
|
181
|
+
});
|
182
|
+
marker.addListener('mouseover', () => {
|
183
|
+
var iw = this.findInfoWindow('hover');
|
184
|
+
if (!iw)
|
185
|
+
return;
|
186
|
+
infowindows[index] = this.openInfoWindow(iw, index);
|
187
|
+
});
|
188
|
+
marker.addListener('mouseout', () => {
|
189
|
+
var infowindow = infowindows[index];
|
190
|
+
infowindow && infowindow.close();
|
191
|
+
infowindows[index] = null;
|
192
|
+
});
|
193
|
+
});
|
194
|
+
this.markers = markers;
|
195
|
+
}
|
196
|
+
set markers(markers) {
|
197
|
+
if (this._markers) {
|
198
|
+
this._markers.forEach(marker => {
|
199
|
+
marker.setMap(null);
|
200
|
+
google.maps.event.clearInstanceListeners(marker);
|
201
|
+
});
|
202
|
+
this._markers = [];
|
203
|
+
}
|
204
|
+
this._markers = markers;
|
205
|
+
}
|
206
|
+
get markers() {
|
207
|
+
if (!this._markers) {
|
208
|
+
this.buildMarkers();
|
209
|
+
}
|
210
|
+
return this._markers;
|
211
|
+
}
|
212
|
+
get trackPath() {
|
213
|
+
return this._trackPath;
|
214
|
+
}
|
215
|
+
set trackPath(trackPath) {
|
216
|
+
if (this.trackPath) {
|
217
|
+
this.trackPath.setMap(null);
|
218
|
+
}
|
219
|
+
this._trackPath = trackPath;
|
220
|
+
}
|
221
|
+
get hidden() {
|
222
|
+
return super.hidden || this.app.isViewMode;
|
223
|
+
}
|
224
|
+
set hidden(hidden) {
|
225
|
+
super.hidden = hidden;
|
226
|
+
}
|
227
|
+
render(context) {
|
228
|
+
var { top, left, width, height } = this.state;
|
229
|
+
context.translate(left, top);
|
230
|
+
// 마커 모양 그리기
|
231
|
+
context.beginPath();
|
232
|
+
context.moveTo(width / 2, height * 0.9);
|
233
|
+
context.bezierCurveTo(width / 2.3, height * 0.6, 0, height / 2, 0, height / 4);
|
234
|
+
context.ellipse(width / 2, height / 4, width / 2, height / 4, 0, Math.PI * 1, Math.PI * 0);
|
235
|
+
context.bezierCurveTo(width, height / 2, width / 1.7, height * 0.6, width / 2, height * 0.9);
|
236
|
+
context.closePath();
|
237
|
+
context.translate(-left, -top);
|
238
|
+
}
|
239
|
+
get controls() {
|
240
|
+
return [];
|
241
|
+
}
|
242
|
+
onchangeTargetMap() {
|
243
|
+
if (this.targetMap) {
|
244
|
+
this._targetMap = null;
|
245
|
+
this._map = null;
|
246
|
+
}
|
247
|
+
var id = this.get('targetMap');
|
248
|
+
if (id !== undefined) {
|
249
|
+
this._targetMap = this.root.findById(id);
|
250
|
+
if (this.targetMap) {
|
251
|
+
this._map = this.targetMap.map;
|
252
|
+
if (!this.map) {
|
253
|
+
var listener = (after) => {
|
254
|
+
if ('map' in after) {
|
255
|
+
this._map = after.map;
|
256
|
+
this.markers && this.markers.forEach(marker => marker.setMap(this.map));
|
257
|
+
this.targetMap.off('change', listener);
|
258
|
+
}
|
259
|
+
};
|
260
|
+
this.targetMap.on('change', listener);
|
261
|
+
}
|
262
|
+
else {
|
263
|
+
this.markers && this.markers.forEach(marker => marker.setMap(this.map));
|
264
|
+
}
|
265
|
+
}
|
266
|
+
}
|
267
|
+
}
|
268
|
+
get targetMap() {
|
269
|
+
return this._targetMap;
|
270
|
+
}
|
271
|
+
onchange(after, before) {
|
272
|
+
if ('targetMap' in after) {
|
273
|
+
this.onchangeTargetMap();
|
274
|
+
}
|
275
|
+
if ('latlngs' in after) {
|
276
|
+
this.buildMarkers();
|
277
|
+
}
|
278
|
+
if ('fillStyle' in after || 'strokeStyle' in after || 'lineWidth' in after) {
|
279
|
+
this.buildMarkers();
|
280
|
+
}
|
281
|
+
super.onchange && super.onchange(after, before);
|
282
|
+
}
|
283
|
+
get latlngs() {
|
284
|
+
return this.getState('latlngs');
|
285
|
+
}
|
286
|
+
set latlngs(latlngs) {
|
287
|
+
this.setState({
|
288
|
+
latlngs
|
289
|
+
});
|
290
|
+
}
|
291
|
+
get nature() {
|
292
|
+
return NATURE;
|
293
|
+
}
|
294
|
+
}
|
295
|
+
Component.register('gmap-path', GMapPath);
|
296
|
+
//# sourceMappingURL=gmap-path.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"gmap-path.js","sourceRoot":"","sources":["../src/gmap-path.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,SAAS,EAA0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AiB,EAAE,MAAkB;QAC5C,IAAI,WAAW,IAAI,KAAK,EAAE,CAAC;YACzB,IAAI,CAAC,iBAAiB,EAAE,CAAA;QAC1B,CAAC;QAED,IAAI,SAAS,IAAI,KAAK,EAAE,CAAC;YACvB,IAAI,CAAC,YAAY,EAAE,CAAA;QACrB,CAAC;QAED,IAAI,WAAW,IAAI,KAAK,IAAI,aAAa,IAAI,KAAK,IAAI,WAAW,IAAI,KAAK,EAAE,CAAC;YAC3E,IAAI,CAAC,YAAY,EAAE,CAAA;QACrB,CAAC;QAED,KAAK,CAAC,QAAQ,IAAI,KAAK,CAAC,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC,CAAA;IACjD,CAAC;IAED,IAAI,OAAO;QACT,OAAO,IAAI,CAAC,QAAQ,CAAC,SAAS,CAAC,CAAA;IACjC,CAAC;IAED,IAAI,OAAO,CAAC,OAAO;QACjB,IAAI,CAAC,QAAQ,CAAC;YACZ,OAAO;SACR,CAAC,CAAA;IACJ,CAAC;IAED,IAAI,MAAM;QACR,OAAO,MAAM,CAAA;IACf,CAAC;CACF;AAED,SAAS,CAAC,QAAQ,CAAC,WAAW,EAAE,QAAQ,CAAC,CAAA","sourcesContent":["/*\n * Copyright © HatioLab Inc. All rights reserved.\n */\n\nimport { Component, InfoWindow, Properties, RectPath, Shape } from '@hatiolab/things-scene'\nimport GoogleMap from './google-map'\n\nconst NATURE = {\n mutable: false,\n resizable: true,\n rotatable: true,\n properties: [\n {\n type: 'id-input',\n label: 'target-map',\n name: 'targetMap',\n property: {\n component: 'google-map'\n }\n },\n {\n type: 'checkbox',\n label: 'show-path',\n name: 'showPath'\n },\n {\n type: 'checkbox',\n label: 'show-intermediate-markers',\n name: 'showIntermediateMarkers'\n },\n {\n type: 'checkbox',\n label: 'start-end-marker-different-design',\n name: 'startEndMarkerDifferentDesign'\n }\n ],\n 'value-property': 'latlngs'\n // help: 'scene/component/gmap-path'\n}\n\nconst EMPTY_MARKER_PATH = 'M 0,0 C -2,-20 -10,-22 -10,-30 A 10,10 0 1,1 10,-30 C 10,-22 2,-20 0,0 z'\nconst END_MARKER_PATH =\n 'M 0,0 C -2,-20 -10,-22 -10,-30 A 10,10 0 1,1 10,-30 C 10,-22 2,-20 0,0 z M -2,-30 a 2,2 0 1,1 4,0 2,2 0 1,1 -4,0'\nconst START_MARKER_PATH =\n 'M 0,0 C -2,-20 -10,-22 -10,-30 A 10,10 0 1,1 10,-30 C 10,-22 2,-20 0,0 z m -3,-34 l 0,8 l 8,-4 l -8,-4 z m -0,-0 l 0,8 l 8,-4 l -8,-4'\n\nexport default class GMapPath extends RectPath(Shape) {\n private _infoWindow?: google.maps.InfoWindow\n private _markers: google.maps.Marker[] = []\n private _map?: google.maps.Map | null\n private _targetMap?: GoogleMap | null\n private _trackPath?: google.maps.Polyline\n\n dispose() {\n this.markers && this.markers.forEach(marker => marker.setMap(null))\n\n this.markers = []\n delete this._infoWindow\n\n super.dispose()\n }\n\n ready() {\n super.ready()\n\n if (this.isTemplate()) {\n return\n }\n\n this.onchangeTargetMap()\n }\n\n get map() {\n return this._map\n }\n\n findInfoWindow(type: string) {\n var eventSetting = (this.state.event && this.state.event[type]) || {}\n\n var infoWindow =\n /* event spec v1.0 */ eventSetting.infoWindow ||\n /* event spec v1.1 */ (eventSetting.action == 'infoWindow' && eventSetting.target)\n\n if (infoWindow) {\n return this.root.findById(infoWindow)\n }\n }\n\n getInfoContent(sceneInfoWindow: InfoWindow, index: number) {\n var tpl = Component.template(sceneInfoWindow.model.frontSideTemplate)\n return (\n `<style>${sceneInfoWindow.model.style}</style>` +\n tpl({\n data: this.data,\n index\n })\n )\n }\n\n openInfoWindow(iw: InfoWindow, index: number) {\n var content = this.getInfoContent(iw, index)\n\n if (!this.map) return\n\n var infoWindow = new google.maps.InfoWindow()\n infoWindow.setContent(content)\n infoWindow.open(this.map, this.markers![index])\n\n return infoWindow\n }\n\n buildMarkers() {\n if (!this.map) {\n return\n }\n\n let {\n latlngs = [],\n fillStyle: fillColor,\n alpha: fillOpacity = 1,\n strokeStyle: strokeColor,\n lineWidth: strokeWeight,\n showIntermediateMarkers = false,\n startEndMarkerDifferentDesign = true,\n showPath = false\n } = this.state\n\n if (showIntermediateMarkers) {\n var markers: google.maps.Marker[] = latlngs.map(({ lat, lng }: { lat: number; lng: number }, index: number) => {\n if (startEndMarkerDifferentDesign) {\n return new google.maps.Marker({\n position: {\n lat: Number(lat) || 0,\n lng: Number(lng) || 0\n },\n map: this.map!,\n icon: {\n path: index == 0 ? START_MARKER_PATH : index + 1 == latlngs.length ? END_MARKER_PATH : EMPTY_MARKER_PATH,\n fillColor,\n fillOpacity,\n strokeColor,\n strokeWeight\n }\n })\n } else {\n return new google.maps.Marker({\n position: {\n lat: Number(lat) || 0,\n lng: Number(lng) || 0\n },\n map: this.map!,\n icon: {\n path: EMPTY_MARKER_PATH,\n fillColor,\n fillOpacity,\n strokeColor,\n strokeWeight\n }\n })\n }\n })\n } else {\n var spots =\n latlngs.length > 1 ? [latlngs[0], latlngs[latlngs.length - 1]] : latlngs.length == 1 ? [latlngs[0]] : []\n\n var markers: google.maps.Marker[] = spots.map(({ lat, lng }, index) => {\n if (startEndMarkerDifferentDesign) {\n return new google.maps.Marker({\n position: {\n lat: Number(lat) || 0,\n lng: Number(lng) || 0\n },\n map: this.map!,\n icon: {\n path: index == 0 ? START_MARKER_PATH : END_MARKER_PATH,\n fillColor,\n fillOpacity,\n strokeColor,\n strokeWeight\n }\n })\n } else {\n return new google.maps.Marker({\n position: {\n lat: Number(lat) || 0,\n lng: Number(lng) || 0\n },\n map: this.map!,\n icon: {\n path: EMPTY_MARKER_PATH,\n fillColor,\n fillOpacity,\n strokeColor,\n strokeWeight\n }\n })\n }\n })\n }\n\n if (showPath) {\n this.trackPath = new google.maps.Polyline({\n path: latlngs,\n geodesic: true,\n strokeColor: '#FF0000',\n strokeOpacity: 1,\n strokeWeight: 4,\n map: this.map\n })\n }\n\n var infowindows = new Array(markers.length)\n\n markers.forEach((marker, index: number) => {\n marker.addListener('click', (e: Event) => {\n var iw = this.findInfoWindow('tap')\n iw && this.openInfoWindow(iw, index)\n\n this.trigger('click', e)\n })\n marker.addListener('mouseover', () => {\n var iw = this.findInfoWindow('hover')\n if (!iw) return\n infowindows[index] = this.openInfoWindow(iw, index)\n })\n marker.addListener('mouseout', () => {\n var infowindow = infowindows[index]\n infowindow && infowindow.close()\n infowindows[index] = null\n })\n })\n\n this.markers = markers\n }\n\n set markers(markers) {\n if (this._markers) {\n this._markers.forEach(marker => {\n marker.setMap(null)\n google.maps.event.clearInstanceListeners(marker)\n })\n\n this._markers = []\n }\n\n this._markers = markers\n }\n\n get markers() {\n if (!this._markers) {\n this.buildMarkers()\n }\n\n return this._markers\n }\n\n get trackPath() {\n return this._trackPath\n }\n\n set trackPath(trackPath) {\n if (this.trackPath) {\n this.trackPath.setMap(null)\n }\n\n this._trackPath = trackPath\n }\n\n get hidden() {\n return super.hidden || this.app.isViewMode\n }\n\n set hidden(hidden) {\n super.hidden = hidden\n }\n\n render(context: CanvasRenderingContext2D) {\n var { top, left, width, height } = this.state\n\n context.translate(left, top)\n\n // 마커 모양 그리기\n context.beginPath()\n\n context.moveTo(width / 2, height * 0.9)\n context.bezierCurveTo(width / 2.3, height * 0.6, 0, height / 2, 0, height / 4)\n\n context.ellipse(width / 2, height / 4, width / 2, height / 4, 0, Math.PI * 1, Math.PI * 0)\n\n context.bezierCurveTo(width, height / 2, width / 1.7, height * 0.6, width / 2, height * 0.9)\n context.closePath()\n\n context.translate(-left, -top)\n }\n\n get controls() {\n return []\n }\n\n onchangeTargetMap() {\n if (this.targetMap) {\n this._targetMap = null\n this._map = null\n }\n\n var id = this.get('targetMap')\n if (id !== undefined) {\n this._targetMap = this.root.findById(id) as GoogleMap\n\n if (this.targetMap) {\n this._map = this.targetMap.map\n\n if (!this.map) {\n var listener = (after: any) => {\n if ('map' in after) {\n this._map = after.map\n this.markers && this.markers.forEach(marker => marker.setMap(this.map!))\n\n this.targetMap!.off('change', listener)\n }\n }\n this.targetMap.on('change', listener)\n } else {\n this.markers && this.markers.forEach(marker => marker.setMap(this.map!))\n }\n }\n }\n }\n\n get targetMap() {\n return this._targetMap\n }\n\n onchange(after: Properties, before: Properties) {\n if ('targetMap' in after) {\n this.onchangeTargetMap()\n }\n\n if ('latlngs' in after) {\n this.buildMarkers()\n }\n\n if ('fillStyle' in after || 'strokeStyle' in after || 'lineWidth' in after) {\n this.buildMarkers()\n }\n\n super.onchange && super.onchange(after, before)\n }\n\n get latlngs() {\n return this.getState('latlngs')\n }\n\n set latlngs(latlngs) {\n this.setState({\n latlngs\n })\n }\n\n get nature() {\n return NATURE\n }\n}\n\nComponent.register('gmap-path', GMapPath)\n"]}
|
@@ -0,0 +1,49 @@
|
|
1
|
+
/// <reference types="googlemaps" />
|
2
|
+
import { HTMLOverlayContainer, Properties } from '@hatiolab/things-scene';
|
3
|
+
export default class GoogleMap extends HTMLOverlayContainer {
|
4
|
+
static load(component: GoogleMap): void;
|
5
|
+
private static loaded;
|
6
|
+
private _listenTo?;
|
7
|
+
private _listener?;
|
8
|
+
private _anchor?;
|
9
|
+
private _map?;
|
10
|
+
ready(): void;
|
11
|
+
removed(): void;
|
12
|
+
rescale(): void;
|
13
|
+
createElement(): void;
|
14
|
+
onload(): void;
|
15
|
+
get tagName(): string;
|
16
|
+
get map(): google.maps.Map<Element> | undefined;
|
17
|
+
dispose(): void;
|
18
|
+
setElementProperties(div: HTMLDivElement): void;
|
19
|
+
onchange(after: Properties, before: Properties): void;
|
20
|
+
get latlng(): {
|
21
|
+
lat: any;
|
22
|
+
lng: any;
|
23
|
+
};
|
24
|
+
set latlng(latlng: {
|
25
|
+
lat: any;
|
26
|
+
lng: any;
|
27
|
+
});
|
28
|
+
get nature(): {
|
29
|
+
mutable: boolean;
|
30
|
+
resizable: boolean;
|
31
|
+
rotatable: boolean;
|
32
|
+
properties: ({
|
33
|
+
type: string;
|
34
|
+
label: string;
|
35
|
+
name: string;
|
36
|
+
property: {
|
37
|
+
step: number;
|
38
|
+
max: number;
|
39
|
+
min: number;
|
40
|
+
};
|
41
|
+
} | {
|
42
|
+
type: string;
|
43
|
+
label: string;
|
44
|
+
name: string;
|
45
|
+
property?: undefined;
|
46
|
+
})[];
|
47
|
+
'value-property': string;
|
48
|
+
};
|
49
|
+
}
|
@@ -0,0 +1,178 @@
|
|
1
|
+
/*
|
2
|
+
* Copyright © HatioLab Inc. All rights reserved.
|
3
|
+
*/
|
4
|
+
const NATURE = {
|
5
|
+
mutable: false,
|
6
|
+
resizable: true,
|
7
|
+
rotatable: true,
|
8
|
+
properties: [
|
9
|
+
{
|
10
|
+
type: 'number',
|
11
|
+
label: 'latitude',
|
12
|
+
name: 'lat',
|
13
|
+
property: {
|
14
|
+
step: 0.000001,
|
15
|
+
max: 90,
|
16
|
+
min: -90
|
17
|
+
}
|
18
|
+
},
|
19
|
+
{
|
20
|
+
type: 'number',
|
21
|
+
label: 'longitude',
|
22
|
+
name: 'lng',
|
23
|
+
property: {
|
24
|
+
step: 0.000001,
|
25
|
+
min: -180,
|
26
|
+
max: 180
|
27
|
+
}
|
28
|
+
},
|
29
|
+
{
|
30
|
+
type: 'number',
|
31
|
+
label: 'zoom',
|
32
|
+
name: 'zoom'
|
33
|
+
},
|
34
|
+
{
|
35
|
+
type: 'string',
|
36
|
+
label: 'api-key',
|
37
|
+
name: 'apiKey'
|
38
|
+
}
|
39
|
+
],
|
40
|
+
'value-property': 'latlng'
|
41
|
+
// help: 'scene/component/gmap-map'
|
42
|
+
};
|
43
|
+
import { Component, HTMLOverlayContainer, ScriptLoader, error } from '@hatiolab/things-scene';
|
44
|
+
function getGlobalScale(component) {
|
45
|
+
var scale = { x: 1, y: 1 };
|
46
|
+
var parent = component;
|
47
|
+
while (parent) {
|
48
|
+
let { x, y } = parent.get('scale') || { x: 1, y: 1 };
|
49
|
+
scale.x *= x || 1;
|
50
|
+
scale.y *= y || 1;
|
51
|
+
parent = parent.parent;
|
52
|
+
}
|
53
|
+
return scale;
|
54
|
+
}
|
55
|
+
class GoogleMap extends HTMLOverlayContainer {
|
56
|
+
constructor() {
|
57
|
+
super(...arguments);
|
58
|
+
this._listener = function (after) {
|
59
|
+
after.scale && this.rescale();
|
60
|
+
}.bind(this);
|
61
|
+
}
|
62
|
+
static load(component) {
|
63
|
+
var key = component.get('apiKey');
|
64
|
+
ScriptLoader.load('https://maps.googleapis.com/maps/api/js' + (key ? '?key=' + key : '')).then(() => component.onload(), error);
|
65
|
+
}
|
66
|
+
ready() {
|
67
|
+
super.ready();
|
68
|
+
if (this.rootModel) {
|
69
|
+
this._listenTo = this.rootModel;
|
70
|
+
this.rootModel.on('change', this._listener);
|
71
|
+
}
|
72
|
+
}
|
73
|
+
removed() {
|
74
|
+
if (this._listenTo) {
|
75
|
+
this._listenTo.off('change', this._listener);
|
76
|
+
delete this._listenTo;
|
77
|
+
delete this._listener;
|
78
|
+
}
|
79
|
+
}
|
80
|
+
/*
|
81
|
+
* google map은 scale된 상태에서 마우스 포지션을 정확히 매핑하지 못하므로, 마커를 정상적으로 동작시키지 못한다.
|
82
|
+
* 따라서, google map의 경우에는 부모의 스케일의 역으로 transform해서, scale을 1로 맞추어야 한다.
|
83
|
+
*/
|
84
|
+
rescale() {
|
85
|
+
var anchor = this._anchor;
|
86
|
+
if (!anchor) {
|
87
|
+
return;
|
88
|
+
}
|
89
|
+
var scale = getGlobalScale(this);
|
90
|
+
var sx = 1 / scale.x;
|
91
|
+
var sy = 1 / scale.y;
|
92
|
+
var transform = `scale(${sx}, ${sy})`;
|
93
|
+
['-webkit-', '-moz-', '-ms-', '-o-', ''].forEach(prefix => {
|
94
|
+
anchor.style[(prefix + 'transform')] = transform;
|
95
|
+
anchor.style[(prefix + 'transform-origin')] = '0px 0px';
|
96
|
+
});
|
97
|
+
var { width, height } = this.state;
|
98
|
+
anchor.style.width = width * scale.x + 'px';
|
99
|
+
anchor.style.height = height * scale.y + 'px';
|
100
|
+
if (GoogleMap.loaded) {
|
101
|
+
google.maps.event.trigger(this.map, 'resize');
|
102
|
+
let { lat, lng } = this.state;
|
103
|
+
this.map &&
|
104
|
+
this.map.setCenter({
|
105
|
+
lat,
|
106
|
+
lng
|
107
|
+
});
|
108
|
+
}
|
109
|
+
}
|
110
|
+
createElement() {
|
111
|
+
super.createElement();
|
112
|
+
this._anchor = document.createElement('div');
|
113
|
+
this.element.appendChild(this._anchor);
|
114
|
+
this.rescale();
|
115
|
+
GoogleMap.load(this);
|
116
|
+
}
|
117
|
+
onload() {
|
118
|
+
GoogleMap.loaded = true;
|
119
|
+
var { lat, lng, zoom } = this.state;
|
120
|
+
try {
|
121
|
+
this._map = new google.maps.Map(this._anchor, {
|
122
|
+
zoom,
|
123
|
+
center: new google.maps.LatLng(lat, lng)
|
124
|
+
});
|
125
|
+
}
|
126
|
+
finally {
|
127
|
+
/*
|
128
|
+
* setState 로 map 객체가 생성되었음을 change 이벤트로 알려줄 수 있다
|
129
|
+
* - set('map', this._map)으로 만들 지 않도록 주의한다.
|
130
|
+
* - setState('map', this._map)으로해야 컴포넌트 모델에 추가되지 않는다.
|
131
|
+
*/
|
132
|
+
this.setState('map', this._map);
|
133
|
+
this.rescale();
|
134
|
+
}
|
135
|
+
}
|
136
|
+
get tagName() {
|
137
|
+
return 'div';
|
138
|
+
}
|
139
|
+
get map() {
|
140
|
+
return this._map;
|
141
|
+
}
|
142
|
+
dispose() {
|
143
|
+
super.dispose();
|
144
|
+
delete this._anchor;
|
145
|
+
}
|
146
|
+
setElementProperties(div) {
|
147
|
+
this.rescale();
|
148
|
+
}
|
149
|
+
onchange(after, before) {
|
150
|
+
if (GoogleMap.loaded) {
|
151
|
+
if (after.zoom) {
|
152
|
+
this.map.setZoom(after.zoom);
|
153
|
+
}
|
154
|
+
if ('lat' in after || 'lng' in after) {
|
155
|
+
let { lat, lng } = this.state;
|
156
|
+
this.map.setCenter(new google.maps.LatLng(lat, lng));
|
157
|
+
}
|
158
|
+
}
|
159
|
+
super.onchange(after, before);
|
160
|
+
this.rescale();
|
161
|
+
}
|
162
|
+
get latlng() {
|
163
|
+
return {
|
164
|
+
lat: this.get('lat'),
|
165
|
+
lng: this.get('lng')
|
166
|
+
};
|
167
|
+
}
|
168
|
+
set latlng(latlng) {
|
169
|
+
this.set(latlng);
|
170
|
+
}
|
171
|
+
get nature() {
|
172
|
+
return NATURE;
|
173
|
+
}
|
174
|
+
}
|
175
|
+
GoogleMap.loaded = false;
|
176
|
+
export default GoogleMap;
|
177
|
+
Component.register('google-map', GoogleMap);
|
178
|
+
//# sourceMappingURL=google-map.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"google-map.js","sourceRoot":"","sources":["../src/google-map.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,MAAM,MAAM,GAAG;IACb,OAAO,EAAE,KAAK;IACd,SAAS,EAAE,IAAI;IACf,SAAS,EAAE,IAAI;IACf,UAAU,EAAE;QACV;YACE,IAAI,EAAE,QAAQ;YACd,KAAK,EAAE,UAAU;YACjB,IAAI,EAAE,KAAK;YACX,QAAQ,EAAE;gBACR,IAAI,EAAE,QAAQ;gBACd,GAAG,EAAE,EAAE;gBACP,GAAG,EAAE,CAAC,EAAE;aACT;SACF;QACD;YACE,IAAI,EAAE,QAAQ;YACd,KAAK,EAAE,WAAW;YAClB,IAAI,EAAE,KAAK;YACX,QAAQ,EAAE;gBACR,IAAI,EAAE,QAAQ;gBACd,GAAG,EAAE,CAAC,GAAG;gBACT,GAAG,EAAE,GAAG;aACT;SACF;QACD;YACE,IAAI,EAAE,QAAQ;YACd,KAAK,EAAE,MAAM;YACb,IAAI,EAAE,MAAM;SACb;QACD;YACE,IAAI,EAAE,QAAQ;YACd,KAAK,EAAE,SAAS;YAChB,IAAI,EAAE,QAAQ;SACf;KACF;IACD,gBAAgB,EAAE,QAAQ;IAC1B,mCAAmC;CACpC,CAAA;AAED,OAAO,EAAE,SAAS,EAAE,oBAAoB,EAAc,YAAY,EAAE,KAAK,EAAE,MAAM,wBAAwB,CAAA;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Y,EAAE,SAAS,CAAC,CAAA","sourcesContent":["/*\n * Copyright © HatioLab Inc. All rights reserved.\n */\n\nconst NATURE = {\n mutable: false,\n resizable: true,\n rotatable: true,\n properties: [\n {\n type: 'number',\n label: 'latitude',\n name: 'lat',\n property: {\n step: 0.000001,\n max: 90,\n min: -90\n }\n },\n {\n type: 'number',\n label: 'longitude',\n name: 'lng',\n property: {\n step: 0.000001,\n min: -180,\n max: 180\n }\n },\n {\n type: 'number',\n label: 'zoom',\n name: 'zoom'\n },\n {\n type: 'string',\n label: 'api-key',\n name: 'apiKey'\n }\n ],\n 'value-property': 'latlng'\n // help: 'scene/component/gmap-map'\n}\n\nimport { Component, HTMLOverlayContainer, Properties, ScriptLoader, error } from '@hatiolab/things-scene'\n\nfunction getGlobalScale(component: GoogleMap) {\n var scale = { x: 1, y: 1 }\n var parent: Component = component\n\n while (parent) {\n let { x, y } = parent.get('scale') || { x: 1, y: 1 }\n scale.x *= x || 1\n scale.y *= y || 1\n\n parent = parent.parent\n }\n return scale\n}\n\nexport default class GoogleMap extends HTMLOverlayContainer {\n static load(component: GoogleMap) {\n var key = component.get('apiKey')\n ScriptLoader.load('https://maps.googleapis.com/maps/api/js' + (key ? '?key=' + key : '')).then(\n () => component.onload(),\n error\n )\n }\n\n private static loaded: boolean = false\n\n private _listenTo?: Component\n private _listener? = function (this: GoogleMap, after: any) {\n after.scale && this.rescale()\n }.bind(this)\n\n private _anchor?: HTMLDivElement\n private _map?: google.maps.Map\n\n ready() {\n super.ready()\n\n if (this.rootModel) {\n this._listenTo = this.rootModel\n this.rootModel.on('change', this._listener!)\n }\n }\n\n removed() {\n if (this._listenTo) {\n this._listenTo.off('change', this._listener!)\n\n delete this._listenTo\n delete this._listener\n }\n }\n\n /*\n * google map은 scale된 상태에서 마우스 포지션을 정확히 매핑하지 못하므로, 마커를 정상적으로 동작시키지 못한다.\n * 따라서, google map의 경우에는 부모의 스케일의 역으로 transform해서, scale을 1로 맞추어야 한다.\n */\n rescale() {\n var anchor = this._anchor\n if (!anchor) {\n return\n }\n var scale = getGlobalScale(this)\n\n var sx = 1 / scale.x\n var sy = 1 / scale.y\n\n var transform = `scale(${sx}, ${sy})`\n\n ;['-webkit-', '-moz-', '-ms-', '-o-', ''].forEach(prefix => {\n anchor!.style[(prefix + 'transform') as any] = transform\n anchor!.style[(prefix + 'transform-origin') as any] = '0px 0px'\n })\n\n var { width, height } = this.state\n anchor.style.width = width * scale.x + 'px'\n anchor.style.height = height * scale.y + 'px'\n\n if (GoogleMap.loaded) {\n google.maps.event.trigger(this.map, 'resize')\n let { lat, lng } = this.state\n this.map &&\n this.map.setCenter({\n lat,\n lng\n })\n }\n }\n\n createElement() {\n super.createElement()\n this._anchor = document.createElement('div')\n this.element.appendChild(this._anchor)\n this.rescale()\n\n GoogleMap.load(this)\n }\n\n onload() {\n GoogleMap.loaded = true\n\n var { lat, lng, zoom } = this.state\n\n try {\n this._map = new google.maps.Map(this._anchor!, {\n zoom,\n center: new google.maps.LatLng(lat, lng)\n })\n } finally {\n /*\n * setState 로 map 객체가 생성되었음을 change 이벤트로 알려줄 수 있다\n * - set('map', this._map)으로 만들 지 않도록 주의한다.\n * - setState('map', this._map)으로해야 컴포넌트 모델에 추가되지 않는다.\n */\n this.setState('map', this._map)\n this.rescale()\n }\n }\n\n get tagName() {\n return 'div'\n }\n\n get map() {\n return this._map\n }\n\n dispose() {\n super.dispose()\n\n delete this._anchor\n }\n\n setElementProperties(div: HTMLDivElement) {\n this.rescale()\n }\n\n onchange(after: Properties, before: Properties) {\n if (GoogleMap.loaded) {\n if (after.zoom) {\n this.map!.setZoom(after.zoom)\n }\n\n if ('lat' in after || 'lng' in after) {\n let { lat, lng } = this.state\n this.map!.setCenter(new google.maps.LatLng(lat, lng))\n }\n }\n\n super.onchange(after, before)\n\n this.rescale()\n }\n\n get latlng() {\n return {\n lat: this.get('lat'),\n lng: this.get('lng')\n }\n }\n\n set latlng(latlng) {\n this.set(latlng)\n }\n\n get nature() {\n return NATURE\n }\n}\n\nComponent.register('google-map', GoogleMap)\n"]}
|
package/dist/index.d.ts
ADDED
package/dist/index.js
ADDED
@@ -0,0 +1,8 @@
|
|
1
|
+
/*
|
2
|
+
* Copyright © HatioLab Inc. All rights reserved.
|
3
|
+
*/
|
4
|
+
import GmapMarker from './gmap-marker';
|
5
|
+
import GmapPath from './gmap-path';
|
6
|
+
import GoogleMap from './google-map';
|
7
|
+
export default [GmapMarker, GmapPath, GoogleMap];
|
8
|
+
//# sourceMappingURL=index.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,UAAU,MAAM,eAAe,CAAA;AACtC,OAAO,QAAQ,MAAM,aAAa,CAAA;AAClC,OAAO,SAAS,MAAM,cAAc,CAAA;AAEpC,eAAe,CAAC,UAAU,EAAE,QAAQ,EAAE,SAAS,CAAC,CAAA","sourcesContent":["/*\n * Copyright © HatioLab Inc. All rights reserved.\n */\nimport GmapMarker from './gmap-marker'\nimport GmapPath from './gmap-path'\nimport GoogleMap from './google-map'\n\nexport default [GmapMarker, GmapPath, GoogleMap]\n"]}
|
@@ -0,0 +1,18 @@
|
|
1
|
+
declare const _default: {
|
2
|
+
type: string;
|
3
|
+
description: string;
|
4
|
+
group: string;
|
5
|
+
icon: string;
|
6
|
+
model: {
|
7
|
+
type: string;
|
8
|
+
left: number;
|
9
|
+
top: number;
|
10
|
+
width: number;
|
11
|
+
height: number;
|
12
|
+
lat: number;
|
13
|
+
lng: number;
|
14
|
+
fillStyle: string;
|
15
|
+
hidden: boolean;
|
16
|
+
};
|
17
|
+
};
|
18
|
+
export default _default;
|
@@ -0,0 +1,20 @@
|
|
1
|
+
const icon = new URL('../../icons/gmap-marker.png', import.meta.url).href;
|
2
|
+
export default {
|
3
|
+
type: 'gmap-marker',
|
4
|
+
description: 'google map marker',
|
5
|
+
group: 'etc',
|
6
|
+
/* line|shape|textAndMedia|chartAndGauge|table|container|dataSource|IoT|3D|warehouse|form|etc */
|
7
|
+
icon,
|
8
|
+
model: {
|
9
|
+
type: 'gmap-marker',
|
10
|
+
left: 150,
|
11
|
+
top: 150,
|
12
|
+
width: 40,
|
13
|
+
height: 60,
|
14
|
+
lat: 22.308117,
|
15
|
+
lng: 114.225443,
|
16
|
+
fillStyle: '#00ff00',
|
17
|
+
hidden: true
|
18
|
+
}
|
19
|
+
};
|
20
|
+
//# sourceMappingURL=gmap-marker.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"gmap-marker.js","sourceRoot":"","sources":["../../src/templates/gmap-marker.ts"],"names":[],"mappings":"AAAA,MAAM,IAAI,GAAG,IAAI,GAAG,CAAC,6BAA6B,EAAE,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,IAAI,CAAA;AAEzE,eAAe;IACb,IAAI,EAAE,aAAa;IACnB,WAAW,EAAE,mBAAmB;IAChC,KAAK,EAAE,KAAK;IACZ,gGAAgG;IAChG,IAAI;IACJ,KAAK,EAAE;QACL,IAAI,EAAE,aAAa;QACnB,IAAI,EAAE,GAAG;QACT,GAAG,EAAE,GAAG;QACR,KAAK,EAAE,EAAE;QACT,MAAM,EAAE,EAAE;QACV,GAAG,EAAE,SAAS;QACd,GAAG,EAAE,UAAU;QACf,SAAS,EAAE,SAAS;QACpB,MAAM,EAAE,IAAI;KACb;CACF,CAAA","sourcesContent":["const icon = new URL('../../icons/gmap-marker.png', import.meta.url).href\n\nexport default {\n type: 'gmap-marker',\n description: 'google map marker',\n group: 'etc',\n /* line|shape|textAndMedia|chartAndGauge|table|container|dataSource|IoT|3D|warehouse|form|etc */\n icon,\n model: {\n type: 'gmap-marker',\n left: 150,\n top: 150,\n width: 40,\n height: 60,\n lat: 22.308117,\n lng: 114.225443,\n fillStyle: '#00ff00',\n hidden: true\n }\n}\n"]}
|
@@ -0,0 +1,21 @@
|
|
1
|
+
declare const _default: {
|
2
|
+
type: string;
|
3
|
+
description: string;
|
4
|
+
group: string;
|
5
|
+
icon: string;
|
6
|
+
model: {
|
7
|
+
type: string;
|
8
|
+
left: number;
|
9
|
+
top: number;
|
10
|
+
width: number;
|
11
|
+
height: number;
|
12
|
+
latlngs: {
|
13
|
+
lat: number;
|
14
|
+
lng: number;
|
15
|
+
}[];
|
16
|
+
startEndMarkerDifferentDesign: boolean;
|
17
|
+
fillStyle: string;
|
18
|
+
hidden: boolean;
|
19
|
+
};
|
20
|
+
};
|
21
|
+
export default _default;
|