Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

custom element Anchors capture object picking #15

Open
AttilaVM opened this issue Jan 26, 2017 · 0 comments
Open

custom element Anchors capture object picking #15

AttilaVM opened this issue Jan 26, 2017 · 0 comments

Comments

@AttilaVM
Copy link

AttilaVM commented Jan 26, 2017

I ran into an esoteric bug:

Custom element anchors were picked by pick_object(x, y) from the scene module using version 16.12.1. on GNU/Linux (which I guess is not relevant)

This bug was also experienced by at least one other person, see this post

I made a self-contained example:

example

To reproduce just unzip the archive in your b4w project directory. Open the anchor_bug.html from the project manager. Click to different points on the anchor fixed black divs (I disabled the pointer events on them), and on certain mouse positions the anchors will be picked instead of the cubes, you will see it in the js console. Of course the error also occurs when you click next to a div.

I found the cause and made a dirty fix or workaround, however I did not spend enough time on it, so it is possible that this change will disable some other functionality:

@@ -1749,11 +1749,6 @@ exports.pick_object = function(canvas_x, canvas_y) {
         return null;
     }
 
-    var anchor = m_anchors.pick_anchor(canvas_x, canvas_y);
-
-    if (anchor)
-        return anchor;
-
     var color = m_scenes.pick_color(main_scene, canvas_x, canvas_y);
 
     if (!color)

My suggestion is that anchor picking code should be separated from the pick_object function to its own function to avoid confusions like this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant