-
Notifications
You must be signed in to change notification settings - Fork 3.5k
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
Sandcastle tweaks #1956
Sandcastle tweaks #1956
Conversation
Sandcastle.addDefaultToolbarButton excutes and highlights the toolbar immediately, eliminating the need for breaking out an extra function to call (muddying the code in the process).
When defined by a demo, Sandcastle.reset is called whenever a button or menu selection is main. This allows for the bookeeping/cleanup code to be cleanly abstracted away from the example-specific code that the user is interested in.
This needs a merge from master now, and edits to the GeoJSON example. |
Yep, doing it now. I also realized I need a change to the default/reset logic due to a problem exposed by the updated GeoJSON example. |
Also changed logic to defer execution of the default action until loading is finsihed; this way we can run the reset function before the default action.
Okay, ready. |
Got an idea, doesn't have to be for this PR, but let me know what you think:
Basically, by declaring menu(s) at the top, and then adding options individually to the menus, we can make the options get added similar to how buttons get added. This would avoid them needing What do you think? |
Great idea. Are you going to take a stab at it? If not I can probably do it over the weekend (in a different PR). |
…oolbar Conflicts: Apps/Sandcastle/gallery/3D Models.html
…oolbar Conflicts: Apps/Sandcastle/gallery/Billboards.html Apps/Sandcastle/gallery/Terrain.html
menu.onchange = onchange; | ||
menu.onchange = function() { | ||
window.Sandcastle.reset(); | ||
if (menu.selectedIndex > 0) { |
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.
Not all menus have a header at index 0, for example the Billboards menu.
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.
Okay, I improved the check so it doesn't matter now. This is ready.
@mramato I didn't get any time to work on the menu feature today. Let me know if you attack it this weekend, otherwise I'll try to carve out time next week. |
Added the below two functions to Sandcastle and made the relevant demos include them.
Sandcastle.addDefaultToolbarButton
executes and highlights the toolbar immediately, eliminating the need for breaking out an extra function to call (muddying the code in the process).Sandcastle.reset
is called whenever a button or menu selection is main. This allows for the bookkeeping/cleanup code to be cleanly abstracted away from the example-specific code that the user is interested in.