revert(diy): 撤销贴纸坐标钳制,恢复可拖出画布外自由摆放
需求决定(2026-09-12):负坐标/超出画布为合法摆放状态; 重叠误报根因是尺寸语义(已由归一化修复),坐标钳制一并移除。 文档同步标注该决策。 Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
+3
-18
@@ -297,16 +297,10 @@ export default function DIYPage() {
|
||||
const handleStickerTouchMove = (e: any) => {
|
||||
if (!isDragging || !activeStickerId) return
|
||||
const touch = e.touches[0]
|
||||
// 需求决定(2026-09-12):贴纸允许拖出画布外自由摆放,不做坐标钳制
|
||||
const next = stickers.map(s => {
|
||||
if (s.id !== activeStickerId) return s
|
||||
// 问题1 修正:坐标钳制在画布内,杜绝负坐标与拖出画布(碰撞盒 = x/y + 显示宽高)
|
||||
const maxX = Math.max(0, category.mask.width - s.width * s.scale)
|
||||
const maxY = Math.max(0, category.mask.height - s.height * s.scale)
|
||||
return {
|
||||
...s,
|
||||
x: Math.min(Math.max(touch.clientX - startPos.x, 0), maxX),
|
||||
y: Math.min(Math.max(touch.clientY - startPos.y, 0), maxY)
|
||||
}
|
||||
return { ...s, x: touch.clientX - startPos.x, y: touch.clientY - startPos.y }
|
||||
})
|
||||
const checked = checkOverlap(next)
|
||||
setStickers(checked)
|
||||
@@ -325,16 +319,7 @@ export default function DIYPage() {
|
||||
const handleScale = (id: string, delta: number) => {
|
||||
const next = stickers.map(s => {
|
||||
if (s.id !== id) return s
|
||||
const scale = Math.max(0.3, Math.min(3, s.scale + delta))
|
||||
// 问题1 修正:缩放后把位置钳回画布内
|
||||
const maxX = Math.max(0, category.mask.width - s.width * scale)
|
||||
const maxY = Math.max(0, category.mask.height - s.height * scale)
|
||||
return {
|
||||
...s,
|
||||
scale,
|
||||
x: Math.min(Math.max(s.x, 0), maxX),
|
||||
y: Math.min(Math.max(s.y, 0), maxY)
|
||||
}
|
||||
return { ...s, scale: Math.max(0.3, Math.min(3, s.scale + delta)) }
|
||||
})
|
||||
const checked = checkOverlap(next)
|
||||
setStickers(checked)
|
||||
|
||||
Reference in New Issue
Block a user