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/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),

View file

@ -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: {

View file

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