mirror of
https://github.com/overte-org/overte.git
synced 2025-07-26 01:36:55 +02:00
Merge branch 'arrow-actions' of github.com:sethalves/hifi into arrow-actions
This commit is contained in:
commit
01ee6e9e98
2 changed files with 30 additions and 28 deletions
|
@ -81,28 +81,43 @@ QScriptValue PointerEvent::toScriptValue(QScriptEngine* engine, const PointerEve
|
||||||
direction.setProperty("z", event._direction.z);
|
direction.setProperty("z", event._direction.z);
|
||||||
obj.setProperty("pos3D", direction);
|
obj.setProperty("pos3D", direction);
|
||||||
|
|
||||||
|
bool isPrimaryButton = false;
|
||||||
|
bool isSecondaryButton = false;
|
||||||
|
bool isTertiaryButton = false;
|
||||||
switch (event._button) {
|
switch (event._button) {
|
||||||
case NoButtons:
|
case NoButtons:
|
||||||
obj.setProperty("button", "None");
|
obj.setProperty("button", "None");
|
||||||
break;
|
break;
|
||||||
case PrimaryButton:
|
case PrimaryButton:
|
||||||
obj.setProperty("button", "Primary");
|
obj.setProperty("button", "Primary");
|
||||||
|
isPrimaryButton = true;
|
||||||
break;
|
break;
|
||||||
case SecondaryButton:
|
case SecondaryButton:
|
||||||
obj.setProperty("button", "Secondary");
|
obj.setProperty("button", "Secondary");
|
||||||
|
isSecondaryButton = true;
|
||||||
break;
|
break;
|
||||||
case TertiaryButton:
|
case TertiaryButton:
|
||||||
obj.setProperty("button", "Tertiary");
|
obj.setProperty("button", "Tertiary");
|
||||||
|
isTertiaryButton = true;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
obj.setProperty("isLeftButton", areFlagsSet(event._buttons, PrimaryButton));
|
if (isPrimaryButton) {
|
||||||
obj.setProperty("isRightButton", areFlagsSet(event._buttons, SecondaryButton));
|
obj.setProperty("isPrimaryButton", isPrimaryButton);
|
||||||
obj.setProperty("isMiddleButton", areFlagsSet(event._buttons, TertiaryButton));
|
obj.setProperty("isLeftButton", isPrimaryButton);
|
||||||
|
}
|
||||||
|
if (isSecondaryButton) {
|
||||||
|
obj.setProperty("isSecondaryButton", isSecondaryButton);
|
||||||
|
obj.setProperty("isRightButton", isSecondaryButton);
|
||||||
|
}
|
||||||
|
if (isTertiaryButton) {
|
||||||
|
obj.setProperty("isTertiaryButton", isTertiaryButton);
|
||||||
|
obj.setProperty("isMiddleButton", isTertiaryButton);
|
||||||
|
}
|
||||||
|
|
||||||
obj.setProperty("isPrimaryButton", areFlagsSet(event._buttons, PrimaryButton));
|
obj.setProperty("isPrimaryHeld", areFlagsSet(event._buttons, PrimaryButton));
|
||||||
obj.setProperty("isSecondaryButton", areFlagsSet(event._buttons, SecondaryButton));
|
obj.setProperty("isSecondaryHeld", areFlagsSet(event._buttons, SecondaryButton));
|
||||||
obj.setProperty("isTertiaryButton", areFlagsSet(event._buttons, TertiaryButton));
|
obj.setProperty("isTertiaryHeld", areFlagsSet(event._buttons, TertiaryButton));
|
||||||
|
|
||||||
return obj;
|
return obj;
|
||||||
}
|
}
|
||||||
|
@ -146,9 +161,9 @@ void PointerEvent::fromScriptValue(const QScriptValue& object, PointerEvent& eve
|
||||||
event._button = NoButtons;
|
event._button = NoButtons;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool primary = object.property("isPrimary").toBool() || object.property("isLeftButton").toBool();
|
bool primary = object.property("isPrimaryHeld").toBool();
|
||||||
bool secondary = object.property("isSecondary").toBool() || object.property("isRightButton").toBool();
|
bool secondary = object.property("isSecondaryHeld").toBool();
|
||||||
bool tertiary = object.property("isTertiary").toBool() || object.property("isMiddleButton").toBool();
|
bool tertiary = object.property("isTertiaryHeld").toBool();
|
||||||
event._buttons = 0;
|
event._buttons = 0;
|
||||||
if (primary) {
|
if (primary) {
|
||||||
event._buttons |= PrimaryButton;
|
event._buttons |= PrimaryButton;
|
||||||
|
|
|
@ -1499,10 +1499,7 @@ function MyController(hand) {
|
||||||
pos3D: rayPickInfo.intersection,
|
pos3D: rayPickInfo.intersection,
|
||||||
normal: rayPickInfo.normal,
|
normal: rayPickInfo.normal,
|
||||||
direction: rayPickInfo.searchRay.direction,
|
direction: rayPickInfo.searchRay.direction,
|
||||||
button: "None",
|
button: "None"
|
||||||
isPrimaryButton: false,
|
|
||||||
isSecondaryButton: false,
|
|
||||||
isTertiaryButton: false
|
|
||||||
};
|
};
|
||||||
|
|
||||||
this.hoverEntity = entity;
|
this.hoverEntity = entity;
|
||||||
|
@ -1522,10 +1519,7 @@ function MyController(hand) {
|
||||||
pos3D: rayPickInfo.intersection,
|
pos3D: rayPickInfo.intersection,
|
||||||
normal: rayPickInfo.normal,
|
normal: rayPickInfo.normal,
|
||||||
direction: rayPickInfo.searchRay.direction,
|
direction: rayPickInfo.searchRay.direction,
|
||||||
button: "None",
|
button: "None"
|
||||||
isPrimaryButton: false,
|
|
||||||
isSecondaryButton: false,
|
|
||||||
isTertiaryButton: false
|
|
||||||
};
|
};
|
||||||
|
|
||||||
Entities.sendMouseMoveOnEntity(entity, pointerEvent);
|
Entities.sendMouseMoveOnEntity(entity, pointerEvent);
|
||||||
|
@ -2198,9 +2192,7 @@ function MyController(hand) {
|
||||||
normal: intersectInfo.normal,
|
normal: intersectInfo.normal,
|
||||||
direction: intersectInfo.searchRay.direction,
|
direction: intersectInfo.searchRay.direction,
|
||||||
button: "Primary",
|
button: "Primary",
|
||||||
isPrimaryButton: true,
|
isPrimaryHeld: true
|
||||||
isSecondaryButton: false,
|
|
||||||
isTertiaryButton: false
|
|
||||||
};
|
};
|
||||||
|
|
||||||
Entities.sendMousePressOnEntity(this.grabbedEntity, pointerEvent);
|
Entities.sendMousePressOnEntity(this.grabbedEntity, pointerEvent);
|
||||||
|
@ -2226,15 +2218,12 @@ function MyController(hand) {
|
||||||
pos3D: intersectInfo.point,
|
pos3D: intersectInfo.point,
|
||||||
normal: intersectInfo.normal,
|
normal: intersectInfo.normal,
|
||||||
direction: intersectInfo.searchRay.direction,
|
direction: intersectInfo.searchRay.direction,
|
||||||
button: "Primary",
|
button: "Primary"
|
||||||
isPrimaryButton: false,
|
|
||||||
isSecondaryButton: false,
|
|
||||||
isTertiaryButton: false
|
|
||||||
};
|
};
|
||||||
} else {
|
} else {
|
||||||
pointerEvent = this.touchingEnterPointerEvent;
|
pointerEvent = this.touchingEnterPointerEvent;
|
||||||
pointerEvent.button = "Primary";
|
pointerEvent.button = "Primary";
|
||||||
pointerEvent.isPrimaryButton = false;
|
pointerEvent.isPrimaryHeld = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
Entities.sendMouseReleaseOnEntity(this.grabbedEntity, pointerEvent);
|
Entities.sendMouseReleaseOnEntity(this.grabbedEntity, pointerEvent);
|
||||||
|
@ -2271,9 +2260,7 @@ function MyController(hand) {
|
||||||
normal: intersectInfo.normal,
|
normal: intersectInfo.normal,
|
||||||
direction: intersectInfo.searchRay.direction,
|
direction: intersectInfo.searchRay.direction,
|
||||||
button: "NoButtons",
|
button: "NoButtons",
|
||||||
isPrimaryButton: true,
|
isPrimaryHeld: true
|
||||||
isSecondaryButton: false,
|
|
||||||
isTertiaryButton: false
|
|
||||||
};
|
};
|
||||||
|
|
||||||
var POINTER_PRESS_TO_MOVE_DELAY = 0.15; // seconds
|
var POINTER_PRESS_TO_MOVE_DELAY = 0.15; // seconds
|
||||||
|
|
Loading…
Reference in a new issue