moagrius / TileView

TileView is a subclass of android.view.ViewGroup that asynchronously displays, pans and zooms tile-based images. Plugins are available for features like markers, hotspots, and path drawing.
MIT License
1.46k stars 337 forks source link

Marker causes change in view #505

Closed balachanthiran closed 5 years ago

balachanthiran commented 5 years ago

I have the code below that runs once i onCreate()

   tileView = findViewById(R.id.tileview);
    new TileView.Builder(tileView)
            .setSize(5000, 20000)
            .defineZoomLevel("tiles/tile-%d-%d.jpg")
            .defineZoomLevel(1, "tileszoom1/tile-%d-%d.jpg")
            .defineZoomLevel(2, "tileszoom2/tile-%d-%d.jpg")
            .installPlugin(new MarkerPlugin(getApplicationContext()))
            .build();
    markerPlugin = (MarkerPlugin) tileView.getPlugin(MarkerPlugin.class);
    marker = new ImageView(getApplicationContext());
    marker.setImageResource(R.drawable.marker);

I then a have a method that runs every second and gives me a new x,y coordinate. In this method remove the existing marker and then add a new marker:

  markerPlugin.removeViewInLayout(marker);
  markerPlugin.addMarker(marker, x, y, 0, 0, 0, 0);

But each time a new marker is added the view changes to the upper left corner. Do you have any idea why?

moagrius commented 5 years ago

What you have looks fine at first glance. Can you post your project somewhere public and I'll try to take a look?

thib-rdr commented 4 years ago

Hi ! I'm having the same exact problem, would it be possible to know if this has been fixed ? @balachanthiran Thanks

balachanthiran commented 4 years ago

Hi, I could not fix it. I ended up using another library: https://github.com/davemorrissey/subsampling-scale-image-view

This works much easier.