Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

eva-plugin-joystick

Package Overview
Dependencies
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

eva-plugin-joystick - npm Package Compare versions

Comparing version 0.1.1 to 0.2.0

dist/plugin.cjs.prod.js

1

dist/eva-plugin-joystick.d.ts

@@ -21,2 +21,3 @@ import { Component } from '@eva/eva.js';

private eventBinded;
private pointerId;
init(params: any): void;

@@ -23,0 +24,0 @@ update(e: any): void;

17

dist/plugin.cjs.js

@@ -92,10 +92,10 @@ 'use strict';

if (this.triggerTouchstart) {
this.emit(exports.JOYSTICK_EVENT.Begin, __assign(__assign({}, this.vector2), { event: e }));
this.emit(exports.JOYSTICK_EVENT.Begin, __assign(__assign({}, this.vector2), { updateParams: e }));
this.triggerTouchstart = false;
}
if (this.moving) {
this.emit(exports.JOYSTICK_EVENT.Drag, __assign(__assign({}, this.vector2), { event: e }));
this.emit(exports.JOYSTICK_EVENT.Drag, __assign(__assign({}, this.vector2), { updateParams: e }));
}
if (this.triggerTouchend) {
this.emit(exports.JOYSTICK_EVENT.End, __assign(__assign({}, this.vector2), { event: e }));
this.emit(exports.JOYSTICK_EVENT.End, __assign(__assign({}, this.vector2), { updateParams: e }));
this.triggerTouchend = false;

@@ -123,2 +123,3 @@ }

this.evt.on('touchstart', function (e) {
var _a;
_this.moving = true;

@@ -128,6 +129,10 @@ _this.basePosition.x = e.data.position.x;

_this.triggerTouchstart = true;
_this.pointerId = (_a = e.data) === null || _a === void 0 ? void 0 : _a.pointerId;
});
this.evt.on('touchmove', function (e) {
var _a;
if (!_this.moving)
return;
if (undefined !== ((_a = e.data) === null || _a === void 0 ? void 0 : _a.pointerId) && _this.pointerId !== e.data.pointerId)
return;
var position = e.data.position;

@@ -147,3 +152,6 @@ var vector2 = _this.vector2;

});
var touchend = function () {
var touchend = function (e) {
var _a;
if (undefined !== ((_a = e.data) === null || _a === void 0 ? void 0 : _a.pointerId) && _this.pointerId !== e.data.pointerId)
return;
_this.moving = false;

@@ -219,2 +227,1 @@ _this.vector2.x = 0;

exports.Joystick = Joystick;
//# sourceMappingURL=plugin.cjs.js.map

@@ -88,10 +88,10 @@ import { GameObject, resource, RESOURCE_TYPE, Component } from '@eva/eva.js';

if (this.triggerTouchstart) {
this.emit(JOYSTICK_EVENT.Begin, __assign(__assign({}, this.vector2), { event: e }));
this.emit(JOYSTICK_EVENT.Begin, __assign(__assign({}, this.vector2), { updateParams: e }));
this.triggerTouchstart = false;
}
if (this.moving) {
this.emit(JOYSTICK_EVENT.Drag, __assign(__assign({}, this.vector2), { event: e }));
this.emit(JOYSTICK_EVENT.Drag, __assign(__assign({}, this.vector2), { updateParams: e }));
}
if (this.triggerTouchend) {
this.emit(JOYSTICK_EVENT.End, __assign(__assign({}, this.vector2), { event: e }));
this.emit(JOYSTICK_EVENT.End, __assign(__assign({}, this.vector2), { updateParams: e }));
this.triggerTouchend = false;

@@ -119,2 +119,3 @@ }

this.evt.on('touchstart', function (e) {
var _a;
_this.moving = true;

@@ -124,6 +125,10 @@ _this.basePosition.x = e.data.position.x;

_this.triggerTouchstart = true;
_this.pointerId = (_a = e.data) === null || _a === void 0 ? void 0 : _a.pointerId;
});
this.evt.on('touchmove', function (e) {
var _a;
if (!_this.moving)
return;
if (undefined !== ((_a = e.data) === null || _a === void 0 ? void 0 : _a.pointerId) && _this.pointerId !== e.data.pointerId)
return;
var position = e.data.position;

@@ -143,3 +148,6 @@ var vector2 = _this.vector2;

});
var touchend = function () {
var touchend = function (e) {
var _a;
if (undefined !== ((_a = e.data) === null || _a === void 0 ? void 0 : _a.pointerId) && _this.pointerId !== e.data.pointerId)
return;
_this.moving = false;

@@ -215,2 +223,1 @@ _this.vector2.x = 0;

export { JOYSTICK_EVENT, Joystick };
//# sourceMappingURL=plugin.esm.js.map

@@ -680,10 +680,10 @@ this.EVA = this.EVA || {};

if (this.triggerTouchstart) {
this.emit(exports.JOYSTICK_EVENT.Begin, __assign(__assign({}, this.vector2), { event: e }));
this.emit(exports.JOYSTICK_EVENT.Begin, __assign(__assign({}, this.vector2), { updateParams: e }));
this.triggerTouchstart = false;
}
if (this.moving) {
this.emit(exports.JOYSTICK_EVENT.Drag, __assign(__assign({}, this.vector2), { event: e }));
this.emit(exports.JOYSTICK_EVENT.Drag, __assign(__assign({}, this.vector2), { updateParams: e }));
}
if (this.triggerTouchend) {
this.emit(exports.JOYSTICK_EVENT.End, __assign(__assign({}, this.vector2), { event: e }));
this.emit(exports.JOYSTICK_EVENT.End, __assign(__assign({}, this.vector2), { updateParams: e }));
this.triggerTouchend = false;

@@ -711,2 +711,3 @@ }

this.evt.on('touchstart', function (e) {
var _a;
_this.moving = true;

@@ -716,6 +717,10 @@ _this.basePosition.x = e.data.position.x;

_this.triggerTouchstart = true;
_this.pointerId = (_a = e.data) === null || _a === void 0 ? void 0 : _a.pointerId;
});
this.evt.on('touchmove', function (e) {
var _a;
if (!_this.moving)
return;
if (undefined !== ((_a = e.data) === null || _a === void 0 ? void 0 : _a.pointerId) && _this.pointerId !== e.data.pointerId)
return;
var position = e.data.position;

@@ -735,3 +740,6 @@ var vector2 = _this.vector2;

});
var touchend = function () {
var touchend = function (e) {
var _a;
if (undefined !== ((_a = e.data) === null || _a === void 0 ? void 0 : _a.pointerId) && _this.pointerId !== e.data.pointerId)
return;
_this.moving = false;

@@ -813,2 +821,1 @@ _this.vector2.x = 0;

}({}, EVA, EVA.plugin.renderer, PIXI, EVA.rendererAdapter));
//# sourceMappingURL=plugin.global.js.map
{
"name": "eva-plugin-joystick",
"version": "0.1.1",
"version": "0.2.0",
"scripts": {

@@ -5,0 +5,0 @@ "dev": "rollup -c rollup.config.dev.js -w",

@@ -94,2 +94,5 @@ # Eva.js Joystick

```
### 事件名
参数为摇杆移动的二维向量,-1,1之间

@@ -107,2 +110,32 @@

摇杆结束事件
摇杆结束事件
### 回调函数参数
- x
当前的joystick向量 x 值 -1 ~ 1 之间
- y
当前的joystick向量 y 值 -1 ~ 1 之间
- updateParams
当前update事件的参数
- deltaTime: number;
每帧间隔时间,可以用于物体匀速运动
- frameCount: number;
当前游戏总帧数
- currentTime: number;
当前游戏时间
- fps: number;
当前游戏帧率

Sorry, the diff of this file is too big to display

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