@opengeoweb/webmap 2.2.1 → 2.4.1
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 +28 -4
- package/index.umd.js +27 -3
- package/lib/components/WMFlyToBBox.d.ts +2 -0
- package/lib/components/WMMapPin.d.ts +3 -1
- package/package.json +1 -1
package/index.esm.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import moment from 'moment';
|
|
2
2
|
import proj4 from 'proj4';
|
|
3
|
-
import { debounce } from 'throttle-debounce';
|
|
3
|
+
import { debounce, throttle } from 'throttle-debounce';
|
|
4
4
|
|
|
5
5
|
function _typeof(obj) {
|
|
6
6
|
"@babel/helpers - typeof";
|
|
@@ -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
|
}]);
|
|
@@ -3804,6 +3813,8 @@ var buildWMSGetMapRequest = function buildWMSGetMapRequest(map, layer) {
|
|
|
3804
3813
|
|
|
3805
3814
|
var SCALE_DELAY = 10;
|
|
3806
3815
|
var ZOOMED_CALLBACK_DELAY = 500;
|
|
3816
|
+
var THROTTLE_WAIT_TIME = 300;
|
|
3817
|
+
var THROTTLE_NO_TRAILING = true;
|
|
3807
3818
|
|
|
3808
3819
|
var WMFlyToBBox = function WMFlyToBBox(wmMap) {
|
|
3809
3820
|
var _this = this;
|
|
@@ -3906,6 +3917,14 @@ var WMFlyToBBox = function WMFlyToBBox(wmMap) {
|
|
|
3906
3917
|
}
|
|
3907
3918
|
};
|
|
3908
3919
|
|
|
3920
|
+
this.startZoomThrottled = throttle(THROTTLE_WAIT_TIME, THROTTLE_NO_TRAILING, function (currentbox, newbox) {
|
|
3921
|
+
return _this.flyZoomToBBOXStartZoom(currentbox, newbox);
|
|
3922
|
+
});
|
|
3923
|
+
|
|
3924
|
+
this.flyZoomToBBOXStartZoomThrottled = function (currentbox, newbox) {
|
|
3925
|
+
_this.startZoomThrottled(currentbox, newbox);
|
|
3926
|
+
};
|
|
3927
|
+
|
|
3909
3928
|
this.wmMap = wmMap;
|
|
3910
3929
|
this.flyZoomToBBOXTimerFuncReadyDebounced = debounce(ZOOMED_CALLBACK_DELAY, this.flyZoomToBBOXTimerFuncReadyDebounced);
|
|
3911
3930
|
this.flyZoomToBBOXDebounced = debounce(SCALE_DELAY, this.flyZoomToBBOXTimerFunc);
|
|
@@ -5203,7 +5222,6 @@ var WMJSMap = /*#__PURE__*/function () {
|
|
|
5203
5222
|
this.mainElement.style.width = "".concat(this.width, "px");
|
|
5204
5223
|
this.mainElement.style.height = "".concat(this.height, "px");
|
|
5205
5224
|
this.setBBOX(this.resizeBBOX);
|
|
5206
|
-
this.mapPin.repositionMapPin();
|
|
5207
5225
|
this.showBoundingBox();
|
|
5208
5226
|
this.divBuffer.resize(this.getWidth().toString(), this.getHeight().toString());
|
|
5209
5227
|
this.repositionLegendGraphic();
|
|
@@ -5662,7 +5680,12 @@ var WMJSMap = /*#__PURE__*/function () {
|
|
|
5662
5680
|
this.mouseWheelEventBBOXNew.right = newRight;
|
|
5663
5681
|
this.mouseWheelEventBBOXNew.top = newTop;
|
|
5664
5682
|
this.mouseWheelBusy = 0;
|
|
5665
|
-
|
|
5683
|
+
|
|
5684
|
+
if (Math.abs(delta) < 4) {
|
|
5685
|
+
this.wMFlyToBBox.flyZoomToBBOXStartZoomThrottled(this.mouseWheelEventBBOXCurrent, this.mouseWheelEventBBOXNew);
|
|
5686
|
+
} else {
|
|
5687
|
+
this.wMFlyToBBox.flyZoomToBBOXStartZoom(this.mouseWheelEventBBOXCurrent, this.mouseWheelEventBBOXNew);
|
|
5688
|
+
}
|
|
5666
5689
|
}
|
|
5667
5690
|
}, {
|
|
5668
5691
|
key: "destroy",
|
|
@@ -6800,6 +6823,7 @@ var WMJSMap = /*#__PURE__*/function () {
|
|
|
6800
6823
|
|
|
6801
6824
|
this.updateBBOX.setBBOX(this.bbox);
|
|
6802
6825
|
this.drawnBBOX.setBBOX(this.bbox);
|
|
6826
|
+
this.mapPin.repositionMapPin(this.bbox);
|
|
6803
6827
|
/* Undo part */
|
|
6804
6828
|
|
|
6805
6829
|
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
|
|
|
@@ -3856,6 +3865,8 @@
|
|
|
3856
3865
|
* */
|
|
3857
3866
|
var SCALE_DELAY = 10;
|
|
3858
3867
|
var ZOOMED_CALLBACK_DELAY = 500;
|
|
3868
|
+
var THROTTLE_WAIT_TIME = 300;
|
|
3869
|
+
var THROTTLE_NO_TRAILING = true;
|
|
3859
3870
|
|
|
3860
3871
|
var WMFlyToBBox =
|
|
3861
3872
|
/** @class */
|
|
@@ -3959,6 +3970,14 @@
|
|
|
3959
3970
|
}
|
|
3960
3971
|
};
|
|
3961
3972
|
|
|
3973
|
+
this.startZoomThrottled = throttleDebounce.throttle(THROTTLE_WAIT_TIME, THROTTLE_NO_TRAILING, function (currentbox, newbox) {
|
|
3974
|
+
return _this.flyZoomToBBOXStartZoom(currentbox, newbox);
|
|
3975
|
+
});
|
|
3976
|
+
|
|
3977
|
+
this.flyZoomToBBOXStartZoomThrottled = function (currentbox, newbox) {
|
|
3978
|
+
_this.startZoomThrottled(currentbox, newbox);
|
|
3979
|
+
};
|
|
3980
|
+
|
|
3962
3981
|
this.wmMap = wmMap;
|
|
3963
3982
|
this.flyZoomToBBOXTimerFuncReadyDebounced = throttleDebounce.debounce(ZOOMED_CALLBACK_DELAY, this.flyZoomToBBOXTimerFuncReadyDebounced);
|
|
3964
3983
|
this.flyZoomToBBOXDebounced = throttleDebounce.debounce(SCALE_DELAY, this.flyZoomToBBOXTimerFunc);
|
|
@@ -5211,7 +5230,6 @@
|
|
|
5211
5230
|
this.mainElement.style.width = this.width + "px";
|
|
5212
5231
|
this.mainElement.style.height = this.height + "px";
|
|
5213
5232
|
this.setBBOX(this.resizeBBOX);
|
|
5214
|
-
this.mapPin.repositionMapPin();
|
|
5215
5233
|
this.showBoundingBox();
|
|
5216
5234
|
this.divBuffer.resize(this.getWidth().toString(), this.getHeight().toString());
|
|
5217
5235
|
this.repositionLegendGraphic();
|
|
@@ -5650,7 +5668,12 @@
|
|
|
5650
5668
|
this.mouseWheelEventBBOXNew.right = newRight;
|
|
5651
5669
|
this.mouseWheelEventBBOXNew.top = newTop;
|
|
5652
5670
|
this.mouseWheelBusy = 0;
|
|
5653
|
-
|
|
5671
|
+
|
|
5672
|
+
if (Math.abs(delta) < 4) {
|
|
5673
|
+
this.wMFlyToBBox.flyZoomToBBOXStartZoomThrottled(this.mouseWheelEventBBOXCurrent, this.mouseWheelEventBBOXNew);
|
|
5674
|
+
} else {
|
|
5675
|
+
this.wMFlyToBBox.flyZoomToBBOXStartZoom(this.mouseWheelEventBBOXCurrent, this.mouseWheelEventBBOXNew);
|
|
5676
|
+
}
|
|
5654
5677
|
};
|
|
5655
5678
|
|
|
5656
5679
|
WMJSMap.prototype.destroy = function () {
|
|
@@ -6749,6 +6772,7 @@
|
|
|
6749
6772
|
|
|
6750
6773
|
this.updateBBOX.setBBOX(this.bbox);
|
|
6751
6774
|
this.drawnBBOX.setBBOX(this.bbox);
|
|
6775
|
+
this.mapPin.repositionMapPin(this.bbox);
|
|
6752
6776
|
/* Undo part */
|
|
6753
6777
|
|
|
6754
6778
|
if (this.DoRedo === 0 && this.DoUndo === 0) {
|
|
@@ -19,4 +19,6 @@ export default class WMFlyToBBox {
|
|
|
19
19
|
resetBBoxTimer: () => void;
|
|
20
20
|
flyZoomToBBOXStop: () => void;
|
|
21
21
|
flyZoomToBBOXStartZoom: (currentbox: WMBBOX, newbox: WMBBOX) => void;
|
|
22
|
+
startZoomThrottled: any;
|
|
23
|
+
flyZoomToBBOXStartZoomThrottled: (currentbox: WMBBOX, newbox: WMBBOX) => void;
|
|
22
24
|
}
|
|
@@ -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
|
|
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
|
}
|