How to use the @egjs/axes.DIRECTION_RIGHT function in @egjs/axes

To help you get started, we’ve selected a few @egjs/axes examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github naver / egjs-flicking / test / unit / methods.spec.js View on Github external
it("prev()", () => {
			// When
			// 1 -> 3
			inst.prev(0);
			// direction is from left to right.
			const direction1 = inst._conf.touch.direction;
			// 3 -> 2
			inst.prev(0);
			// direction is from left to right.
			const direction2 = inst._conf.touch.direction;
			// Then
			expect(direction1).to.be.equals(Axes.DIRECTION_RIGHT);
			expect(direction2).to.be.equals(Axes.DIRECTION_RIGHT);
		});
		it("next()", () => {
github naver / egjs-flicking / test / unit / methods.spec.js View on Github external
it("prev()", () => {
			// When
			// 1 -> 3
			inst.prev(0);
			// direction is from left to right.
			const direction1 = inst._conf.touch.direction;
			// 3 -> 2
			inst.prev(0);
			// direction is from left to right.
			const direction2 = inst._conf.touch.direction;
			// Then
			expect(direction1).to.be.equals(Axes.DIRECTION_RIGHT);
			expect(direction2).to.be.equals(Axes.DIRECTION_RIGHT);
		});
		it("next()", () => {
github naver / egjs-flicking / test / unit / events.spec.js View on Github external
// The panel restored in its original position?
					expect(currPos % inst._conf.panel.size === 0).to.be.ok;

					// Restored panel index value?
					expect(panelIndex).to.deep.equal({
							no: inst._conf.panel.no,
							index: inst._conf.panel.index
						});

					// Restore events are fired correctly?
					expect($el.eventFired).to.deep.equal(["beforeRestore", "flick", "restore"]);

					let direction = tutils.unique($el.eventDirection);

					// Direction value of restore event are right?
					expect(direction.length === 1 && direction[0] === Axes.DIRECTION_RIGHT).to.be.ok;

					done();
				});
		});
github naver / egjs-flicking / test / unit / events.spec.js View on Github external
tutils.simulator($el, { deltaX: 100, deltaY: 50 }, () => {
				// Is right during touch hold?
				expect(check(directionHold[id], Axes.DIRECTION_RIGHT)).to.be.ok;

				// Is right during touch unhold?
				expect(check(directionUnhold[id], Axes.DIRECTION_RIGHT)).to.be.ok;

				done();
			});
		});
github naver / egjs-flicking / dist / flicking.esm.js View on Github external
_proto._setAdaptiveHeight = function _setAdaptiveHeight(direction) {
      var conf = this._conf;
      var indexToMove = conf.indexToMove;
      var $children;
      var height;
      var $panel = indexToMove === 0 ? // panel moved by 1
      this["get" + (direction === Axes.DIRECTION_LEFT && "Next" || direction === Axes.DIRECTION_RIGHT && "Prev" || "") + "Element"]() : // panel moved by .moveTo()
      conf.panel.$list[conf.panel.currIndex + indexToMove];
      var $first = $panel.querySelector(":first-child");

      if ($first) {
        height = $first.getAttribute(DATA_HEIGHT);

        if (!height) {
          $children = $panel.children;
          height = utils.outerHeight($children.length > 1 ? ($panel.style.height = "auto", $panel) : $first);
          height > 0 && $first.setAttribute(DATA_HEIGHT, height);
        }

        height > 0 && (this.$wrapper.style.height = height + "px");
      }
    };
    /**
github naver / egjs-flicking / src / Flicking.js View on Github external
const panel = conf.panel;
		const circular = this.options.circular;
		const currentIndex = panel.index;
		let indexToMove;
		let isPositive;
		let no = noValue;

		no = utils.getNumValue(no, -1);

		if (no < 0 || no >= panel.origCount || no === panel.no ||
			panel.animating || conf.touch.holding) {
			return this;
		}

		indexToMove = no - (circular ? panel.no : currentIndex);
		if (direction === Axes.DIRECTION_RIGHT && indexToMove < 0) {
			indexToMove += panel.origCount;
		} else if (direction === Axes.DIRECTION_LEFT && indexToMove > 0) {
			indexToMove -= panel.origCount;
		}
		isPositive = indexToMove > 0;

		// check for real panel count which can be moved on each sides in circular mode
		if (circular &&
			Math.abs(indexToMove) >
			(isPositive ? panel.count - (currentIndex + 1) : currentIndex)) {
			indexToMove += (isPositive ? -1 : 1) * panel.count;
			isPositive = indexToMove > 0;
		}

		this._setPanelNo(circular ? {no} : {no, index: no});
		this._conf.indexToMove = indexToMove;
github naver / egjs-flicking / src / Flicking.js View on Github external
_setAdaptiveHeight(direction) {
		const conf = this._conf;
		const indexToMove = conf.indexToMove;
		let $children;
		let height;

		const $panel = indexToMove === 0 ?

			// panel moved by 1
			this[`get${
				(direction === Axes.DIRECTION_LEFT && "Next") ||
				(direction === Axes.DIRECTION_RIGHT && "Prev") || ""
			}Element`]() :

			// panel moved by .moveTo()
			conf.panel.$list[
				conf.panel.currIndex + indexToMove
			];

		const $first = $panel.querySelector(":first-child");

		if ($first) {
			height = $first.getAttribute(DATA_HEIGHT);

			if (!height) {
				$children = $panel.children;

				height = utils.outerHeight(
github naver / egjs-flicking / src / Flicking.js View on Github external
* @type {Number}
	 * @default 2
	 */
	static DIRECTION_LEFT = Axes.DIRECTION_LEFT;

	/**
	 * Constant value for right direction.
	 * @ko right 방향에 대한 상수 값.
	 * @name DIRECTION_RIGHT
	 * @memberof eg.Flicking
	 * @static
	 * @constant
	 * @type {Number}
	 * @default 4
	 */
	static DIRECTION_RIGHT = Axes.DIRECTION_RIGHT;

	/**
	 * Constant value for up direction.
	 * @ko up 방향에 대한 상수 값.
	 * @name DIRECTION_UP
	 * @memberof eg.Flicking
	 * @static
	 * @constant
	 * @type {Number}
	 * @default 8
	 */
	static DIRECTION_UP = Axes.DIRECTION_UP;

	/**
	 * Constant value for down direction.
	 * @ko down 방향에 대한 상수 값.
github naver / egjs-flicking / src / Flicking.js View on Github external
next(duration) {
		const index = this.getNextIndex();

		if (typeof index !== "number") {
			return this;
		}
		return this._moveTo(index, duration, Axes.DIRECTION_RIGHT);
	}

@egjs/axes

A module used to change the information of user action entered by various input devices such as touch screen or mouse into the logical virtual coordinates. You can easily create a UI that responds to user actions.

MIT
Latest version published 10 months ago

Package Health Score

67 / 100
Full package analysis

Similar packages