@versa_ai/vmml-editor 1.0.41 → 1.0.42
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/.turbo/turbo-build.log +9 -9
- package/dist/index.js +147 -167
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +148 -168
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
- package/src/components/EditorCanvas.tsx +387 -449
- package/src/index.tsx +6 -2
- package/src/utils/VmmlConverter.ts +30 -0
package/src/index.tsx
CHANGED
|
@@ -30,7 +30,7 @@ const EditorFn = <Schema extends AnyZodObject, Props>(
|
|
|
30
30
|
pauseWhenBuffering = false,
|
|
31
31
|
isBatchModify = false,
|
|
32
32
|
textWarapCenter = false,
|
|
33
|
-
hideConfig =
|
|
33
|
+
hideConfig = { hideDelete: false, hideEdit: false, hideMute: false, hideVolume: false } // { hideDelete: false, hideEdit: false, hideMute: false, hideVolume: false }
|
|
34
34
|
}: any,
|
|
35
35
|
ref: any,
|
|
36
36
|
) => {
|
|
@@ -274,6 +274,10 @@ const EditorFn = <Schema extends AnyZodObject, Props>(
|
|
|
274
274
|
const onPause = () => {
|
|
275
275
|
setShowCanvas(true)
|
|
276
276
|
setIsPlaying(false);
|
|
277
|
+
if (canvasRef.current) {
|
|
278
|
+
const { current: canvasC }: any = canvasRef;
|
|
279
|
+
canvasC.checkObjectInPoint();
|
|
280
|
+
}
|
|
277
281
|
};
|
|
278
282
|
|
|
279
283
|
const onWaiting = () => {
|
|
@@ -317,7 +321,7 @@ const EditorFn = <Schema extends AnyZodObject, Props>(
|
|
|
317
321
|
if (fcTracks.length) {
|
|
318
322
|
const clips = fcTracks.map((item: any) => item.clips).flat().filter((item: any) => Reflect.has(item, "fObj"));
|
|
319
323
|
const fObjs = clips.map((item: any) => item.fObj);
|
|
320
|
-
setInitFcObjs(fObjs);
|
|
324
|
+
// setInitFcObjs(fObjs); 暂时屏蔽
|
|
321
325
|
// 表情包标记
|
|
322
326
|
fObjs.forEach((item: any) => {
|
|
323
327
|
onVideoChange(item.clipData);
|
|
@@ -99,6 +99,7 @@ class VmmlConverter {
|
|
|
99
99
|
|
|
100
100
|
// const [rect, textbox] = fObj.objects;
|
|
101
101
|
// const { clipData: { id, inPoint, lineSpacing }} = fObj;
|
|
102
|
+
console.log(fObj, 'fObj>>>>')
|
|
102
103
|
const { clipData: { id, inPoint, text, textColor, bgColor}} = fObj;
|
|
103
104
|
const {template:{duration}} = this.vmml;
|
|
104
105
|
const clips = [];
|
|
@@ -222,6 +223,33 @@ class VmmlConverter {
|
|
|
222
223
|
|
|
223
224
|
// console.log("updateClip 最终vmml", this.vmml);
|
|
224
225
|
}
|
|
226
|
+
public updateTextClip(fObj: any, duration: number) {
|
|
227
|
+
console.log("updateClip fObj", fObj, this.tracks);
|
|
228
|
+
const posParam = this.setPosParam(fObj);
|
|
229
|
+
const {
|
|
230
|
+
clipData: { id },
|
|
231
|
+
} = fObj;
|
|
232
|
+
const [existClip] = this.findClip(id);
|
|
233
|
+
|
|
234
|
+
if (existClip) {
|
|
235
|
+
const { clipData: { text, textColor, bgColor }} = fObj;
|
|
236
|
+
const scale = this.fontSize / 22;
|
|
237
|
+
existClip.duration = duration
|
|
238
|
+
console.log(bgColor, 'bgColor>>>')
|
|
239
|
+
existClip.textClip = {
|
|
240
|
+
...existClip.textClip,
|
|
241
|
+
posParam,
|
|
242
|
+
backgroundColor: this.toARGB(bgColor),
|
|
243
|
+
textContent: text,
|
|
244
|
+
textColor: this.toARGB(textColor),
|
|
245
|
+
dimension: {
|
|
246
|
+
width: Math.floor(fObj.width * scale),
|
|
247
|
+
height: Math.floor(fObj.height * scale),
|
|
248
|
+
}
|
|
249
|
+
};
|
|
250
|
+
}
|
|
251
|
+
console.log(this.vmml, 'updateText>>>')
|
|
252
|
+
}
|
|
225
253
|
|
|
226
254
|
/**
|
|
227
255
|
* 删除 Clip
|
|
@@ -256,10 +284,12 @@ class VmmlConverter {
|
|
|
256
284
|
}
|
|
257
285
|
}
|
|
258
286
|
}
|
|
287
|
+
console.log('删除之后的vmml', this.vmml)
|
|
259
288
|
}
|
|
260
289
|
|
|
261
290
|
changeVmml (newVmml: any) {
|
|
262
291
|
this.vmml = newVmml;
|
|
292
|
+
this.tracks = this.vmml.template.tracks;
|
|
263
293
|
}
|
|
264
294
|
|
|
265
295
|
//切换静音 视频/音频
|