diff options
author | bors-servo <lbergstrom+bors@mozilla.com> | 2018-10-30 03:41:52 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-10-30 03:41:52 -0400 |
commit | b5b8550fb206cf7159feed3ea14418b5c0358ee2 (patch) | |
tree | 953628bf45801bb71495f7556a8bd0b39418a8c0 /support/magicleap/Servo2D/code/inc/Servo2D.h | |
parent | 662fd0afa49ff48888e7f6fe42e23470117b2ddd (diff) | |
parent | fc38c04313f377daaaa378172b940b971e220d5c (diff) | |
download | servo-b5b8550fb206cf7159feed3ea14418b5c0358ee2.tar.gz servo-b5b8550fb206cf7159feed3ea14418b5c0358ee2.zip |
Auto merge of #22045 - asajeffrey:magicleap-follow-hyperlinks, r=paulrouget
Get the ML port to follow hyperlinks
<!-- Please describe your changes on the following line: -->
This PR adds some basic mouse support to the magic leap touchpad. Moves are mapped to mouse moves (for hover style) and trigger pulls are mapped to mouse clicks (for following hyperlinks).
---
<!-- Thank you for contributing to Servo! Please replace each `[ ]` by `[X]` when the step is complete, and replace `__` with appropriate data: -->
- [X] `./mach build -d` does not report any errors
- [X] `./mach test-tidy` does not report any errors
- [X] These changes do not require tests because we can't test on ML
<!-- Also, please make sure that "Allow edits from maintainers" checkbox is checked, so that we can help you if you get stuck somewhere along the way.-->
<!-- Pull requests that do not address these steps are welcome, but they will require additional verification as part of the review process. -->
<!-- Reviewable:start -->
---
This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/22045)
<!-- Reviewable:end -->
Diffstat (limited to 'support/magicleap/Servo2D/code/inc/Servo2D.h')
-rw-r--r-- | support/magicleap/Servo2D/code/inc/Servo2D.h | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/support/magicleap/Servo2D/code/inc/Servo2D.h b/support/magicleap/Servo2D/code/inc/Servo2D.h index 866f2e09e6c..2f76c306e7c 100644 --- a/support/magicleap/Servo2D/code/inc/Servo2D.h +++ b/support/magicleap/Servo2D/code/inc/Servo2D.h @@ -5,6 +5,9 @@ #include <lumin/LandscapeApp.h> #include <lumin/Prism.h> #include <lumin/event/ServerEvent.h> +#include <lumin/event/KeyInputEventData.h> +#include <lumin/event/ControlTouchPadInputEventData.h> +#include <lumin/node/QuadNode.h> #include <lumin/resource/PlanarResource.h> #include <SceneDescriptor.h> @@ -88,9 +91,18 @@ protected: * Handle events from the server */ virtual bool eventListener(lumin::ServerEvent* event) override; + bool touchpadEventListener(lumin::ControlTouchPadInputEventData* event); + bool keyEventListener(lumin::KeyInputEventData* event); + + /** + * Get the current cursor position, with respect to the viewport. + */ + glm::vec2 viewportCursorPosition(); + bool pointInsideViewport(glm::vec2 pt); private: lumin::Prism* prism_ = nullptr; // represents the bounded space where the App renders. lumin::PlanarResource* plane_ = nullptr; // the plane we're rendering into + lumin::QuadNode* content_node_ = nullptr; // the node containing the plane ServoInstance servo_ = nullptr; // the servo instance we're embedding }; |