geojs 1.14.11 → 1.14.13
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/.github/workflows/commitlint.yml +1 -1
- package/.github/workflows/main.yml +5 -5
- package/geo.js +54 -15
- package/geo.lean.js +54 -15
- package/geo.lean.min.js +3 -3
- package/geo.min.js +4 -4
- package/package.json +1 -1
- package/src/annotationLayer.js +7 -3
- package/src/event.js +7 -1
- package/src/feature.js +0 -1
- package/src/pointFeature.js +0 -5
- package/src/svg/object.js +21 -0
- package/src/svg/svgRenderer.js +15 -2
package/package.json
CHANGED
package/src/annotationLayer.js
CHANGED
|
@@ -678,10 +678,12 @@ var annotationLayer = function (arg) {
|
|
|
678
678
|
* edited or used.
|
|
679
679
|
* @param {object} [options] Additional options to pass when creating an
|
|
680
680
|
* annotation.
|
|
681
|
+
* @param {string} [reason] An optional reason to pass to the
|
|
682
|
+
* `geo.event.annotation.mode` event.
|
|
681
683
|
* @returns {string|null|this} The current mode or the layer.
|
|
682
684
|
* @fires geo.event.annotation.mode
|
|
683
685
|
*/
|
|
684
|
-
this.mode = function (arg, editAnnotation, options) {
|
|
686
|
+
this.mode = function (arg, editAnnotation, options, reason) {
|
|
685
687
|
if (arg === undefined) {
|
|
686
688
|
return m_mode;
|
|
687
689
|
}
|
|
@@ -701,11 +703,13 @@ var annotationLayer = function (arg) {
|
|
|
701
703
|
m_keyHandler = Mousetrap(mapNode[0]);
|
|
702
704
|
}
|
|
703
705
|
if (m_mode) {
|
|
704
|
-
m_keyHandler.bind('esc', function () { m_this.mode(null); });
|
|
706
|
+
m_keyHandler.bind('esc', function () { m_this.mode(null, undefined, undefined, 'escape'); });
|
|
705
707
|
} else {
|
|
706
708
|
m_keyHandler.unbind('esc');
|
|
707
709
|
}
|
|
710
|
+
let oldState;
|
|
708
711
|
if (m_this.currentAnnotation) {
|
|
712
|
+
oldState = m_this.currentAnnotation.state();
|
|
709
713
|
switch (m_this.currentAnnotation.state()) {
|
|
710
714
|
case geo_annotation.state.create:
|
|
711
715
|
m_this.removeAnnotation(m_this.currentAnnotation);
|
|
@@ -754,7 +758,7 @@ var annotationLayer = function (arg) {
|
|
|
754
758
|
});
|
|
755
759
|
}
|
|
756
760
|
m_this.geoTrigger(geo_event.annotation.mode, {
|
|
757
|
-
mode: m_mode, oldMode: oldMode});
|
|
761
|
+
mode: m_mode, oldMode: oldMode, oldState: oldState, reason: reason});
|
|
758
762
|
if (oldMode === m_this.modes.edit || oldMode === m_this.modes.cursor) {
|
|
759
763
|
m_this.modified();
|
|
760
764
|
}
|
package/src/event.js
CHANGED
|
@@ -746,9 +746,15 @@ geo_event.annotation.state = 'geo_annotation_state';
|
|
|
746
746
|
* @event geo.event.annotation.mode
|
|
747
747
|
* @type {geo.event.base}
|
|
748
748
|
* @property {string?} mode The new annotation mode. This is one of the values
|
|
749
|
-
* from {@link geo.
|
|
749
|
+
* from {@link geo.annotationLayer.mode} or an annotation name.
|
|
750
750
|
* @property {string?} oldMode The annotation mode before this change. This is
|
|
751
|
+
* one of the values from {@link geo.annotationLayer.mode} or an
|
|
752
|
+
* annotation name.
|
|
753
|
+
* @property {string?} oldState If there was an active annotation before the
|
|
754
|
+
* mode change, this is the annotation state before the change. This is
|
|
751
755
|
* one of the values from {@link geo.annotation.state}.
|
|
756
|
+
* @property {string?} reason An optional string that was passed to the mode
|
|
757
|
+
* change method.
|
|
752
758
|
*/
|
|
753
759
|
geo_event.annotation.mode = 'geo_annotation_mode';
|
|
754
760
|
|
package/src/feature.js
CHANGED
package/src/pointFeature.js
CHANGED
|
@@ -204,11 +204,6 @@ var pointFeature = function (arg) {
|
|
|
204
204
|
// mark the datum as a cluster for accessor methods
|
|
205
205
|
d.__cluster = true;
|
|
206
206
|
|
|
207
|
-
// store all of the data objects for each point in the cluster as __data
|
|
208
|
-
d.__data = new Array(d.obj.length);
|
|
209
|
-
for (let idx = 0; idx < d.obj.length; idx += 1) {
|
|
210
|
-
d.__data[idx] = m_allData[d.obj[idx].index];
|
|
211
|
-
}
|
|
212
207
|
data[didx] = d;
|
|
213
208
|
}
|
|
214
209
|
|
package/src/svg/object.js
CHANGED
|
@@ -23,6 +23,7 @@ var svg_object = function (arg) {
|
|
|
23
23
|
var m_id = 'svg-' + uniqueID(),
|
|
24
24
|
s_exit = this._exit,
|
|
25
25
|
m_this = this,
|
|
26
|
+
s_visible = this.visible,
|
|
26
27
|
s_draw = this.draw;
|
|
27
28
|
|
|
28
29
|
this._svgid = function () {
|
|
@@ -59,6 +60,26 @@ var svg_object = function (arg) {
|
|
|
59
60
|
s_exit();
|
|
60
61
|
};
|
|
61
62
|
|
|
63
|
+
/**
|
|
64
|
+
* Get/Set the visibility of the feature.
|
|
65
|
+
*
|
|
66
|
+
* @param {boolean} [val] A boolean to change the visibility, or `undefined`
|
|
67
|
+
* to return the visibility.
|
|
68
|
+
* @param {boolean} [direct] If `true`, when getting the visibility,
|
|
69
|
+
* disregard the visibility of the parent layer, and when setting, refresh
|
|
70
|
+
* the state regardless of whether it has changed or not. Otherwise, the
|
|
71
|
+
* functional visibility is returned, where both the feature and the layer
|
|
72
|
+
* must be visible for a `true` result.
|
|
73
|
+
* @returns {boolean|this} Either the visibility (if getting) or the feature
|
|
74
|
+
* (if setting).
|
|
75
|
+
*/
|
|
76
|
+
this.visible = function (val, direct) {
|
|
77
|
+
if (val !== undefined && val !== s_visible(undefined, true) && m_this.renderer()) {
|
|
78
|
+
m_this.renderer()._scheduleUpdate();
|
|
79
|
+
}
|
|
80
|
+
return s_visible(val, direct);
|
|
81
|
+
};
|
|
82
|
+
|
|
62
83
|
return this;
|
|
63
84
|
};
|
|
64
85
|
|
package/src/svg/svgRenderer.js
CHANGED
|
@@ -548,9 +548,16 @@ var svgRenderer = function (arg) {
|
|
|
548
548
|
return m_this;
|
|
549
549
|
};
|
|
550
550
|
|
|
551
|
+
/**
|
|
552
|
+
* Schedule an update in the next render frame.
|
|
553
|
+
*/
|
|
554
|
+
this._scheduleUpdate = function () {
|
|
555
|
+
m_this.layer().map().scheduleAnimationFrame(m_this._renderFrame);
|
|
556
|
+
};
|
|
557
|
+
|
|
551
558
|
/**
|
|
552
559
|
* Render all features that are marked as needing an update. This should
|
|
553
|
-
* only be called
|
|
560
|
+
* only be called during an animation frame.
|
|
554
561
|
*/
|
|
555
562
|
this._renderFrame = function () {
|
|
556
563
|
var id;
|
|
@@ -566,6 +573,11 @@ var svgRenderer = function (arg) {
|
|
|
566
573
|
m_this._renderFeature(id);
|
|
567
574
|
}
|
|
568
575
|
}
|
|
576
|
+
for (id in m_features) {
|
|
577
|
+
if (m_features.hasOwnProperty(id) && ids[id] === undefined) {
|
|
578
|
+
m_this.select(id).attr('visibility', !m_features[id].visible || m_features[id].visible() ? 'visible' : 'hidden');
|
|
579
|
+
}
|
|
580
|
+
}
|
|
569
581
|
};
|
|
570
582
|
|
|
571
583
|
/**
|
|
@@ -580,6 +592,7 @@ var svgRenderer = function (arg) {
|
|
|
580
592
|
if (!m_features[id]) {
|
|
581
593
|
return m_this;
|
|
582
594
|
}
|
|
595
|
+
m_this.select(id).remove();
|
|
583
596
|
var data = m_features[id].data,
|
|
584
597
|
index = m_features[id].index,
|
|
585
598
|
style = m_features[id].style,
|
|
@@ -598,7 +611,7 @@ var svgRenderer = function (arg) {
|
|
|
598
611
|
rendersel.attr('class', classes.concat([id]).join(' '));
|
|
599
612
|
setStyles(rendersel, style);
|
|
600
613
|
if (visible) {
|
|
601
|
-
rendersel.
|
|
614
|
+
rendersel.attr('visibility', visible() ? 'visible' : 'hidden');
|
|
602
615
|
}
|
|
603
616
|
if (entries.size() && m_features[id].sortByZ) {
|
|
604
617
|
selection.sort(function (a, b) {
|