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
Minor: unpositioned extension button in wrong place #326
Comments
While many of the comments are not canon, and were just my quick attempt to make sense of the arguments (which in this case, it looks like I got wrong), it does seem like the description I have there would be the desired behavior, so I have made the change in However, the current invocation of |
Thanks for the before/after fix. I have noticed the inconsistent ordering behavior and had it on my todo list to figure out at some point. Like you, I jotted it down as a problem but didn't prioritize the resolution as it's infrequent and not all that impactful. |
Perhaps the items could be added to an oversized array asynchronously, only increasing the array size when a collision happens. After all the promises return, the array could be compressed and the items added to #main_menu ul. I'm sure it's not that simple as there are multiple button types being processed. |
OK, I've got a pretty hacked up version of this repo now but I the following approach seems to work. First, I add a data-position attribute to the div if the extension has a preference. Then after the promises return, I sort the children of all elements with the class tools_panel. To be backwards compatible, I give preference to the items without a position...that is, they will remain unsorted at the top/left. I don't think it's the fastest way to sort this list but it seems to be working for me. Here's the two code fragments
|
#326 unpositioned extension button in wrong place
Describe the bug
According to comment at svg_editor.js:3214
@Property {Integer} [position] The numeric index for placement; defaults to last position (as of the time of extension addition) if not present. For use with {@link http://api.jquery.com/eq/}.
However, I believe this case falls through to line 3276
$(parent).children().last().before(button);
Which adds it in the second to last position. I think this should be
$(parent).children().last().after(button);
The text was updated successfully, but these errors were encountered: