diff --git a/app.js b/app.js index 5981fdaa..360df5e2 100644 --- a/app.js +++ b/app.js @@ -254,6 +254,7 @@ const script = { "moto/load-url", "moto/db", "kiri/ui", + "kiri/do", "kiri/lang", "kiri/lang-en", "kiri/catalog", @@ -280,7 +281,6 @@ const script = { "kiri/init", "kiri/export", "kiri/tools", - "kiri/do", "@devices", "@icons" ].map(p => p.charAt(0) !== '@' ? `src/${p}.js` : p), diff --git a/src/kiri/do.js b/src/kiri/do.js index bc98f685..047f87b0 100644 --- a/src/kiri/do.js +++ b/src/kiri/do.js @@ -37,7 +37,8 @@ kiri.load(function(API) { }; function updateButtons() { - $('doit').style.display = stack.length ? '' : 'none'; + let isArrange = API.view.get() === API.const.VIEWS.ARRANGE; + $('doit').style.display = isArrange && stack.length ? 'flex' : 'none'; $('undo').disabled = stpos === 0; $('redo').disabled = stpos == stack.length; } @@ -86,6 +87,10 @@ kiri.load(function(API) { clear(); }); + event.on('view.set', mode => { + updateButtons(); + }); + // selection event (store position) event.on('widget.rotate', (rec) => { let type = "rotate"; @@ -113,7 +118,7 @@ kiri.load(function(API) { if (Math.abs(1 - (x * y * z)) < 0.0001) { return; } - let widgets = API.selection.widgets(); + let widgets = API.selection.widgets(true); let type = "scale"; pushActions({ redo: { @@ -137,7 +142,7 @@ kiri.load(function(API) { // move complete (store updated position) event.on('mouse.drag.done', () => { - let widgets = API.selection.widgets(); + let widgets = API.selection.widgets(true); let type = "move"; pushActions({ redo: { diff --git a/web/kiri/index.css b/web/kiri/index.css index 1a741817..74c20509 100644 --- a/web/kiri/index.css +++ b/web/kiri/index.css @@ -344,6 +344,7 @@ th, tr, td, label { } #doit { + display: none; position: absolute; white-space: nowrap; font-size: smaller;