Couple improvements

Only send one message when gain is changed.  Eliminated the bool and
now just sending un-personalMute, etc...
This commit is contained in:
David Kelly 2017-01-19 17:22:39 -08:00
parent d9fbf832e2
commit 5adc2cc593
3 changed files with 26 additions and 11 deletions

View file

@ -283,7 +283,12 @@ Item {
maximumValue: 20.0
stepSize: 5
updateValueWhileDragging: true
onValueChanged: updateGainFromQML(uuid, value)
onValueChanged: updateGainFromQML(uuid, value, false)
onPressedChanged: {
if (!pressed) {
updateGainFromQML(uuid, value, true)
}
}
MouseArea {
anchors.fill: parent
onWheel: {
@ -297,7 +302,8 @@ Item {
mouse.accepted = false
}
onReleased: {
// Pass through to Slider
// the above mouse.accepted seems to make this
// never get called, nonetheless...
mouse.accepted = false
}
}
@ -319,12 +325,13 @@ Item {
}
}
function updateGainFromQML(avatarUuid, sliderValue) {
if (pal.gainSliderValueDB[avatarUuid] !== sliderValue) {
function updateGainFromQML(avatarUuid, sliderValue, isReleased) {
if (isReleased || pal.gainSliderValueDB[avatarUuid] !== sliderValue) {
pal.gainSliderValueDB[avatarUuid] = sliderValue;
var data = {
sessionId: avatarUuid,
gain: sliderValue
gain: sliderValue,
isReleased: isReleased
};
pal.sendToScript({method: 'updateGain', params: data});
}

View file

@ -247,7 +247,7 @@ Rectangle {
userModel.setProperty(model.userIndex, styleData.role, newValue)
userModelData[model.userIndex][styleData.role] = newValue // Defensive programming
Users[styleData.role](model.sessionId, newValue)
UserActivityLogger["palAction"](newValue ? "un-" + styleData.role : styleData.role, model.sessionId)
UserActivityLogger["palAction"](newValue ? styleData.role : "un-" + styleData.role, model.sessionId)
if (styleData.role === "ignore") {
userModel.setProperty(model.userIndex, "personalMute", newValue)
userModelData[model.userIndex]["personalMute"] = newValue // Defensive programming

View file

@ -103,6 +103,8 @@ ExtendedOverlay.prototype.select = function (selected) {
return;
}
UserActivityLogger.palAction(selected ? "avatar_selected" : "avatar_deselected", this.key);
this.editOverlay({color: color(selected, this.hovering, this.audioLevel)});
if (this.model) {
this.model.editOverlay({textures: textures(selected)});
@ -208,7 +210,6 @@ pal.fromQml.connect(function (message) { // messages are {method, params}, like
var id = overlay.key;
var selected = ExtendedOverlay.isSelected(id);
overlay.select(selected);
UserActivityLogger.palAction("avatar_selected", id);
});
HighlightedEntity.clearOverlays();
@ -233,17 +234,24 @@ pal.fromQml.connect(function (message) { // messages are {method, params}, like
case 'refresh':
removeOverlays();
populateUserList();
UserActivityLogger.palAction("refresh");
UserActivityLogger.palAction("refresh", "");
break;
case 'updateGain':
data = message.params;
Users.setAvatarGain(data['sessionId'], data['gain']);
UserActivityLogger.palAction("avatar_gain_changed", data['sessionId']);
if (data['isReleased']) {
// isReleased=true happens once at the end of a cycle of dragging
// the slider about, but with same gain as last isReleased=false so
// we don't set the gain in that case, and only here do we want to
// send an analytic event.
UserActivityLogger.palAction("avatar_gain_changed", data['sessionId']);
} else {
Users.setAvatarGain(data['sessionId'], data['gain']);
}
break;
case 'displayNameUpdate':
if (MyAvatar.displayName != message.params) {
MyAvatar.displayName = message.params;
UserActivityLogger.palAction("display_name_change");
UserActivityLogger.palAction("display_name_change", "");
}
break;
default: