How to use the @egjs/axes.DIRECTION_LEFT 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("next()", () => {
			// When
			// 2 -> 3
			inst.next(0);
			// direction is from right to left
			const direction1 = inst._conf.touch.direction;
			// 3 -> 1
			inst.next(0);
			// direction is from right to left
			const direction2 = inst._conf.touch.direction;

			// Then
			expect(direction1).to.be.equals(Axes.DIRECTION_LEFT);
			expect(direction2).to.be.equals(Axes.DIRECTION_LEFT);
		});
	});
github naver / egjs-flicking / test / unit / methods.spec.js View on Github external
it("next()", () => {
			// When
			// 2 -> 3
			inst.next(0);
			// direction is from right to left
			const direction1 = inst._conf.touch.direction;
			// 3 -> 1
			inst.next(0);
			// direction is from right to left
			const direction2 = inst._conf.touch.direction;

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

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

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

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

				done();
			});
		});
github naver / egjs-flicking / src / Flicking.js View on Github external
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;
		this._setValueToMove(isPositive);
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;
github naver / egjs-flicking / dist / flicking.esm.js View on Github external
_proto.prev = function prev(duration) {
      var index = this.getPrevIndex();

      if (typeof index !== "number") {
        return this;
      }

      return this._moveTo(index, duration, Axes.DIRECTION_LEFT);
    };
    /**
github naver / egjs-flicking / src / Flicking.js View on Github external
prev(duration) {
		const index = this.getPrevIndex();

		if (typeof index !== "number") {
			return this;
		}
		return this._moveTo(index, duration, Axes.DIRECTION_LEFT);
	}
github naver / egjs-flicking / src / Flicking.js View on Github external
* @type {Number}
	 * @default 1
	 */
	static DIRECTION_NONE = Axes.DIRECTION_NONE;

	/**
	 * Constant value for left direction.
	 * @ko left 방향에 대한 상수 값.
	 * @name DIRECTION_LEFT
	 * @memberof eg.Flicking
	 * @static
	 * @constant
	 * @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 방향에 대한 상수 값.

@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 3 months ago

Package Health Score

75 / 100
Full package analysis

Similar packages