Skip to content

Commit 228ca47

Browse files
committed
Updating drag values.
1 parent c152156 commit 228ca47

4 files changed

Lines changed: 21 additions & 4 deletions

File tree

v3/src/input/local/components/ProcessDragEvents.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -134,6 +134,12 @@ var ProcessDragEvents = function (pointer, time)
134134

135135
input = gameObject.input;
136136

137+
// input.dragX = pointer.x - (input.localX - gameObject.displayOriginX);
138+
// input.dragY = pointer.y - (input.localY - gameObject.displayOriginY);
139+
140+
input.dragX = pointer.x - input.localX;
141+
input.dragY = pointer.y - input.localY;
142+
137143
this.events.dispatch(new InputEvent.DRAG(pointer, gameObject));
138144

139145
input.onDrag(gameObject, pointer);
@@ -154,6 +160,8 @@ var ProcessDragEvents = function (pointer, time)
154160
input = gameObject.input;
155161

156162
input.dragState = 0;
163+
input.dragX = input.localX - gameObject.displayOriginX;
164+
input.dragY = input.localY - gameObject.displayOriginY;
157165

158166
this.events.dispatch(new InputEvent.DRAG_END(pointer, gameObject));
159167

v3/src/input/local/events/DragEndEvent.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,9 @@ var DragEndEvent = new Class({
2323
// The local x/y coordinates of the event within the Game Object
2424
this.x = pointer.x;
2525
this.y = pointer.y;
26+
27+
this.dragX = gameObject.input.dragX;
28+
this.dragY = gameObject.input.dragY;
2629
}
2730

2831
});

v3/src/input/local/events/DragEvent.js

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,12 @@ var DragEvent = new Class({
2424
this.x = pointer.x;
2525
this.y = pointer.y;
2626

27+
this.dragX = gameObject.input.dragX;
28+
this.dragY = gameObject.input.dragY;
29+
2730
// The local x/y coordinates of the event within the Game Object
28-
this.dragX = pointer.x - gameObject.input.dragX;
29-
this.dragY = pointer.y - gameObject.input.dragY;
31+
// this.dragX = pointer.x - gameObject.input.dragX;
32+
// this.dragY = pointer.y - gameObject.input.dragY;
3033
}
3134

3235
});

v3/src/input/local/events/DragStartEvent.js

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,11 @@ var DragStartEvent = new Class({
2121
this.gameObject = gameObject;
2222

2323
// The local x/y coordinates of the event within the Game Object
24-
this.x = gameObject.input.dragX;
25-
this.y = gameObject.input.dragY;
24+
this.x = pointer.x;
25+
this.y = pointer.y;
26+
27+
this.dragX = gameObject.input.dragX;
28+
this.dragY = gameObject.input.dragY;
2629
}
2730

2831
});

0 commit comments

Comments
 (0)