fix #185 janky layer things
Signed-off-by: Victor Seiji Hariki <victorseijih@gmail.com>
This commit is contained in:
parent
759b396f6d
commit
794ddcc275
1 changed files with 18 additions and 5 deletions
|
@ -188,9 +188,13 @@ const uil = {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Synchronizes with the layer lib
|
// Synchronizes with the layer lib
|
||||||
this.layers.forEach((uiLayer, index) => {
|
const ids = this.layers.map((l) => l.id);
|
||||||
if (index === 0) uiLayer.layer.moveAfter(bgLayer);
|
ids.forEach((id, index) => {
|
||||||
else uiLayer.layer.moveAfter(copy[index - 1].layer);
|
if (index === 0) this.layerIndex[id].layer.moveAfter(bgLayer);
|
||||||
|
else
|
||||||
|
this.layerIndex[id].layer.moveAfter(
|
||||||
|
this.layerIndex[ids[index - 1]].layer
|
||||||
|
);
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
|
@ -401,6 +405,14 @@ class UILayer {
|
||||||
deletable: true,
|
deletable: true,
|
||||||
});
|
});
|
||||||
|
|
||||||
|
console.debug(
|
||||||
|
"After",
|
||||||
|
(
|
||||||
|
(uil.layers.length > 0 && uil.layers[uil.layers.length - 1].layer) ||
|
||||||
|
bgLayer
|
||||||
|
).id
|
||||||
|
);
|
||||||
|
|
||||||
this.layer = imageCollection.registerLayer(extra.key, {
|
this.layer = imageCollection.registerLayer(extra.key, {
|
||||||
id: extra.id,
|
id: extra.id,
|
||||||
name,
|
name,
|
||||||
|
@ -451,10 +463,11 @@ commands.createCommand(
|
||||||
"addLayer",
|
"addLayer",
|
||||||
(title, opt, state) => {
|
(title, opt, state) => {
|
||||||
const options = Object.assign({}, opt) || {};
|
const options = Object.assign({}, opt) || {};
|
||||||
|
const id = guid();
|
||||||
defaultOpt(options, {
|
defaultOpt(options, {
|
||||||
id: guid(),
|
id,
|
||||||
group: null,
|
group: null,
|
||||||
name: "New Layer",
|
name: id,
|
||||||
key: null,
|
key: null,
|
||||||
deletable: true,
|
deletable: true,
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in a new issue