mirror of
https://github.com/overte-org/overte.git
synced 2025-04-13 14:52:19 +02:00
Complex checkpoint
This commit is contained in:
parent
03851d4188
commit
c83cd4a94a
3 changed files with 36 additions and 12 deletions
|
@ -416,6 +416,20 @@ Rectangle {
|
|||
}
|
||||
}
|
||||
}
|
||||
Timer {
|
||||
property var selected
|
||||
property int userIndex
|
||||
id: selectionTimer
|
||||
onTriggered: {
|
||||
if (selected) {
|
||||
table.selection.clear(); // for now, no multi-select
|
||||
table.selection.select(userIndex);
|
||||
table.positionViewAtRow(userIndex, ListView.Visible);
|
||||
} else {
|
||||
table.selection.deselect(userIndex);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function findSessionIndex(sessionId, optionalData) { // no findIndex in .qml
|
||||
var data = optionalData || userModelData, length = data.length;
|
||||
|
@ -453,19 +467,25 @@ Rectangle {
|
|||
case 'select':
|
||||
var sessionIds = message.params[0];
|
||||
var selected = message.params[1];
|
||||
var alreadyRefreshed = message.params[2];
|
||||
var userIndex = findSessionIndex(sessionIds[0]);
|
||||
if (sessionIds.length > 1) {
|
||||
letterbox("", "", 'Only one user can be selected at a time.');
|
||||
} else if (userIndex < 0) {
|
||||
letterbox("", "", 'The last editor is not among this list of users.');
|
||||
} else {
|
||||
if (selected) {
|
||||
table.selection.clear(); // for now, no multi-select
|
||||
table.selection.select(userIndex);
|
||||
table.positionViewAtRow(userIndex, ListView.Visible);
|
||||
if (alreadyRefreshed === true) {
|
||||
letterbox('', '', 'The last editor of this object is either you or not among this list of users.');
|
||||
} else {
|
||||
table.selection.deselect(userIndex);
|
||||
pal.sendToScript({method: 'refresh', params: message.params});
|
||||
}
|
||||
} else {
|
||||
if (alreadyRefreshed === true) {
|
||||
selectionTimer.interval = 250;
|
||||
} else {
|
||||
selectionTimer.interval = 0;
|
||||
}
|
||||
selectionTimer.selected = selected;
|
||||
selectionTimer.userIndex = userIndex;
|
||||
selectionTimer.start();
|
||||
}
|
||||
break;
|
||||
// Received an "updateUsername()" request from the JS
|
||||
|
|
|
@ -134,7 +134,7 @@ EntityListTool = function(opts) {
|
|||
Window.alert('There were no recent users of the ' + selectionManager.selections.length + ' selected objects.');
|
||||
} else {
|
||||
// No need to subscribe if we're just sending.
|
||||
Messages.sendMessage('com.highfidelity.pal', JSON.stringify({method: 'select', params: [dedupped, true]}), 'local');
|
||||
Messages.sendMessage('com.highfidelity.pal', JSON.stringify({method: 'select', params: [dedupped, true, false]}), 'local');
|
||||
}
|
||||
} else if (data.type == "delete") {
|
||||
deleteSelectedEntities();
|
||||
|
|
|
@ -233,7 +233,7 @@ pal.fromQml.connect(function (message) { // messages are {method, params}, like
|
|||
break;
|
||||
case 'refresh':
|
||||
removeOverlays();
|
||||
populateUserList();
|
||||
populateUserList(message.params);
|
||||
UserActivityLogger.palAction("refresh", "");
|
||||
break;
|
||||
case 'updateGain':
|
||||
|
@ -271,7 +271,7 @@ function addAvatarNode(id) {
|
|||
color: color(selected, false, 0.0),
|
||||
ignoreRayIntersection: false}, selected, true);
|
||||
}
|
||||
function populateUserList() {
|
||||
function populateUserList(selectData) {
|
||||
var data = [];
|
||||
AvatarList.getAvatarIdentifiers().sort().forEach(function (id) { // sorting the identifiers is just an aid for debugging
|
||||
var avatar = AvatarList.getAvatar(id);
|
||||
|
@ -295,7 +295,11 @@ function populateUserList() {
|
|||
data.push(avatarPalDatum);
|
||||
print('PAL data:', JSON.stringify(avatarPalDatum));
|
||||
});
|
||||
pal.sendToQml({method: 'users', params: data});
|
||||
pal.sendToQml({ method: 'users', params: data });
|
||||
if (selectData) {
|
||||
selectData[2] = true;
|
||||
pal.sendToQml({ method: 'select', params: selectData });
|
||||
}
|
||||
}
|
||||
|
||||
// The function that handles the reply from the server
|
||||
|
@ -388,7 +392,7 @@ function removeOverlays() {
|
|||
function handleClick(pickRay) {
|
||||
ExtendedOverlay.applyPickRay(pickRay, function (overlay) {
|
||||
// Don't select directly. Tell qml, who will give us back a list of ids.
|
||||
var message = {method: 'select', params: [[overlay.key], !overlay.selected]};
|
||||
var message = {method: 'select', params: [[overlay.key], !overlay.selected, false]};
|
||||
pal.sendToQml(message);
|
||||
return true;
|
||||
});
|
||||
|
|
Loading…
Reference in a new issue