@opengeoweb/webmap 2.2.0 → 2.4.0

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.
package/index.esm.js CHANGED
@@ -3575,6 +3575,7 @@ var MapPin = /*#__PURE__*/function () {
3575
3575
  this.geoPosX = null;
3576
3576
  this.geoPosY = null;
3577
3577
  this.displayMapPin = true;
3578
+ this.disableMapPin = false;
3578
3579
 
3579
3580
  this.redrawMap = function () {
3580
3581
  _this._map.draw();
@@ -3595,6 +3596,8 @@ var MapPin = /*#__PURE__*/function () {
3595
3596
  var x = _x;
3596
3597
  var y = _y;
3597
3598
  if (!x || !y) return;
3599
+ if (_this.disableMapPin && !_bbox) return; // we still want to update the pin position when the bbox changes.
3600
+
3598
3601
  _this.x = parseInt(x, 10);
3599
3602
  _this.y = parseInt(y, 10);
3600
3603
  _this.exactX = parseFloat(x);
@@ -3619,6 +3622,12 @@ var MapPin = /*#__PURE__*/function () {
3619
3622
  _this.setMapPin(newpos.x, newpos.y);
3620
3623
  };
3621
3624
 
3625
+ this.toggleDisableMapPin = function () {
3626
+ _this.disableMapPin = !_this.disableMapPin;
3627
+
3628
+ _this.redrawMap();
3629
+ };
3630
+
3622
3631
  this.showMapPin = function () {
3623
3632
  _this.displayMapPin = true;
3624
3633
 
@@ -3638,7 +3647,7 @@ var MapPin = /*#__PURE__*/function () {
3638
3647
  key: "drawMarker",
3639
3648
  value: function drawMarker(ctx) {
3640
3649
  if (isDefined(this.x) && isDefined(this.y)) {
3641
- WMDrawMarker(ctx, this.x, this.y, '#051039');
3650
+ WMDrawMarker(ctx, this.x, this.y, this.disableMapPin ? '#808080' : '#051039');
3642
3651
  }
3643
3652
  }
3644
3653
  }]);
@@ -5203,7 +5212,6 @@ var WMJSMap = /*#__PURE__*/function () {
5203
5212
  this.mainElement.style.width = "".concat(this.width, "px");
5204
5213
  this.mainElement.style.height = "".concat(this.height, "px");
5205
5214
  this.setBBOX(this.resizeBBOX);
5206
- this.mapPin.repositionMapPin();
5207
5215
  this.showBoundingBox();
5208
5216
  this.divBuffer.resize(this.getWidth().toString(), this.getHeight().toString());
5209
5217
  this.repositionLegendGraphic();
@@ -6800,6 +6808,7 @@ var WMJSMap = /*#__PURE__*/function () {
6800
6808
 
6801
6809
  this.updateBBOX.setBBOX(this.bbox);
6802
6810
  this.drawnBBOX.setBBOX(this.bbox);
6811
+ this.mapPin.repositionMapPin(this.bbox);
6803
6812
  /* Undo part */
6804
6813
 
6805
6814
  if (this.DoRedo === 0 && this.DoUndo === 0) {
package/index.umd.js CHANGED
@@ -3620,6 +3620,7 @@
3620
3620
  this.geoPosX = null;
3621
3621
  this.geoPosY = null;
3622
3622
  this.displayMapPin = true;
3623
+ this.disableMapPin = false;
3623
3624
 
3624
3625
  this.redrawMap = function () {
3625
3626
  _this._map.draw();
@@ -3640,6 +3641,8 @@
3640
3641
  var x = _x;
3641
3642
  var y = _y;
3642
3643
  if (!x || !y) return;
3644
+ if (_this.disableMapPin && !_bbox) return; // we still want to update the pin position when the bbox changes.
3645
+
3643
3646
  _this.x = parseInt(x, 10);
3644
3647
  _this.y = parseInt(y, 10);
3645
3648
  _this.exactX = parseFloat(x);
@@ -3664,6 +3667,12 @@
3664
3667
  _this.setMapPin(newpos.x, newpos.y);
3665
3668
  };
3666
3669
 
3670
+ this.toggleDisableMapPin = function () {
3671
+ _this.disableMapPin = !_this.disableMapPin;
3672
+
3673
+ _this.redrawMap();
3674
+ };
3675
+
3667
3676
  this.showMapPin = function () {
3668
3677
  _this.displayMapPin = true;
3669
3678
 
@@ -3681,7 +3690,7 @@
3681
3690
 
3682
3691
  MapPin.prototype.drawMarker = function (ctx) {
3683
3692
  if (isDefined(this.x) && isDefined(this.y)) {
3684
- WMDrawMarker(ctx, this.x, this.y, '#051039');
3693
+ WMDrawMarker(ctx, this.x, this.y, this.disableMapPin ? '#808080' : '#051039');
3685
3694
  }
3686
3695
  };
3687
3696
 
@@ -5211,7 +5220,6 @@
5211
5220
  this.mainElement.style.width = this.width + "px";
5212
5221
  this.mainElement.style.height = this.height + "px";
5213
5222
  this.setBBOX(this.resizeBBOX);
5214
- this.mapPin.repositionMapPin();
5215
5223
  this.showBoundingBox();
5216
5224
  this.divBuffer.resize(this.getWidth().toString(), this.getHeight().toString());
5217
5225
  this.repositionLegendGraphic();
@@ -6749,6 +6757,7 @@
6749
6757
 
6750
6758
  this.updateBBOX.setBBOX(this.bbox);
6751
6759
  this.drawnBBOX.setBBOX(this.bbox);
6760
+ this.mapPin.repositionMapPin(this.bbox);
6752
6761
  /* Undo part */
6753
6762
 
6754
6763
  if (this.DoRedo === 0 && this.DoUndo === 0) {
@@ -9,15 +9,17 @@ declare class MapPin {
9
9
  private geoPosX;
10
10
  private geoPosY;
11
11
  displayMapPin: boolean;
12
+ disableMapPin: boolean;
12
13
  constructor(_map: WMJSMap);
13
14
  redrawMap: () => void;
14
15
  drawMarker(ctx: CanvasRenderingContext2D): void;
15
- repositionMapPin: (_bbox?: WMBBOX) => void;
16
+ repositionMapPin: (_bbox: WMBBOX) => void;
16
17
  setMapPin: (_x: number, _y: number, _bbox?: WMBBOX) => void;
17
18
  positionMapPinByLatLon: (coord: {
18
19
  x: number;
19
20
  y: number;
20
21
  }) => void;
22
+ toggleDisableMapPin: () => void;
21
23
  showMapPin: () => void;
22
24
  hideMapPin: () => void;
23
25
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@opengeoweb/webmap",
3
- "version": "2.2.0",
3
+ "version": "2.4.0",
4
4
  "description": "GeoWeb webmap library for the opengeoweb project",
5
5
  "license": "Apache-2.0",
6
6
  "repository": {