Coder Social home page Coder Social logo

Comments (14)

moagrius avatar moagrius commented on July 23, 2024

i'm not following - can you use code or psuedo-code to describe step-by-step what you're experiencing?

from tileview.

moagrius avatar moagrius commented on July 23, 2024

per email exchange, this issue was resolved by calling requestLayout after adding a marker, to make sure the layout rect was registered with the hit-testing map. The latest release has this functionality built-in.

from tileview.

Eteokles avatar Eteokles commented on July 23, 2024

For me it's not working. When i add a marker dynamically and if i don't zoom in or out onTap is not triggered. I use the last src version and i've called requestLayout (after a test without) but it doesn't work...

from tileview.

Tristus1er avatar Tristus1er commented on July 23, 2024

Same here !

from tileview.

moagrius avatar moagrius commented on July 23, 2024

can you guys try calling both invalidate* and postInvalidate on the MarkerManager after the marker is added?

or... can you provide step-by-step instructions to recreate?

from tileview.

Eteokles avatar Eteokles commented on July 23, 2024

in my onFingerDown method i do
handler.postdelayed( runnable, ViewConfiguration.getLongPressTimeout() );

runnable :
public void run() {
if (!movedFinger) {
ImageView marker = new ImageView(ctx);
marker.setImageResource(R.drawable.marker);
marker.setTag("Test");
tileview.addMarker(marker, xPoint, yPoint, -0.5f, -1f);
}
}

I've tried both invalidate and postInvalidate but without result.

from tileview.

moagrius avatar moagrius commented on July 23, 2024

I see - so the marker is rendering but it's not being registered for the onMarkerTap event, right? If that's not correct, please explain.

Assuming that is correct, a little background: onMakerTap just compares the coordinates of the tap event to a map of all the marker's layout as Rects. This is calculated in onLayout.

I suspect the problem is because you're both adding markers from a handler, off the UI thread. So, try this:

At the end of your run method (on the line after tileview.addMarker(marker, xPoint, yPoint, -0.5f, -1f);), add something like this

tileview.post(new Runnable(){
  @Override
  public void run(){
    tileview.requestLayout();
  }
});

post will be called on the TileView's UI thread, and hopefully force a recalculation of the marker layouts which would register them with the onMarkerTap map of Rects.

LMK if that helps. If not, I'll try to recreate locally to find a patch.

from tileview.

Eteokles avatar Eteokles commented on July 23, 2024

nop... it still not work.

from tileview.

moagrius avatar moagrius commented on July 23, 2024

ok, i'll create a debug build and post back within the next couple days, hopefully with a patch to commit

thanks for the feedback

from tileview.

Eteokles avatar Eteokles commented on July 23, 2024

in the onLayout method of MarkerManager if i comment

if(!changed){ 
    return; 
}

It's work. The Rect is not define.

from tileview.

moagrius avatar moagrius commented on July 23, 2024

awesome - looks like a premature optimization - I'll make the change and commit as soon as I get a chance.

thanks!

from tileview.

moagrius avatar moagrius commented on July 23, 2024

@skaor this patch has been included in the latest commit and release. thanks for contributing!

from tileview.

Eteokles avatar Eteokles commented on July 23, 2024

yeahhh my first contrib to a github project :p !

from tileview.

moagrius avatar moagrius commented on July 23, 2024

you're even mentioned in the release - you're basically famous now ;)

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.