@abi-software/flatmap-viewer 2.5.8 → 2.5.9
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/README.rst +1 -1
- package/package.json +1 -1
- package/src/controls/annotation.js +11 -3
- package/src/interactions.js +16 -5
package/README.rst
CHANGED
|
@@ -38,7 +38,7 @@ The map server endpoint is specified as ``MAP_ENDPOINT`` in ``src/main.js``. It
|
|
|
38
38
|
Package Installation
|
|
39
39
|
====================
|
|
40
40
|
|
|
41
|
-
* ``npm install @abi-software/flatmap-viewer@2.5.
|
|
41
|
+
* ``npm install @abi-software/flatmap-viewer@2.5.9``
|
|
42
42
|
|
|
43
43
|
Documentation
|
|
44
44
|
-------------
|
package/package.json
CHANGED
|
@@ -78,6 +78,7 @@ export class AnnotationDrawControl
|
|
|
78
78
|
keybindings: true
|
|
79
79
|
})
|
|
80
80
|
this.__map = null
|
|
81
|
+
this.__inDrawing = false
|
|
81
82
|
}
|
|
82
83
|
|
|
83
84
|
onAdd(map)
|
|
@@ -96,7 +97,7 @@ export class AnnotationDrawControl
|
|
|
96
97
|
e.preventDefault();
|
|
97
98
|
}
|
|
98
99
|
}, false)
|
|
99
|
-
map.on('draw.modechange', this.
|
|
100
|
+
map.on('draw.modechange', this.modeChangedEvent.bind(this))
|
|
100
101
|
map.on('draw.create', this.createdFeature.bind(this))
|
|
101
102
|
map.on('draw.delete', this.deletedFeature.bind(this))
|
|
102
103
|
map.on('draw.update', this.updatedFeature.bind(this))
|
|
@@ -197,13 +198,20 @@ export class AnnotationDrawControl
|
|
|
197
198
|
}
|
|
198
199
|
}
|
|
199
200
|
|
|
200
|
-
|
|
201
|
-
|
|
201
|
+
modeChangedEvent(event)
|
|
202
|
+
//=====================
|
|
202
203
|
{
|
|
203
204
|
// Used as a flag to indicate the feature mode
|
|
205
|
+
this.__inDrawing = (event.mode.startsWith('draw'))
|
|
204
206
|
this.#sendEvent('modeChanged', event)
|
|
205
207
|
}
|
|
206
208
|
|
|
209
|
+
inDrawingMode()
|
|
210
|
+
//=============
|
|
211
|
+
{
|
|
212
|
+
return this.__inDrawing
|
|
213
|
+
}
|
|
214
|
+
|
|
207
215
|
commitEvent(event)
|
|
208
216
|
//================
|
|
209
217
|
{
|
package/src/interactions.js
CHANGED
|
@@ -333,6 +333,14 @@ export class UserInteractions
|
|
|
333
333
|
}
|
|
334
334
|
}
|
|
335
335
|
|
|
336
|
+
inDrawingAnnotationMode()
|
|
337
|
+
//=======================
|
|
338
|
+
{
|
|
339
|
+
if (this.#annotationDrawControl) {
|
|
340
|
+
return this.#annotationDrawControl.inDrawingMode()
|
|
341
|
+
}
|
|
342
|
+
}
|
|
343
|
+
|
|
336
344
|
commitAnnotationEvent(event)
|
|
337
345
|
//==========================
|
|
338
346
|
{
|
|
@@ -1185,22 +1193,25 @@ export class UserInteractions
|
|
|
1185
1193
|
this.unselectFeatures();
|
|
1186
1194
|
return;
|
|
1187
1195
|
}
|
|
1188
|
-
const
|
|
1189
|
-
const clickedDrawnFeature = clickedFeatures.filter((f)
|
|
1196
|
+
const inDrawing = this.inDrawingAnnotationMode()
|
|
1197
|
+
const clickedDrawnFeature = clickedFeatures.filter((f) => !f.id)[0];
|
|
1198
|
+
const clickedFeature = clickedFeatures.filter((f) => f.id)[0];
|
|
1190
1199
|
this.selectionEvent_(event.originalEvent, clickedFeature);
|
|
1191
1200
|
if (this._modal) {
|
|
1192
1201
|
// Remove tooltip, reset active features, etc
|
|
1193
1202
|
this.__resetFeatureDisplay();
|
|
1194
1203
|
this.unselectFeatures();
|
|
1195
1204
|
this.__clearModal();
|
|
1196
|
-
} else if (
|
|
1205
|
+
} else if (clickedDrawnFeature && !inDrawing) {
|
|
1206
|
+
// When feature and drawn feature are coinciding, click on annotation layer by default
|
|
1207
|
+
// While in drawing, DISABLE 'click' event on annotation layer
|
|
1208
|
+
this.__featureEvent('click', clickedDrawnFeature);
|
|
1209
|
+
} else if (clickedFeature) {
|
|
1197
1210
|
this.__lastClickLngLat = event.lngLat;
|
|
1198
1211
|
this.__featureEvent('click', clickedFeature);
|
|
1199
1212
|
if ('properties' in clickedFeature && 'hyperlink' in clickedFeature.properties) {
|
|
1200
1213
|
window.open(clickedFeature.properties.hyperlink, '_blank');
|
|
1201
1214
|
}
|
|
1202
|
-
} else if (clickedDrawnFeature !== undefined) {
|
|
1203
|
-
this.__featureEvent('click', clickedDrawnFeature);
|
|
1204
1215
|
}
|
|
1205
1216
|
}
|
|
1206
1217
|
|