feat(image-annotate): 选区编辑 + 便利版 UI + 单张输出预设(1.1.0)
This commit is contained in:
1 parent
b9ace636ef
commit
662d7eae77
22 files changed
+3795
-343
No files matched your search
@@ -12,7 +12,7 @@ import { TEXT_FONT, allObjects, assignLayerZ, deleteSelectedShape, deleteSelecte
|
||||
import { boxCorners, clamp, drawRotationHandles, hitRotationHandle, rotPt, unrotPt } from './viewport.js'
|
||||
import { drawShape } from './tools.js'
|
||||
import { saveSnapshot, snapshotState } from './history.js'
|
||||
import { startImagePlacement } from './placement.js'
|
||||
import { placeImageDirectly } from './placement.js'
|
||||
import { updateBrushParamUI, updateColorUI } from './events.js'
|
||||
import { isDrawableLayer } from '../vendor/layer-logic.js'
|
||||
|
||||
@@ -41,7 +41,8 @@ import { isDrawableLayer } from '../vendor/layer-logic.js'
|
||||
// 与合成/导出/面板/命中测试共用同一份 z 序,杜绝「面板顺序 ≠ 实际叠放」
|
||||
for (const u of layerUnits()) {
|
||||
const el = u.kind === 'bitmap' ? u.obj.canvas : u.obj._canvas
|
||||
if (!el) continue
|
||||
// 快照恢复后的矢量对象可能带着被 JSON 序列化过的伪画布({}),必须挡住
|
||||
if (!el || el.nodeType !== 1) continue
|
||||
S.canvasStack.insertBefore(el, S.strokeCanvas)
|
||||
el.style.display = u.obj.visible === false ? 'none' : 'block'
|
||||
}
|
||||
@@ -312,9 +313,10 @@ export function setActiveLayer(id) {
|
||||
renderObjects()
|
||||
}
|
||||
|
||||
/** 添加位图图层(导入图片) — 启动放置流程,先调整大小/位置再确认 */
|
||||
/** 添加位图图层(导入图片)— 便利版:一步落层,不再需要 Enter 二次确认
|
||||
* 需要调大小/位置时切换到「选择」工具拖动 8 个手柄;Ctrl+Z 可撤销这一步。 */
|
||||
export function addBitmapLayer(img) {
|
||||
startImagePlacement(img)
|
||||
placeImageDirectly(img)
|
||||
}
|
||||
|
||||
/** 新建空白图层 */
|
||||
@@ -366,7 +368,7 @@ export function setActiveLayer(id) {
|
||||
|
||||
// ============ 矢量对象独立画布(位图/矢量统一排序) ============
|
||||
function vecCanvasFor(obj) {
|
||||
if (!obj._canvas || !obj._canvas.parentNode) {
|
||||
if (!obj._canvas || obj._canvas.nodeType !== 1 || !obj._canvas.parentNode) {
|
||||
const c = document.createElement('canvas')
|
||||
c.className = 'iwb-editor-vec-canvas'
|
||||
c.width = S.imgW
|
||||
@@ -390,7 +392,7 @@ export function setActiveLayer(id) {
|
||||
return obj
|
||||
}
|
||||
export function removeVecCanvas(obj) {
|
||||
if (obj && obj._canvas) {
|
||||
if (obj && obj._canvas && obj._canvas.nodeType === 1) {
|
||||
if (obj._canvas.parentNode) obj._canvas.parentNode.removeChild(obj._canvas)
|
||||
obj._canvas = null
|
||||
obj._ctx = null
|
||||
|
||||
Reference in new issue
Block a user