mirror of
https://github.com/HifiExperiments/overte.git
synced 2025-05-29 17:20:27 +02:00
Merge pull request #14149 from thoys/feat/create/entityList-autoScroll
MS19054: [CreateApp/EntityList] auto scroll
This commit is contained in:
commit
6221b9ee59
5 changed files with 116 additions and 67 deletions
|
@ -602,7 +602,7 @@ var toolBar = (function () {
|
||||||
Entities.editEntity(entityID, {
|
Entities.editEntity(entityID, {
|
||||||
position: position
|
position: position
|
||||||
});
|
});
|
||||||
selectionManager._update();
|
selectionManager._update(false, this);
|
||||||
} else if (dimensionsCheckCount < MAX_DIMENSIONS_CHECKS) {
|
} else if (dimensionsCheckCount < MAX_DIMENSIONS_CHECKS) {
|
||||||
Script.setTimeout(dimensionsCheckFunction, DIMENSIONS_CHECK_INTERVAL);
|
Script.setTimeout(dimensionsCheckFunction, DIMENSIONS_CHECK_INTERVAL);
|
||||||
}
|
}
|
||||||
|
@ -614,9 +614,9 @@ var toolBar = (function () {
|
||||||
properties.type + " would be out of bounds.");
|
properties.type + " would be out of bounds.");
|
||||||
}
|
}
|
||||||
|
|
||||||
selectionManager.clearSelections();
|
selectionManager.clearSelections(this);
|
||||||
entityListTool.sendUpdate();
|
entityListTool.sendUpdate();
|
||||||
selectionManager.setSelections([entityID]);
|
selectionManager.setSelections([entityID], this);
|
||||||
|
|
||||||
Window.setFocus();
|
Window.setFocus();
|
||||||
|
|
||||||
|
@ -767,7 +767,7 @@ var toolBar = (function () {
|
||||||
}
|
}
|
||||||
deletedEntityTimer = Script.setTimeout(function () {
|
deletedEntityTimer = Script.setTimeout(function () {
|
||||||
if (entitiesToDelete.length > 0) {
|
if (entitiesToDelete.length > 0) {
|
||||||
selectionManager.removeEntities(entitiesToDelete);
|
selectionManager.removeEntities(entitiesToDelete, this);
|
||||||
}
|
}
|
||||||
entityListTool.removeEntities(entitiesToDelete, selectionManager.selections);
|
entityListTool.removeEntities(entitiesToDelete, selectionManager.selections);
|
||||||
entitiesToDelete = [];
|
entitiesToDelete = [];
|
||||||
|
@ -995,7 +995,7 @@ var toolBar = (function () {
|
||||||
gridTool.setVisible(false);
|
gridTool.setVisible(false);
|
||||||
grid.setEnabled(false);
|
grid.setEnabled(false);
|
||||||
propertiesTool.setVisible(false);
|
propertiesTool.setVisible(false);
|
||||||
selectionManager.clearSelections();
|
selectionManager.clearSelections(this);
|
||||||
cameraManager.disable();
|
cameraManager.disable();
|
||||||
selectionDisplay.disableTriggerMapping();
|
selectionDisplay.disableTriggerMapping();
|
||||||
tablet.landscape = false;
|
tablet.landscape = false;
|
||||||
|
@ -1123,7 +1123,7 @@ function handleOverlaySelectionToolUpdates(channel, message, sender) {
|
||||||
var entity = entityIconOverlayManager.findEntity(data.overlayID);
|
var entity = entityIconOverlayManager.findEntity(data.overlayID);
|
||||||
|
|
||||||
if (entity !== null) {
|
if (entity !== null) {
|
||||||
selectionManager.setSelections([entity]);
|
selectionManager.setSelections([entity], this);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1270,7 +1270,7 @@ function mouseClickEvent(event) {
|
||||||
|
|
||||||
if (result === null || result === undefined) {
|
if (result === null || result === undefined) {
|
||||||
if (!event.isShifted) {
|
if (!event.isShifted) {
|
||||||
selectionManager.clearSelections();
|
selectionManager.clearSelections(this);
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -1322,9 +1322,9 @@ function mouseClickEvent(event) {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!event.isShifted) {
|
if (!event.isShifted) {
|
||||||
selectionManager.setSelections([foundEntity]);
|
selectionManager.setSelections([foundEntity], this);
|
||||||
} else {
|
} else {
|
||||||
selectionManager.addEntity(foundEntity, true);
|
selectionManager.addEntity(foundEntity, true, this);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (wantDebug) {
|
if (wantDebug) {
|
||||||
|
@ -1622,7 +1622,7 @@ function selectAllEtitiesInCurrentSelectionBox(keepIfTouching) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
selectionManager.setSelections(entities);
|
selectionManager.setSelections(entities, this);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1762,7 +1762,7 @@ function deleteSelectedEntities() {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (savedProperties.length > 0) {
|
if (savedProperties.length > 0) {
|
||||||
SelectionManager.clearSelections();
|
SelectionManager.clearSelections(this);
|
||||||
pushCommandForSelections([], savedProperties);
|
pushCommandForSelections([], savedProperties);
|
||||||
entityListTool.deleteEntities(deletedIDs);
|
entityListTool.deleteEntities(deletedIDs);
|
||||||
}
|
}
|
||||||
|
@ -1779,7 +1779,7 @@ function toggleSelectedEntitiesLocked() {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
entityListTool.sendUpdate();
|
entityListTool.sendUpdate();
|
||||||
selectionManager._update();
|
selectionManager._update(false, this);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1793,7 +1793,7 @@ function toggleSelectedEntitiesVisible() {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
entityListTool.sendUpdate();
|
entityListTool.sendUpdate();
|
||||||
selectionManager._update();
|
selectionManager._update(false, this);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1990,7 +1990,7 @@ function importSVO(importURL) {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isActive) {
|
if (isActive) {
|
||||||
selectionManager.setSelections(pastedEntityIDs);
|
selectionManager.setSelections(pastedEntityIDs, this);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
Window.notifyEditError("Can't import entities: entities would be out of bounds.");
|
Window.notifyEditError("Can't import entities: entities would be out of bounds.");
|
||||||
|
@ -2038,7 +2038,7 @@ function deleteKey(value) {
|
||||||
}
|
}
|
||||||
function deselectKey(value) {
|
function deselectKey(value) {
|
||||||
if (value === 0) { // on release
|
if (value === 0) { // on release
|
||||||
selectionManager.clearSelections();
|
selectionManager.clearSelections(this);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
function toggleKey(value) {
|
function toggleKey(value) {
|
||||||
|
@ -2198,7 +2198,7 @@ function applyEntityProperties(data) {
|
||||||
// We might be getting an undo while edit.js is disabled. If that is the case, don't set
|
// We might be getting an undo while edit.js is disabled. If that is the case, don't set
|
||||||
// our selections, causing the edit widgets to display.
|
// our selections, causing the edit widgets to display.
|
||||||
if (isActive) {
|
if (isActive) {
|
||||||
selectionManager.setSelections(selectedEntityIDs);
|
selectionManager.setSelections(selectedEntityIDs, this);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2401,7 +2401,7 @@ var PropertiesTool = function (opts) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
pushCommandForSelections();
|
pushCommandForSelections();
|
||||||
selectionManager._update();
|
selectionManager._update(false, this);
|
||||||
} else if (data.type === 'parent') {
|
} else if (data.type === 'parent') {
|
||||||
parentSelectedEntities();
|
parentSelectedEntities();
|
||||||
} else if (data.type === 'unparent') {
|
} else if (data.type === 'unparent') {
|
||||||
|
@ -2430,7 +2430,7 @@ var PropertiesTool = function (opts) {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
pushCommandForSelections();
|
pushCommandForSelections();
|
||||||
selectionManager._update();
|
selectionManager._update(false, this);
|
||||||
}
|
}
|
||||||
} else if (data.action === "moveAllToGrid") {
|
} else if (data.action === "moveAllToGrid") {
|
||||||
if (selectionManager.hasSelection()) {
|
if (selectionManager.hasSelection()) {
|
||||||
|
@ -2450,7 +2450,7 @@ var PropertiesTool = function (opts) {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
pushCommandForSelections();
|
pushCommandForSelections();
|
||||||
selectionManager._update();
|
selectionManager._update(false, this);
|
||||||
}
|
}
|
||||||
} else if (data.action === "resetToNaturalDimensions") {
|
} else if (data.action === "resetToNaturalDimensions") {
|
||||||
if (selectionManager.hasSelection()) {
|
if (selectionManager.hasSelection()) {
|
||||||
|
@ -2471,7 +2471,7 @@ var PropertiesTool = function (opts) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
pushCommandForSelections();
|
pushCommandForSelections();
|
||||||
selectionManager._update();
|
selectionManager._update(false, this);
|
||||||
}
|
}
|
||||||
} else if (data.action === "previewCamera") {
|
} else if (data.action === "previewCamera") {
|
||||||
if (selectionManager.hasSelection()) {
|
if (selectionManager.hasSelection()) {
|
||||||
|
@ -2489,7 +2489,7 @@ var PropertiesTool = function (opts) {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
pushCommandForSelections();
|
pushCommandForSelections();
|
||||||
selectionManager._update();
|
selectionManager._update(false, this);
|
||||||
}
|
}
|
||||||
} else if (data.action === "reloadClientScripts") {
|
} else if (data.action === "reloadClientScripts") {
|
||||||
if (selectionManager.hasSelection()) {
|
if (selectionManager.hasSelection()) {
|
||||||
|
|
|
@ -13,7 +13,7 @@ const DESCENDING_STRING = '▾';
|
||||||
const LOCKED_GLYPH = "";
|
const LOCKED_GLYPH = "";
|
||||||
const VISIBLE_GLYPH = "";
|
const VISIBLE_GLYPH = "";
|
||||||
const TRANSPARENCY_GLYPH = "";
|
const TRANSPARENCY_GLYPH = "";
|
||||||
const BAKED_GLYPH = ""
|
const BAKED_GLYPH = "";
|
||||||
const SCRIPT_GLYPH = "k";
|
const SCRIPT_GLYPH = "k";
|
||||||
const BYTES_PER_MEGABYTE = 1024 * 1024;
|
const BYTES_PER_MEGABYTE = 1024 * 1024;
|
||||||
const IMAGE_MODEL_NAME = 'default-image-model.fbx';
|
const IMAGE_MODEL_NAME = 'default-image-model.fbx';
|
||||||
|
@ -54,10 +54,10 @@ const COMPARE_ASCENDING = function(a, b) {
|
||||||
}
|
}
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
};
|
||||||
const COMPARE_DESCENDING = function(a, b) {
|
const COMPARE_DESCENDING = function(a, b) {
|
||||||
return COMPARE_ASCENDING(b, a);
|
return COMPARE_ASCENDING(b, a);
|
||||||
}
|
};
|
||||||
|
|
||||||
// List of all entities
|
// List of all entities
|
||||||
var entities = [];
|
var entities = [];
|
||||||
|
@ -161,22 +161,22 @@ function loaded() {
|
||||||
};
|
};
|
||||||
elRefresh.onclick = function() {
|
elRefresh.onclick = function() {
|
||||||
refreshEntities();
|
refreshEntities();
|
||||||
}
|
};
|
||||||
elToggleLocked.onclick = function() {
|
elToggleLocked.onclick = function() {
|
||||||
EventBridge.emitWebEvent(JSON.stringify({ type: 'toggleLocked' }));
|
EventBridge.emitWebEvent(JSON.stringify({ type: 'toggleLocked' }));
|
||||||
}
|
};
|
||||||
elToggleVisible.onclick = function() {
|
elToggleVisible.onclick = function() {
|
||||||
EventBridge.emitWebEvent(JSON.stringify({ type: 'toggleVisible' }));
|
EventBridge.emitWebEvent(JSON.stringify({ type: 'toggleVisible' }));
|
||||||
}
|
};
|
||||||
elExport.onclick = function() {
|
elExport.onclick = function() {
|
||||||
EventBridge.emitWebEvent(JSON.stringify({ type: 'export'}));
|
EventBridge.emitWebEvent(JSON.stringify({ type: 'export'}));
|
||||||
}
|
};
|
||||||
elPal.onclick = function() {
|
elPal.onclick = function() {
|
||||||
EventBridge.emitWebEvent(JSON.stringify({ type: 'pal' }));
|
EventBridge.emitWebEvent(JSON.stringify({ type: 'pal' }));
|
||||||
}
|
};
|
||||||
elDelete.onclick = function() {
|
elDelete.onclick = function() {
|
||||||
EventBridge.emitWebEvent(JSON.stringify({ type: 'delete' }));
|
EventBridge.emitWebEvent(JSON.stringify({ type: 'delete' }));
|
||||||
}
|
};
|
||||||
elFilter.onkeyup = refreshEntityList;
|
elFilter.onkeyup = refreshEntityList;
|
||||||
elFilter.onpaste = refreshEntityList;
|
elFilter.onpaste = refreshEntityList;
|
||||||
elFilter.onchange = onFilterChange;
|
elFilter.onchange = onFilterChange;
|
||||||
|
@ -287,7 +287,7 @@ function loaded() {
|
||||||
if (selectedIndex >= 0) {
|
if (selectedIndex >= 0) {
|
||||||
selection = [];
|
selection = [];
|
||||||
selection = selection.concat(selectedEntities);
|
selection = selection.concat(selectedEntities);
|
||||||
selection.splice(selectedIndex, 1)
|
selection.splice(selectedIndex, 1);
|
||||||
} else {
|
} else {
|
||||||
selection = selection.concat(selectedEntities);
|
selection = selection.concat(selectedEntities);
|
||||||
}
|
}
|
||||||
|
@ -320,22 +320,23 @@ function loaded() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
updateSelectedEntities(selection);
|
updateSelectedEntities(selection, false);
|
||||||
|
|
||||||
EventBridge.emitWebEvent(JSON.stringify({
|
EventBridge.emitWebEvent(JSON.stringify({
|
||||||
type: "selectionUpdate",
|
type: "selectionUpdate",
|
||||||
focus: false,
|
focus: false,
|
||||||
entityIds: selection,
|
entityIds: selection,
|
||||||
}));
|
}));
|
||||||
|
|
||||||
refreshFooter();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function onRowDoubleClicked() {
|
function onRowDoubleClicked() {
|
||||||
|
let selection = [this.dataset.entityID];
|
||||||
|
updateSelectedEntities(selection, false);
|
||||||
|
|
||||||
EventBridge.emitWebEvent(JSON.stringify({
|
EventBridge.emitWebEvent(JSON.stringify({
|
||||||
type: "selectionUpdate",
|
type: "selectionUpdate",
|
||||||
focus: true,
|
focus: true,
|
||||||
entityIds: [this.dataset.entityID],
|
entityIds: selection,
|
||||||
}));
|
}));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -382,7 +383,7 @@ function loaded() {
|
||||||
hasScript: entity.hasScript,
|
hasScript: entity.hasScript,
|
||||||
elRow: null, // if this entity has a visible row element assigned to it
|
elRow: null, // if this entity has a visible row element assigned to it
|
||||||
selected: false // if this entity is selected for edit regardless of having a visible row
|
selected: false // if this entity is selected for edit regardless of having a visible row
|
||||||
}
|
};
|
||||||
|
|
||||||
entities.push(entityData);
|
entities.push(entityData);
|
||||||
entitiesByID[entityData.id] = entityData;
|
entitiesByID[entityData.id] = entityData;
|
||||||
|
@ -511,7 +512,7 @@ function loaded() {
|
||||||
isBaked: document.querySelector('#entity-isBaked .sort-order'),
|
isBaked: document.querySelector('#entity-isBaked .sort-order'),
|
||||||
drawCalls: document.querySelector('#entity-drawCalls .sort-order'),
|
drawCalls: document.querySelector('#entity-drawCalls .sort-order'),
|
||||||
hasScript: document.querySelector('#entity-hasScript .sort-order'),
|
hasScript: document.querySelector('#entity-hasScript .sort-order'),
|
||||||
}
|
};
|
||||||
function setSortColumn(column) {
|
function setSortColumn(column) {
|
||||||
PROFILE("set-sort-column", function() {
|
PROFILE("set-sort-column", function() {
|
||||||
if (currentSortColumn === column) {
|
if (currentSortColumn === column) {
|
||||||
|
@ -546,7 +547,7 @@ function loaded() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function updateSelectedEntities(selectedIDs) {
|
function updateSelectedEntities(selectedIDs, autoScroll) {
|
||||||
let notFound = false;
|
let notFound = false;
|
||||||
|
|
||||||
// reset all currently selected entities and their rows first
|
// reset all currently selected entities and their rows first
|
||||||
|
@ -575,6 +576,26 @@ function loaded() {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
if (autoScroll && selectedIDs.length > 0) {
|
||||||
|
let firstItem = Number.MAX_VALUE;
|
||||||
|
let lastItem = -1;
|
||||||
|
let itemFound = false;
|
||||||
|
visibleEntities.forEach(function(entity, index) {
|
||||||
|
if (selectedIDs.indexOf(entity.id) !== -1) {
|
||||||
|
if (firstItem > index) {
|
||||||
|
firstItem = index;
|
||||||
|
}
|
||||||
|
if (lastItem < index) {
|
||||||
|
lastItem = index;
|
||||||
|
}
|
||||||
|
itemFound = true;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
if (itemFound) {
|
||||||
|
entityList.scrollToRow(firstItem, lastItem);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
refreshFooter();
|
refreshFooter();
|
||||||
|
|
||||||
return notFound;
|
return notFound;
|
||||||
|
@ -735,7 +756,7 @@ function loaded() {
|
||||||
if (data.type === "clearEntityList") {
|
if (data.type === "clearEntityList") {
|
||||||
clearEntities();
|
clearEntities();
|
||||||
} else if (data.type === "selectionUpdate") {
|
} else if (data.type === "selectionUpdate") {
|
||||||
let notFound = updateSelectedEntities(data.selectedIDs);
|
let notFound = updateSelectedEntities(data.selectedIDs, true);
|
||||||
if (notFound) {
|
if (notFound) {
|
||||||
refreshEntities();
|
refreshEntities();
|
||||||
}
|
}
|
||||||
|
@ -747,13 +768,13 @@ function loaded() {
|
||||||
clearEntities();
|
clearEntities();
|
||||||
} else {
|
} else {
|
||||||
updateEntityData(newEntities);
|
updateEntityData(newEntities);
|
||||||
updateSelectedEntities(data.selectedIDs);
|
updateSelectedEntities(data.selectedIDs, true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
} else if (data.type === "removeEntities" && data.deletedIDs !== undefined && data.selectedIDs !== undefined) {
|
} else if (data.type === "removeEntities" && data.deletedIDs !== undefined && data.selectedIDs !== undefined) {
|
||||||
removeEntities(data.deletedIDs);
|
removeEntities(data.deletedIDs);
|
||||||
updateSelectedEntities(data.selectedIDs);
|
updateSelectedEntities(data.selectedIDs, true);
|
||||||
} else if (data.type === "deleted" && data.ids) {
|
} else if (data.type === "deleted" && data.ids) {
|
||||||
removeEntities(data.ids);
|
removeEntities(data.ids);
|
||||||
}
|
}
|
||||||
|
|
|
@ -38,7 +38,7 @@ function ListView(elTableBody, elTableScroll, elTableHeaderRow, createRowFunctio
|
||||||
this.lastRowShiftScrollTop = 0;
|
this.lastRowShiftScrollTop = 0;
|
||||||
|
|
||||||
this.initialize();
|
this.initialize();
|
||||||
};
|
}
|
||||||
|
|
||||||
ListView.prototype = {
|
ListView.prototype = {
|
||||||
getNumRows: function() {
|
getNumRows: function() {
|
||||||
|
@ -152,6 +152,30 @@ ListView.prototype = {
|
||||||
this.refresh();
|
this.refresh();
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Scrolls firstRowIndex with least effort, also tries to make the window include the other selections in case lastRowIndex is set.
|
||||||
|
* In the case that firstRowIndex and lastRowIndex are already within the visible bounds then nothing will happen.
|
||||||
|
* @param {number} firstRowIndex - The row that will be scrolled to.
|
||||||
|
* @param {number} lastRowIndex - The last index of the bound.
|
||||||
|
*/
|
||||||
|
scrollToRow: function (firstRowIndex, lastRowIndex) {
|
||||||
|
lastRowIndex = lastRowIndex ? lastRowIndex : firstRowIndex;
|
||||||
|
let boundingTop = firstRowIndex * this.rowHeight;
|
||||||
|
let boundingBottom = (lastRowIndex * this.rowHeight) + this.rowHeight;
|
||||||
|
if ((boundingBottom - boundingTop) > this.elTableScroll.clientHeight) {
|
||||||
|
boundingBottom = boundingTop + this.elTableScroll.clientHeight;
|
||||||
|
}
|
||||||
|
|
||||||
|
let currentVisibleAreaTop = this.elTableScroll.scrollTop;
|
||||||
|
let currentVisibleAreaBottom = currentVisibleAreaTop + this.elTableScroll.clientHeight;
|
||||||
|
|
||||||
|
if (boundingTop < currentVisibleAreaTop) {
|
||||||
|
this.elTableScroll.scrollTop = boundingTop;
|
||||||
|
} else if (boundingBottom > currentVisibleAreaBottom) {
|
||||||
|
this.elTableScroll.scrollTop = boundingBottom - (this.elTableScroll.clientHeight);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
refresh: function() {
|
refresh: function() {
|
||||||
// block refreshing before rows are initialized
|
// block refreshing before rows are initialized
|
||||||
|
|
|
@ -98,7 +98,11 @@ EntityListTool = function(shouldUseEditTabletApp) {
|
||||||
that.setVisible(!visible);
|
that.setVisible(!visible);
|
||||||
};
|
};
|
||||||
|
|
||||||
selectionManager.addEventListener(function() {
|
selectionManager.addEventListener(function(isSelectionUpdate, caller) {
|
||||||
|
if (caller === that) {
|
||||||
|
// ignore events that we emitted from the entity list itself
|
||||||
|
return;
|
||||||
|
}
|
||||||
var selectedIDs = [];
|
var selectedIDs = [];
|
||||||
|
|
||||||
for (var i = 0; i < selectionManager.selections.length; i++) {
|
for (var i = 0; i < selectionManager.selections.length; i++) {
|
||||||
|
@ -224,7 +228,7 @@ EntityListTool = function(shouldUseEditTabletApp) {
|
||||||
for (var i = 0; i < ids.length; i++) {
|
for (var i = 0; i < ids.length; i++) {
|
||||||
entityIDs.push(ids[i]);
|
entityIDs.push(ids[i]);
|
||||||
}
|
}
|
||||||
selectionManager.setSelections(entityIDs);
|
selectionManager.setSelections(entityIDs, that);
|
||||||
if (data.focus) {
|
if (data.focus) {
|
||||||
cameraManager.enable();
|
cameraManager.enable();
|
||||||
cameraManager.focus(selectionManager.worldPosition,
|
cameraManager.focus(selectionManager.worldPosition,
|
||||||
|
|
|
@ -40,7 +40,7 @@ SelectionManager = (function() {
|
||||||
Messages.messageReceived.connect(handleEntitySelectionToolUpdates);
|
Messages.messageReceived.connect(handleEntitySelectionToolUpdates);
|
||||||
}
|
}
|
||||||
|
|
||||||
// FUNCTION: HANDLE ENTITY SELECTION TOOL UDPATES
|
// FUNCTION: HANDLE ENTITY SELECTION TOOL UPDATES
|
||||||
function handleEntitySelectionToolUpdates(channel, message, sender) {
|
function handleEntitySelectionToolUpdates(channel, message, sender) {
|
||||||
if (channel !== 'entityToolUpdates') {
|
if (channel !== 'entityToolUpdates') {
|
||||||
return;
|
return;
|
||||||
|
@ -63,7 +63,7 @@ SelectionManager = (function() {
|
||||||
if (wantDebug) {
|
if (wantDebug) {
|
||||||
print("setting selection to " + messageParsed.entityID);
|
print("setting selection to " + messageParsed.entityID);
|
||||||
}
|
}
|
||||||
that.setSelections([messageParsed.entityID]);
|
that.setSelections([messageParsed.entityID], that);
|
||||||
}
|
}
|
||||||
} else if (messageParsed.method === "clearSelection") {
|
} else if (messageParsed.method === "clearSelection") {
|
||||||
if (!SelectionDisplay.triggered() || SelectionDisplay.triggeredHand === messageParsed.hand) {
|
if (!SelectionDisplay.triggered() || SelectionDisplay.triggeredHand === messageParsed.hand) {
|
||||||
|
@ -136,7 +136,7 @@ SelectionManager = (function() {
|
||||||
return that.selections.length > 0;
|
return that.selections.length > 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
that.setSelections = function(entityIDs) {
|
that.setSelections = function(entityIDs, caller) {
|
||||||
that.selections = [];
|
that.selections = [];
|
||||||
for (var i = 0; i < entityIDs.length; i++) {
|
for (var i = 0; i < entityIDs.length; i++) {
|
||||||
var entityID = entityIDs[i];
|
var entityID = entityIDs[i];
|
||||||
|
@ -144,10 +144,10 @@ SelectionManager = (function() {
|
||||||
Selection.addToSelectedItemsList(HIGHLIGHT_LIST_NAME, "entity", entityID);
|
Selection.addToSelectedItemsList(HIGHLIGHT_LIST_NAME, "entity", entityID);
|
||||||
}
|
}
|
||||||
|
|
||||||
that._update(true);
|
that._update(true, caller);
|
||||||
};
|
};
|
||||||
|
|
||||||
that.addEntity = function(entityID, toggleSelection) {
|
that.addEntity = function(entityID, toggleSelection, caller) {
|
||||||
if (entityID) {
|
if (entityID) {
|
||||||
var idx = -1;
|
var idx = -1;
|
||||||
for (var i = 0; i < that.selections.length; i++) {
|
for (var i = 0; i < that.selections.length; i++) {
|
||||||
|
@ -165,7 +165,7 @@ SelectionManager = (function() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
that._update(true);
|
that._update(true, caller);
|
||||||
};
|
};
|
||||||
|
|
||||||
function removeEntityByID(entityID) {
|
function removeEntityByID(entityID) {
|
||||||
|
@ -176,21 +176,21 @@ SelectionManager = (function() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
that.removeEntity = function (entityID) {
|
that.removeEntity = function (entityID, caller) {
|
||||||
removeEntityByID(entityID);
|
removeEntityByID(entityID);
|
||||||
that._update(true);
|
that._update(true, caller);
|
||||||
};
|
};
|
||||||
|
|
||||||
that.removeEntities = function(entityIDs) {
|
that.removeEntities = function(entityIDs, caller) {
|
||||||
for (var i = 0, length = entityIDs.length; i < length; i++) {
|
for (var i = 0, length = entityIDs.length; i < length; i++) {
|
||||||
removeEntityByID(entityIDs[i]);
|
removeEntityByID(entityIDs[i]);
|
||||||
}
|
}
|
||||||
that._update(true);
|
that._update(true, caller);
|
||||||
};
|
};
|
||||||
|
|
||||||
that.clearSelections = function() {
|
that.clearSelections = function(caller) {
|
||||||
that.selections = [];
|
that.selections = [];
|
||||||
that._update(true);
|
that._update(true, caller);
|
||||||
};
|
};
|
||||||
|
|
||||||
that.addChildrenEntities = function(parentEntityID, entityList) {
|
that.addChildrenEntities = function(parentEntityID, entityList) {
|
||||||
|
@ -477,7 +477,7 @@ SelectionManager = (function() {
|
||||||
undoHistory.pushCommand(undo, copiedProperties, redo, copiedProperties);
|
undoHistory.pushCommand(undo, copiedProperties, redo, copiedProperties);
|
||||||
};
|
};
|
||||||
|
|
||||||
that._update = function(selectionUpdated) {
|
that._update = function(selectionUpdated, caller) {
|
||||||
var properties = null;
|
var properties = null;
|
||||||
if (that.selections.length === 0) {
|
if (that.selections.length === 0) {
|
||||||
that.localDimensions = null;
|
that.localDimensions = null;
|
||||||
|
@ -542,7 +542,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);
|
listeners[j](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));
|
||||||
}
|
}
|
||||||
|
@ -985,7 +985,7 @@ SelectionDisplay = (function() {
|
||||||
that.pressedHand = NO_HAND;
|
that.pressedHand = NO_HAND;
|
||||||
that.triggered = function() {
|
that.triggered = function() {
|
||||||
return that.triggeredHand !== NO_HAND;
|
return that.triggeredHand !== NO_HAND;
|
||||||
}
|
};
|
||||||
function pointingAtDesktopWindowOrTablet(hand) {
|
function pointingAtDesktopWindowOrTablet(hand) {
|
||||||
var pointingAtDesktopWindow = (hand === Controller.Standard.RightHand &&
|
var pointingAtDesktopWindow = (hand === Controller.Standard.RightHand &&
|
||||||
SelectionManager.pointingAtDesktopWindowRight) ||
|
SelectionManager.pointingAtDesktopWindowRight) ||
|
||||||
|
@ -1032,7 +1032,7 @@ SelectionDisplay = (function() {
|
||||||
that.disableTriggerMapping = function() {
|
that.disableTriggerMapping = function() {
|
||||||
that.triggerClickMapping.disable();
|
that.triggerClickMapping.disable();
|
||||||
that.triggerPressMapping.disable();
|
that.triggerPressMapping.disable();
|
||||||
}
|
};
|
||||||
Script.scriptEnding.connect(that.disableTriggerMapping);
|
Script.scriptEnding.connect(that.disableTriggerMapping);
|
||||||
|
|
||||||
// FUNCTION DEF(s): Intersection Check Helpers
|
// FUNCTION DEF(s): Intersection Check Helpers
|
||||||
|
@ -1234,7 +1234,7 @@ SelectionDisplay = (function() {
|
||||||
if (wantDebug) {
|
if (wantDebug) {
|
||||||
print(" Trigger SelectionManager::update");
|
print(" Trigger SelectionManager::update");
|
||||||
}
|
}
|
||||||
SelectionManager._update();
|
SelectionManager._update(false, that);
|
||||||
|
|
||||||
if (wantDebug) {
|
if (wantDebug) {
|
||||||
print("=============== eST::MouseMoveEvent END =======================");
|
print("=============== eST::MouseMoveEvent END =======================");
|
||||||
|
@ -1299,7 +1299,7 @@ SelectionDisplay = (function() {
|
||||||
lastMouseEvent.isControl = event.isControl;
|
lastMouseEvent.isControl = event.isControl;
|
||||||
lastMouseEvent.isAlt = event.isAlt;
|
lastMouseEvent.isAlt = event.isAlt;
|
||||||
activeTool.onMove(lastMouseEvent);
|
activeTool.onMove(lastMouseEvent);
|
||||||
SelectionManager._update();
|
SelectionManager._update(false, this);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -1315,7 +1315,7 @@ SelectionDisplay = (function() {
|
||||||
lastMouseEvent.isControl = event.isControl;
|
lastMouseEvent.isControl = event.isControl;
|
||||||
lastMouseEvent.isAlt = event.isAlt;
|
lastMouseEvent.isAlt = event.isAlt;
|
||||||
activeTool.onMove(lastMouseEvent);
|
activeTool.onMove(lastMouseEvent);
|
||||||
SelectionManager._update();
|
SelectionManager._update(false, this);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -2179,7 +2179,7 @@ SelectionDisplay = (function() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
SelectionManager._update();
|
SelectionManager._update(false, this);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -2301,7 +2301,7 @@ SelectionDisplay = (function() {
|
||||||
|
|
||||||
previousPickRay = pickRay;
|
previousPickRay = pickRay;
|
||||||
|
|
||||||
SelectionManager._update();
|
SelectionManager._update(false, this);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -2488,7 +2488,7 @@ SelectionDisplay = (function() {
|
||||||
|
|
||||||
previousPickRay = pickRay;
|
previousPickRay = pickRay;
|
||||||
|
|
||||||
SelectionManager._update();
|
SelectionManager._update(false, this);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -2599,7 +2599,7 @@ SelectionDisplay = (function() {
|
||||||
|
|
||||||
previousPickRay = pickRay;
|
previousPickRay = pickRay;
|
||||||
|
|
||||||
SelectionManager._update();
|
SelectionManager._update(false, this);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue