mirror of
https://github.com/overte-org/overte.git
synced 2025-08-09 09:48:44 +02:00
Merge pull request #15227 from thoys/fix/create/dontIgnoreAllUpdatesWhenFocussed
Case 21816: don't ignore updates that originate from entityPropertiesTool itself [master]
This commit is contained in:
commit
20c3a36308
3 changed files with 11 additions and 7 deletions
|
@ -2286,14 +2286,15 @@ var PropertiesTool = function (opts) {
|
||||||
})
|
})
|
||||||
};
|
};
|
||||||
|
|
||||||
function updateSelections(selectionUpdated) {
|
function updateSelections(selectionUpdated, caller) {
|
||||||
if (blockPropertyUpdates) {
|
if (blockPropertyUpdates) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
var data = {
|
var data = {
|
||||||
type: 'update',
|
type: 'update',
|
||||||
spaceMode: selectionDisplay.getSpaceMode()
|
spaceMode: selectionDisplay.getSpaceMode(),
|
||||||
|
isPropertiesToolUpdate: caller === this,
|
||||||
};
|
};
|
||||||
|
|
||||||
if (selectionUpdated) {
|
if (selectionUpdated) {
|
||||||
|
@ -2339,7 +2340,7 @@ var PropertiesTool = function (opts) {
|
||||||
|
|
||||||
emitScriptEvent(data);
|
emitScriptEvent(data);
|
||||||
}
|
}
|
||||||
selectionManager.addEventListener(updateSelections);
|
selectionManager.addEventListener(updateSelections, this);
|
||||||
|
|
||||||
|
|
||||||
var onWebEventReceived = function(data) {
|
var onWebEventReceived = function(data) {
|
||||||
|
|
|
@ -3326,7 +3326,7 @@ function loaded() {
|
||||||
|
|
||||||
let hasSelectedEntityChanged = lastEntityID !== '"' + selectedEntityProperties.id + '"';
|
let hasSelectedEntityChanged = lastEntityID !== '"' + selectedEntityProperties.id + '"';
|
||||||
|
|
||||||
if (!hasSelectedEntityChanged && document.hasFocus()) {
|
if (!data.isPropertiesToolUpdate && !hasSelectedEntityChanged && document.hasFocus()) {
|
||||||
// in case the selection has not changed and we still have focus on the properties page,
|
// in case the selection has not changed and we still have focus on the properties page,
|
||||||
// we will ignore the event.
|
// we will ignore the event.
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -128,8 +128,11 @@ SelectionManager = (function() {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
that.addEventListener = function(func) {
|
that.addEventListener = function(func, thisContext) {
|
||||||
listeners.push(func);
|
listeners.push({
|
||||||
|
callback: func,
|
||||||
|
thisContext: thisContext
|
||||||
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
that.hasSelection = function() {
|
that.hasSelection = function() {
|
||||||
|
@ -572,7 +575,7 @@ SelectionManager = (function() {
|
||||||
|
|
||||||
for (var j = 0; j < listeners.length; j++) {
|
for (var j = 0; j < listeners.length; j++) {
|
||||||
try {
|
try {
|
||||||
listeners[j](selectionUpdated === true, caller);
|
listeners[j].callback.call(listeners[j].thisContext, selectionUpdated === true, caller);
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
print("ERROR: entitySelectionTool.update got exception: " + JSON.stringify(e));
|
print("ERROR: entitySelectionTool.update got exception: " + JSON.stringify(e));
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue