fix module load order. fix none/all selection for undo/redo. fix button show based on mode

This commit is contained in:
Stewart Allen 2021-10-19 22:23:18 -04:00
commit 6083543c12
3 changed files with 10 additions and 4 deletions

2
app.js
View file

@ -254,6 +254,7 @@ const script = {
"moto/load-url", "moto/load-url",
"moto/db", "moto/db",
"kiri/ui", "kiri/ui",
"kiri/do",
"kiri/lang", "kiri/lang",
"kiri/lang-en", "kiri/lang-en",
"kiri/catalog", "kiri/catalog",
@ -280,7 +281,6 @@ const script = {
"kiri/init", "kiri/init",
"kiri/export", "kiri/export",
"kiri/tools", "kiri/tools",
"kiri/do",
"@devices", "@devices",
"@icons" "@icons"
].map(p => p.charAt(0) !== '@' ? `src/${p}.js` : p), ].map(p => p.charAt(0) !== '@' ? `src/${p}.js` : p),

View file

@ -37,7 +37,8 @@ kiri.load(function(API) {
}; };
function updateButtons() { 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; $('undo').disabled = stpos === 0;
$('redo').disabled = stpos == stack.length; $('redo').disabled = stpos == stack.length;
} }
@ -86,6 +87,10 @@ kiri.load(function(API) {
clear(); clear();
}); });
event.on('view.set', mode => {
updateButtons();
});
// selection event (store position) // selection event (store position)
event.on('widget.rotate', (rec) => { event.on('widget.rotate', (rec) => {
let type = "rotate"; let type = "rotate";
@ -113,7 +118,7 @@ kiri.load(function(API) {
if (Math.abs(1 - (x * y * z)) < 0.0001) { if (Math.abs(1 - (x * y * z)) < 0.0001) {
return; return;
} }
let widgets = API.selection.widgets(); let widgets = API.selection.widgets(true);
let type = "scale"; let type = "scale";
pushActions({ pushActions({
redo: { redo: {
@ -137,7 +142,7 @@ kiri.load(function(API) {
// move complete (store updated position) // move complete (store updated position)
event.on('mouse.drag.done', () => { event.on('mouse.drag.done', () => {
let widgets = API.selection.widgets(); let widgets = API.selection.widgets(true);
let type = "move"; let type = "move";
pushActions({ pushActions({
redo: { redo: {

View file

@ -344,6 +344,7 @@ th, tr, td, label {
} }
#doit { #doit {
display: none;
position: absolute; position: absolute;
white-space: nowrap; white-space: nowrap;
font-size: smaller; font-size: smaller;