mirror of
https://github.com/JulianGro/overte.git
synced 2025-04-25 21:35:04 +02:00
process consistent select message
This commit is contained in:
parent
12fffe8530
commit
bbf7d16537
3 changed files with 39 additions and 29 deletions
|
@ -427,14 +427,20 @@ Item {
|
||||||
sortModel();
|
sortModel();
|
||||||
break;
|
break;
|
||||||
case 'select':
|
case 'select':
|
||||||
var sessionId = message.params[0];
|
var sessionIds = message.params[0];
|
||||||
var selected = message.params[1];
|
var selected = message.params[1];
|
||||||
var userIndex = findSessionIndex(sessionId);
|
var userIndex = findSessionIndex(sessionIds[0]);
|
||||||
if (selected) {
|
if (sessionIds.length > 1) {
|
||||||
table.selection.clear(); // for now, no multi-select
|
console.log('FIXME NEEDS MODAL: Only one user can be selected at a time.');
|
||||||
table.selection.select(userIndex);
|
} else if (userIndex < 0) {
|
||||||
|
console.log('FIXME NEEEDS MODAL: The last editor has left.');
|
||||||
} else {
|
} else {
|
||||||
table.selection.deselect(userIndex);
|
if (selected) {
|
||||||
|
table.selection.clear(); // for now, no multi-select
|
||||||
|
table.selection.select(userIndex);
|
||||||
|
} else {
|
||||||
|
table.selection.deselect(userIndex);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
// Received an "updateUsername()" request from the JS
|
// Received an "updateUsername()" request from the JS
|
||||||
|
|
|
@ -133,7 +133,7 @@ EntityListTool = function(opts) {
|
||||||
Window.alert('There were no recent users of the ' + selectionManager.selections.length + ' selected objects.');
|
Window.alert('There were no recent users of the ' + selectionManager.selections.length + ' selected objects.');
|
||||||
} else {
|
} else {
|
||||||
// No need to subscribe if we're just sending.
|
// No need to subscribe if we're just sending.
|
||||||
Messages.sendMessage('com.highfidelity.pal', JSON.stringify({method: 'select', params: dedupped}), 'local');
|
Messages.sendMessage('com.highfidelity.pal', JSON.stringify({method: 'select', params: [dedupped, true]}), 'local');
|
||||||
}
|
}
|
||||||
} else if (data.type == "delete") {
|
} else if (data.type == "delete") {
|
||||||
deleteSelectedEntities();
|
deleteSelectedEntities();
|
||||||
|
|
|
@ -256,34 +256,13 @@ function removeOverlays() {
|
||||||
ExtendedOverlay.some(function (overlay) { overlay.deleteOverlay(); });
|
ExtendedOverlay.some(function (overlay) { overlay.deleteOverlay(); });
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
|
||||||
// Message from other scripts, such as edit.js
|
|
||||||
//
|
|
||||||
var CHANNEL = 'com.highfidelity.pal';
|
|
||||||
function receiveMessage(channel, messageString, senderID) {
|
|
||||||
if ((channel !== CHANNEL) ||
|
|
||||||
(senderID !== MyAvatar.sessionUUID)) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
var message = JSON.parse(messageString);
|
|
||||||
switch (message.method) {
|
|
||||||
case 'select':
|
|
||||||
print('fixme processing', message.params);
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
print('Unrecognized PAL message', messageString);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
Messages.subscribe(CHANNEL);
|
|
||||||
Messages.messageReceived.connect(receiveMessage);
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// Clicks.
|
// Clicks.
|
||||||
//
|
//
|
||||||
function handleClick(pickRay) {
|
function handleClick(pickRay) {
|
||||||
ExtendedOverlay.applyPickRay(pickRay, function (overlay) {
|
ExtendedOverlay.applyPickRay(pickRay, function (overlay) {
|
||||||
// Don't select directly. Tell qml, who will give us back a list of ids.
|
// 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]};
|
||||||
pal.sendToQml(message);
|
pal.sendToQml(message);
|
||||||
return true;
|
return true;
|
||||||
});
|
});
|
||||||
|
@ -354,6 +333,31 @@ function onClicked() {
|
||||||
pal.setVisible(!pal.visible);
|
pal.setVisible(!pal.visible);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Message from other scripts, such as edit.js
|
||||||
|
//
|
||||||
|
var CHANNEL = 'com.highfidelity.pal';
|
||||||
|
function receiveMessage(channel, messageString, senderID) {
|
||||||
|
if ((channel !== CHANNEL) ||
|
||||||
|
(senderID !== MyAvatar.sessionUUID)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
var message = JSON.parse(messageString);
|
||||||
|
switch (message.method) {
|
||||||
|
case 'select':
|
||||||
|
if (!pal.visible) {
|
||||||
|
onClicked();
|
||||||
|
}
|
||||||
|
pal.sendToQml(message); // Accepts objects, not just strings.
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
print('Unrecognized PAL message', messageString);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Messages.subscribe(CHANNEL);
|
||||||
|
Messages.messageReceived.connect(receiveMessage);
|
||||||
|
|
||||||
|
|
||||||
var AVERAGING_RATIO = 0.05;
|
var AVERAGING_RATIO = 0.05;
|
||||||
var LOUDNESS_FLOOR = 11.0;
|
var LOUDNESS_FLOOR = 11.0;
|
||||||
var LOUDNESS_SCALE = 2.8 / 5.0;
|
var LOUDNESS_SCALE = 2.8 / 5.0;
|
||||||
|
|
Loading…
Reference in a new issue