add shift-e hot key to open bambu dialog
This commit is contained in:
parent
a8e2f1ddb4
commit
ac1982b923
3 changed files with 28 additions and 0 deletions
|
|
@ -478,6 +478,20 @@ self.kiri.load(api => {
|
|||
return luminance > 0.5 ? "000000" : "FFFFFF";
|
||||
}
|
||||
|
||||
api.onkey(ev => {
|
||||
if (ev.key && ev.key.code === 'KeyE' && ev.key.shiftKey) {
|
||||
let cdev = api.conf.get().device;
|
||||
if (!printers) {
|
||||
printers = cdev.extras?.bbl;
|
||||
}
|
||||
if (printers) {
|
||||
device = device || cdev;
|
||||
api.modal.show('bambu');
|
||||
}
|
||||
return true;
|
||||
}
|
||||
});
|
||||
|
||||
api.event.on("init-done", function() {
|
||||
if (init) {
|
||||
return;
|
||||
|
|
|
|||
|
|
@ -25,6 +25,7 @@ let { data, kiri, moto, noop } = root,
|
|||
drop_layout: true, // layout on new drop
|
||||
hoverAdds: false, // when true only searches widget additions
|
||||
on_key: undefined, // function override default key handlers
|
||||
on_key2: [], // allows for multiple key handlers
|
||||
on_load: undefined, // function override file drop loads
|
||||
on_add_stl: undefined, // legacy override stl drop loads
|
||||
on_mouse_up: undefined, // function intercepts mouse up select
|
||||
|
|
@ -40,6 +41,9 @@ let { data, kiri, moto, noop } = root,
|
|||
moto.broker.publish("feature.hover", b);
|
||||
}
|
||||
},
|
||||
onkey = (fn) => {
|
||||
api.feature.on_key2.push(fn);
|
||||
},
|
||||
doit = {
|
||||
undo: noop, // do.js
|
||||
redo: noop // do.js
|
||||
|
|
@ -101,6 +105,7 @@ let { data, kiri, moto, noop } = root,
|
|||
modal: {}, // main.js
|
||||
mode: {}, // main.js
|
||||
o2js, // via utils
|
||||
onkey, // <--
|
||||
platform: {}, // platform.js
|
||||
probe: {}, // main.js
|
||||
process: {}, // main.js
|
||||
|
|
|
|||
|
|
@ -253,6 +253,9 @@ gapp.register("kiri.init", (root, exports) => {
|
|||
if (api.feature.on_key) {
|
||||
if (api.feature.on_key({up:evt})) return;
|
||||
}
|
||||
for (let handler of api.feature.on_key2) {
|
||||
if (handler({up:evt})) return;
|
||||
}
|
||||
switch (evt.keyCode) {
|
||||
// escape
|
||||
case 27:
|
||||
|
|
@ -280,6 +283,9 @@ gapp.register("kiri.init", (root, exports) => {
|
|||
if (api.feature.on_key) {
|
||||
if (api.feature.on_key({down:evt})) return;
|
||||
}
|
||||
for (let handler of api.feature.on_key2) {
|
||||
if (handler({down:evt})) return;
|
||||
}
|
||||
let move = evt.altKey ? 5 : 0,
|
||||
deg = move ? 0 : -Math.PI / (evt.shiftKey ? 36 : 2);
|
||||
switch (evt.keyCode) {
|
||||
|
|
@ -352,6 +358,9 @@ gapp.register("kiri.init", (root, exports) => {
|
|||
if (api.feature.on_key) {
|
||||
if (api.feature.on_key({key:evt})) return;
|
||||
}
|
||||
for (let handler of api.feature.on_key2) {
|
||||
if (handler({key:evt})) return;
|
||||
}
|
||||
if (evt.ctrlKey) {
|
||||
switch (evt.key) {
|
||||
case 'g': return api.group.merge();
|
||||
|
|
|
|||
Loading…
Reference in a new issue