Commit 96b0bac3 authored by Jonathan Wilkes's avatar Jonathan Wilkes
Browse files

abstracted out iemgui dialog bindings into generic dialog_bindings

parent c0c5b4ce
......@@ -572,13 +572,7 @@ function add_events(name) {
pdgui.remove_dialogwin(pd_object_callback);
this.close(true);
});
document.onkeydown = function(evt) {
if (evt.keyCode === 13) { // enter
ok();
} else if (evt.keyCode === 27) { // escape
cancel();
}
};
pdgui.dialog_bindings(name);
}
</script>
......
......@@ -3894,3 +3894,15 @@ function gui_find_lowest_and_arrange(cid, reference_element_tag, objtag) {
}
}
}
// Bindings for dialog menu of iemgui, canvas, etc.
exports.dialog_bindings = function(did) {
var dwin = dialogwin[did].window;
dwin.document.onkeydown = function(evt) {
if (evt.keyCode === 13) { // enter
dwin.ok();
} else if (evt.keyCode === 27) { // escape
dwin.cancel();
}
};
}
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