Jump to content

Leaflet.PixiOverlay - Problem with render sprites


federoldan
 Share

Recommended Posts

Hello, first of all I want to clarify that I've already read this post. My problem is very similar but not the same. Also, there isn't a solution in that thread.

Wich is my problem?

So, I render a bunch of Sprites in the map using a regular PIXI.Container. So far so good, there is no problem there.

image.png.7429ab1933aec4db506deb4103ea1d0b.png

When I zoom in, the scale of the sprites gets to little and all of those sprites who aren't beeing focused dissapear when zooming out. I would like to be able to zoom in and out without problems and use the scale property the right way

I hope I made myself clear.

This is my code for the Sprite creation.

image.thumb.png.7be60aaf93e09f9612909c024fe337ff.png

And this is function is for the zoom wich is called as a callback of the creation of the pixiOverlay (it executes every time there is an event in the map, such as: creation, zoom in, zoom out, etc)

image.png.9a869c62f014ced846c9e0283ef200f1.png

Link to comment
Share on other sites

I've found a solution! Obviously, it was an scale issue. I still dont't figured out how does scale works but the solution is this:

I set the scale of the sprite equal to the current pixi overlay instance using the map zoom as argument and the dividing it by 16 (sprite size):

image.thumb.png.632817e07940fada443c22f639023be3.png

And when zooming in or out I set the scale as it follows:

image.png.df785efb989a7561c424a1a81a282b51.png

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...