@xeokit/xeokit-sdk 2.4.0-alpha-14 → 2.4.0-alpha-15
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/dist/xeokit-sdk.cjs.js
CHANGED
|
@@ -327,6 +327,7 @@ class ContextMenu {
|
|
|
327
327
|
* @param {Object} [cfg.context] The context, which is passed into the item callbacks. This can also be dynamically set on {@link ContextMenu#context}. This must be set before calling {@link ContextMenu#show}.
|
|
328
328
|
* @param {Boolean} [cfg.enabled=true] Whether this ````ContextMenu```` is initially enabled. {@link ContextMenu#show} does nothing while this is ````false````.
|
|
329
329
|
* @param {Boolean} [cfg.hideOnMouseDown=true] Whether this ````ContextMenu```` automatically hides whenever we mouse-down or tap anywhere in the page.
|
|
330
|
+
* @param {Boolean} [cfg.hideOnMouseSelect=true] Whether this ````ContextMenu```` automatically hides after we select a menu item. Se false if we want the menu to remain shown and show any updates to its item titles, after we've selected an item.
|
|
330
331
|
*/
|
|
331
332
|
constructor(cfg = {}) {
|
|
332
333
|
|
|
@@ -365,6 +366,8 @@ class ContextMenu {
|
|
|
365
366
|
this.items = cfg.items;
|
|
366
367
|
}
|
|
367
368
|
|
|
369
|
+
this._hideOnMouseSelect = (cfg.hideOnMouseSelect !== false);
|
|
370
|
+
|
|
368
371
|
this.context = cfg.context;
|
|
369
372
|
this.enabled = cfg.enabled !== false;
|
|
370
373
|
this.hide();
|
|
@@ -793,7 +796,6 @@ class ContextMenu {
|
|
|
793
796
|
|
|
794
797
|
item.itemElement.addEventListener("click", (event) => {
|
|
795
798
|
event.preventDefault();
|
|
796
|
-
self.hide();
|
|
797
799
|
if (!self._context) {
|
|
798
800
|
return;
|
|
799
801
|
}
|
|
@@ -803,9 +805,13 @@ class ContextMenu {
|
|
|
803
805
|
if (item.doAction) {
|
|
804
806
|
item.doAction(self._context);
|
|
805
807
|
}
|
|
808
|
+
if (this._hideOnMouseSelect) {
|
|
809
|
+
self.hide();
|
|
810
|
+
} else {
|
|
811
|
+
self._updateItemsTitles();
|
|
812
|
+
self._updateItemsEnabledStatus();
|
|
813
|
+
}
|
|
806
814
|
});
|
|
807
|
-
|
|
808
|
-
|
|
809
815
|
item.itemElement.addEventListener("mouseenter", (event) => {
|
|
810
816
|
event.preventDefault();
|
|
811
817
|
if (item.enabled === false) {
|
package/dist/xeokit-sdk.es.js
CHANGED
|
@@ -323,6 +323,7 @@ class ContextMenu {
|
|
|
323
323
|
* @param {Object} [cfg.context] The context, which is passed into the item callbacks. This can also be dynamically set on {@link ContextMenu#context}. This must be set before calling {@link ContextMenu#show}.
|
|
324
324
|
* @param {Boolean} [cfg.enabled=true] Whether this ````ContextMenu```` is initially enabled. {@link ContextMenu#show} does nothing while this is ````false````.
|
|
325
325
|
* @param {Boolean} [cfg.hideOnMouseDown=true] Whether this ````ContextMenu```` automatically hides whenever we mouse-down or tap anywhere in the page.
|
|
326
|
+
* @param {Boolean} [cfg.hideOnMouseSelect=true] Whether this ````ContextMenu```` automatically hides after we select a menu item. Se false if we want the menu to remain shown and show any updates to its item titles, after we've selected an item.
|
|
326
327
|
*/
|
|
327
328
|
constructor(cfg = {}) {
|
|
328
329
|
|
|
@@ -361,6 +362,8 @@ class ContextMenu {
|
|
|
361
362
|
this.items = cfg.items;
|
|
362
363
|
}
|
|
363
364
|
|
|
365
|
+
this._hideOnMouseSelect = (cfg.hideOnMouseSelect !== false);
|
|
366
|
+
|
|
364
367
|
this.context = cfg.context;
|
|
365
368
|
this.enabled = cfg.enabled !== false;
|
|
366
369
|
this.hide();
|
|
@@ -789,7 +792,6 @@ class ContextMenu {
|
|
|
789
792
|
|
|
790
793
|
item.itemElement.addEventListener("click", (event) => {
|
|
791
794
|
event.preventDefault();
|
|
792
|
-
self.hide();
|
|
793
795
|
if (!self._context) {
|
|
794
796
|
return;
|
|
795
797
|
}
|
|
@@ -799,9 +801,13 @@ class ContextMenu {
|
|
|
799
801
|
if (item.doAction) {
|
|
800
802
|
item.doAction(self._context);
|
|
801
803
|
}
|
|
804
|
+
if (this._hideOnMouseSelect) {
|
|
805
|
+
self.hide();
|
|
806
|
+
} else {
|
|
807
|
+
self._updateItemsTitles();
|
|
808
|
+
self._updateItemsEnabledStatus();
|
|
809
|
+
}
|
|
802
810
|
});
|
|
803
|
-
|
|
804
|
-
|
|
805
811
|
item.itemElement.addEventListener("mouseenter", (event) => {
|
|
806
812
|
event.preventDefault();
|
|
807
813
|
if (item.enabled === false) {
|