mirror of
https://github.com/nasa/openmct.git
synced 2025-06-22 17:08:57 +00:00
Review and integrate mobile-2008 (#2040)
Fixes #2008 * Viewport metatag updated * Fix to Time Conductor for Safari * Remove data visualization element in TC * Hide TC ticks when on mobile * Add touch functionality to mct-drag * Reduced size of image thumbnails; Changed min-heights of image and thumbnail holders for .mobile.phone * remove create dialog from mobile
This commit is contained in:
committed by
Andrew Henry
parent
e19ce4ac8c
commit
c909831dd4
@ -46,7 +46,7 @@ define(
|
||||
* @constructor
|
||||
*
|
||||
*/
|
||||
function MCTDrag($document) {
|
||||
function MCTDrag($document, agentService) {
|
||||
|
||||
// Link; install event handlers.
|
||||
function link(scope, element, attrs) {
|
||||
@ -55,10 +55,26 @@ define(
|
||||
// only be attached to the element being linked, as the
|
||||
// mouse may leave this element during the drag.
|
||||
var body = $document.find('body'),
|
||||
isMobile = agentService.isMobile(),
|
||||
touchEvents,
|
||||
initialPosition,
|
||||
$event,
|
||||
delta;
|
||||
|
||||
if (isMobile) {
|
||||
touchEvents = {
|
||||
start: 'touchstart',
|
||||
end: 'touchend',
|
||||
move: 'touchmove'
|
||||
};
|
||||
} else {
|
||||
touchEvents = {
|
||||
start: 'mousedown',
|
||||
end: "mouseup",
|
||||
move: "mousemove"
|
||||
};
|
||||
}
|
||||
|
||||
// Utility function to cause evaluation of mctDrag,
|
||||
// mctDragUp, etc
|
||||
function fireListener(name) {
|
||||
@ -103,8 +119,8 @@ define(
|
||||
// Called only when the drag ends (on mouseup)
|
||||
function endDrag(event) {
|
||||
// Detach event handlers
|
||||
body.off("mouseup", endDrag);
|
||||
body.off("mousemove", continueDrag);
|
||||
body.off(touchEvents.end, endDrag);
|
||||
body.off(touchEvents.move, continueDrag);
|
||||
|
||||
// Also call continueDrag, to fire mctDrag
|
||||
// and do its usual position update
|
||||
@ -125,8 +141,8 @@ define(
|
||||
// Listen for mouse events at the body level,
|
||||
// since the mouse may leave the element during
|
||||
// the drag.
|
||||
body.on("mouseup", endDrag);
|
||||
body.on("mousemove", continueDrag);
|
||||
body.on(touchEvents.end, endDrag);
|
||||
body.on(touchEvents.move, continueDrag);
|
||||
|
||||
// Set an initial position
|
||||
updatePosition(event);
|
||||
@ -141,8 +157,8 @@ define(
|
||||
return false;
|
||||
}
|
||||
|
||||
// Listen for mousedown on the element
|
||||
element.on("mousedown", startDrag);
|
||||
// Listen for start event on the element
|
||||
element.on(touchEvents.start, startDrag);
|
||||
}
|
||||
|
||||
return {
|
||||
|
Reference in New Issue
Block a user