How to use @egjs/axes - 10 common examples

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 / 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
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 / 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 / test / unit / events.spec.js View on Github external
tutils.simulator($el, { deltaX: -50, deltaY: 100 }, () => {
				// Is down during touch hold?
				expect(check(directionHold[id], Axes.DIRECTION_DOWN)).to.be.ok;

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

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

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

				done();
			});
		});

@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