mirror of
https://github.com/nasa/openmct.git
synced 2025-04-19 16:40:58 +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:
parent
b0c42c12b7
commit
e32403a75f
@ -20,6 +20,7 @@
|
||||
at runtime from the About dialog for additional information.
|
||||
-->
|
||||
|
||||
<!-- Back Arrow Icon used on mobile-->
|
||||
<span ng-controller="BrowseController"
|
||||
ng-click="backArrow()">
|
||||
<a class='icon ui-symbol mobile-back-arrow'><</a>
|
||||
|
@ -25,7 +25,7 @@
|
||||
<mct-representation key="'object-header'" mct-object="domainObject">
|
||||
</mct-representation>
|
||||
</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">
|
||||
<mct-representation key="'action-group'"
|
||||
mct-object="domainObject"
|
||||
|
@ -64,23 +64,6 @@ define(
|
||||
// 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
|
||||
// that is currently navigated-to.
|
||||
@ -142,6 +125,10 @@ define(
|
||||
navigateTo(domainObject);
|
||||
}
|
||||
}
|
||||
|
||||
function updateRouteBackArrow() {
|
||||
console.log("Back Arrow");
|
||||
}
|
||||
|
||||
// Load the root object, put it in the scope.
|
||||
// Also, load its immediate children, and (possibly)
|
||||
@ -172,7 +159,7 @@ define(
|
||||
navigationService.removeListener(setNavigation);
|
||||
});
|
||||
|
||||
$scope.backArrow = backArr;
|
||||
$scope.backArrow = updateRouteBackArrow;
|
||||
|
||||
}
|
||||
|
||||
|
@ -52,7 +52,7 @@ define(
|
||||
beforeEach(function () {
|
||||
mockScope = jasmine.createSpyObj(
|
||||
"$scope",
|
||||
[ "$on", "$watch", "treeSlide" ]
|
||||
[ "$on", "$watch", "treeSlide", "backArrow" ]
|
||||
);
|
||||
mockRoute = { current: { params: {} } };
|
||||
mockLocation = jasmine.createSpyObj(
|
||||
@ -244,7 +244,13 @@ define(
|
||||
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",
|
||||
"implementation": "controllers/TreeNodeController.js",
|
||||
"depends": [ "$scope", "$timeout", "$rootScope", "queryService" ]
|
||||
"depends": [ "$scope", "$timeout", "queryService" ]
|
||||
},
|
||||
{
|
||||
"key": "ActionGroupController",
|
||||
|
@ -891,22 +891,22 @@ mct-container {
|
||||
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) {
|
||||
/* line 175, ../sass/mobile/_layout.scss */
|
||||
/* line 176, ../sass/mobile/_layout.scss */
|
||||
.desktop-hide {
|
||||
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) {
|
||||
/* line 182, ../sass/mobile/_layout.scss */
|
||||
/* line 183, ../sass/mobile/_layout.scss */
|
||||
.mobile-hide {
|
||||
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) {
|
||||
/* line 189, ../sass/mobile/_layout.scss */
|
||||
/* line 190, ../sass/mobile/_layout.scss */
|
||||
.phone-hide {
|
||||
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) {
|
||||
/* line 195, ../sass/mobile/_layout.scss */
|
||||
/* line 196, ../sass/mobile/_layout.scss */
|
||||
.tree-holder {
|
||||
overflow-x: hidden !important; } }
|
||||
|
||||
|
@ -168,6 +168,7 @@
|
||||
}
|
||||
|
||||
.mobile-back-arrow {
|
||||
// display: none !important;
|
||||
// font-size: 0.8em;
|
||||
}
|
||||
|
||||
|
@ -50,7 +50,7 @@ define(
|
||||
* expand-to-show-navigated-object behavior.)
|
||||
* @constructor
|
||||
*/
|
||||
function TreeNodeController($scope, $timeout, $rootScope, queryService) {
|
||||
function TreeNodeController($scope, $timeout, queryService) {
|
||||
var selectedObject = ($scope.ngModel || {}).selectedObject,
|
||||
isSelected = false,
|
||||
hasBeenExpanded = false;
|
||||
|
@ -55,22 +55,13 @@ define(
|
||||
return path;
|
||||
}
|
||||
|
||||
function urlForLastLocation(mode, domainObject) {
|
||||
var context = domainObject &&
|
||||
domainObject.getCapability('context'),
|
||||
objectPath = context ? context.getPath() : [],
|
||||
editedPath = (objectPath.length > 1) ? objectPath.slice(0, -1) : objectPath,
|
||||
ids = editedPath.map(function (domainObject) {
|
||||
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;
|
||||
}
|
||||
// function idForLevelArrow(domainObject) {
|
||||
// var context = domainObject &&
|
||||
// domainObject.getCapability('context'),
|
||||
// objectPath = context ? context.getPath() : [],
|
||||
// id = objectPath[objectPath.length - 2];
|
||||
// return id;
|
||||
// }
|
||||
|
||||
// Uses the Url for the current location
|
||||
// from the urlForLocation function and
|
||||
@ -81,13 +72,7 @@ define(
|
||||
"index.html#" + urlForLocation(mode, domainObject) + viewPath;
|
||||
return newTabPath;
|
||||
}
|
||||
|
||||
function urlForBack(mode, domainObject) {
|
||||
var newTabPath =
|
||||
"index.html#/" + urlForLastLocation(mode, domainObject);
|
||||
return newTabPath;
|
||||
}
|
||||
|
||||
|
||||
return {
|
||||
/**
|
||||
* Returns the Url path for a specific domain object
|
||||
@ -107,9 +92,9 @@ define(
|
||||
* @param {DomainObject} value of the domain object
|
||||
* 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 () {
|
||||
controller.checkMobile();
|
||||
if (controller) {
|
||||
controller.checkMobile();
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
|
@ -52,12 +52,12 @@ define(
|
||||
mousePosition = [ event.clientX, event.clientY ];
|
||||
}
|
||||
|
||||
function trackTouchPosition(event) {
|
||||
var tEvent = event.changedTouches[0];
|
||||
// Record mouse position, so bubble can be shown at latest
|
||||
// mouse position (not just where the mouse entered)
|
||||
touchPosition = [ tEvent.clientX + 44, tEvent.clientY ];
|
||||
}
|
||||
// function trackTouchPosition(event) {
|
||||
// var tEvent = event.changedTouches[0];
|
||||
// // Record mouse position, so bubble can be shown at latest
|
||||
// // mouse position (not just where the mouse entered)
|
||||
// touchPosition = [ tEvent.clientX + 44, tEvent.clientY ];
|
||||
// }
|
||||
|
||||
function hideBubble() {
|
||||
// If a bubble is showing, dismiss it
|
||||
@ -102,22 +102,22 @@ define(
|
||||
element.on('mouseleave', hideBubble);
|
||||
}
|
||||
|
||||
function showTouchBubble(event) {
|
||||
// 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);
|
||||
}
|
||||
}
|
||||
// function showTouchBubble(event) {
|
||||
// // 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);
|
||||
// }
|
||||
// }
|
||||
|
||||
// Checks if you are on a mobile device, if the device is
|
||||
// not mobile (queryService.isMobile() = false), then
|
||||
@ -126,9 +126,6 @@ define(
|
||||
// Show bubble (on a timeout) on mouse over
|
||||
element.on('mouseenter', showBubble);
|
||||
}
|
||||
// else if (queryService.isMobile(navigator.userAgent)) {
|
||||
// element.on('touchstart', showTouchBubble);
|
||||
// }
|
||||
|
||||
// Also make sure we dismiss bubble if representation is destroyed
|
||||
// before the mouse actually leaves it
|
||||
|
Loading…
x
Reference in New Issue
Block a user