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
@@ -8,13 +8,13 @@
|
||||
|
||||
import { S, ZOOM_STEP, runtime } from './state.js'
|
||||
import { ROT_CURSOR, clamp, getPos, isOverRotationHandle, setView, setZoomActual, setZoomFit, zoomStep } from './viewport.js'
|
||||
import { addBitmapLayer, addBlankLayer, applyBitmapDrag, beginBitmapDrag, clearSelection, ensureWritableLayer, getActiveCtx, getActiveLayer, hitBitmapHandle, removeVecCanvas, renderLayerPanel } from './layers.js'
|
||||
import { addBitmapLayer, addBlankLayer, applyBitmapDrag, beginBitmapDrag, clearSelection, deleteLayer, ensureWritableLayer, getActiveCtx, getActiveLayer, hitBitmapHandle, removeVecCanvas, renderLayerPanel } from './layers.js'
|
||||
import { applyColorChange, beginStroke, clearToolRing, drawToolRing, endStroke, eraseSegment, exitPicker, hidePickerTip, sampleColor, setTool, showPickerTip, strokeSegment } from './tools.js'
|
||||
import { beginMarquee, updateMarquee, endMarquee, beginLasso, updateLasso, endLasso, clearMarquee, syncAnts, renderSelection } from './selection.js'
|
||||
import { runCommand, toast } from './commands.js'
|
||||
import { showSelectionContext, hideSelectionContext } from './floating.js'
|
||||
import { applyConstraintDrag, cancelCrop, clearOverlay, confirmCrop, drawCropPreview, hideCropBar, hitCropHandle, insideRect, resizeCropRect, setConstraint, showCropBar, updateCropInfo } from './crop.js'
|
||||
import { applyShapeHandle, beginPenEdit, beginShapeHandleDrag, beginTextRotate, beginTextScaleDrag, commitTextInput, deleteSelectedShape, deleteSelectedText, exitPenEdit, getPenEditingShape, getSelectedShape, getSelectedText, hideTextInput, hitAnyObject, hitPenEdgeInsert, hitPenPoint, hitShapeHandle, hitShapeLayer, hitTextHandle, hitTextLayer, hitTopmost, moveLayer, renderObjects, selectUnit, shapeBounds, showTextInput } from './objects.js'
|
||||
import { applyShapeHandle, beginPenEdit, beginShapeHandleDrag, beginTextRotate, beginTextScaleDrag, commitTextInput, deleteSelectedShape, deleteSelectedText, exitPenEdit, getPenEditingShape, getSelectedShape, getSelectedText, hideTextInput, hitAnyObject, hitPenEdgeInsert, hitPenPoint, hitShapeHandle, hitShapeLayer, hitTextHandle, hitTextLayer, hitTopmost, moveLayer, renderObjects, selectNeighborLayer, selectUnit, shapeBounds, showTextInput } from './objects.js'
|
||||
import { cancelImagePlacement, confirmImagePlacement, drawPlacementPreview, hitPlacementHandle, insidePlacementRect, resizePlacement } from './placement.js'
|
||||
import { close, exportResult } from './index.js'
|
||||
import { loadImage } from './dom.js'
|
||||
@@ -1741,7 +1741,9 @@ import { hexToRgb, parseRatio, rgbToHex } from '../vendor/image-math.js'
|
||||
}
|
||||
|
||||
// PS:] 增大 / [ 减小画笔大小(画笔与橡皮共用,光标环即时反馈)
|
||||
if (!mod && !e.altKey && (e.key === '[' || e.key === ']')) {
|
||||
// 同时匹配 e.code(BracketLeft/Right):中文输入法下 e.key 会变成「【」「】」,只看 e.key 会失灵
|
||||
const isBracket = e.key === '[' || e.key === ']' || e.code === 'BracketLeft' || e.code === 'BracketRight'
|
||||
if (!mod && !e.altKey && isBracket) {
|
||||
e.preventDefault()
|
||||
const step = S.brushSize >= 64 ? 8 : S.brushSize >= 24 ? 4 : S.brushSize >= 8 ? 2 : 1
|
||||
S.brushSize = clamp(S.brushSize + (e.key === ']' ? step : -step), 1, 300)
|
||||
@@ -1799,17 +1801,34 @@ import { hexToRgb, parseRatio, rgbToHex } from '../vendor/image-math.js'
|
||||
}
|
||||
if (S.selectedTextId) { e.preventDefault(); deleteSelectedText(); renderLayerPanel(); return }
|
||||
if (S.selectedShapeId) { e.preventDefault(); deleteSelectedShape(); renderLayerPanel(); return }
|
||||
// PS 习惯:选中位图层(非原图)时 Delete 直接删除该图层
|
||||
if (S.selectedLayerId && S.selectedLayerId !== 'base') {
|
||||
e.preventDefault()
|
||||
deleteLayer(S.selectedLayerId)
|
||||
renderLayerPanel()
|
||||
return
|
||||
}
|
||||
}
|
||||
if (e.code === 'Space') {
|
||||
e.preventDefault()
|
||||
if (!S.spaceDown) { S.spaceDown = true; updateCursor() }
|
||||
return
|
||||
}
|
||||
if (mod && (e.key === ']' || e.key === '[')) {
|
||||
e.preventDefault()
|
||||
const up = e.key === ']'
|
||||
moveLayer(e.shiftKey ? (up ? 'top' : 'bottom') : (up ? 'up' : 'down'))
|
||||
return
|
||||
// ---- 图层快捷键(PS 同款,统一用 e.code 匹配防中文输入法吞键)----
|
||||
// Ctrl+] / Ctrl+[ 上移/下移一层;Ctrl+Shift+] / Ctrl+Shift+[ 置顶/置底;
|
||||
// Alt+] / Alt+[ 向上/向下选择图层(Mac 上 Cmd+]/[ 被浏览器前进/后退占用,用 Ctrl)
|
||||
if (e.code === 'BracketLeft' || e.code === 'BracketRight') {
|
||||
const up = e.code === 'BracketRight'
|
||||
if (mod) {
|
||||
e.preventDefault()
|
||||
moveLayer(e.shiftKey ? (up ? 'top' : 'bottom') : (up ? 'up' : 'down'))
|
||||
return
|
||||
}
|
||||
if (e.altKey) {
|
||||
e.preventDefault()
|
||||
selectNeighborLayer(up)
|
||||
return
|
||||
}
|
||||
}
|
||||
if (mod && key === 'z') {
|
||||
e.preventDefault()
|
||||
|
||||
Reference in new issue
Block a user