feat(image-annotate): v1.2.9 图层 PS 快捷键 + 顶栏会话组左移
- 图层快捷键(PS 同款,e.code 匹配防中文输入法吞键): Ctrl+]/[ 上/下移一层、Ctrl+Shift+]/[ 置顶/置底、Alt+]/[ 向上/向下选层 - Delete 删除选中的位图图层(原图锁定除外) - moveLayer 无选中时 toast 提示,不再无声失败 - 顶栏「新建/覆盖/退出」移到最左会话组;右侧只留 输出+导出,下载改文案「导出」 - [ / ] 笔刷大小同时匹配 e.code,中文输入法下不再失灵 - __debug().shapes 补 z 字段;harness 新增 6 项断言(113 项全绿)
This commit is contained in:
1 parent
e1465b9d68
commit
9d923aed26
9 files changed
+255
-88
No files matched your search
@@ -13,6 +13,7 @@ import { drawBitmapSelection, drawVectorToCanvas, hitBitmapAt, removeVecCanvas,
|
||||
import { drawPlacementPreview } from './placement.js'
|
||||
import { drawShape } from './tools.js'
|
||||
import { saveSnapshot, snapshotState } from './history.js'
|
||||
import { toast } from './commands.js'
|
||||
import { renderOptionBar, updateLayerUI } from './events.js'
|
||||
import { isDrawableLayer } from '../vendor/layer-logic.js'
|
||||
|
||||
@@ -226,7 +227,9 @@ import { isDrawableLayer } from '../vendor/layer-logic.js'
|
||||
const layer = S.layers.find(l => l.id === S.selectedLayerId && l.id !== 'base' && !l.locked)
|
||||
if (layer) sel = { kind: 'bitmap', obj: layer }
|
||||
}
|
||||
if (!sel || sel.obj.locked || sel.obj.id === 'base') return
|
||||
// 快捷键(Ctrl+]/[)与按钮共用此入口:没选中时给出可见反馈,不再无声失败
|
||||
if (!sel) { toast('先在画布或图层面板选中要调整的元素', 'info'); return }
|
||||
if (sel.obj.locked || sel.obj.id === 'base') return
|
||||
const units = layerUnits()
|
||||
// base 是锁定且不透明的底图,固定在最下层;任何元素都不许置底到它下面(否则等于消失)
|
||||
const baseIdx = units.findIndex(u => u.obj.id === 'base')
|
||||
@@ -251,6 +254,24 @@ import { isDrawableLayer } from '../vendor/layer-logic.js'
|
||||
renderLayerPanel()
|
||||
}
|
||||
|
||||
/** PS: Alt+] / Alt+[ 向上/向下选择图层(位图与矢量同一份 z 列表)。
|
||||
* 当前没有任何选中时:向上选最顶层、向下选最底层,让用户能用键盘从头开始遍历。 */
|
||||
export function selectNeighborLayer(up) {
|
||||
const units = layerUnits()
|
||||
if (!units.length) return
|
||||
const sel = getSelectedObject()
|
||||
let cur = -1
|
||||
if (sel) cur = units.findIndex(u => u.obj === sel.obj)
|
||||
else if (S.selectedLayerId) cur = units.findIndex(u => u.kind === 'bitmap' && u.obj.id === S.selectedLayerId)
|
||||
const idx = cur < 0
|
||||
? (up ? units.length - 1 : 0)
|
||||
: (up ? Math.min(cur + 1, units.length - 1) : Math.max(cur - 1, 0))
|
||||
const u = units[idx]
|
||||
if (!u) return
|
||||
selectUnit(u.kind, u.obj.id)
|
||||
renderLayerPanel()
|
||||
}
|
||||
|
||||
function shapeHandlePoints(s) {
|
||||
const b = shapeBounds(s)
|
||||
if (s.type === 'pen') {
|
||||
|
||||
Reference in new issue
Block a user