diff --git a/platform/commonUI/inspect/src/gestures/InfoGesture.js b/platform/commonUI/inspect/src/gestures/InfoGesture.js index b01902d78f..67107773f5 100644 --- a/platform/commonUI/inspect/src/gestures/InfoGesture.js +++ b/platform/commonUI/inspect/src/gestures/InfoGesture.js @@ -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 diff --git a/platform/representation/bundle.json b/platform/representation/bundle.json index 64fc1b0f27..cbbe058701 100644 --- a/platform/representation/bundle.json +++ b/platform/representation/bundle.json @@ -26,7 +26,7 @@ { "key": "menu", "implementation": "gestures/ContextMenuGesture.js", - "depends": [ "$compile", "$document", "$window", "$rootScope", "queryService" ] + "depends": [ "$timeout", "$compile", "$document", "$window", "$rootScope", "queryService" ] } ], "components": [ diff --git a/platform/representation/src/gestures/ContextMenuGesture.js b/platform/representation/src/gestures/ContextMenuGesture.js index 298d34face..e7a9fe27f3 100644 --- a/platform/representation/src/gestures/ContextMenuGesture.js +++ b/platform/representation/src/gestures/ContextMenuGesture.js @@ -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