-
-
Notifications
You must be signed in to change notification settings - Fork 1.9k
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
Layer fix #2121
Layer fix #2121
Changes from all commits
af9f8f9
0162797
5039aa5
4e627d9
e0a10af
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -54,7 +54,7 @@ module.exports = function draw(gd) { | |
*/ | ||
|
||
// draw update menu container | ||
var menus = fullLayout._infolayer | ||
var menus = fullLayout._menulayer | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ha I guess that does it. I first thought about splitting the updatemenu buttons from their header Can anyone think of a situation where one would want to place an updatemenu below other There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I can't see when you'd want the updatemenu below anything else, but I guess it could be useful to separate There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Updatemenus were already smart enough to put the dropdown buttons (but not always-visible buttons) on top - exactly what I was suggesting 🎉 🏆 But there was a bug with this that if a new menu was added when other menus already existed, this would get added on top of the dropdown buttons -> fixed in e0a10af |
||
.selectAll('g.' + constants.containerClassName) | ||
.data(menuData.length > 0 ? [0] : []); | ||
|
||
|
@@ -97,6 +97,9 @@ module.exports = function draw(gd) { | |
|
||
// remove exiting header, remove dropped buttons and reset margins | ||
if(headerGroups.enter().size()) { | ||
// make sure gButton is on top of all headers | ||
gButton.node().parentNode.appendChild(gButton.node()); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Nicely done. |
||
|
||
gButton | ||
.call(removeAllButtons) | ||
.attr(constants.menuIndexAttrName, '-1'); | ||
|
@@ -135,13 +138,12 @@ module.exports = function draw(gd) { | |
}); | ||
}; | ||
|
||
/** | ||
* get only visible menus for display | ||
*/ | ||
function makeMenuData(fullLayout) { | ||
var contOpts = fullLayout[constants.name], | ||
menuData = []; | ||
|
||
// Filter visible dropdowns and attach '_index' to each | ||
// fullLayout options object to be used for 'object constancy' | ||
// in the data join key function. | ||
var contOpts = fullLayout[constants.name]; | ||
var menuData = []; | ||
|
||
for(var i = 0; i < contOpts.length; i++) { | ||
var item = contOpts[i]; | ||
|
@@ -154,7 +156,7 @@ function makeMenuData(fullLayout) { | |
|
||
// Note that '_index' is set at the default step, | ||
// it corresponds to the menu index in the user layout update menu container. | ||
// Because a menu can b set invisible, | ||
// Because a menu can be set invisible, | ||
// this is a more 'consistent' field than the index in the menuData. | ||
function keyFunction(menuOpts) { | ||
return menuOpts._index; | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Really we should just move shapes (and annotations for that matter) to the standard d3 update pattern like images already use (and which did not require this kind of change to adapt to the changed layering)... but that's a bigger project than I had an appetite for right now!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixing two 🪲 in one PR, but hungry for more 🍔