@mint-ui/map 0.5.6-beta → 0.5.8-beta

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.
@@ -61,4 +61,5 @@ export declare abstract class MintMapController {
61
61
  checkBoundsChangeThrottleTime(): boolean;
62
62
  getBaseToMapZoom(zoomBase: number): number;
63
63
  getMapToBaseZoom(mapZoom: number): number;
64
+ printStatus(): void;
64
65
  }
@@ -5,6 +5,10 @@ Object.defineProperty(exports, '__esModule', { value: true });
5
5
  var tslib = require('tslib');
6
6
  var uuid = require('uuid');
7
7
  var MapTypes = require('../types/MapTypes.js');
8
+ require('./util/animation.js');
9
+ require('./util/geo.js');
10
+ require('./util/polygon.js');
11
+ var status = require('./util/status.js');
8
12
 
9
13
  var MintMapController =
10
14
  /** @class */
@@ -168,6 +172,10 @@ function () {
168
172
  throw new Error("[getMapToBaseZoom][".concat(mapZoom, "] is not valid zoom level"));
169
173
  };
170
174
 
175
+ MintMapController.prototype.printStatus = function () {
176
+ status.Status.print();
177
+ };
178
+
171
179
  return MintMapController;
172
180
  }();
173
181
 
@@ -9,6 +9,7 @@ export interface CircleMarkerProps {
9
9
  zIndex?: number;
10
10
  svgProperties?: React.SVGProps<SVGSVGElement>;
11
11
  shapeProperties?: React.SVGProps<SVGCircleElement>;
12
+ debugLabel?: string;
12
13
  }
13
14
  /**
14
15
  * CircleMarker
@@ -17,4 +18,4 @@ export interface CircleMarkerProps {
17
18
  *
18
19
  * @returns {JSX.Element} JSX
19
20
  */
20
- export declare function CircleMarker({ children, center, radius, radiusUnit, background, svgProperties, shapeProperties, visible, zIndex, }: PropsWithChildren<CircleMarkerProps>): JSX.Element;
21
+ export declare function CircleMarker({ children, center, radius, radiusUnit, background, svgProperties, shapeProperties, visible, zIndex, debugLabel, }: PropsWithChildren<CircleMarkerProps>): JSX.Element;
@@ -13,6 +13,7 @@ var SVGCircle = require('./base/SVGCircle.js');
13
13
  require('../../util/animation.js');
14
14
  var geo = require('../../util/geo.js');
15
15
  require('../../util/polygon.js');
16
+ require('../../util/status.js');
16
17
 
17
18
  function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
18
19
 
@@ -40,7 +41,8 @@ function CircleMarker(_a) {
40
41
  shapeProperties = _e === void 0 ? {} : _e,
41
42
  _f = _a.visible,
42
43
  visible = _f === void 0 ? true : _f,
43
- zIndex = _a.zIndex; //controller
44
+ zIndex = _a.zIndex,
45
+ debugLabel = _a.debugLabel; //controller
44
46
 
45
47
  var controller = MintMapProvider.useMintMapController(); //zoom start event
46
48
 
@@ -124,7 +126,8 @@ function CircleMarker(_a) {
124
126
  anchor: anchor,
125
127
  visible: visible,
126
128
  disablePointerEvent: true,
127
- zIndex: zIndex
129
+ zIndex: zIndex,
130
+ debugLabel: debugLabel
128
131
  }, mapVisible && React__default["default"].createElement(SVGCircle.SVGCircle, {
129
132
  radius: computedRadius,
130
133
  background: background,
@@ -15,6 +15,7 @@ export interface PolygonMarkerProps {
15
15
  mode?: 'POLYGON' | 'POLYLINE';
16
16
  svgProperties?: React.SVGProps<SVGSVGElement>;
17
17
  shapeProperties?: React.SVGProps<SVGPathElement>;
18
+ debugLabel?: string;
18
19
  }
19
20
  /**
20
21
  *PolygonMarker
@@ -23,4 +24,4 @@ export interface PolygonMarkerProps {
23
24
  *
24
25
  * @returns {JSX.Element} JSX
25
26
  */
26
- export declare function PolygonMarker({ children, position, background, innerPositions, simplifyPath, simplifyTolerance, lastReapeated, svgProperties, shapeProperties, visible, zIndex, mode, }: PropsWithChildren<PolygonMarkerProps>): JSX.Element;
27
+ export declare function PolygonMarker({ children, position, background, innerPositions, simplifyPath, simplifyTolerance, lastReapeated, svgProperties, shapeProperties, visible, zIndex, mode, debugLabel, }: PropsWithChildren<PolygonMarkerProps>): JSX.Element;
@@ -13,6 +13,7 @@ require('../../util/animation.js');
13
13
  require('../../util/geo.js');
14
14
  require('tslib');
15
15
  var polygon = require('../../util/polygon.js');
16
+ require('../../util/status.js');
16
17
  var NaverMintMapController = require('../../../naver/NaverMintMapController.js');
17
18
 
18
19
  function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
@@ -46,7 +47,8 @@ function PolygonMarker(_a) {
46
47
  visible = _g === void 0 ? true : _g,
47
48
  zIndex = _a.zIndex,
48
49
  _h = _a.mode,
49
- mode = _h === void 0 ? 'POLYGON' : _h; //controller
50
+ mode = _h === void 0 ? 'POLYGON' : _h,
51
+ debugLabel = _a.debugLabel; //controller
50
52
 
51
53
  var controller = MintMapProvider.useMintMapController(); //zoom start event
52
54
 
@@ -164,7 +166,8 @@ function PolygonMarker(_a) {
164
166
  position: polygonStart,
165
167
  visible: visible,
166
168
  disablePointerEvent: true,
167
- zIndex: zIndex
169
+ zIndex: zIndex,
170
+ debugLabel: debugLabel
168
171
  }, mapVisible && React__default["default"].createElement(SVGPolygon.SVGPolygon, {
169
172
  path: offsets,
170
173
  innerPath: innerOffsets,
@@ -3,3 +3,5 @@ export * from './geo';
3
3
  export * from './waiting';
4
4
  export * from './cluster';
5
5
  export * from './polygon';
6
+ export * from './log';
7
+ export * from './status';
@@ -0,0 +1 @@
1
+ export declare function log(debug: boolean | undefined, label: string | undefined, ...args: any[]): void;
@@ -0,0 +1,18 @@
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, '__esModule', { value: true });
4
+
5
+ var tslib = require('tslib');
6
+
7
+ function log(debug, label) {
8
+ var args = [];
9
+
10
+ for (var _i = 2; _i < arguments.length; _i++) {
11
+ args[_i - 2] = arguments[_i];
12
+ }
13
+
14
+ if (!debug) return;
15
+ args && console.log.apply(console, tslib.__spreadArray(['[mint-map debug]', label || ''], args, false));
16
+ }
17
+
18
+ exports.log = log;
@@ -0,0 +1,9 @@
1
+ declare class MintMapStatus {
2
+ marker: number;
3
+ byLabel: Map<string, number>;
4
+ init(): void;
5
+ print(): void;
6
+ setMarker(inc: number, label?: string): void;
7
+ }
8
+ export declare const Status: MintMapStatus;
9
+ export {};
@@ -0,0 +1,58 @@
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, '__esModule', { value: true });
4
+
5
+ var MintMapStatus =
6
+ /** @class */
7
+ function () {
8
+ function MintMapStatus() {
9
+ this.marker = 0;
10
+ this.byLabel = new Map();
11
+ }
12
+
13
+ MintMapStatus.prototype.init = function () {
14
+ this.marker = 0;
15
+ this.byLabel.clear();
16
+ };
17
+
18
+ MintMapStatus.prototype.print = function () {
19
+ var str = "[mint-map status]\n\nmarker : ".concat(this.marker, "\n ");
20
+
21
+ if (this.byLabel.size > 0) {
22
+ str += '\n-------- status detail (by label) ----------';
23
+ this.byLabel.forEach(function (val, key) {
24
+ str += "\n(".concat(key, ") : ").concat(val);
25
+ });
26
+ str += '\n\n';
27
+ }
28
+
29
+ console.log(str);
30
+ };
31
+
32
+ MintMapStatus.prototype.setMarker = function (inc, label) {
33
+ this.marker += inc;
34
+
35
+ if (label) {
36
+ var curr = this.byLabel.get(label);
37
+ var calc = 0;
38
+
39
+ if (curr === undefined) {
40
+ calc = inc;
41
+ } else {
42
+ calc = curr + inc;
43
+ }
44
+
45
+ if (calc === 0) {
46
+ this.byLabel.delete(label);
47
+ } else {
48
+ this.byLabel.set(label, calc);
49
+ }
50
+ }
51
+ };
52
+
53
+ return MintMapStatus;
54
+ }();
55
+
56
+ var Status = new MintMapStatus();
57
+
58
+ exports.Status = Status;
@@ -3,6 +3,8 @@
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
5
  var tslib = require('tslib');
6
+ var log = require('../core/util/log.js');
7
+ var status = require('../core/util/status.js');
6
8
  var MintMapController = require('../core/MintMapController.js');
7
9
  var waiting = require('../core/util/waiting.js');
8
10
  var MapEventTypes = require('../types/MapEventTypes.js');
@@ -216,6 +218,8 @@ function (_super) {
216
218
  googleMarker_1 = new google.maps.Marker(options);
217
219
  }
218
220
 
221
+ log.log(this.mapProps.debug || marker.options.debug, marker.options.debugLabel, this.type + ' marker created');
222
+ status.Status.setMarker(1, marker.options.debugLabel);
219
223
  marker.native = googleMarker_1;
220
224
  ((_a = marker.options) === null || _a === void 0 ? void 0 : _a.event) && marker.options.event.forEach(function (handler, key) {
221
225
  if (_this.markerEvents.includes(key)) {
@@ -254,6 +258,8 @@ function (_super) {
254
258
  marker.native.position = options.position;
255
259
  }
256
260
  }
261
+
262
+ log.log(this.mapProps.debug || options.debug, marker.options.debugLabel, this.type + ' marker updated');
257
263
  }
258
264
  };
259
265
 
@@ -320,6 +326,8 @@ function (_super) {
320
326
  } else if (drawable.native instanceof google.maps.marker.AdvancedMarkerView) {
321
327
  google.maps.event.clearInstanceListeners(drawable.native);
322
328
  drawable.native.map = null;
329
+ log.log(this.mapProps.debug || drawable.options.debug, drawable.options.debugLabel, this.type + ' marker cleared');
330
+ status.Status.setMarker(-1, drawable.options.debugLabel);
323
331
  return true;
324
332
  }
325
333
  }
@@ -8,6 +8,8 @@ var waiting = require('../core/util/waiting.js');
8
8
  var tools = require('@mint-ui/tools');
9
9
  var MapTypes = require('../types/MapTypes.js');
10
10
  var MapEventTypes = require('../types/MapEventTypes.js');
11
+ var log = require('../core/util/log.js');
12
+ var status = require('../core/util/status.js');
11
13
 
12
14
  var KakaoMintMapController =
13
15
  /** @class */
@@ -233,6 +235,8 @@ function (_super) {
233
235
  this.updateMarker(marker, marker.options);
234
236
  } else {
235
237
  kakaoMarker_1 = new kakao.maps.CustomOverlay(options);
238
+ log.log(this.mapProps.debug || marker.options.debug, marker.options.debugLabel, this.type + ' marker created');
239
+ status.Status.setMarker(1, marker.options.debugLabel);
236
240
  marker.options.visible !== undefined && kakaoMarker_1.setVisible(marker.options.visible);
237
241
  this.removeParentElementsMargin(marker);
238
242
  marker.native = kakaoMarker_1;
@@ -261,6 +265,7 @@ function (_super) {
261
265
  marker.native.setVisible(options.visible);
262
266
  }
263
267
 
268
+ log.log(this.mapProps.debug || options.debug, marker.options.debugLabel, this.type + ' marker updated');
264
269
  this.removeParentElementsMargin(marker);
265
270
  }
266
271
  }
@@ -333,6 +338,8 @@ function (_super) {
333
338
  (_a = this.markerPool) === null || _a === void 0 ? void 0 : _a.releasePoolItem(drawable.native);
334
339
  } else {
335
340
  drawable.native.setMap(null);
341
+ log.log(this.mapProps.debug || drawable.options.debug, drawable.options.debugLabel, this.type + ' marker cleared');
342
+ status.Status.setMarker(-1, drawable.options.debugLabel);
336
343
  }
337
344
  } else {
338
345
  drawable.native.setMap(null);
@@ -8,6 +8,8 @@ var waiting = require('../core/util/waiting.js');
8
8
  var tools = require('@mint-ui/tools');
9
9
  var MapTypes = require('../types/MapTypes.js');
10
10
  var MapEventTypes = require('../types/MapEventTypes.js');
11
+ var log = require('../core/util/log.js');
12
+ var status = require('../core/util/status.js');
11
13
 
12
14
  var NaverMintMapController =
13
15
  /** @class */
@@ -216,8 +218,7 @@ function (_super) {
216
218
  map: this.map,
217
219
  position: marker.options.position,
218
220
  visible: marker.options.visible === undefined || marker.options.visible
219
- }; //console.log('controller createMarker', marker.options);
220
-
221
+ };
221
222
  marker.element && (options.icon = {
222
223
  content: marker.element,
223
224
  anchor: marker.options.anchor
@@ -235,6 +236,8 @@ function (_super) {
235
236
  marker.native = naverMarker_1;
236
237
  }
237
238
 
239
+ log.log(this.mapProps.debug || marker.options.debug, marker.options.debugLabel, this.type + ' marker created');
240
+ status.Status.setMarker(1, marker.options.debugLabel);
238
241
  ((_a = marker.options) === null || _a === void 0 ? void 0 : _a.event) && marker.options.event.forEach(function (handler, key) {
239
242
  if (_this.markerEvents.includes(key)) {
240
243
  naver.maps.Event.addListener(naverMarker_1, key, handler);
@@ -268,7 +271,9 @@ function (_super) {
268
271
  marker.native.setIcon(tslib.__assign(tslib.__assign({}, marker.native.getIcon()), {
269
272
  anchor: options.anchor
270
273
  }));
271
- } // const newOption = {
274
+ }
275
+
276
+ log.log(this.mapProps.debug || options.debug, marker.options.debugLabel, this.type + ' marker updated'); // const newOption = {
272
277
  // map:map,
273
278
  // position:options.position instanceof Position?options.position:marker.native.getPosition(),
274
279
  // visible:options.visible === undefined || options.visible,
@@ -282,7 +287,6 @@ function (_super) {
282
287
  // visible:options.visible === undefined || options.visible,
283
288
  // icon:{...marker.native.getIcon(), anchor:options.anchor}
284
289
  // })
285
-
286
290
  }
287
291
  }
288
292
  };
@@ -340,6 +344,9 @@ function (_super) {
340
344
  } else {
341
345
  drawable.native.setMap(null);
342
346
  }
347
+
348
+ log.log(this.mapProps.debug || drawable.options.debug, drawable.options.debugLabel, this.type + ' marker cleared');
349
+ status.Status.setMarker(-1, drawable.options.debugLabel);
343
350
  } else {
344
351
  drawable.native.setMap(null);
345
352
  }
@@ -12,6 +12,14 @@ export interface DrawableOptions {
12
12
  * 이벤트 목록
13
13
  */
14
14
  event?: Map<keyof DocumentEventMap, (e: Event) => boolean | void>;
15
+ /**
16
+ * 디버그
17
+ */
18
+ debug?: boolean;
19
+ /**
20
+ * 디버그상의 label
21
+ */
22
+ debugLabel?: string;
15
23
  }
16
24
  export declare abstract class Drawable {
17
25
  /**
@@ -68,6 +68,10 @@ export interface MintMapProps extends MintMapEvents {
68
68
  * 맵 로딩화면
69
69
  */
70
70
  mapLoadingComponent?: () => JSX.Element;
71
+ /**
72
+ * 디버그
73
+ */
74
+ debug?: boolean;
71
75
  }
72
76
  /**
73
77
  * 지도의 기본 설정