@mint-ui/map 0.5.6-beta → 0.5.7-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
 
@@ -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
 
@@ -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 }; }
@@ -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
  * 지도의 기본 설정