mirror of
https://github.com/nasa/openmct.git
synced 2025-04-12 05:40:17 +00:00
[Mobile] Starting Context
Added check to make sure user is touching only one object. Started contextmenugesture to be long touch, however currently long touch is still infogesture.
This commit is contained in:
parent
c85a3787c0
commit
3d0795cde3
@ -103,17 +103,20 @@ define(
|
||||
}
|
||||
|
||||
function showTouchBubble(event) {
|
||||
trackTouchPosition(event);
|
||||
pendingBubble = $timeout(function () {
|
||||
dismissBubble = infoService.display(
|
||||
"info-table",
|
||||
domainObject.getModel().name,
|
||||
domainObject.useCapability('metadata'),
|
||||
touchPosition
|
||||
);
|
||||
}, touchDELAY);
|
||||
// Makes sure user is only touching one place
|
||||
if (event.touches.length < 2) {
|
||||
trackTouchPosition(event);
|
||||
pendingBubble = $timeout(function () {
|
||||
dismissBubble = infoService.display(
|
||||
"info-table",
|
||||
domainObject.getModel().name,
|
||||
domainObject.useCapability('metadata'),
|
||||
touchPosition
|
||||
);
|
||||
}, touchDELAY);
|
||||
|
||||
element.on('touchend', hideBubble);
|
||||
element.on('touchend', hideBubble);
|
||||
}
|
||||
}
|
||||
|
||||
// Checks if you are on a mobile device, if the device is
|
||||
|
@ -26,7 +26,7 @@
|
||||
{
|
||||
"key": "menu",
|
||||
"implementation": "gestures/ContextMenuGesture.js",
|
||||
"depends": [ "$compile", "$document", "$window", "$rootScope", "queryService" ]
|
||||
"depends": [ "$timeout", "$compile", "$document", "$window", "$rootScope", "queryService" ]
|
||||
}
|
||||
],
|
||||
"components": [
|
||||
|
@ -50,7 +50,7 @@ define(
|
||||
* @param {DomainObject} domainObject the object on which actions
|
||||
* in the context menu will be performed
|
||||
*/
|
||||
function ContextMenuGesture($compile, $document, $window, $rootScope, queryService, element, domainObject) {
|
||||
function ContextMenuGesture($timeout, $compile, $document, $window, $rootScope, queryService, element, domainObject) {
|
||||
function showMenu(event) {
|
||||
var winDim = [$window.innerWidth, $window.innerHeight],
|
||||
eventCoors = [event.pageX, event.pageY],
|
||||
@ -101,6 +101,59 @@ define(
|
||||
// Don't launch browser's context menu
|
||||
event.preventDefault();
|
||||
}
|
||||
|
||||
// function showTouchMenu(event) {
|
||||
// var winDim = [$window.innerWidth, $window.innerHeight],
|
||||
// eventCoors = [event.pageX, event.pageY],
|
||||
// menuDim = GestureConstants.MCT_MENU_DIMENSIONS,
|
||||
// body = $document.find('body'),
|
||||
// scope = $rootScope.$new(),
|
||||
// goLeft = eventCoors[0] + menuDim[0] > winDim[0],
|
||||
// goUp = eventCoors[1] + menuDim[1] > winDim[1],
|
||||
// menu;
|
||||
//
|
||||
// // Remove the context menu
|
||||
// function dismiss() {
|
||||
// menu.remove();
|
||||
// body.off("click", dismiss);
|
||||
// dismissExistingMenu = undefined;
|
||||
// }
|
||||
//
|
||||
// if (event.touches.length < 2) {
|
||||
// // Dismiss any menu which was already showing
|
||||
// if (dismissExistingMenu) {
|
||||
// dismissExistingMenu();
|
||||
// }
|
||||
//
|
||||
// // ...and record the presence of this menu.
|
||||
// dismissExistingMenu = dismiss;
|
||||
//
|
||||
// // Set up the scope, including menu positioning
|
||||
// scope.domainObject = domainObject;
|
||||
// scope.menuStyle = {};
|
||||
// scope.menuStyle[goLeft ? "right" : "left"] =
|
||||
// (goLeft ? (winDim[0] - eventCoors[0]) : eventCoors[0]) + 'px';
|
||||
// scope.menuStyle[goUp ? "bottom" : "top"] =
|
||||
// (goUp ? (winDim[1] - eventCoors[1]) : eventCoors[1]) + 'px';
|
||||
// scope.menuClass = {
|
||||
// "go-left": goLeft,
|
||||
// "go-up": goUp,
|
||||
// "context-menu-holder": true
|
||||
// };
|
||||
//
|
||||
// // Create the context menu
|
||||
// menu = $compile(MENU_TEMPLATE)(scope);
|
||||
//
|
||||
// // Add the menu to the body
|
||||
// body.append(menu);
|
||||
//
|
||||
// // Dismiss the menu when body is clicked elsewhere
|
||||
// body.on('click', dismiss);
|
||||
//
|
||||
// // Don't launch browser's context menu
|
||||
// event.preventDefault();
|
||||
// }
|
||||
// }
|
||||
|
||||
// Iff the user is not on a mobile device, then when
|
||||
// the context menu event occurs, show object actions instead
|
||||
|
Loading…
x
Reference in New Issue
Block a user