jvs-ppt-ui 0.0.37 → 0.0.38
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/lib/jvs-ppt-ui.es.js +17437 -17300
- package/dist/lib/jvs-ppt-ui.umd.js +81 -81
- package/dist/lib/style.css +1 -1
- package/package.json +1 -1
- package/src/components/CanvasArea.vue +53 -14
- package/src/components/SidebarLeft.vue +30 -6
- package/src/components/sidebar/common/SidebarPositionGroup.vue +199 -33
- package/src/components/sidebar/panels/SidebarImageFormatPanel.vue +37 -33
- package/src/composables/canvas/useCanvasCrop.ts +25 -2
- package/src/composables/sidebar/useSidebarElementTransform.ts +13 -7
package/package.json
CHANGED
|
@@ -290,6 +290,7 @@ const {
|
|
|
290
290
|
|
|
291
291
|
// Crop Composable
|
|
292
292
|
const {
|
|
293
|
+
isCropping,
|
|
293
294
|
startInteractiveCrop,
|
|
294
295
|
handleCropDrag,
|
|
295
296
|
stopCropDrag,
|
|
@@ -299,7 +300,10 @@ const {
|
|
|
299
300
|
pauseHistory,
|
|
300
301
|
getElementPixels: (el: any) => getElementPixels(el),
|
|
301
302
|
findParentGroup: (id: any) => findParentGroup(id),
|
|
302
|
-
addHistorySnapshot: () => addHistorySnapshot()
|
|
303
|
+
addHistorySnapshot: () => addHistorySnapshot(),
|
|
304
|
+
onCropStop: () => {
|
|
305
|
+
justSelectedElement = true
|
|
306
|
+
}
|
|
303
307
|
})
|
|
304
308
|
|
|
305
309
|
// Element Map and Group helpers
|
|
@@ -836,6 +840,7 @@ const isInteracting = computed(() => {
|
|
|
836
840
|
isDraggingChild.value ||
|
|
837
841
|
isResizing.value ||
|
|
838
842
|
isRotating.value ||
|
|
843
|
+
isCropping.value ||
|
|
839
844
|
isDraggingLine.value ||
|
|
840
845
|
isDraggingLineControlPoint.value ||
|
|
841
846
|
isPanningCanvas.value
|
|
@@ -1160,21 +1165,48 @@ const getQuickToolbarAnchor = (el: any) => {
|
|
|
1160
1165
|
return { box, extraTableOffset }
|
|
1161
1166
|
}
|
|
1162
1167
|
|
|
1163
|
-
// 将工具栏物理坐标(left/top)
|
|
1168
|
+
// 将工具栏物理坐标(left/top)钳制在幻灯片及画布可视区域内,防止超出可视区顶部被裁剪或拖出画布无法拖回
|
|
1164
1169
|
const clampQuickToolbarPhysical = (left: number, top: number) => {
|
|
1165
1170
|
const scale = (zoomRatio.value || 100) / 100
|
|
1166
1171
|
const slideW = (logicalWidth.value || 0) * scale
|
|
1167
1172
|
const slideH = (logicalHeight.value || 0) * scale
|
|
1168
1173
|
const toolbarEl = document.querySelector('.floating-quick-toolbar') as HTMLElement | null
|
|
1169
|
-
const halfW = (toolbarEl?.offsetWidth ||
|
|
1170
|
-
const toolbarH = toolbarEl?.offsetHeight ||
|
|
1174
|
+
const halfW = (toolbarEl?.offsetWidth || 220) / 2 // translateX(-50%),left 为中心点
|
|
1175
|
+
const toolbarH = toolbarEl?.offsetHeight || 42
|
|
1176
|
+
|
|
1177
|
+
let minLeft = halfW
|
|
1178
|
+
let maxLeft = Math.max(halfW, slideW - halfW)
|
|
1179
|
+
let minTop = -56
|
|
1180
|
+
let maxTop = Math.max(0, slideH - toolbarH)
|
|
1171
1181
|
|
|
1172
|
-
const
|
|
1173
|
-
const
|
|
1174
|
-
|
|
1182
|
+
const wrapperEl = document.querySelector('.canvas-slide-wrapper') as HTMLElement | null
|
|
1183
|
+
const zoomContainerEl = document.querySelector('.slide-zoom-container') as HTMLElement | null
|
|
1184
|
+
if (wrapperEl && zoomContainerEl) {
|
|
1185
|
+
const wrapperRect = wrapperEl.getBoundingClientRect()
|
|
1186
|
+
const zoomRect = zoomContainerEl.getBoundingClientRect()
|
|
1187
|
+
// 距离 .canvas-slide-wrapper 可视边界保留至少 8px 安全间距,防止顶部/四周溢出被裁剪
|
|
1188
|
+
const visibleMinTop = (wrapperRect.top - zoomRect.top) + 8
|
|
1189
|
+
const visibleMaxTop = (wrapperRect.bottom - zoomRect.top) - toolbarH - 8
|
|
1190
|
+
const visibleMinLeft = (wrapperRect.left - zoomRect.left) + halfW + 8
|
|
1191
|
+
const visibleMaxLeft = (wrapperRect.right - zoomRect.left) - halfW - 8
|
|
1192
|
+
|
|
1193
|
+
minTop = Math.max(minTop, visibleMinTop)
|
|
1194
|
+
if (visibleMaxTop >= minTop) {
|
|
1195
|
+
maxTop = Math.min(maxTop, visibleMaxTop)
|
|
1196
|
+
}
|
|
1197
|
+
minLeft = Math.max(minLeft, visibleMinLeft)
|
|
1198
|
+
if (visibleMaxLeft >= minLeft) {
|
|
1199
|
+
maxLeft = Math.min(maxLeft, visibleMaxLeft)
|
|
1200
|
+
}
|
|
1201
|
+
}
|
|
1202
|
+
|
|
1203
|
+
const clampedLeft = Math.min(Math.max(left, minLeft), Math.max(minLeft, maxLeft))
|
|
1204
|
+
const clampedTop = Math.min(Math.max(top, minTop), Math.max(minTop, maxTop))
|
|
1205
|
+
return { left: Math.round(clampedLeft), top: Math.round(clampedTop) }
|
|
1175
1206
|
}
|
|
1176
1207
|
|
|
1177
1208
|
const getFloatingQuickToolbarStyle = (el: any) => {
|
|
1209
|
+
void selectionVersion.value
|
|
1178
1210
|
if (isDragging.value || isCanvasDragging.value) {
|
|
1179
1211
|
return { display: 'none' } as any
|
|
1180
1212
|
}
|
|
@@ -1602,6 +1634,9 @@ watch([selectedElementId, isEditingText], () => {
|
|
|
1602
1634
|
savedSelectionRange = null
|
|
1603
1635
|
}
|
|
1604
1636
|
selectionVersion.value++
|
|
1637
|
+
nextTick(() => {
|
|
1638
|
+
selectionVersion.value++
|
|
1639
|
+
})
|
|
1605
1640
|
})
|
|
1606
1641
|
|
|
1607
1642
|
watch(selectedElementId, (newId, oldId) => {
|
|
@@ -1964,6 +1999,7 @@ function handleWindowMouseDown(e: MouseEvent) {
|
|
|
1964
1999
|
if (
|
|
1965
2000
|
target.closest('.resize-handle') ||
|
|
1966
2001
|
target.closest('.rotate-handle') ||
|
|
2002
|
+
target.closest('.crop-handle') ||
|
|
1967
2003
|
target.closest('.line-point-handle') ||
|
|
1968
2004
|
target.closest('.line-control-handle') ||
|
|
1969
2005
|
target.closest('.table-edit-mask') ||
|
|
@@ -2005,7 +2041,10 @@ function handleWindowMouseDown(e: MouseEvent) {
|
|
|
2005
2041
|
return
|
|
2006
2042
|
}
|
|
2007
2043
|
|
|
2008
|
-
// Deselect active elements
|
|
2044
|
+
// Deselect active elements (blur any active right-sidebar input first so its @blur commits while selectedElement is still active)
|
|
2045
|
+
if (typeof document !== 'undefined' && document.activeElement instanceof HTMLElement && document.activeElement.closest('.sidebar-right')) {
|
|
2046
|
+
document.activeElement.blur()
|
|
2047
|
+
}
|
|
2009
2048
|
if (isEditingText.value) {
|
|
2010
2049
|
checkAndExitEditText(undefined, true)
|
|
2011
2050
|
}
|
|
@@ -8923,12 +8962,12 @@ async function handleGlobalPaste(e: ClipboardEvent) {
|
|
|
8923
8962
|
:selected-element-keypoints="selectedElementKeypoints"
|
|
8924
8963
|
:get-resize-cursor="getResizeCursor"
|
|
8925
8964
|
:zoom-ratio="zoomRatio"
|
|
8926
|
-
@resize-start="(ev, el, handle) => startResize(ev, el, handle)"
|
|
8927
|
-
@rotate-start="(ev, el) => startRotate(ev, el)"
|
|
8928
|
-
@keypoint-drag-start="(ev, el, idx) => startDragKeypoint(ev, el, idx)"
|
|
8929
|
-
@line-point-drag-start="(ev, el, pt) => startDragLinePoint(ev, el, pt)"
|
|
8930
|
-
@line-control-point-drag-start="(ev, el, t) => startDragLineControlPoint(ev, el, t)"
|
|
8931
|
-
@crop-start="(ev, el, handle) => startInteractiveCrop(ev, el, handle)"
|
|
8965
|
+
@resize-start="(ev, el, handle) => { justSelectedElement = true; startResize(ev, el, handle) }"
|
|
8966
|
+
@rotate-start="(ev, el) => { justSelectedElement = true; startRotate(ev, el) }"
|
|
8967
|
+
@keypoint-drag-start="(ev, el, idx) => { justSelectedElement = true; startDragKeypoint(ev, el, idx) }"
|
|
8968
|
+
@line-point-drag-start="(ev, el, pt) => { justSelectedElement = true; startDragLinePoint(ev, el, pt) }"
|
|
8969
|
+
@line-control-point-drag-start="(ev, el, t) => { justSelectedElement = true; startDragLineControlPoint(ev, el, t) }"
|
|
8970
|
+
@crop-start="(ev, el, handle) => { justSelectedElement = true; startInteractiveCrop(ev, el, handle) }"
|
|
8932
8971
|
/>
|
|
8933
8972
|
</div>
|
|
8934
8973
|
|
|
@@ -642,6 +642,16 @@ function ensureTemplateMasterForSlide(tpl: SlideTemplateItem, slide: any): strin
|
|
|
642
642
|
return newMasterId
|
|
643
643
|
}
|
|
644
644
|
|
|
645
|
+
function isSlideBlankOrUnedited(slide: any): boolean {
|
|
646
|
+
if (!slide) return false
|
|
647
|
+
const els = Array.isArray(slide.elements) ? slide.elements.filter(Boolean) : []
|
|
648
|
+
if (els.length === 0) return true
|
|
649
|
+
return els.every((el: any) => {
|
|
650
|
+
if (el.isPlaceholderReplaced || el.replaced) return false
|
|
651
|
+
return isPlaceholderElement(el)
|
|
652
|
+
})
|
|
653
|
+
}
|
|
654
|
+
|
|
645
655
|
function insertSingleTemplateSlide(tpl: SlideTemplateItem, slide: any, slideIdx: number) {
|
|
646
656
|
if (!slide) return
|
|
647
657
|
addHistorySnapshot()
|
|
@@ -652,9 +662,16 @@ function insertSingleTemplateSlide(tpl: SlideTemplateItem, slide: any, slideIdx:
|
|
|
652
662
|
if (!cloned.title) {
|
|
653
663
|
cloned.title = `${tpl.name} - 幻灯片 ${slideIdx + 1}`
|
|
654
664
|
}
|
|
655
|
-
const
|
|
656
|
-
slides.value
|
|
657
|
-
|
|
665
|
+
const currentIdx = Math.max(0, Math.min(slides.value.length - 1, activeIndex.value))
|
|
666
|
+
const curSlide = slides.value[currentIdx]
|
|
667
|
+
if (curSlide && isSlideBlankOrUnedited(curSlide)) {
|
|
668
|
+
slides.value.splice(currentIdx, 1, cloned)
|
|
669
|
+
activeIndex.value = currentIdx
|
|
670
|
+
} else {
|
|
671
|
+
const insertPos = Math.min(slides.value.length, Math.max(0, activeIndex.value + 1))
|
|
672
|
+
slides.value.splice(insertPos, 0, cloned)
|
|
673
|
+
activeIndex.value = insertPos
|
|
674
|
+
}
|
|
658
675
|
activeSlideVersion.value++
|
|
659
676
|
displaySlides.value = [...slides.value]
|
|
660
677
|
addHistorySnapshot()
|
|
@@ -675,9 +692,16 @@ function insertAllTemplateSlides(tpl: SlideTemplateItem) {
|
|
|
675
692
|
}
|
|
676
693
|
return cloned
|
|
677
694
|
})
|
|
678
|
-
const
|
|
679
|
-
slides.value
|
|
680
|
-
|
|
695
|
+
const currentIdx = Math.max(0, Math.min(slides.value.length - 1, activeIndex.value))
|
|
696
|
+
const curSlide = slides.value[currentIdx]
|
|
697
|
+
if (curSlide && isSlideBlankOrUnedited(curSlide)) {
|
|
698
|
+
slides.value.splice(currentIdx, 1, ...clonedList)
|
|
699
|
+
activeIndex.value = currentIdx
|
|
700
|
+
} else {
|
|
701
|
+
const insertPos = Math.min(slides.value.length, Math.max(0, activeIndex.value + 1))
|
|
702
|
+
slides.value.splice(insertPos, 0, ...clonedList)
|
|
703
|
+
activeIndex.value = insertPos
|
|
704
|
+
}
|
|
681
705
|
activeSlideVersion.value++
|
|
682
706
|
displaySlides.value = [...slides.value]
|
|
683
707
|
addHistorySnapshot()
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
<script setup lang="ts">
|
|
2
|
-
import { ref, computed } from 'vue'
|
|
2
|
+
import { ref, computed, nextTick } from 'vue'
|
|
3
3
|
import { useSlides } from '../../../composables/useSlides'
|
|
4
4
|
|
|
5
5
|
const props = withDefaults(defineProps<{
|
|
@@ -36,7 +36,7 @@ const emit = defineEmits<{
|
|
|
36
36
|
(e: 'adjustZIndex', command: any): void
|
|
37
37
|
}>()
|
|
38
38
|
|
|
39
|
-
const { activeSlide, selectedElementId, selectedElementIds } = useSlides()
|
|
39
|
+
const { activeSlide, selectedElementId, selectedElementIds, undo, redo } = useSlides()
|
|
40
40
|
|
|
41
41
|
const selectedIds = computed(() => {
|
|
42
42
|
if (selectedElementIds.value && selectedElementIds.value.length > 0) {
|
|
@@ -74,36 +74,184 @@ const canMoveDown = computed(() => {
|
|
|
74
74
|
const canMoveTop = computed(() => canMoveUp.value)
|
|
75
75
|
const canMoveBottom = computed(() => canMoveDown.value)
|
|
76
76
|
|
|
77
|
+
type FieldKey = 'X' | 'Y' | 'W' | 'H' | 'ROTATE'
|
|
78
|
+
const MIN_ELEMENT_DIMENSION = 10
|
|
79
|
+
|
|
80
|
+
const focusedField = ref<FieldKey | null>(null)
|
|
81
|
+
const draftText = ref<string>('')
|
|
82
|
+
const focusInitialVal = ref<number>(0)
|
|
83
|
+
const fieldUndoStack = ref<string[]>([])
|
|
84
|
+
const fieldRedoStack = ref<string[]>([])
|
|
85
|
+
|
|
77
86
|
const rotateInputRef = ref<HTMLInputElement | null>(null)
|
|
78
|
-
const rotateDisplayLen = computed(() =>
|
|
87
|
+
const rotateDisplayLen = computed(() => {
|
|
88
|
+
const text = focusedField.value === 'ROTATE' ? draftText.value : String(props.elementRotate ?? 0)
|
|
89
|
+
return Math.max(1, text.length)
|
|
90
|
+
})
|
|
79
91
|
|
|
80
|
-
function
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
92
|
+
function getPropVal(field: FieldKey): number {
|
|
93
|
+
switch (field) {
|
|
94
|
+
case 'X': return props.elementX ?? 0
|
|
95
|
+
case 'Y': return props.elementY ?? 0
|
|
96
|
+
case 'W': return props.elementW ?? MIN_ELEMENT_DIMENSION
|
|
97
|
+
case 'H': return props.elementH ?? MIN_ELEMENT_DIMENSION
|
|
98
|
+
case 'ROTATE': return props.elementRotate ?? 0
|
|
84
99
|
}
|
|
85
100
|
}
|
|
86
101
|
|
|
87
|
-
function
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
102
|
+
function emitFieldVal(field: FieldKey, val: number) {
|
|
103
|
+
switch (field) {
|
|
104
|
+
case 'X': emit('update:elementX', val); break
|
|
105
|
+
case 'Y': emit('update:elementY', val); break
|
|
106
|
+
case 'W': emit('update:elementW', val); break
|
|
107
|
+
case 'H': emit('update:elementH', val); break
|
|
108
|
+
case 'ROTATE': emit('update:elementRotate', val); break
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
function normalizeRotateVal(val: number): number {
|
|
93
113
|
let deg = Math.round(val) % 360
|
|
94
114
|
if (deg < 0) deg += 360
|
|
95
|
-
|
|
115
|
+
return deg
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
function onFieldFocus(field: FieldKey) {
|
|
119
|
+
const curVal = getPropVal(field)
|
|
120
|
+
focusedField.value = field
|
|
121
|
+
draftText.value = String(curVal)
|
|
122
|
+
focusInitialVal.value = curVal
|
|
123
|
+
fieldUndoStack.value = [draftText.value]
|
|
124
|
+
fieldRedoStack.value = []
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
function recordDraftChange(text: string) {
|
|
128
|
+
draftText.value = text
|
|
129
|
+
const stack = fieldUndoStack.value
|
|
130
|
+
if (stack.length === 0 || stack[stack.length - 1] !== text) {
|
|
131
|
+
stack.push(text)
|
|
132
|
+
if (stack.length > 50) stack.shift()
|
|
133
|
+
}
|
|
134
|
+
fieldRedoStack.value = []
|
|
96
135
|
}
|
|
97
136
|
|
|
98
|
-
function
|
|
137
|
+
function applyDraftIfValid(field: FieldKey, rawText: string) {
|
|
138
|
+
const raw = rawText.trim()
|
|
139
|
+
if (raw === '' || raw === '-') return
|
|
140
|
+
const num = Number(raw)
|
|
141
|
+
if (isNaN(num)) return
|
|
142
|
+
if (field === 'W' || field === 'H') {
|
|
143
|
+
if (num < MIN_ELEMENT_DIMENSION) return
|
|
144
|
+
emitFieldVal(field, num)
|
|
145
|
+
} else if (field === 'ROTATE') {
|
|
146
|
+
emitFieldVal(field, normalizeRotateVal(num))
|
|
147
|
+
} else {
|
|
148
|
+
emitFieldVal(field, num)
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
function onFieldInput(field: FieldKey, e: Event) {
|
|
153
|
+
const target = e.target as HTMLInputElement
|
|
154
|
+
recordDraftChange(target.value)
|
|
155
|
+
applyDraftIfValid(field, target.value)
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
function onFieldBlur(field: FieldKey, e: Event) {
|
|
99
159
|
const target = e.target as HTMLInputElement
|
|
100
|
-
|
|
101
|
-
|
|
160
|
+
const raw = target.value.trim()
|
|
161
|
+
let finalVal: number
|
|
162
|
+
|
|
163
|
+
if (field === 'W' || field === 'H') {
|
|
164
|
+
const fallback = Math.max(MIN_ELEMENT_DIMENSION, focusInitialVal.value || getPropVal(field))
|
|
165
|
+
if (raw === '' || raw === '-' || isNaN(Number(raw))) {
|
|
166
|
+
finalVal = fallback
|
|
167
|
+
} else {
|
|
168
|
+
finalVal = Math.max(MIN_ELEMENT_DIMENSION, Number(raw))
|
|
169
|
+
}
|
|
170
|
+
} else if (field === 'ROTATE') {
|
|
171
|
+
const fallback = normalizeRotateVal(focusInitialVal.value || getPropVal(field))
|
|
172
|
+
if (raw === '' || raw === '-' || isNaN(Number(raw))) {
|
|
173
|
+
finalVal = fallback
|
|
174
|
+
} else {
|
|
175
|
+
finalVal = normalizeRotateVal(Number(raw))
|
|
176
|
+
}
|
|
102
177
|
} else {
|
|
103
|
-
|
|
104
|
-
if (
|
|
105
|
-
|
|
106
|
-
|
|
178
|
+
const fallback = focusInitialVal.value ?? getPropVal(field)
|
|
179
|
+
if (raw === '' || raw === '-' || isNaN(Number(raw))) {
|
|
180
|
+
finalVal = fallback
|
|
181
|
+
} else {
|
|
182
|
+
finalVal = Number(raw)
|
|
183
|
+
}
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
focusedField.value = null
|
|
187
|
+
draftText.value = String(finalVal)
|
|
188
|
+
fieldUndoStack.value = []
|
|
189
|
+
fieldRedoStack.value = []
|
|
190
|
+
target.value = String(finalVal)
|
|
191
|
+
emitFieldVal(field, finalVal)
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
function onFieldKeyDown(field: FieldKey, e: KeyboardEvent) {
|
|
195
|
+
if (e.key === 'Enter') {
|
|
196
|
+
;(e.target as HTMLElement)?.blur()
|
|
197
|
+
return
|
|
198
|
+
}
|
|
199
|
+
const isMod = e.ctrlKey || e.metaKey
|
|
200
|
+
if (!isMod) return
|
|
201
|
+
const key = e.key.toLowerCase()
|
|
202
|
+
const isUndo = key === 'z' && !e.shiftKey
|
|
203
|
+
const isRedo = key === 'y' || (key === 'z' && e.shiftKey)
|
|
204
|
+
if (!isUndo && !isRedo) return
|
|
205
|
+
|
|
206
|
+
// 彻底阻止浏览器原生 input 撤销栈将已回填的值重复拼接(如 92 变 9292)
|
|
207
|
+
e.preventDefault()
|
|
208
|
+
e.stopPropagation()
|
|
209
|
+
const target = e.target as HTMLInputElement
|
|
210
|
+
|
|
211
|
+
if (isUndo) {
|
|
212
|
+
if (fieldUndoStack.value.length > 1) {
|
|
213
|
+
const current = fieldUndoStack.value.pop()!
|
|
214
|
+
fieldRedoStack.value.push(current)
|
|
215
|
+
const prev = fieldUndoStack.value[fieldUndoStack.value.length - 1]
|
|
216
|
+
draftText.value = prev
|
|
217
|
+
target.value = prev
|
|
218
|
+
applyDraftIfValid(field, prev)
|
|
219
|
+
} else {
|
|
220
|
+
if (undo) undo()
|
|
221
|
+
nextTick(() => {
|
|
222
|
+
const nextVal = String(getPropVal(field))
|
|
223
|
+
draftText.value = nextVal
|
|
224
|
+
focusInitialVal.value = Number(nextVal) || 0
|
|
225
|
+
fieldUndoStack.value = [nextVal]
|
|
226
|
+
fieldRedoStack.value = []
|
|
227
|
+
target.value = nextVal
|
|
228
|
+
})
|
|
229
|
+
}
|
|
230
|
+
} else if (isRedo) {
|
|
231
|
+
if (fieldRedoStack.value.length > 0) {
|
|
232
|
+
const next = fieldRedoStack.value.pop()!
|
|
233
|
+
fieldUndoStack.value.push(next)
|
|
234
|
+
draftText.value = next
|
|
235
|
+
target.value = next
|
|
236
|
+
applyDraftIfValid(field, next)
|
|
237
|
+
} else {
|
|
238
|
+
if (redo) redo()
|
|
239
|
+
nextTick(() => {
|
|
240
|
+
const nextVal = String(getPropVal(field))
|
|
241
|
+
draftText.value = nextVal
|
|
242
|
+
focusInitialVal.value = Number(nextVal) || 0
|
|
243
|
+
fieldUndoStack.value = [nextVal]
|
|
244
|
+
fieldRedoStack.value = []
|
|
245
|
+
target.value = nextVal
|
|
246
|
+
})
|
|
247
|
+
}
|
|
248
|
+
}
|
|
249
|
+
}
|
|
250
|
+
|
|
251
|
+
function focusRotateInput(e: MouseEvent) {
|
|
252
|
+
if (e.target !== rotateInputRef.value) {
|
|
253
|
+
rotateInputRef.value?.focus()
|
|
254
|
+
rotateInputRef.value?.select()
|
|
107
255
|
}
|
|
108
256
|
}
|
|
109
257
|
</script>
|
|
@@ -115,14 +263,22 @@ function onRotateBlur(e: Event) {
|
|
|
115
263
|
<div class="pos-main-cols">
|
|
116
264
|
<div class="custom-num-input">
|
|
117
265
|
<span class="custom-num-prefix">X</span>
|
|
118
|
-
<input type="number" step="any"
|
|
119
|
-
|
|
266
|
+
<input type="number" step="any"
|
|
267
|
+
:value="focusedField === 'X' ? draftText : elementX"
|
|
268
|
+
@focus="onFieldFocus('X')"
|
|
269
|
+
@input="onFieldInput('X', $event)"
|
|
270
|
+
@blur="onFieldBlur('X', $event)"
|
|
271
|
+
@keydown="onFieldKeyDown('X', $event)"
|
|
120
272
|
class="custom-num-field" />
|
|
121
273
|
</div>
|
|
122
274
|
<div class="custom-num-input">
|
|
123
275
|
<span class="custom-num-prefix">Y</span>
|
|
124
|
-
<input type="number" step="any"
|
|
125
|
-
|
|
276
|
+
<input type="number" step="any"
|
|
277
|
+
:value="focusedField === 'Y' ? draftText : elementY"
|
|
278
|
+
@focus="onFieldFocus('Y')"
|
|
279
|
+
@input="onFieldInput('Y', $event)"
|
|
280
|
+
@blur="onFieldBlur('Y', $event)"
|
|
281
|
+
@keydown="onFieldKeyDown('Y', $event)"
|
|
126
282
|
class="custom-num-field" />
|
|
127
283
|
</div>
|
|
128
284
|
</div>
|
|
@@ -134,14 +290,23 @@ function onRotateBlur(e: Event) {
|
|
|
134
290
|
<div class="pos-main-cols">
|
|
135
291
|
<div class="custom-num-input">
|
|
136
292
|
<span class="custom-num-prefix">W</span>
|
|
137
|
-
<input type="number" step="any" :
|
|
138
|
-
|
|
293
|
+
<input type="number" step="any" :min="MIN_ELEMENT_DIMENSION"
|
|
294
|
+
:value="focusedField === 'W' ? draftText : elementW"
|
|
295
|
+
@focus="onFieldFocus('W')"
|
|
296
|
+
@input="onFieldInput('W', $event)"
|
|
297
|
+
@blur="onFieldBlur('W', $event)"
|
|
298
|
+
@keydown="onFieldKeyDown('W', $event)"
|
|
139
299
|
class="custom-num-field" />
|
|
140
300
|
</div>
|
|
141
301
|
<div class="custom-num-input" :class="{ 'is-disabled': disableHeight }">
|
|
142
302
|
<span class="custom-num-prefix">H</span>
|
|
143
|
-
<input type="number" step="any" :
|
|
144
|
-
|
|
303
|
+
<input type="number" step="any" :min="MIN_ELEMENT_DIMENSION"
|
|
304
|
+
:value="focusedField === 'H' ? draftText : elementH"
|
|
305
|
+
:disabled="disableHeight" :readonly="disableHeight"
|
|
306
|
+
@focus="!disableHeight && onFieldFocus('H')"
|
|
307
|
+
@input="!disableHeight && onFieldInput('H', $event)"
|
|
308
|
+
@blur="!disableHeight && onFieldBlur('H', $event)"
|
|
309
|
+
@keydown="!disableHeight && onFieldKeyDown('H', $event)"
|
|
145
310
|
class="custom-num-field" />
|
|
146
311
|
</div>
|
|
147
312
|
</div>
|
|
@@ -169,10 +334,11 @@ function onRotateBlur(e: Event) {
|
|
|
169
334
|
ref="rotateInputRef"
|
|
170
335
|
type="text"
|
|
171
336
|
inputmode="numeric"
|
|
172
|
-
:value="elementRotate ?? 0"
|
|
173
|
-
@
|
|
174
|
-
@
|
|
175
|
-
@
|
|
337
|
+
:value="focusedField === 'ROTATE' ? draftText : (elementRotate ?? 0)"
|
|
338
|
+
@focus="onFieldFocus('ROTATE')"
|
|
339
|
+
@input="onFieldInput('ROTATE', $event)"
|
|
340
|
+
@blur="onFieldBlur('ROTATE', $event)"
|
|
341
|
+
@keydown="onFieldKeyDown('ROTATE', $event)"
|
|
176
342
|
class="custom-num-field rotate-num-field"
|
|
177
343
|
:style="{ width: `calc(${rotateDisplayLen}ch + 6px)` }"
|
|
178
344
|
/>
|
|
@@ -301,7 +301,7 @@ function applyPresetFilter(values: Record<string, string>) {
|
|
|
301
301
|
|
|
302
302
|
<!-- Image Actions (Crop, Replace, Reset, Set Background) -->
|
|
303
303
|
<div class="control-group"
|
|
304
|
-
style="padding: 0 16px; display: flex; flex-direction: column; gap: 8px; margin-top: 12px; border-bottom: 1px solid #
|
|
304
|
+
style="padding: 0 16px; display: flex; flex-direction: column; gap: 8px; margin-top: 12px; border-bottom: 1px solid #f1f5f9; padding-bottom: 12px; margin-bottom: 12px;">
|
|
305
305
|
<!-- Row 1 -->
|
|
306
306
|
<div style="display: grid; grid-template-columns: 1fr 1fr; gap: 8px;">
|
|
307
307
|
<!-- 剪裁 split dropdown group -->
|
|
@@ -389,12 +389,16 @@ function applyPresetFilter(values: Record<string, string>) {
|
|
|
389
389
|
</div>
|
|
390
390
|
|
|
391
391
|
<!-- 1. 蒙版 Accordion -->
|
|
392
|
-
<div class="control-group shape-accordion-group"
|
|
393
|
-
|
|
394
|
-
<div class="shape-accordion-header" @click="toggleMaskHeader" style="padding: 0 16px;">
|
|
392
|
+
<div class="control-group shape-accordion-group">
|
|
393
|
+
<div class="shape-accordion-header" @click="toggleMaskHeader">
|
|
395
394
|
<span class="control-label shape-accordion-header-label">
|
|
396
|
-
<span
|
|
397
|
-
|
|
395
|
+
<span>蒙版</span>
|
|
396
|
+
<span class="accordion-arrow">
|
|
397
|
+
<svg class="icon" style="width: 14px; height: 14px;">
|
|
398
|
+
<use :href="(enableColorMask && isMaskExpanded) ? '#icon-ppt-xiala-zhankai' : '#icon-ppt-xiala-shouqi'"
|
|
399
|
+
:xlink:href="(enableColorMask && isMaskExpanded) ? '#icon-ppt-xiala-zhankai' : '#icon-ppt-xiala-shouqi'"></use>
|
|
400
|
+
</svg>
|
|
401
|
+
</span>
|
|
398
402
|
</span>
|
|
399
403
|
<el-switch v-model="enableColorMask" size="small" @click.stop />
|
|
400
404
|
</div>
|
|
@@ -435,12 +439,16 @@ function applyPresetFilter(values: Record<string, string>) {
|
|
|
435
439
|
</div>
|
|
436
440
|
|
|
437
441
|
<!-- 2. 滤镜 Accordion -->
|
|
438
|
-
<div class="control-group shape-accordion-group"
|
|
439
|
-
|
|
440
|
-
<div class="shape-accordion-header" @click="toggleFiltersHeader" style="padding: 0 16px;">
|
|
442
|
+
<div class="control-group shape-accordion-group">
|
|
443
|
+
<div class="shape-accordion-header" @click="toggleFiltersHeader">
|
|
441
444
|
<span class="control-label shape-accordion-header-label">
|
|
442
|
-
<span
|
|
443
|
-
|
|
445
|
+
<span>滤镜</span>
|
|
446
|
+
<span class="accordion-arrow">
|
|
447
|
+
<svg class="icon" style="width: 14px; height: 14px;">
|
|
448
|
+
<use :href="(enableFilters && isFiltersExpanded) ? '#icon-ppt-xiala-zhankai' : '#icon-ppt-xiala-shouqi'"
|
|
449
|
+
:xlink:href="(enableFilters && isFiltersExpanded) ? '#icon-ppt-xiala-zhankai' : '#icon-ppt-xiala-shouqi'"></use>
|
|
450
|
+
</svg>
|
|
451
|
+
</span>
|
|
444
452
|
</span>
|
|
445
453
|
<el-switch v-model="enableFilters" size="small" @click.stop />
|
|
446
454
|
</div>
|
|
@@ -661,37 +669,41 @@ function applyPresetFilter(values: Record<string, string>) {
|
|
|
661
669
|
}
|
|
662
670
|
|
|
663
671
|
.shape-accordion-group {
|
|
664
|
-
|
|
672
|
+
border-bottom: 1px solid #f1f5f9;
|
|
673
|
+
padding-bottom: 12px;
|
|
674
|
+
margin-bottom: 12px;
|
|
665
675
|
}
|
|
666
676
|
|
|
667
677
|
.shape-accordion-header {
|
|
668
|
-
height: 34px;
|
|
669
|
-
padding: 0 16px;
|
|
670
678
|
display: flex;
|
|
671
679
|
align-items: center;
|
|
672
|
-
|
|
680
|
+
justify-content: space-between;
|
|
681
|
+
padding: 0 16px;
|
|
682
|
+
height: 34px;
|
|
673
683
|
cursor: pointer;
|
|
674
684
|
user-select: none;
|
|
675
685
|
}
|
|
676
686
|
|
|
677
687
|
.shape-accordion-header-label {
|
|
678
|
-
font-size:
|
|
679
|
-
font-weight:
|
|
680
|
-
color:
|
|
688
|
+
font-size: 14px;
|
|
689
|
+
font-weight: 400;
|
|
690
|
+
color: #1e293b;
|
|
681
691
|
display: flex;
|
|
682
692
|
align-items: center;
|
|
683
693
|
gap: 6px;
|
|
684
|
-
width: 80px;
|
|
685
694
|
flex-shrink: 0;
|
|
686
|
-
text-align: left;
|
|
687
695
|
}
|
|
688
696
|
|
|
689
697
|
.accordion-arrow {
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
color: #
|
|
694
|
-
|
|
698
|
+
display: flex;
|
|
699
|
+
align-items: center;
|
|
700
|
+
justify-content: center;
|
|
701
|
+
color: #64748b;
|
|
702
|
+
}
|
|
703
|
+
|
|
704
|
+
:deep(.el-switch) {
|
|
705
|
+
--el-switch-on-color: #2563eb;
|
|
706
|
+
--el-switch-off-color: #cbd5e1;
|
|
695
707
|
}
|
|
696
708
|
|
|
697
709
|
.shape-accordion-content {
|
|
@@ -788,12 +800,4 @@ function applyPresetFilter(values: Record<string, string>) {
|
|
|
788
800
|
color: var(--text-primary, #1e293b) !important;
|
|
789
801
|
}
|
|
790
802
|
}
|
|
791
|
-
|
|
792
|
-
:deep(.el-switch__core) {
|
|
793
|
-
border-radius: 4px !important;
|
|
794
|
-
}
|
|
795
|
-
|
|
796
|
-
:deep(.el-switch__action) {
|
|
797
|
-
border-radius: 3px !important;
|
|
798
|
-
}
|
|
799
803
|
</style>
|