Ejemplo n.º 1
0
	indexChanged: function (was) {
		var current, delta, deltaAbs, idx;

		this.assignBreadcrumbIndex();

		// Set animation direction to use proper timing function before start animation
		// This direction is only consumed by MoonAnimator.
		this.$.animator.direction = this.getDirection();

		this.adjustFirstPanelBeforeTransition();

		// Push or drop history, based on the direction of the index change
		if (this.allowBackKey) {
			was = was || 0;
			delta = this.index - was;
			deltaAbs = Math.abs(delta);

			if (delta > 0) {
				for (idx = 0; idx < deltaAbs; idx++) {
					this.pushBackHistory(idx + was);
				}
			} else {
				current = EnyoHistory.peek();

				// ensure we have history to drop - if the first history entry's index corresponds
				// to the index prior to our current index, we assume the other entries exist
				if (current && current.index + 1 == was) {
					EnyoHistory.drop(deltaAbs);
				}
			}
		}

		Panels.prototype.indexChanged.apply(this, arguments);
	},
Ejemplo n.º 2
0
	openChanged: function () {
		this.$.drawer.set('spotlightDisabled', !this.getOpen());
		this.setActive(this.getOpen());
		this.doListActionOpenChanged({open: this.open});

		if (this.allowBackKey) {
			if (this.open) this.pushBackHistory();
			else if (!EnyoHistory.isProcessing()) EnyoHistory.drop();
		}

		// If opened, show drawer and resize it if needed
		if (this.open) {
			if (this.drawerNeedsResize) {
				this.resizeDrawer();
				this.drawerNeedsResize = false;
			}
			// Capture onSpotlightFocus happening outside the drawer, so that we can prevent focus
			// from landing in the header beneath the drawer
			dispatcher.capture(this.$.drawer, {onSpotlightFocus: 'capturedSpotlightFocus'}, this);
		} else {
			dispatcher.release(this.$.drawer);
		}
	},
Ejemplo n.º 3
0
	removeHistoryEntry: function () {
		if (this.allowBackKey && this.hasHistoryEntry) {
			EnyoHistory.drop();
			this.hasHistoryEntry = false;
		}
	},