Commit f9face87 authored by Jonathan Wilkes's avatar Jonathan Wilkes
Browse files

disable canvas menu options when the dialog is present. Also, change variable...

disable canvas menu options when the dialog is present. Also, change variable name "o" to something less error-prone
parent f39a43bd
......@@ -357,10 +357,10 @@ function pdmenu_irc () {
}
function minit(menu_item, options) {
var o;
for (o in options) {
if (options.hasOwnProperty(o)) {
menu_item[o] = options[o];
var key;
for (key in options) {
if (options.hasOwnProperty(key)) {
menu_item[key] = options[key];
}
}
}
......
......@@ -785,10 +785,20 @@ function menu_generic () {
}
function minit(menu_item, options) {
var o;
for (o in options) {
if (options.hasOwnProperty(o)) {
menu_item[o] = options[o];
var key;
for (key in options) {
if (options.hasOwnProperty(key)) {
// For click callbacks, we want to check if canvas state is
// "none", in which case we don't call them. This is just a
// hack, though-- it'd be a better UX to disable all menu items
// when we're in the "none" state.
menu_item[key] = (key !== "click") ?
options[key] :
function() {
if (canvas_events.get_state() !== "none") {
options[key]();
}
};
}
}
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment