Coder Social home page Coder Social logo

Comments (4)

moagrius avatar moagrius commented on September 23, 2024

the x and y returned are "real" pixel values - see #11

post back if that doesn't make sense or you need more help

from tileview.

braj008 avatar braj008 commented on September 23, 2024

Thank you. It worked. Now, lets move to 2nd part of the issue.
When and as I zoom, markers getting relocated. May be there is something to do with marker positions with each zoom level, I am not sure.
Please suggest.

from tileview.

moagrius avatar moagrius commented on September 23, 2024

Markers stay in the relative position they were assigned. They will always indicate the same pixel on the tiled image.

If you have a TileView and call setSize(100,100), then add a marker at 50,50, that marker will always be at 50% from top and left. with setSize(500,500) and addMarker at 50,100, the marker would always be at 10% the total distance of the TileView from left and 20% the total distance from top.

If you're using a positioning system via TileView.defineRelativeBounds (e.g., lat/lng), then that's what the TileView will use with any subsequent position methods. To have a marker appear with a tap, while using a postioning system, you'd probably do something like this (untested - shooting a little blind here)

@Override
    public void onTap(int x, int y) {
    Log.i(TAG, "onTap : "+x+" - "+y);
    // you can use the new .unscale() instead of manual division for the next 2 lines, if you have the most current commit         
    int x = (int) ( x / getScale() );
    int y = (int) ( y / getScale() );      
    Point point = mTileView.translate( x, y );
    View marker = new ImageView( this);
    ((ImageView) marker).setImageResource( R.drawable.maps_marker_blue );
     mTileView.addMarker( marker, point.x,  point.y );          
   }

You'll also have to consider anchors. Anchors offset the marker view, so that the pixel on the image being indicated can be "pointed at" by whatever portion of the view is appropriate - maybe the top right, maybe centered horizontally and above (like a google marker, which would be -0.5f, -1.0f). More info on that in the wiki https://github.com/moagrius/TileView/wiki/Positioning and https://github.com/moagrius/TileView/wiki/Anchors

If that's not the behavior you're looking for, then you might want to just use a FrameLayout on top of the TileView.

Post back if you're still having trouble. I'm about to shut down for the night but will check back in tomorrow.

from tileview.

braj008 avatar braj008 commented on September 23, 2024

Thank you. new unscale(..) worked as expected.

from tileview.

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.