@syncfusion/ej2-maps 20.3.49 → 20.3.56
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/CHANGELOG.md +12 -1
- package/dist/ej2-maps.min.js +2 -2
- package/dist/ej2-maps.umd.min.js +2 -2
- package/dist/ej2-maps.umd.min.js.map +1 -1
- package/dist/es6/ej2-maps.es2015.js +226 -170
- package/dist/es6/ej2-maps.es2015.js.map +1 -1
- package/dist/es6/ej2-maps.es5.js +226 -170
- package/dist/es6/ej2-maps.es5.js.map +1 -1
- package/dist/global/ej2-maps.min.js +2 -2
- package/dist/global/ej2-maps.min.js.map +1 -1
- package/dist/global/index.d.ts +1 -1
- package/package.json +13 -13
- package/src/maps/layers/data-label.js +8 -2
- package/src/maps/layers/layer-panel.js +21 -19
- package/src/maps/layers/legend.js +11 -6
- package/src/maps/layers/marker.js +11 -10
- package/src/maps/layers/navigation-selected-line.js +40 -42
- package/src/maps/maps.d.ts +2 -0
- package/src/maps/maps.js +41 -38
- package/src/maps/model/base.js +1 -1
- package/src/maps/user-interaction/annotation.js +2 -1
- package/src/maps/user-interaction/highlight.js +34 -11
- package/src/maps/user-interaction/tooltip.js +3 -3
- package/src/maps/user-interaction/zoom.js +33 -23
- package/src/maps/utils/helper.js +21 -15
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { itemHighlight } from '../index';
|
|
1
|
+
import { itemHighlight, shapeHighlight } from '../index';
|
|
2
2
|
import { Browser, isNullOrUndefined } from '@syncfusion/ej2-base';
|
|
3
3
|
import { getElementsByClassName, getElement, removeClass, createStyle, customizeStyle, getTargetElement } from '../utils/helper';
|
|
4
4
|
/**
|
|
@@ -158,16 +158,34 @@ var Highlight = /** @class */ (function () {
|
|
|
158
158
|
var marker = parseInt(targetEle.id.split('_MarkerIndex_')[1].split('_')[0], 10);
|
|
159
159
|
isMarkerSelect = this.maps.layers[layerIndex].markerSettings[marker].highlightSettings.enable;
|
|
160
160
|
}
|
|
161
|
-
var
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
opacity: this.highlightSettings.border.opacity
|
|
165
|
-
};
|
|
161
|
+
var borderColor = (targetEle.parentElement.id.indexOf('LineString') === -1) ? this.highlightSettings.border.color : (this.highlightSettings.fill || this.highlightSettings.border.color);
|
|
162
|
+
var borderWidth = (targetEle.parentElement.id.indexOf('LineString') === -1) ? (this.highlightSettings.border.width / (isMarkerSelect ? 1 : this.maps.scale)) : (this.highlightSettings.border.width / this.maps.scale);
|
|
163
|
+
var borderOpacity = isNullOrUndefined(this.highlightSettings.border.opacity) ? this.highlightSettings.opacity : this.highlightSettings.border.opacity;
|
|
166
164
|
var eventArgs = {
|
|
167
165
|
opacity: this.highlightSettings.opacity,
|
|
168
166
|
fill: (targetEle.parentElement.id.indexOf('LineString') === -1) ? (targetEle.id.indexOf('NavigationIndex') === -1 ? !isNullOrUndefined(this.highlightSettings.fill)
|
|
169
167
|
? this.highlightSettings.fill : targetEle.getAttribute('fill') : 'none') : 'transparent',
|
|
170
|
-
border:
|
|
168
|
+
border: { color: borderColor, width: borderWidth, opacity: borderOpacity },
|
|
169
|
+
cancel: false
|
|
170
|
+
};
|
|
171
|
+
var shapeEventArgs = {
|
|
172
|
+
opacity: eventArgs.opacity,
|
|
173
|
+
fill: eventArgs.fill,
|
|
174
|
+
border: { color: borderColor, width: borderWidth, opacity: borderOpacity },
|
|
175
|
+
name: shapeHighlight,
|
|
176
|
+
target: targetEle.id,
|
|
177
|
+
cancel: false,
|
|
178
|
+
shapeData: shapeData,
|
|
179
|
+
data: data,
|
|
180
|
+
maps: this.maps
|
|
181
|
+
};
|
|
182
|
+
if (targetEle.id.indexOf('shapeIndex') > -1) {
|
|
183
|
+
this.maps.trigger(shapeHighlight, shapeEventArgs, function () { });
|
|
184
|
+
}
|
|
185
|
+
var itemEventArgs = {
|
|
186
|
+
opacity: eventArgs.opacity,
|
|
187
|
+
fill: eventArgs.fill,
|
|
188
|
+
border: { color: borderColor, width: borderWidth, opacity: borderOpacity },
|
|
171
189
|
name: itemHighlight,
|
|
172
190
|
target: targetEle.id,
|
|
173
191
|
cancel: false,
|
|
@@ -175,15 +193,20 @@ var Highlight = /** @class */ (function () {
|
|
|
175
193
|
data: data,
|
|
176
194
|
maps: this.maps
|
|
177
195
|
};
|
|
178
|
-
this.maps.trigger(itemHighlight,
|
|
179
|
-
eventArgs.
|
|
180
|
-
|
|
196
|
+
this.maps.trigger(itemHighlight, itemEventArgs, function () {
|
|
197
|
+
itemEventArgs.cancel = eventArgs.cancel !== itemEventArgs.cancel ? itemEventArgs.cancel : targetEle.id.indexOf('shapeIndex') > -1 ? shapeEventArgs.cancel : eventArgs.cancel;
|
|
198
|
+
itemEventArgs.fill = eventArgs.fill !== itemEventArgs.fill ? itemEventArgs.fill : targetEle.id.indexOf('shapeIndex') > -1 ? shapeEventArgs.fill : eventArgs.fill;
|
|
199
|
+
itemEventArgs.opacity = eventArgs.opacity !== itemEventArgs.opacity ? itemEventArgs.opacity : targetEle.id.indexOf('shapeIndex') > -1 ? shapeEventArgs.opacity : eventArgs.opacity;
|
|
200
|
+
itemEventArgs.border.color = eventArgs.border.color !== itemEventArgs.border.color ? itemEventArgs.border.color : targetEle.id.indexOf('shapeIndex') > -1 ? shapeEventArgs.border.color : eventArgs.border.color;
|
|
201
|
+
itemEventArgs.border.width = eventArgs.border.width !== itemEventArgs.border.width ? itemEventArgs.border.width : targetEle.id.indexOf('shapeIndex') > -1 ? shapeEventArgs.border.width : eventArgs.border.width;
|
|
202
|
+
itemEventArgs.border.opacity = eventArgs.border.opacity !== itemEventArgs.border.opacity ? itemEventArgs.border.opacity : targetEle.id.indexOf('shapeIndex') > -1 ? shapeEventArgs.border.opacity : eventArgs.border.opacity;
|
|
203
|
+
_this.highlightMap(targetEle, itemEventArgs);
|
|
181
204
|
});
|
|
182
205
|
};
|
|
183
206
|
Highlight.prototype.highlightMap = function (targetEle, eventArgs) {
|
|
184
207
|
var parentElement;
|
|
185
208
|
var children;
|
|
186
|
-
if (targetEle.getAttribute('class') === 'highlightMapStyle') {
|
|
209
|
+
if (targetEle.getAttribute('class') === 'highlightMapStyle' || eventArgs.cancel) {
|
|
187
210
|
return;
|
|
188
211
|
}
|
|
189
212
|
else {
|
|
@@ -161,9 +161,9 @@ var MapsTooltip = /** @class */ (function () {
|
|
|
161
161
|
else {
|
|
162
162
|
tooltipEle = createElement('div', {
|
|
163
163
|
id: this.maps.element.id + '_mapsTooltip',
|
|
164
|
-
className: 'EJ2-maps-Tooltip'
|
|
165
|
-
styles: 'position: absolute;pointer-events:none;'
|
|
164
|
+
className: 'EJ2-maps-Tooltip'
|
|
166
165
|
});
|
|
166
|
+
tooltipEle.style.cssText = 'position: absolute;pointer-events:none;';
|
|
167
167
|
document.getElementById(this.maps.element.id + '_Secondary_Element').appendChild(tooltipEle);
|
|
168
168
|
}
|
|
169
169
|
if (option.template !== null && Object.keys(typeof option.template === 'object' ? option.template : {}).length === 1) {
|
|
@@ -241,7 +241,7 @@ var MapsTooltip = /** @class */ (function () {
|
|
|
241
241
|
&& tooltipTemplateElement.innerHTML.indexOf('</a>') !== -1) {
|
|
242
242
|
var templateStyle = tooltipTemplateElement.getAttribute('style');
|
|
243
243
|
templateStyle = templateStyle.replace('pointer-events: none;', 'position-events:all;');
|
|
244
|
-
tooltipTemplateElement.
|
|
244
|
+
tooltipTemplateElement.style.cssText = templateStyle;
|
|
245
245
|
}
|
|
246
246
|
}
|
|
247
247
|
else {
|
|
@@ -455,7 +455,7 @@ var Zoom = /** @class */ (function () {
|
|
|
455
455
|
}
|
|
456
456
|
else {
|
|
457
457
|
markerStyle = 'visibility:hidden';
|
|
458
|
-
currentEle.
|
|
458
|
+
currentEle.style.cssText = markerStyle;
|
|
459
459
|
}
|
|
460
460
|
}
|
|
461
461
|
}
|
|
@@ -573,22 +573,22 @@ var Zoom = /** @class */ (function () {
|
|
|
573
573
|
var layerIndex = parseInt((element ? element : layerElement).id.split('_LayerIndex_')[1].split('_')[0], 10);
|
|
574
574
|
var markerSVGObject = this.maps.renderer.createGroup({
|
|
575
575
|
id: this.maps.element.id + '_Markers_Group',
|
|
576
|
-
class: 'GroupElement'
|
|
577
|
-
style: 'pointer-events: auto;'
|
|
576
|
+
class: 'GroupElement'
|
|
578
577
|
});
|
|
578
|
+
markerSVGObject.style.pointerEvents = 'auto';
|
|
579
579
|
if (document.getElementById(markerSVGObject.id)) {
|
|
580
580
|
removeElement(markerSVGObject.id);
|
|
581
581
|
}
|
|
582
582
|
var mapsAreaRect = this.maps.mapAreaRect;
|
|
583
583
|
var markerTemplateElements = createElement('div', {
|
|
584
584
|
id: this.maps.element.id + '_LayerIndex_' + layerIndex + '_Markers_Template_Group',
|
|
585
|
-
className: 'template'
|
|
586
|
-
styles: 'overflow: hidden; position: absolute;pointer-events: none;' +
|
|
587
|
-
'top:' + mapsAreaRect.y + 'px;' +
|
|
588
|
-
'left:' + mapsAreaRect.x + 'px;' +
|
|
589
|
-
'height:' + mapsAreaRect.height + 'px;' +
|
|
590
|
-
'width:' + mapsAreaRect.width + 'px;'
|
|
585
|
+
className: 'template'
|
|
591
586
|
});
|
|
587
|
+
markerTemplateElements.style.cssText = 'overflow: hidden; position: absolute;pointer-events: none;' +
|
|
588
|
+
'top:' + mapsAreaRect.y + 'px;' +
|
|
589
|
+
'left:' + mapsAreaRect.x + 'px;' +
|
|
590
|
+
'height:' + mapsAreaRect.height + 'px;' +
|
|
591
|
+
'width:' + mapsAreaRect.width + 'px;';
|
|
592
592
|
if (document.getElementById(markerTemplateElements.id)) {
|
|
593
593
|
removeElement(markerTemplateElements.id);
|
|
594
594
|
}
|
|
@@ -720,16 +720,26 @@ var Zoom = /** @class */ (function () {
|
|
|
720
720
|
var labelX = label['location']['x'];
|
|
721
721
|
var labelY = label['location']['y'];
|
|
722
722
|
if (type === 'Template') {
|
|
723
|
-
var
|
|
724
|
-
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
|
|
732
|
-
|
|
723
|
+
var locationX = 0;
|
|
724
|
+
var locationY = 0;
|
|
725
|
+
if (this.maps.isTileMap) {
|
|
726
|
+
zoomtext = label['dataLabelText'];
|
|
727
|
+
zoomtextSize = measureText(zoomtext, style);
|
|
728
|
+
locationX = ((labelX + x) * scale) - (zoomtextSize['width'] / 2);
|
|
729
|
+
locationY = ((labelY + y) * scale) - (zoomtextSize['height']);
|
|
730
|
+
}
|
|
731
|
+
else {
|
|
732
|
+
var layerEle = getElementByID(this.maps.element.id + '_Layer_Collections');
|
|
733
|
+
labelX = ((Math.abs(this.maps.baseMapRectBounds['min']['x'] - labelX)) * scale);
|
|
734
|
+
labelY = ((Math.abs(this.maps.baseMapRectBounds['min']['y'] - labelY)) * scale);
|
|
735
|
+
var templateOffset = element.getBoundingClientRect();
|
|
736
|
+
var layerOffset = layerEle.getBoundingClientRect();
|
|
737
|
+
var elementOffset = element.parentElement.getBoundingClientRect();
|
|
738
|
+
locationX = ((labelX) + (layerOffset.left - elementOffset.left));
|
|
739
|
+
locationY = ((labelY) + (layerOffset.top - elementOffset.top));
|
|
740
|
+
}
|
|
741
|
+
element.style.left = locationX + 'px';
|
|
742
|
+
element.style.top = locationY + 'px';
|
|
733
743
|
}
|
|
734
744
|
else {
|
|
735
745
|
labelX = ((labelX + x) * scale);
|
|
@@ -861,10 +871,10 @@ var Zoom = /** @class */ (function () {
|
|
|
861
871
|
if (element['style']['display'] !== 'none') {
|
|
862
872
|
if ((staticMapOffset['x'] > templateOffset['x'] || staticMapOffset['x'] + staticMapOffsetWidth < templateOffset['x'] + templateOffset['width'])
|
|
863
873
|
&& (staticMapOffset['y'] > templateOffset['y'] || staticMapOffset['y'] + staticMapOffset['height'] < templateOffset['y'] + templateOffset['height'])) {
|
|
864
|
-
element
|
|
874
|
+
element.style.display = 'none';
|
|
865
875
|
}
|
|
866
876
|
else if ((staticMapOffset['x'] > templateOffset['x'] || staticMapOffset['x'] + staticMapOffsetWidth < templateOffset['x'] + templateOffset['width'])) {
|
|
867
|
-
element
|
|
877
|
+
element.style.display = 'none';
|
|
868
878
|
}
|
|
869
879
|
}
|
|
870
880
|
}
|
|
@@ -1001,7 +1011,6 @@ var Zoom = /** @class */ (function () {
|
|
|
1001
1011
|
}
|
|
1002
1012
|
map.zoomTranslatePoint = map.translatePoint;
|
|
1003
1013
|
this.mouseDownPoints = this.mouseMovePoints;
|
|
1004
|
-
this.maps.zoomNotApplied = false;
|
|
1005
1014
|
this.isSingleClick = false;
|
|
1006
1015
|
};
|
|
1007
1016
|
Zoom.prototype.toAlignSublayer = function () {
|
|
@@ -1352,7 +1361,8 @@ var Zoom = /** @class */ (function () {
|
|
|
1352
1361
|
Zoom.prototype.alignToolBar = function () {
|
|
1353
1362
|
var map = this.maps;
|
|
1354
1363
|
var padding = 10;
|
|
1355
|
-
var element = createElement('div', { id: map.element.id + '_ToolBar'
|
|
1364
|
+
var element = createElement('div', { id: map.element.id + '_ToolBar' });
|
|
1365
|
+
element.style.cssText = 'position:absolute;z-index:2';
|
|
1356
1366
|
var rectSVGObject = map.renderer.createSvg({
|
|
1357
1367
|
id: map.element.id + '_Zooming_ToolBar', width: 10, height: 10
|
|
1358
1368
|
});
|
package/src/maps/utils/helper.js
CHANGED
|
@@ -684,9 +684,9 @@ export function renderTextElement(option, style, color, parent, isMinus) {
|
|
|
684
684
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
685
685
|
export function convertElement(element, markerId, data, index, mapObj) {
|
|
686
686
|
var childElement = createElement('div', {
|
|
687
|
-
id: markerId
|
|
688
|
-
styles: 'position: absolute;pointer-events: auto;'
|
|
687
|
+
id: markerId
|
|
689
688
|
});
|
|
689
|
+
childElement.style.cssText = 'position: absolute;pointer-events: auto;';
|
|
690
690
|
var elementLength = element.length;
|
|
691
691
|
while (elementLength > 0) {
|
|
692
692
|
childElement.appendChild(element[0]);
|
|
@@ -773,11 +773,12 @@ export function convertElementFromLabel(element, labelId, data, index, mapObj) {
|
|
|
773
773
|
// eslint-disable-next-line @typescript-eslint/ban-types
|
|
774
774
|
templateHtml = templateHtml.replace(new RegExp('{{:' + properties[i] + '}}', 'g'), data[properties[i].toString()]);
|
|
775
775
|
}
|
|
776
|
-
|
|
776
|
+
var templateEle = createElement('div', {
|
|
777
777
|
id: labelId,
|
|
778
|
-
innerHTML: templateHtml
|
|
779
|
-
styles: 'position: absolute'
|
|
778
|
+
innerHTML: templateHtml
|
|
780
779
|
});
|
|
780
|
+
templateEle.style.position = 'absolute';
|
|
781
|
+
return templateEle;
|
|
781
782
|
}
|
|
782
783
|
/**
|
|
783
784
|
*
|
|
@@ -2180,7 +2181,7 @@ export function getZoomTranslate(mapObject, layer, animate) {
|
|
|
2180
2181
|
mapObject.zoomSettings.zoomFactor ===
|
|
2181
2182
|
mapObject.mapScaleValue ? mapObject.zoomSettings.zoomFactor :
|
|
2182
2183
|
mapObject.zoomSettings.zoomFactor !== mapObject.mapScaleValue && !mapObject.centerPositionChanged ? mapObject.mapScaleValue : mapObject.zoomSettings.zoomFactor;
|
|
2183
|
-
if (mapObject.zoomSettings.shouldZoomInitially) {
|
|
2184
|
+
if (mapObject.zoomSettings.shouldZoomInitially && !mapObject.isZoomByPosition) {
|
|
2184
2185
|
mapObject.mapScaleValue = zoomFactorValue = scaleFactor = ((mapObject.enablePersistence || mapObject.zoomSettings.shouldZoomInitially) && mapObject.scale === 1)
|
|
2185
2186
|
? mapObject.scale : (isNullOrUndefined(mapObject.markerZoomFactor)) ? mapObject.mapScaleValue : mapObject.markerZoomFactor;
|
|
2186
2187
|
zoomFactorValue = mapObject.mapScaleValue;
|
|
@@ -2214,6 +2215,10 @@ export function getZoomTranslate(mapObject, layer, animate) {
|
|
|
2214
2215
|
y = -point.y + topPosition;
|
|
2215
2216
|
}
|
|
2216
2217
|
else {
|
|
2218
|
+
if (mapObject.isZoomByPosition) {
|
|
2219
|
+
mapObject.zoomTranslatePoint.x = -point.x + leftPosition;
|
|
2220
|
+
mapObject.zoomTranslatePoint.y = -point.y + topPosition;
|
|
2221
|
+
}
|
|
2217
2222
|
x = mapObject.zoomTranslatePoint.x;
|
|
2218
2223
|
y = mapObject.zoomTranslatePoint.y;
|
|
2219
2224
|
zoomFactorValue = zoomFactor;
|
|
@@ -2422,7 +2427,7 @@ export function triggerShapeEvent(targetId, selection, maps, eventName) {
|
|
|
2422
2427
|
target: targetId,
|
|
2423
2428
|
maps: maps
|
|
2424
2429
|
};
|
|
2425
|
-
maps.trigger(eventName, eventArgs, function (
|
|
2430
|
+
maps.trigger(eventName, eventArgs, function () {
|
|
2426
2431
|
eventArgs.border.opacity = isNullOrUndefined(eventArgs.border.opacity) ? eventArgs.opacity : eventArgs.border.opacity;
|
|
2427
2432
|
});
|
|
2428
2433
|
return eventArgs;
|
|
@@ -2651,11 +2656,11 @@ export function showTooltip(text, size, x, y, areaWidth, areaHeight, id, element
|
|
|
2651
2656
|
}
|
|
2652
2657
|
if (!tooltip) {
|
|
2653
2658
|
tooltip = createElement('div', {
|
|
2654
|
-
id: id
|
|
2655
|
-
styles: 'background-color: rgb(255, 255, 255) !important; color:black !important; ' +
|
|
2656
|
-
'position:absolute;border:1px solid rgb(0, 0, 0); padding-left:5px;' +
|
|
2657
|
-
'font-size:12px; font-family: "Segoe UI"; text-align:center'
|
|
2659
|
+
id: id
|
|
2658
2660
|
});
|
|
2661
|
+
tooltip.style.cssText = 'background-color: rgb(255, 255, 255) !important; color:black !important; ' +
|
|
2662
|
+
'position:absolute;border:1px solid rgb(0, 0, 0); padding-left:5px;' +
|
|
2663
|
+
'font-size:12px; font-family: "Segoe UI"; text-align:center';
|
|
2659
2664
|
}
|
|
2660
2665
|
if (x < (areaWidth - width)) {
|
|
2661
2666
|
// eslint-disable-next-line no-self-assign
|
|
@@ -2753,13 +2758,14 @@ export function createTooltip(id, text, top, left, fontSize) {
|
|
|
2753
2758
|
'position:absolute;border:1px solid #707070;font-size:' + fontSize + ';border-radius:2px;';
|
|
2754
2759
|
if (!tooltip) {
|
|
2755
2760
|
tooltip = createElement('div', {
|
|
2756
|
-
id: id, innerHTML: ' ' + text + ' '
|
|
2761
|
+
id: id, innerHTML: ' ' + text + ' '
|
|
2757
2762
|
});
|
|
2763
|
+
tooltip.style.cssText = style;
|
|
2758
2764
|
document.body.appendChild(tooltip);
|
|
2759
2765
|
}
|
|
2760
2766
|
else {
|
|
2761
|
-
tooltip.
|
|
2762
|
-
tooltip.
|
|
2767
|
+
tooltip.innerHTML = ' ' + text + ' ';
|
|
2768
|
+
tooltip.style.cssText = style;
|
|
2763
2769
|
}
|
|
2764
2770
|
}
|
|
2765
2771
|
/**
|
|
@@ -3157,7 +3163,7 @@ export function animate(element, delay, duration, process, end) {
|
|
|
3157
3163
|
end.call(_this, { element: element });
|
|
3158
3164
|
if (element.id.indexOf('Marker') > -1) {
|
|
3159
3165
|
var markerElement = getElementByID(element.id.split('_Layer')[0] + '_Markers_Group');
|
|
3160
|
-
markerElement.
|
|
3166
|
+
markerElement.style.cssText = markerStyle;
|
|
3161
3167
|
}
|
|
3162
3168
|
}
|
|
3163
3169
|
};
|