Socket
Socket
Sign inDemoInstall

@antv/g-gesture

Package Overview
Dependencies
Maintainers
15
Versions
152
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@antv/g-gesture - npm Package Compare versions

Comparing version 0.1.0-beta.1 to 0.1.0-beta.2

6

esm/event/wheel.js

@@ -1,2 +0,2 @@

import * as tslib_1 from "tslib";
import { __assign, __extends } from "tslib";
import EE from '@antv/event-emitter';

@@ -19,3 +19,3 @@ import * as d3Ease from 'd3-ease';

var Wheel = /** @class */ (function (_super) {
tslib_1.__extends(Wheel, _super);
__extends(Wheel, _super);
function Wheel(element) {

@@ -82,3 +82,3 @@ var _this = _super.call(this) || this;

// 移动端的滑动应该是跟随手指
return tslib_1.__assign({}, ev, { deltaX: -deltaX, deltaY: -deltaY });
return __assign(__assign({}, ev), { deltaX: -deltaX, deltaY: -deltaY });
};

@@ -85,0 +85,0 @@ return Wheel;

@@ -7,2 +7,3 @@ import { Event } from '@antv/g';

export interface GestureEvent {
readonly event: Event;
readonly x: number;

@@ -9,0 +10,0 @@ readonly y: number;

@@ -0,1 +1,2 @@

import { Event } from '@antv/g';
import { Gesture } from './gesture';

@@ -8,4 +9,4 @@ export declare class Pan extends Gesture {

protected onTouchEnd(ev: any): void;
protected onTouchMove(ev: any): void;
protected onTouchMove(ev: Event): void;
protected onTouchStart(ev: any): void;
}

@@ -1,5 +0,5 @@

import * as tslib_1 from "tslib";
import { __extends } from "tslib";
import { Gesture } from './gesture';
var Pan = /** @class */ (function (_super) {
tslib_1.__extends(Pan, _super);
__extends(Pan, _super);
function Pan() {

@@ -18,3 +18,3 @@ var _this = _super !== null && _super.apply(this, arguments) || this;

this.preY = y;
this.emit({ x: x, y: y, deltaX: deltaX, deltaY: deltaY });
this.emit({ x: x, y: y, deltaX: deltaX, deltaY: deltaY, event: ev });
};

@@ -21,0 +21,0 @@ Pan.prototype.onTouchStart = function (ev) {

@@ -1,2 +0,2 @@

import * as tslib_1 from "tslib";
import { __extends } from "tslib";
import { clock } from '../utils/clock';

@@ -7,3 +7,3 @@ import { Gesture } from './gesture';

var Press = /** @class */ (function (_super) {
tslib_1.__extends(Press, _super);
__extends(Press, _super);
function Press() {

@@ -34,3 +34,3 @@ var _this = _super !== null && _super.apply(this, arguments) || this;

this.pressTimeout = window.setTimeout(function () {
_this.emit({ x: x, y: y });
_this.emit({ x: x, y: y, event: ev });
}, TIME);

@@ -37,0 +37,0 @@ };

@@ -0,1 +1,2 @@

import { Event } from '@antv/g';
import { Gesture } from './gesture';

@@ -11,5 +12,5 @@ export declare class Swipe extends Gesture {

protected onTouchCancel(ev: any): void;
protected onTouchEnd(ev: any): void;
protected onTouchEnd(ev: Event): void;
protected onTouchMove(ev: any): void;
protected onTouchStart(ev: any): void;
}

@@ -1,2 +0,2 @@

import * as tslib_1 from "tslib";
import { __extends } from "tslib";
import { clock } from '../utils/clock';

@@ -6,3 +6,3 @@ import { Gesture } from './gesture';

var Swipe = /** @class */ (function (_super) {
tslib_1.__extends(Swipe, _super);
__extends(Swipe, _super);
function Swipe() {

@@ -30,3 +30,3 @@ var _this = _super !== null && _super.apply(this, arguments) || this;

// 抛出事件
this.emit({ x: x, y: y, speedX: speedX, speedY: speedY });
this.emit({ x: x, y: y, speedX: speedX, speedY: speedY, event: ev });
}

@@ -33,0 +33,0 @@ };

@@ -0,1 +1,2 @@

import { Event } from '@antv/g';
import { Gesture } from './gesture';

@@ -8,5 +9,5 @@ export declare class Tap extends Gesture {

protected onTouchCancel(ev: any): void;
protected onTouchEnd(ev: any): void;
protected onTouchEnd(ev: Event): void;
protected onTouchMove(ev: any): void;
protected onTouchStart(ev: any): void;
}

@@ -1,2 +0,2 @@

import * as tslib_1 from "tslib";
import { __extends } from "tslib";
import { clock } from '../utils/clock';

@@ -7,3 +7,3 @@ import { Gesture } from './gesture';

var Tap = /** @class */ (function (_super) {
tslib_1.__extends(Tap, _super);
__extends(Tap, _super);
function Tap() {

@@ -20,3 +20,3 @@ var _this = _super !== null && _super.apply(this, arguments) || this;

clock.now() - this.touchStartTime < TIME) {
this.emit({ x: x, y: y });
this.emit({ x: x, y: y, event: ev });
}

@@ -23,0 +23,0 @@ };

@@ -27,2 +27,3 @@ import EE from '@antv/event-emitter';

private bindTouchStart;
private preventEvent;
/**

@@ -29,0 +30,0 @@ * touchstart 触发

@@ -1,2 +0,2 @@

import * as tslib_1 from "tslib";
import { __extends } from "tslib";
import EE from '@antv/event-emitter';

@@ -11,3 +11,3 @@ import { getGesture } from './gestures';

var GM = /** @class */ (function (_super) {
tslib_1.__extends(GM, _super);
__extends(GM, _super);
function GM(element, options) {

@@ -21,3 +21,3 @@ if (options === void 0) { options = {}; }

_this.onTouchStart = function (ev) {
ev.event.preventDefault();
_this.preventEvent(ev.event);
_this.element.on('touchmove', _this.onTouchMove);

@@ -34,3 +34,3 @@ _this.element.on('touchend', _this.onTouchEnd);

_this.onTouchMove = function (ev) {
ev.event.preventDefault();
_this.preventEvent(ev.event);
_this.emit('touchmove', ev);

@@ -44,3 +44,3 @@ _this.doGestures(ev);

_this.onTouchEnd = function (ev) {
ev.event.preventDefault();
_this.preventEvent(ev.event);
_this.emit('touchend', ev);

@@ -57,3 +57,3 @@ _this.element.off('touchmove', _this.onTouchMove);

_this.onTouchCancel = function (ev) {
ev.event.preventDefault();
_this.preventEvent(ev.event);
_this.emit('touchcancel', ev);

@@ -95,2 +95,9 @@ _this.element.off('touchmove', _this.onTouchMove);

};
GM.prototype.preventEvent = function (ev) {
var type = ev.type;
var prevents = this.options.prevents || [];
if (prevents.includes(type)) {
ev.preventDefault();
}
};
GM.prototype.doGestures = function (ev) {

@@ -97,0 +104,0 @@ this.gestures.forEach(function (g) {

export interface Options {
gestures?: string[];
prevents?: string[];
}

@@ -83,3 +83,3 @@ "use strict";

// 移动端的滑动应该是跟随手指
return tslib_1.__assign({}, ev, { deltaX: -deltaX, deltaY: -deltaY });
return tslib_1.__assign(tslib_1.__assign({}, ev), { deltaX: -deltaX, deltaY: -deltaY });
};

@@ -86,0 +86,0 @@ return Wheel;

@@ -7,2 +7,3 @@ import { Event } from '@antv/g';

export interface GestureEvent {
readonly event: Event;
readonly x: number;

@@ -9,0 +10,0 @@ readonly y: number;

@@ -0,1 +1,2 @@

import { Event } from '@antv/g';
import { Gesture } from './gesture';

@@ -8,4 +9,4 @@ export declare class Pan extends Gesture {

protected onTouchEnd(ev: any): void;
protected onTouchMove(ev: any): void;
protected onTouchMove(ev: Event): void;
protected onTouchStart(ev: any): void;
}

@@ -20,3 +20,3 @@ "use strict";

this.preY = y;
this.emit({ x: x, y: y, deltaX: deltaX, deltaY: deltaY });
this.emit({ x: x, y: y, deltaX: deltaX, deltaY: deltaY, event: ev });
};

@@ -23,0 +23,0 @@ Pan.prototype.onTouchStart = function (ev) {

@@ -35,3 +35,3 @@ "use strict";

this.pressTimeout = window.setTimeout(function () {
_this.emit({ x: x, y: y });
_this.emit({ x: x, y: y, event: ev });
}, TIME);

@@ -38,0 +38,0 @@ };

@@ -0,1 +1,2 @@

import { Event } from '@antv/g';
import { Gesture } from './gesture';

@@ -11,5 +12,5 @@ export declare class Swipe extends Gesture {

protected onTouchCancel(ev: any): void;
protected onTouchEnd(ev: any): void;
protected onTouchEnd(ev: Event): void;
protected onTouchMove(ev: any): void;
protected onTouchStart(ev: any): void;
}

@@ -31,3 +31,3 @@ "use strict";

// 抛出事件
this.emit({ x: x, y: y, speedX: speedX, speedY: speedY });
this.emit({ x: x, y: y, speedX: speedX, speedY: speedY, event: ev });
}

@@ -34,0 +34,0 @@ };

@@ -0,1 +1,2 @@

import { Event } from '@antv/g';
import { Gesture } from './gesture';

@@ -8,5 +9,5 @@ export declare class Tap extends Gesture {

protected onTouchCancel(ev: any): void;
protected onTouchEnd(ev: any): void;
protected onTouchEnd(ev: Event): void;
protected onTouchMove(ev: any): void;
protected onTouchStart(ev: any): void;
}

@@ -21,3 +21,3 @@ "use strict";

clock_1.clock.now() - this.touchStartTime < TIME) {
this.emit({ x: x, y: y });
this.emit({ x: x, y: y, event: ev });
}

@@ -24,0 +24,0 @@ };

@@ -27,2 +27,3 @@ import EE from '@antv/event-emitter';

private bindTouchStart;
private preventEvent;
/**

@@ -29,0 +30,0 @@ * touchstart 触发

@@ -22,3 +22,3 @@ "use strict";

_this.onTouchStart = function (ev) {
ev.event.preventDefault();
_this.preventEvent(ev.event);
_this.element.on('touchmove', _this.onTouchMove);

@@ -35,3 +35,3 @@ _this.element.on('touchend', _this.onTouchEnd);

_this.onTouchMove = function (ev) {
ev.event.preventDefault();
_this.preventEvent(ev.event);
_this.emit('touchmove', ev);

@@ -45,3 +45,3 @@ _this.doGestures(ev);

_this.onTouchEnd = function (ev) {
ev.event.preventDefault();
_this.preventEvent(ev.event);
_this.emit('touchend', ev);

@@ -58,3 +58,3 @@ _this.element.off('touchmove', _this.onTouchMove);

_this.onTouchCancel = function (ev) {
ev.event.preventDefault();
_this.preventEvent(ev.event);
_this.emit('touchcancel', ev);

@@ -96,2 +96,9 @@ _this.element.off('touchmove', _this.onTouchMove);

};
GM.prototype.preventEvent = function (ev) {
var type = ev.type;
var prevents = this.options.prevents || [];
if (prevents.includes(type)) {
ev.preventDefault();
}
};
GM.prototype.doGestures = function (ev) {

@@ -98,0 +105,0 @@ this.gestures.forEach(function (g) {

export interface Options {
gestures?: string[];
prevents?: string[];
}
{
"name": "@antv/g-gesture",
"version": "0.1.0-beta.1",
"version": "0.1.0-beta.2",
"description": "Gesture module for @antv/g.",

@@ -34,2 +34,4 @@ "main": "lib/index.js",

"devDependencies": {
"@antv/torch": "~1.0.5",
"@antv/g": "~3.5.0-beta.1",
"chai": "~4.1.2",

@@ -36,0 +38,0 @@ "husky": "^3.0.4",

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc