Merge pull request #5218 from braindx/drag-transform-fix

Fix drag coordinates with camera zoom (issue #4755)
This commit is contained in:
Richard Davey 2020-07-13 11:36:29 +01:00 committed by GitHub
commit bc0c289550
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -1126,8 +1126,8 @@ var InputPlugin = new Class({
input.dragStartX = gameObject.x;
input.dragStartY = gameObject.y;
input.dragStartXGlobal = pointer.x;
input.dragStartYGlobal = pointer.y;
input.dragStartXGlobal = pointer.worldX;
input.dragStartYGlobal = pointer.worldY;
input.dragX = input.dragStartXGlobal - input.dragStartX;
input.dragY = input.dragStartYGlobal - input.dragStartY;
@ -1330,13 +1330,13 @@ var InputPlugin = new Class({
if (!gameObject.parentContainer)
{
dragX = pointer.x - input.dragX;
dragY = pointer.y - input.dragY;
dragX = pointer.worldX - input.dragX;
dragY = pointer.worldY - input.dragY;
}
else
{
var dx = pointer.x - input.dragStartXGlobal;
var dy = pointer.y - input.dragStartYGlobal;
var dx = pointer.worldX - input.dragStartXGlobal;
var dy = pointer.worldY - input.dragStartYGlobal;
var rotation = gameObject.getParentRotation();