geojs 1.14.12 → 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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "geojs",
3
- "version": "1.14.12",
3
+ "version": "1.14.13",
4
4
  "description": "JavaScript Geo Visualization and Analysis Library",
5
5
  "homepage": "https://github.com/OpenGeoscience/geojs",
6
6
  "license": "Apache-2.0",
@@ -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.annotation.state}.
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