mirror of
https://github.com/lubosz/overte.git
synced 2025-04-17 20:50:27 +02:00
use triggerClicks from controllers for edit handles
This commit is contained in:
parent
6c92949aed
commit
82e5d6ad29
2 changed files with 22 additions and 7 deletions
|
@ -73,6 +73,9 @@ Script.include("/~/system/libraries/utils.js");
|
|||
method: "clearSelection"
|
||||
}));
|
||||
}
|
||||
Messages.sendLocalMessage("entityToolUpdates", JSON.stringify({
|
||||
method: "triggerClicked"
|
||||
}));
|
||||
}
|
||||
if (this.selectedTarget.type === Picks.INTERSECTED_ENTITY) {
|
||||
if (!this.isTabletMaterialEntity(this.selectedTarget.objectID)) {
|
||||
|
@ -89,6 +92,14 @@ Script.include("/~/system/libraries/utils.js");
|
|||
}
|
||||
|
||||
this.triggerClicked = true;
|
||||
} else {
|
||||
if (this.triggerClicked) {
|
||||
Messages.sendLocalMessage("entityToolUpdates", JSON.stringify({
|
||||
method: "triggerUnClicked"
|
||||
}));
|
||||
}
|
||||
|
||||
this.triggerClicked = false;
|
||||
}
|
||||
|
||||
this.sendPointingAtData(controllerData);
|
||||
|
|
|
@ -14,13 +14,14 @@
|
|||
//
|
||||
|
||||
/* global SelectionManager, SelectionDisplay, grid, rayPlaneIntersection, rayPlaneIntersection2, pushCommandForSelections,
|
||||
getMainTabletIDs, getControllerWorldLocation */
|
||||
getMainTabletIDs, getControllerWorldLocation, TRIGGER_ON_VALUE, TRIGGER_OFF_VALUE */
|
||||
|
||||
var SPACE_LOCAL = "local";
|
||||
var SPACE_WORLD = "world";
|
||||
var HIGHLIGHT_LIST_NAME = "editHandleHighlightList";
|
||||
|
||||
Script.include([
|
||||
"./controllerDispatcherUtils.js",
|
||||
"./controllers.js",
|
||||
"./utils.js"
|
||||
]);
|
||||
|
@ -67,6 +68,10 @@ SelectionManager = (function() {
|
|||
that.pointingAtDesktopWindowLeft = messageParsed.desktopWindow;
|
||||
that.pointingAtTabletLeft = messageParsed.tablet;
|
||||
}
|
||||
} else if (messageParsed.method === "triggerClicked") {
|
||||
that.triggerClicked = true;
|
||||
} else if (messageParsed.method === "triggerUnClicked") {
|
||||
that.triggerClicked = false;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -109,6 +114,8 @@ SelectionManager = (function() {
|
|||
that.pointingAtDesktopWindowRight = false;
|
||||
that.pointingAtTabletLeft = false;
|
||||
that.pointingAtTabletRight = false;
|
||||
|
||||
that.triggerClicked = false;
|
||||
|
||||
that.saveProperties = function() {
|
||||
that.savedProperties = {};
|
||||
|
@ -751,14 +758,11 @@ SelectionDisplay = (function() {
|
|||
// But we dont' get mousePressEvents.
|
||||
that.triggerMapping = Controller.newMapping(Script.resolvePath('') + '-click');
|
||||
Script.scriptEnding.connect(that.triggerMapping.disable);
|
||||
that.TRIGGER_GRAB_VALUE = 0.85; // From handControllerGrab/Pointer.js. Should refactor.
|
||||
that.TRIGGER_ON_VALUE = 0.4;
|
||||
that.TRIGGER_OFF_VALUE = 0.15;
|
||||
that.triggered = false;
|
||||
var activeHand = Controller.Standard.RightHand;
|
||||
function makeTriggerHandler(hand) {
|
||||
return function (value) {
|
||||
if (!that.triggered && (value > that.TRIGGER_GRAB_VALUE)) { // should we smooth?
|
||||
return function () {
|
||||
if (!that.triggered && SelectionManager.triggerClicked) {
|
||||
that.triggered = true;
|
||||
if (activeHand !== hand) {
|
||||
// No switching while the other is already triggered, so no need to release.
|
||||
|
@ -775,7 +779,7 @@ SelectionDisplay = (function() {
|
|||
return;
|
||||
}
|
||||
that.mousePressEvent({});
|
||||
} else if (that.triggered && (value < that.TRIGGER_OFF_VALUE)) {
|
||||
} else if (that.triggered && !SelectionManager.triggerClicked) {
|
||||
that.triggered = false;
|
||||
that.mouseReleaseEvent({});
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue