How to lock outside view range

  • Hi Everyone,

    I didn't know where to ask this.

    I use the Multi Touch plugin, and I have a problem.

    This will be hard to explain but here is the thing:

    The layout size is smaller than the view/window size. And it looks like, that the program doesnt care about it, I can grab the map outside the view area.

    Here is a sample:

    dl.dropbox.com/u/84346612/pan_problem.capx

    The user can grab the map outside the view area (where there is only black in the browser), like the area wouldnt be "locked down".

    How can I disable outside the view area?

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • Whew! You say that your layout is smaller than your window, but thankfully in your project that is not the case.

    Keep in mind that WindowWidth and WindowHeight are the dimensions of your view window, and (scrollx,scrolly) is the center of the view window over the layout.

    So to keep from responding to touches outside the view window add the following conditions to each of the events that handles touch:

    touch.X < scrollx-(WindowWidth/2)

    touch.X > scrollx+(WindowWidth/2)

    touch.Y < scrolly-(WindowHeight/2)

    touch.Y > scrolly+(WindowHeight/2)

    Here is the modified capx:

    Pan_Fix.capx

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)