Skip to content

Commit ec0773a

Browse files
committed
Removed Input class
1 parent e233830 commit ec0773a

1 file changed

Lines changed: 0 additions & 189 deletions

File tree

plugins/spine/src/runtimes/spine-both.js

Lines changed: 0 additions & 189 deletions
Original file line numberDiff line numberDiff line change
@@ -7256,195 +7256,6 @@ var spine;
72567256
})(webgl = spine.webgl || (spine.webgl = {}));
72577257
})(spine || (spine = {}));
72587258
var spine;
7259-
(function (spine) {
7260-
var webgl;
7261-
(function (webgl) {
7262-
var Input = (function () {
7263-
function Input(element) {
7264-
this.lastX = 0;
7265-
this.lastY = 0;
7266-
this.buttonDown = false;
7267-
this.currTouch = null;
7268-
this.touchesPool = new spine.Pool(function () {
7269-
return new spine.webgl.Touch(0, 0, 0);
7270-
});
7271-
this.listeners = new Array();
7272-
this.element = element;
7273-
this.setupCallbacks(element);
7274-
}
7275-
Input.prototype.setupCallbacks = function (element) {
7276-
var _this = this;
7277-
var mouseDown = function (ev) {
7278-
if (ev instanceof MouseEvent) {
7279-
var rect = element.getBoundingClientRect();
7280-
var x = ev.clientX - rect.left;
7281-
var y = ev.clientY - rect.top;
7282-
var listeners = _this.listeners;
7283-
for (var i = 0; i < listeners.length; i++) {
7284-
listeners[i].down(x, y);
7285-
}
7286-
_this.lastX = x;
7287-
_this.lastY = y;
7288-
_this.buttonDown = true;
7289-
document.addEventListener("mousemove", mouseMove);
7290-
document.addEventListener("mouseup", mouseUp);
7291-
}
7292-
};
7293-
var mouseMove = function (ev) {
7294-
if (ev instanceof MouseEvent) {
7295-
var rect = element.getBoundingClientRect();
7296-
var x = ev.clientX - rect.left;
7297-
var y = ev.clientY - rect.top;
7298-
var listeners = _this.listeners;
7299-
for (var i = 0; i < listeners.length; i++) {
7300-
if (_this.buttonDown) {
7301-
listeners[i].dragged(x, y);
7302-
}
7303-
else {
7304-
listeners[i].moved(x, y);
7305-
}
7306-
}
7307-
_this.lastX = x;
7308-
_this.lastY = y;
7309-
}
7310-
};
7311-
var mouseUp = function (ev) {
7312-
if (ev instanceof MouseEvent) {
7313-
var rect = element.getBoundingClientRect();
7314-
var x = ev.clientX - rect.left;
7315-
var y = ev.clientY - rect.top;
7316-
var listeners = _this.listeners;
7317-
for (var i = 0; i < listeners.length; i++) {
7318-
listeners[i].up(x, y);
7319-
}
7320-
_this.lastX = x;
7321-
_this.lastY = y;
7322-
_this.buttonDown = false;
7323-
document.removeEventListener("mousemove", mouseMove);
7324-
document.removeEventListener("mouseup", mouseUp);
7325-
}
7326-
};
7327-
element.addEventListener("mousedown", mouseDown, true);
7328-
element.addEventListener("mousemove", mouseMove, true);
7329-
element.addEventListener("mouseup", mouseUp, true);
7330-
element.addEventListener("touchstart", function (ev) {
7331-
if (_this.currTouch != null)
7332-
return;
7333-
var touches = ev.changedTouches;
7334-
for (var i = 0; i < touches.length; i++) {
7335-
var touch = touches[i];
7336-
var rect = element.getBoundingClientRect();
7337-
var x = touch.clientX - rect.left;
7338-
var y = touch.clientY - rect.top;
7339-
_this.currTouch = _this.touchesPool.obtain();
7340-
_this.currTouch.identifier = touch.identifier;
7341-
_this.currTouch.x = x;
7342-
_this.currTouch.y = y;
7343-
break;
7344-
}
7345-
var listeners = _this.listeners;
7346-
for (var i_16 = 0; i_16 < listeners.length; i_16++) {
7347-
listeners[i_16].down(_this.currTouch.x, _this.currTouch.y);
7348-
}
7349-
console.log("Start " + _this.currTouch.x + ", " + _this.currTouch.y);
7350-
_this.lastX = _this.currTouch.x;
7351-
_this.lastY = _this.currTouch.y;
7352-
_this.buttonDown = true;
7353-
ev.preventDefault();
7354-
}, false);
7355-
element.addEventListener("touchend", function (ev) {
7356-
var touches = ev.changedTouches;
7357-
for (var i = 0; i < touches.length; i++) {
7358-
var touch = touches[i];
7359-
if (_this.currTouch.identifier === touch.identifier) {
7360-
var rect = element.getBoundingClientRect();
7361-
var x = _this.currTouch.x = touch.clientX - rect.left;
7362-
var y = _this.currTouch.y = touch.clientY - rect.top;
7363-
_this.touchesPool.free(_this.currTouch);
7364-
var listeners = _this.listeners;
7365-
for (var i_17 = 0; i_17 < listeners.length; i_17++) {
7366-
listeners[i_17].up(x, y);
7367-
}
7368-
console.log("End " + x + ", " + y);
7369-
_this.lastX = x;
7370-
_this.lastY = y;
7371-
_this.buttonDown = false;
7372-
_this.currTouch = null;
7373-
break;
7374-
}
7375-
}
7376-
ev.preventDefault();
7377-
}, false);
7378-
element.addEventListener("touchcancel", function (ev) {
7379-
var touches = ev.changedTouches;
7380-
for (var i = 0; i < touches.length; i++) {
7381-
var touch = touches[i];
7382-
if (_this.currTouch.identifier === touch.identifier) {
7383-
var rect = element.getBoundingClientRect();
7384-
var x = _this.currTouch.x = touch.clientX - rect.left;
7385-
var y = _this.currTouch.y = touch.clientY - rect.top;
7386-
_this.touchesPool.free(_this.currTouch);
7387-
var listeners = _this.listeners;
7388-
for (var i_18 = 0; i_18 < listeners.length; i_18++) {
7389-
listeners[i_18].up(x, y);
7390-
}
7391-
console.log("End " + x + ", " + y);
7392-
_this.lastX = x;
7393-
_this.lastY = y;
7394-
_this.buttonDown = false;
7395-
_this.currTouch = null;
7396-
break;
7397-
}
7398-
}
7399-
ev.preventDefault();
7400-
}, false);
7401-
element.addEventListener("touchmove", function (ev) {
7402-
if (_this.currTouch == null)
7403-
return;
7404-
var touches = ev.changedTouches;
7405-
for (var i = 0; i < touches.length; i++) {
7406-
var touch = touches[i];
7407-
if (_this.currTouch.identifier === touch.identifier) {
7408-
var rect = element.getBoundingClientRect();
7409-
var x = touch.clientX - rect.left;
7410-
var y = touch.clientY - rect.top;
7411-
var listeners = _this.listeners;
7412-
for (var i_19 = 0; i_19 < listeners.length; i_19++) {
7413-
listeners[i_19].dragged(x, y);
7414-
}
7415-
console.log("Drag " + x + ", " + y);
7416-
_this.lastX = _this.currTouch.x = x;
7417-
_this.lastY = _this.currTouch.y = y;
7418-
break;
7419-
}
7420-
}
7421-
ev.preventDefault();
7422-
}, false);
7423-
};
7424-
Input.prototype.addListener = function (listener) {
7425-
this.listeners.push(listener);
7426-
};
7427-
Input.prototype.removeListener = function (listener) {
7428-
var idx = this.listeners.indexOf(listener);
7429-
if (idx > -1) {
7430-
this.listeners.splice(idx, 1);
7431-
}
7432-
};
7433-
return Input;
7434-
}());
7435-
webgl.Input = Input;
7436-
var Touch = (function () {
7437-
function Touch(identifier, x, y) {
7438-
this.identifier = identifier;
7439-
this.x = x;
7440-
this.y = y;
7441-
}
7442-
return Touch;
7443-
}());
7444-
webgl.Touch = Touch;
7445-
})(webgl = spine.webgl || (spine.webgl = {}));
7446-
})(spine || (spine = {}));
7447-
var spine;
74487259
(function (spine) {
74497260
var webgl;
74507261
(function (webgl) {

0 commit comments

Comments
 (0)