[Mobile] Gestures
Now to dismiss bubble, touch anywhere the touch will not fire other gestures (such as the pressing of another object).
This commit is contained in:
@@ -39,7 +39,6 @@ define(
|
|||||||
*/
|
*/
|
||||||
function InfoGestureButton($document, agentService, infoService, element, domainObject) {
|
function InfoGestureButton($document, agentService, infoService, element, domainObject) {
|
||||||
var dismissBubble,
|
var dismissBubble,
|
||||||
pendingBubble,
|
|
||||||
touchPosition,
|
touchPosition,
|
||||||
scopeOff,
|
scopeOff,
|
||||||
body = $document.find('body');
|
body = $document.find('body');
|
||||||
@@ -59,6 +58,7 @@ define(
|
|||||||
dismissBubble();
|
dismissBubble();
|
||||||
dismissBubble = undefined;
|
dismissBubble = undefined;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Detaches body touch listener
|
// Detaches body touch listener
|
||||||
body.off('touchstart', hideBubble);
|
body.off('touchstart', hideBubble);
|
||||||
}
|
}
|
||||||
@@ -71,14 +71,21 @@ define(
|
|||||||
|
|
||||||
// Show the bubble, but on any touchstart on the
|
// Show the bubble, but on any touchstart on the
|
||||||
// body (anywhere) call hidebubble
|
// body (anywhere) call hidebubble
|
||||||
pendingBubble =
|
|
||||||
dismissBubble = infoService.display(
|
dismissBubble = infoService.display(
|
||||||
"info-table",
|
"info-table",
|
||||||
domainObject.getModel().name,
|
domainObject.getModel().name,
|
||||||
domainObject.useCapability('metadata'),
|
domainObject.useCapability('metadata'),
|
||||||
touchPosition
|
touchPosition
|
||||||
);
|
);
|
||||||
body.on('touchstart', hideBubble);
|
|
||||||
|
// On any touch on the body, default body touches/events
|
||||||
|
// are prevented, the bubble is dismissed, and the touchstart
|
||||||
|
// body event is unbound, reallowing gestures
|
||||||
|
body.on('touchstart', function (event) {
|
||||||
|
event.preventDefault();
|
||||||
|
hideBubble();
|
||||||
|
body.unbind('touchstart');
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
// Checks if you are on a mobile device, if the device is
|
// Checks if you are on a mobile device, if the device is
|
||||||
|
|||||||
@@ -62,9 +62,10 @@ define(
|
|||||||
// to where clicked or pressed)
|
// to where clicked or pressed)
|
||||||
bubble.css('position', 'absolute');
|
bubble.css('position', 'absolute');
|
||||||
if (agentService.isPhone(navigator.userAgent)) {
|
if (agentService.isPhone(navigator.userAgent)) {
|
||||||
bubble.css('right', 5 + 'px');
|
bubble.css('right', 0 + 'px');
|
||||||
bubble.css('left', 5 + 'px');
|
bubble.css('left', 0 + 'px');
|
||||||
bubble.css('top', 40 + 'px');
|
bubble.css('top', 'auto');
|
||||||
|
bubble.css('bottom', 25 + 'px');
|
||||||
} else {
|
} else {
|
||||||
if (goLeft) {
|
if (goLeft) {
|
||||||
bubble.css('right', (winDim[0] - position[0] + OFFSET[0]) + 'px');
|
bubble.css('right', (winDim[0] - position[0] + OFFSET[0]) + 'px');
|
||||||
|
|||||||
Reference in New Issue
Block a user