mirror of
https://github.com/nasa/openmct.git
synced 2025-06-14 05:08:15 +00:00
[Mobile] Clean-Up
Cleaned the unused code for the backArrow and long touch gestures. Commented out functions for later use Currently shows the back arrow, however, only will print to console on press. Edited tests where mobile checks were breaking and fixed.
This commit is contained in:
@ -20,6 +20,7 @@
|
|||||||
at runtime from the About dialog for additional information.
|
at runtime from the About dialog for additional information.
|
||||||
-->
|
-->
|
||||||
|
|
||||||
|
<!-- Back Arrow Icon used on mobile-->
|
||||||
<span ng-controller="BrowseController"
|
<span ng-controller="BrowseController"
|
||||||
ng-click="backArrow()">
|
ng-click="backArrow()">
|
||||||
<a class='icon ui-symbol mobile-back-arrow'><</a>
|
<a class='icon ui-symbol mobile-back-arrow'><</a>
|
||||||
|
@ -25,7 +25,7 @@
|
|||||||
<mct-representation key="'object-header'" mct-object="domainObject">
|
<mct-representation key="'object-header'" mct-object="domainObject">
|
||||||
</mct-representation>
|
</mct-representation>
|
||||||
</div>
|
</div>
|
||||||
<!-- For now, on mobile the button bar is hidden-->
|
<!-- Temporarily, on mobile, the button bar is hidden-->
|
||||||
<div class="btn-bar right abs mobile-hide">
|
<div class="btn-bar right abs mobile-hide">
|
||||||
<mct-representation key="'action-group'"
|
<mct-representation key="'action-group'"
|
||||||
mct-object="domainObject"
|
mct-object="domainObject"
|
||||||
|
@ -64,23 +64,6 @@ define(
|
|||||||
// domainObject
|
// domainObject
|
||||||
$location.path(urlService.urlForLocation("browse", domainObject));
|
$location.path(urlService.urlForLocation("browse", domainObject));
|
||||||
}
|
}
|
||||||
|
|
||||||
function backArr() {
|
|
||||||
var priorRoute = $route.current,
|
|
||||||
// Act as if params HADN'T changed to avoid page reload
|
|
||||||
unlisten;
|
|
||||||
|
|
||||||
unlisten = $scope.$on('$locationChangeSuccess', function () {
|
|
||||||
// Checks path to make sure /browse/ is at front
|
|
||||||
// if so, change $route.current
|
|
||||||
if ($location.path().indexOf("/browse/") === 0) {
|
|
||||||
$route.current = priorRoute;
|
|
||||||
}
|
|
||||||
unlisten();
|
|
||||||
});
|
|
||||||
console.log(urlService.urlForBack("browse", $scope.navigatedObject));
|
|
||||||
$location.path(urlService.urlForBack("browse", $scope.navigatedObject));
|
|
||||||
}
|
|
||||||
|
|
||||||
// Callback for updating the in-scope reference to the object
|
// Callback for updating the in-scope reference to the object
|
||||||
// that is currently navigated-to.
|
// that is currently navigated-to.
|
||||||
@ -142,6 +125,10 @@ define(
|
|||||||
navigateTo(domainObject);
|
navigateTo(domainObject);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function updateRouteBackArrow() {
|
||||||
|
console.log("Back Arrow");
|
||||||
|
}
|
||||||
|
|
||||||
// Load the root object, put it in the scope.
|
// Load the root object, put it in the scope.
|
||||||
// Also, load its immediate children, and (possibly)
|
// Also, load its immediate children, and (possibly)
|
||||||
@ -172,7 +159,7 @@ define(
|
|||||||
navigationService.removeListener(setNavigation);
|
navigationService.removeListener(setNavigation);
|
||||||
});
|
});
|
||||||
|
|
||||||
$scope.backArrow = backArr;
|
$scope.backArrow = updateRouteBackArrow;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -52,7 +52,7 @@ define(
|
|||||||
beforeEach(function () {
|
beforeEach(function () {
|
||||||
mockScope = jasmine.createSpyObj(
|
mockScope = jasmine.createSpyObj(
|
||||||
"$scope",
|
"$scope",
|
||||||
[ "$on", "$watch", "treeSlide" ]
|
[ "$on", "$watch", "treeSlide", "backArrow" ]
|
||||||
);
|
);
|
||||||
mockRoute = { current: { params: {} } };
|
mockRoute = { current: { params: {} } };
|
||||||
mockLocation = jasmine.createSpyObj(
|
mockLocation = jasmine.createSpyObj(
|
||||||
@ -244,7 +244,13 @@ define(
|
|||||||
mockUrlService.urlForLocation(mockMode, mockNextObject)
|
mockUrlService.urlForLocation(mockMode, mockNextObject)
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// Mocks the back arrow call that
|
||||||
|
// lets the html code know the back
|
||||||
|
// arrow navigation needs to be done
|
||||||
|
it("calls the backArrow function", function () {
|
||||||
|
mockScope.backArrow();
|
||||||
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
@ -65,7 +65,7 @@
|
|||||||
{
|
{
|
||||||
"key": "TreeNodeController",
|
"key": "TreeNodeController",
|
||||||
"implementation": "controllers/TreeNodeController.js",
|
"implementation": "controllers/TreeNodeController.js",
|
||||||
"depends": [ "$scope", "$timeout", "$rootScope", "queryService" ]
|
"depends": [ "$scope", "$timeout", "queryService" ]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"key": "ActionGroupController",
|
"key": "ActionGroupController",
|
||||||
|
@ -891,22 +891,22 @@ mct-container {
|
|||||||
opacity: 1 !important; } }
|
opacity: 1 !important; } }
|
||||||
|
|
||||||
@media screen and (min-device-width: 800px) and (min-device-height: 1025px), screen and (min-device-width: 1025px) and (min-device-height: 800px) {
|
@media screen and (min-device-width: 800px) and (min-device-height: 1025px), screen and (min-device-width: 1025px) and (min-device-height: 800px) {
|
||||||
/* line 175, ../sass/mobile/_layout.scss */
|
/* line 176, ../sass/mobile/_layout.scss */
|
||||||
.desktop-hide {
|
.desktop-hide {
|
||||||
display: none; } }
|
display: none; } }
|
||||||
|
|
||||||
@media screen and (orientation: portrait) and (max-width: 514px) and (max-height: 740px) and (max-device-width: 799px) and (max-device-height: 1024px), screen and (orientation: landscape) and (max-height: 514px) and (max-width: 740px) and (max-device-width: 799px) and (max-device-height: 1024px), screen and (orientation: landscape) and (max-height: 514px) and (max-width: 740px) and (max-device-width: 1024px) and (max-device-height: 799px), screen and (orientation: portrait) and (min-width: 515px) and (max-width: 799px) and (min-height: 741px) and (max-height: 1024px) and (max-device-width: 799px) and (max-device-height: 1024px), screen and (orientation: landscape) and (min-height: 515px) and (max-height: 799px) and (min-width: 741px) and (max-width: 1024px) and (max-device-width: 799px) and (max-device-height: 1024px), screen and (orientation: landscape) and (min-height: 515px) and (max-height: 799px) and (min-width: 741px) and (max-width: 1024px) and (max-device-width: 1024px) and (max-device-height: 799px) {
|
@media screen and (orientation: portrait) and (max-width: 514px) and (max-height: 740px) and (max-device-width: 799px) and (max-device-height: 1024px), screen and (orientation: landscape) and (max-height: 514px) and (max-width: 740px) and (max-device-width: 799px) and (max-device-height: 1024px), screen and (orientation: landscape) and (max-height: 514px) and (max-width: 740px) and (max-device-width: 1024px) and (max-device-height: 799px), screen and (orientation: portrait) and (min-width: 515px) and (max-width: 799px) and (min-height: 741px) and (max-height: 1024px) and (max-device-width: 799px) and (max-device-height: 1024px), screen and (orientation: landscape) and (min-height: 515px) and (max-height: 799px) and (min-width: 741px) and (max-width: 1024px) and (max-device-width: 799px) and (max-device-height: 1024px), screen and (orientation: landscape) and (min-height: 515px) and (max-height: 799px) and (min-width: 741px) and (max-width: 1024px) and (max-device-width: 1024px) and (max-device-height: 799px) {
|
||||||
/* line 182, ../sass/mobile/_layout.scss */
|
/* line 183, ../sass/mobile/_layout.scss */
|
||||||
.mobile-hide {
|
.mobile-hide {
|
||||||
display: none; } }
|
display: none; } }
|
||||||
|
|
||||||
@media screen and (orientation: portrait) and (max-width: 514px) and (max-height: 740px) and (max-device-width: 799px) and (max-device-height: 1024px), screen and (orientation: landscape) and (max-height: 514px) and (max-width: 740px) and (max-device-width: 799px) and (max-device-height: 1024px), screen and (orientation: landscape) and (max-height: 514px) and (max-width: 740px) and (max-device-width: 1024px) and (max-device-height: 799px) {
|
@media screen and (orientation: portrait) and (max-width: 514px) and (max-height: 740px) and (max-device-width: 799px) and (max-device-height: 1024px), screen and (orientation: landscape) and (max-height: 514px) and (max-width: 740px) and (max-device-width: 799px) and (max-device-height: 1024px), screen and (orientation: landscape) and (max-height: 514px) and (max-width: 740px) and (max-device-width: 1024px) and (max-device-height: 799px) {
|
||||||
/* line 189, ../sass/mobile/_layout.scss */
|
/* line 190, ../sass/mobile/_layout.scss */
|
||||||
.phone-hide {
|
.phone-hide {
|
||||||
display: none; } }
|
display: none; } }
|
||||||
|
|
||||||
@media screen and (orientation: portrait) and (max-width: 514px) and (max-height: 740px) and (max-device-width: 799px) and (max-device-height: 1024px), screen and (orientation: landscape) and (max-height: 514px) and (max-width: 740px) and (max-device-width: 799px) and (max-device-height: 1024px), screen and (orientation: landscape) and (max-height: 514px) and (max-width: 740px) and (max-device-width: 1024px) and (max-device-height: 799px), screen and (orientation: portrait) and (min-width: 515px) and (max-width: 799px) and (min-height: 741px) and (max-height: 1024px) and (max-device-width: 799px) and (max-device-height: 1024px), screen and (orientation: landscape) and (min-height: 515px) and (max-height: 799px) and (min-width: 741px) and (max-width: 1024px) and (max-device-width: 799px) and (max-device-height: 1024px), screen and (orientation: landscape) and (min-height: 515px) and (max-height: 799px) and (min-width: 741px) and (max-width: 1024px) and (max-device-width: 1024px) and (max-device-height: 799px) {
|
@media screen and (orientation: portrait) and (max-width: 514px) and (max-height: 740px) and (max-device-width: 799px) and (max-device-height: 1024px), screen and (orientation: landscape) and (max-height: 514px) and (max-width: 740px) and (max-device-width: 799px) and (max-device-height: 1024px), screen and (orientation: landscape) and (max-height: 514px) and (max-width: 740px) and (max-device-width: 1024px) and (max-device-height: 799px), screen and (orientation: portrait) and (min-width: 515px) and (max-width: 799px) and (min-height: 741px) and (max-height: 1024px) and (max-device-width: 799px) and (max-device-height: 1024px), screen and (orientation: landscape) and (min-height: 515px) and (max-height: 799px) and (min-width: 741px) and (max-width: 1024px) and (max-device-width: 799px) and (max-device-height: 1024px), screen and (orientation: landscape) and (min-height: 515px) and (max-height: 799px) and (min-width: 741px) and (max-width: 1024px) and (max-device-width: 1024px) and (max-device-height: 799px) {
|
||||||
/* line 195, ../sass/mobile/_layout.scss */
|
/* line 196, ../sass/mobile/_layout.scss */
|
||||||
.tree-holder {
|
.tree-holder {
|
||||||
overflow-x: hidden !important; } }
|
overflow-x: hidden !important; } }
|
||||||
|
|
||||||
|
@ -168,6 +168,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
.mobile-back-arrow {
|
.mobile-back-arrow {
|
||||||
|
// display: none !important;
|
||||||
// font-size: 0.8em;
|
// font-size: 0.8em;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -50,7 +50,7 @@ define(
|
|||||||
* expand-to-show-navigated-object behavior.)
|
* expand-to-show-navigated-object behavior.)
|
||||||
* @constructor
|
* @constructor
|
||||||
*/
|
*/
|
||||||
function TreeNodeController($scope, $timeout, $rootScope, queryService) {
|
function TreeNodeController($scope, $timeout, queryService) {
|
||||||
var selectedObject = ($scope.ngModel || {}).selectedObject,
|
var selectedObject = ($scope.ngModel || {}).selectedObject,
|
||||||
isSelected = false,
|
isSelected = false,
|
||||||
hasBeenExpanded = false;
|
hasBeenExpanded = false;
|
||||||
|
@ -55,22 +55,13 @@ define(
|
|||||||
return path;
|
return path;
|
||||||
}
|
}
|
||||||
|
|
||||||
function urlForLastLocation(mode, domainObject) {
|
// function idForLevelArrow(domainObject) {
|
||||||
var context = domainObject &&
|
// var context = domainObject &&
|
||||||
domainObject.getCapability('context'),
|
// domainObject.getCapability('context'),
|
||||||
objectPath = context ? context.getPath() : [],
|
// objectPath = context ? context.getPath() : [],
|
||||||
editedPath = (objectPath.length > 1) ? objectPath.slice(0, -1) : objectPath,
|
// id = objectPath[objectPath.length - 2];
|
||||||
ids = editedPath.map(function (domainObject) {
|
// return id;
|
||||||
return domainObject.getId();
|
// }
|
||||||
}),
|
|
||||||
// Parses the path together. Starts with the
|
|
||||||
// default index.html file, then the mode passed
|
|
||||||
// into the service, followed by ids in the url
|
|
||||||
// joined by '/', and lastly the view path from
|
|
||||||
// the current location
|
|
||||||
path = mode + "/" + ids.slice(1).join("/");
|
|
||||||
return path;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Uses the Url for the current location
|
// Uses the Url for the current location
|
||||||
// from the urlForLocation function and
|
// from the urlForLocation function and
|
||||||
@ -81,13 +72,7 @@ define(
|
|||||||
"index.html#" + urlForLocation(mode, domainObject) + viewPath;
|
"index.html#" + urlForLocation(mode, domainObject) + viewPath;
|
||||||
return newTabPath;
|
return newTabPath;
|
||||||
}
|
}
|
||||||
|
|
||||||
function urlForBack(mode, domainObject) {
|
|
||||||
var newTabPath =
|
|
||||||
"index.html#/" + urlForLastLocation(mode, domainObject);
|
|
||||||
return newTabPath;
|
|
||||||
}
|
|
||||||
|
|
||||||
return {
|
return {
|
||||||
/**
|
/**
|
||||||
* Returns the Url path for a specific domain object
|
* Returns the Url path for a specific domain object
|
||||||
@ -107,9 +92,9 @@ define(
|
|||||||
* @param {DomainObject} value of the domain object
|
* @param {DomainObject} value of the domain object
|
||||||
* to get the path of
|
* to get the path of
|
||||||
*/
|
*/
|
||||||
urlForLocation: urlForLocation,
|
urlForLocation: urlForLocation
|
||||||
|
|
||||||
urlForBack: urlForBack
|
// idForLevelArrow: idForLevelArrow
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -187,7 +187,9 @@ define(
|
|||||||
});
|
});
|
||||||
|
|
||||||
it("check if tree node is in a mobile device", function () {
|
it("check if tree node is in a mobile device", function () {
|
||||||
controller.checkMobile();
|
if (controller) {
|
||||||
|
controller.checkMobile();
|
||||||
|
}
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -52,12 +52,12 @@ define(
|
|||||||
mousePosition = [ event.clientX, event.clientY ];
|
mousePosition = [ event.clientX, event.clientY ];
|
||||||
}
|
}
|
||||||
|
|
||||||
function trackTouchPosition(event) {
|
// function trackTouchPosition(event) {
|
||||||
var tEvent = event.changedTouches[0];
|
// var tEvent = event.changedTouches[0];
|
||||||
// Record mouse position, so bubble can be shown at latest
|
// // Record mouse position, so bubble can be shown at latest
|
||||||
// mouse position (not just where the mouse entered)
|
// // mouse position (not just where the mouse entered)
|
||||||
touchPosition = [ tEvent.clientX + 44, tEvent.clientY ];
|
// touchPosition = [ tEvent.clientX + 44, tEvent.clientY ];
|
||||||
}
|
// }
|
||||||
|
|
||||||
function hideBubble() {
|
function hideBubble() {
|
||||||
// If a bubble is showing, dismiss it
|
// If a bubble is showing, dismiss it
|
||||||
@ -102,22 +102,22 @@ define(
|
|||||||
element.on('mouseleave', hideBubble);
|
element.on('mouseleave', hideBubble);
|
||||||
}
|
}
|
||||||
|
|
||||||
function showTouchBubble(event) {
|
// function showTouchBubble(event) {
|
||||||
// Makes sure user is only touching one place
|
// // Makes sure user is only touching one place
|
||||||
if (event.touches.length < 2) {
|
// if (event.touches.length < 2) {
|
||||||
trackTouchPosition(event);
|
// trackTouchPosition(event);
|
||||||
pendingBubble = $timeout(function () {
|
// pendingBubble = $timeout(function () {
|
||||||
dismissBubble = infoService.display(
|
// dismissBubble = infoService.display(
|
||||||
"info-table",
|
// "info-table",
|
||||||
domainObject.getModel().name,
|
// domainObject.getModel().name,
|
||||||
domainObject.useCapability('metadata'),
|
// domainObject.useCapability('metadata'),
|
||||||
touchPosition
|
// touchPosition
|
||||||
);
|
// );
|
||||||
}, touchDELAY);
|
// }, touchDELAY);
|
||||||
|
//
|
||||||
element.on('touchend', hideBubble);
|
// element.on('touchend', hideBubble);
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
|
|
||||||
// Checks if you are on a mobile device, if the device is
|
// Checks if you are on a mobile device, if the device is
|
||||||
// not mobile (queryService.isMobile() = false), then
|
// not mobile (queryService.isMobile() = false), then
|
||||||
@ -126,9 +126,6 @@ define(
|
|||||||
// Show bubble (on a timeout) on mouse over
|
// Show bubble (on a timeout) on mouse over
|
||||||
element.on('mouseenter', showBubble);
|
element.on('mouseenter', showBubble);
|
||||||
}
|
}
|
||||||
// else if (queryService.isMobile(navigator.userAgent)) {
|
|
||||||
// element.on('touchstart', showTouchBubble);
|
|
||||||
// }
|
|
||||||
|
|
||||||
// Also make sure we dismiss bubble if representation is destroyed
|
// Also make sure we dismiss bubble if representation is destroyed
|
||||||
// before the mouse actually leaves it
|
// before the mouse actually leaves it
|
||||||
|
Reference in New Issue
Block a user