@mint-ui/map 0.1.4-beta → 0.1.6-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.
@@ -26,7 +26,13 @@ export declare class Position {
26
26
  export declare class Bounds {
27
27
  nw: Position;
28
28
  se: Position;
29
- constructor(nw: Position, se: Position);
29
+ ne: Position;
30
+ sw: Position;
31
+ constructor(nw?: Position, se?: Position, ne?: Position, sw?: Position);
32
+ static fromNWSE(nw: Position, se: Position): Bounds;
33
+ static fromNESW(ne: Position, sw: Position): Bounds;
34
+ private covertNWSEtoNESW;
35
+ private covertNESWtoNWSE;
30
36
  getCenter(): Position;
31
37
  includes(positions: Position[]): boolean;
32
38
  includesOnlyOnePoint(positions: Position[]): boolean;
@@ -29,11 +29,41 @@ var Position = function () {
29
29
  }();
30
30
 
31
31
  var Bounds = function () {
32
- function Bounds(nw, se) {
32
+ function Bounds(nw, se, ne, sw) {
33
+ if (!(nw && se || ne && sw)) {
34
+ throw new Error('nw/se or ne/sw needed');
35
+ }
36
+
33
37
  this.nw = nw;
34
38
  this.se = se;
39
+ this.ne = ne;
40
+ this.sw = sw;
41
+
42
+ if (nw && se) {
43
+ this.covertNWSEtoNESW(nw, se);
44
+ } else if (ne && sw) {
45
+ this.covertNESWtoNWSE(ne, sw);
46
+ }
35
47
  }
36
48
 
49
+ Bounds.fromNWSE = function (nw, se) {
50
+ return new Bounds(nw, se, undefined, undefined);
51
+ };
52
+
53
+ Bounds.fromNESW = function (ne, sw) {
54
+ return new Bounds(undefined, undefined, ne, sw);
55
+ };
56
+
57
+ Bounds.prototype.covertNWSEtoNESW = function (nw, se) {
58
+ this.ne = new Position(nw.lat, se.lng);
59
+ this.sw = new Position(se.lat, nw.lng);
60
+ };
61
+
62
+ Bounds.prototype.covertNESWtoNWSE = function (ne, sw) {
63
+ this.nw = new Position(ne.lat, sw.lng);
64
+ this.se = new Position(sw.lat, ne.lng);
65
+ };
66
+
37
67
  Bounds.prototype.getCenter = function () {
38
68
  return new Position(this.nw.lat + (this.se.lat - this.nw.lat) / 2, this.nw.lng + (this.se.lng - this.nw.lng) / 2);
39
69
  };
@@ -44,9 +44,11 @@ function MapMarkerWrapper(_a) {
44
44
  }
45
45
  }, [movingState]);
46
46
  React.useEffect(function () {
47
- setMovingState(tslib.__assign(tslib.__assign({}, movingAnimation), {
48
- marker: markerRef.current
49
- }));
47
+ if (movingAnimation) {
48
+ setMovingState(tslib.__assign(tslib.__assign({}, movingAnimation), {
49
+ marker: markerRef.current
50
+ }));
51
+ }
50
52
  }, [movingAnimation]);
51
53
  var start = MarkerMovingHook.useMarkerMoving(movingState)[0];
52
54
 
@@ -396,7 +396,7 @@ var GoogleMintMapController = function (_super) {
396
396
  };
397
397
 
398
398
  GoogleMintMapController.prototype.fromGoogleBounds = function (bounds) {
399
- return new MintMap.Bounds(new MintMap.Position(bounds.getSouthWest().lat(), bounds.getSouthWest().lng()), new MintMap.Position(bounds.getNorthEast().lat(), bounds.getNorthEast().lng()));
399
+ return MintMap.Bounds.fromNESW(new MintMap.Position(bounds.getNorthEast().lat(), bounds.getNorthEast().lng()), new MintMap.Position(bounds.getSouthWest().lat(), bounds.getSouthWest().lng()));
400
400
  };
401
401
 
402
402
  GoogleMintMapController.prototype.getCurrBounds = function () {
@@ -404,7 +404,7 @@ var NaverMintMapController = function (_super) {
404
404
  }
405
405
 
406
406
  var bounds = this.map.getBounds();
407
- return new MintMap.Bounds(new MintMap.Position(bounds.getMin().y, bounds.getMin().x), new MintMap.Position(bounds.getMax().y, bounds.getMax().x));
407
+ return MintMap.Bounds.fromNWSE(new MintMap.Position(bounds.getMin().y, bounds.getMin().x), new MintMap.Position(bounds.getMax().y, bounds.getMax().x));
408
408
  };
409
409
 
410
410
  NaverMintMapController.prototype.panningTo = function (targetCenter) {
package/dist/index.es.js CHANGED
@@ -718,7 +718,7 @@ var NaverMintMapController = function (_super) {
718
718
  }
719
719
 
720
720
  var bounds = this.map.getBounds();
721
- return new Bounds(new Position(bounds.getMin().y, bounds.getMin().x), new Position(bounds.getMax().y, bounds.getMax().x));
721
+ return Bounds.fromNWSE(new Position(bounds.getMin().y, bounds.getMin().x), new Position(bounds.getMax().y, bounds.getMax().x));
722
722
  };
723
723
 
724
724
  NaverMintMapController.prototype.panningTo = function (targetCenter) {
@@ -1127,7 +1127,7 @@ var GoogleMintMapController = function (_super) {
1127
1127
  };
1128
1128
 
1129
1129
  GoogleMintMapController.prototype.fromGoogleBounds = function (bounds) {
1130
- return new Bounds(new Position(bounds.getSouthWest().lat(), bounds.getSouthWest().lng()), new Position(bounds.getNorthEast().lat(), bounds.getNorthEast().lng()));
1130
+ return Bounds.fromNESW(new Position(bounds.getNorthEast().lat(), bounds.getNorthEast().lng()), new Position(bounds.getSouthWest().lat(), bounds.getSouthWest().lng()));
1131
1131
  };
1132
1132
 
1133
1133
  GoogleMintMapController.prototype.getCurrBounds = function () {
@@ -1171,11 +1171,41 @@ var Position = function () {
1171
1171
  }();
1172
1172
 
1173
1173
  var Bounds = function () {
1174
- function Bounds(nw, se) {
1174
+ function Bounds(nw, se, ne, sw) {
1175
+ if (!(nw && se || ne && sw)) {
1176
+ throw new Error('nw/se or ne/sw needed');
1177
+ }
1178
+
1175
1179
  this.nw = nw;
1176
1180
  this.se = se;
1181
+ this.ne = ne;
1182
+ this.sw = sw;
1183
+
1184
+ if (nw && se) {
1185
+ this.covertNWSEtoNESW(nw, se);
1186
+ } else if (ne && sw) {
1187
+ this.covertNESWtoNWSE(ne, sw);
1188
+ }
1177
1189
  }
1178
1190
 
1191
+ Bounds.fromNWSE = function (nw, se) {
1192
+ return new Bounds(nw, se, undefined, undefined);
1193
+ };
1194
+
1195
+ Bounds.fromNESW = function (ne, sw) {
1196
+ return new Bounds(undefined, undefined, ne, sw);
1197
+ };
1198
+
1199
+ Bounds.prototype.covertNWSEtoNESW = function (nw, se) {
1200
+ this.ne = new Position(nw.lat, se.lng);
1201
+ this.sw = new Position(se.lat, nw.lng);
1202
+ };
1203
+
1204
+ Bounds.prototype.covertNESWtoNWSE = function (ne, sw) {
1205
+ this.nw = new Position(ne.lat, sw.lng);
1206
+ this.se = new Position(sw.lat, ne.lng);
1207
+ };
1208
+
1179
1209
  Bounds.prototype.getCenter = function () {
1180
1210
  return new Position(this.nw.lat + (this.se.lat - this.nw.lat) / 2, this.nw.lng + (this.se.lng - this.nw.lng) / 2);
1181
1211
  };
@@ -1593,9 +1623,11 @@ function MapMarkerWrapper(_a) {
1593
1623
  }
1594
1624
  }, [movingState]);
1595
1625
  useEffect(function () {
1596
- setMovingState(__assign(__assign({}, movingAnimation), {
1597
- marker: markerRef.current
1598
- }));
1626
+ if (movingAnimation) {
1627
+ setMovingState(__assign(__assign({}, movingAnimation), {
1628
+ marker: markerRef.current
1629
+ }));
1630
+ }
1599
1631
  }, [movingAnimation]);
1600
1632
  var start = useMarkerMoving(movingState)[0];
1601
1633
 
package/dist/index.umd.js CHANGED
@@ -724,7 +724,7 @@
724
724
  }
725
725
 
726
726
  var bounds = this.map.getBounds();
727
- return new Bounds(new Position(bounds.getMin().y, bounds.getMin().x), new Position(bounds.getMax().y, bounds.getMax().x));
727
+ return Bounds.fromNWSE(new Position(bounds.getMin().y, bounds.getMin().x), new Position(bounds.getMax().y, bounds.getMax().x));
728
728
  };
729
729
 
730
730
  NaverMintMapController.prototype.panningTo = function (targetCenter) {
@@ -1133,7 +1133,7 @@
1133
1133
  };
1134
1134
 
1135
1135
  GoogleMintMapController.prototype.fromGoogleBounds = function (bounds) {
1136
- return new Bounds(new Position(bounds.getSouthWest().lat(), bounds.getSouthWest().lng()), new Position(bounds.getNorthEast().lat(), bounds.getNorthEast().lng()));
1136
+ return Bounds.fromNESW(new Position(bounds.getNorthEast().lat(), bounds.getNorthEast().lng()), new Position(bounds.getSouthWest().lat(), bounds.getSouthWest().lng()));
1137
1137
  };
1138
1138
 
1139
1139
  GoogleMintMapController.prototype.getCurrBounds = function () {
@@ -1177,11 +1177,41 @@
1177
1177
  }();
1178
1178
 
1179
1179
  var Bounds = function () {
1180
- function Bounds(nw, se) {
1180
+ function Bounds(nw, se, ne, sw) {
1181
+ if (!(nw && se || ne && sw)) {
1182
+ throw new Error('nw/se or ne/sw needed');
1183
+ }
1184
+
1181
1185
  this.nw = nw;
1182
1186
  this.se = se;
1187
+ this.ne = ne;
1188
+ this.sw = sw;
1189
+
1190
+ if (nw && se) {
1191
+ this.covertNWSEtoNESW(nw, se);
1192
+ } else if (ne && sw) {
1193
+ this.covertNESWtoNWSE(ne, sw);
1194
+ }
1183
1195
  }
1184
1196
 
1197
+ Bounds.fromNWSE = function (nw, se) {
1198
+ return new Bounds(nw, se, undefined, undefined);
1199
+ };
1200
+
1201
+ Bounds.fromNESW = function (ne, sw) {
1202
+ return new Bounds(undefined, undefined, ne, sw);
1203
+ };
1204
+
1205
+ Bounds.prototype.covertNWSEtoNESW = function (nw, se) {
1206
+ this.ne = new Position(nw.lat, se.lng);
1207
+ this.sw = new Position(se.lat, nw.lng);
1208
+ };
1209
+
1210
+ Bounds.prototype.covertNESWtoNWSE = function (ne, sw) {
1211
+ this.nw = new Position(ne.lat, sw.lng);
1212
+ this.se = new Position(sw.lat, ne.lng);
1213
+ };
1214
+
1185
1215
  Bounds.prototype.getCenter = function () {
1186
1216
  return new Position(this.nw.lat + (this.se.lat - this.nw.lat) / 2, this.nw.lng + (this.se.lng - this.nw.lng) / 2);
1187
1217
  };
@@ -1599,9 +1629,11 @@
1599
1629
  }
1600
1630
  }, [movingState]);
1601
1631
  React.useEffect(function () {
1602
- setMovingState(tslib.__assign(tslib.__assign({}, movingAnimation), {
1603
- marker: markerRef.current
1604
- }));
1632
+ if (movingAnimation) {
1633
+ setMovingState(tslib.__assign(tslib.__assign({}, movingAnimation), {
1634
+ marker: markerRef.current
1635
+ }));
1636
+ }
1605
1637
  }, [movingAnimation]);
1606
1638
  var start = useMarkerMoving(movingState)[0];
1607
1639
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mint-ui/map",
3
- "version": "0.1.4-beta",
3
+ "version": "0.1.6-beta",
4
4
  "main": "./dist/index.js",
5
5
  "module": "./dist/index.es.js",
6
6
  "browser": "./dist/index.umd.js",