* fix issue #736

* Update ext-storage.js

* 7.1.3
This commit is contained in:
JFH
2022-03-13 19:37:27 +01:00
committed by GitHub
parent a335e44dc8
commit ca5107f599
7 changed files with 67 additions and 57 deletions

View File

@@ -98,6 +98,7 @@ export default {
svgEditor.loadFromString(cached)
const name = storage.getItem(`title-${key}`) ?? 'untitled.svg'
svgEditor.topPanel.updateTitle(name)
svgEditor.layersPanel.populateLayers()
}
}

View File

@@ -153,11 +153,7 @@ class LayersPanel {
index (el) {
if (!el) return -1
let i = 0
do {
i++
} while (el === el.previousElementSibling)
return i
return Array.from(document.querySelector('#layerlist tbody').children).indexOf(el)
}
/**
@@ -181,12 +177,9 @@ class LayersPanel {
* @returns {void}
*/
moveLayer (pos) {
const total = this.editor.svgCanvas.getCurrentDrawing().getNumLayers()
let curIndex = (this.index(document.querySelector('#layerlist tr.layersel')) - 1)
if (curIndex > 0 || curIndex < total - 1) {
curIndex += pos
this.editor.svgCanvas.setCurrentLayerPosition(total - curIndex - 1)
const curPos = this.editor.svgCanvas.indexCurrentLayer()
if (curPos !== -1) {
this.editor.svgCanvas.setCurrentLayerPosition(curPos - pos)
this.populateLayers()
}
}