GithubHelp home page GithubHelp logo

Problem panning on iPad 4 about gestouch HOT 4 CLOSED

fljot avatar fljot commented on June 15, 2024
Problem panning on iPad 4

from gestouch.

Comments (4)

fljot avatar fljot commented on June 15, 2024

Well it sounds like it's related to retina. What's the size of your view and what's the size of the stage? Maybe view is scaled twice in terms of width and height? If so you need to transform offsets (using view.globalToLocal).

from gestouch.

treylok avatar treylok commented on June 15, 2024

Thanks a lot for your response and help. Unfortunately, I am not that good with matrix operations or positioning in general when it comes to different devices and DPIs. I tried changing the code by adding

var globalPoint:Point =   globalToLocal(new Point(gesture.offsetX, gesture.offsetY));
matrix.translate(globalPoint.x, globalPoint.y);

but I am still not getting the correct results. I did however notice when I change the application DPI from 160 to 240 everything works as expected on the retna display.

Here is the info I am getting for the stage and view dimensions:
Stage: 1536 x 2008
View: 1024 x 1293.66

Thanks again, sorry if this post does not belong here because I think it is an issue on my end and not with your code.

from gestouch.

fljot avatar fljot commented on June 15, 2024

Well it's a common task, and I should actually add it to examples project.
Haven't tested, but I think it should work:

public static const ZERO_POINT:Point = new Point();// define somewhere

private var globalOffset:Point = new Point();//reuse same instance for better performance
globalOffset.x = gesture.offsetX;
globalOffset.y = gesture.offsetY;
var offsetInThis:Point = this.globalToLocal(globalOffset).subtract(this.globalToLocal(ZERO_POINT));

upd: I would include this functionality in gestures of course, BUT since architecture is not only about flash.display::DisplatObject anymore... This is not that hard to transform stuff after all.

from gestouch.

treylok avatar treylok commented on June 15, 2024

It is working like a charm! Thanks a ton, both for your help with my problem and for your great work on this library and providing them to us for use!

from gestouch.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.