Merge branch 'StableVersion' of http://18.167.251.121:10003/aidlab/aida_front into dev_vite
This commit is contained in:
@@ -55,6 +55,7 @@ commandManager.setChangeCallback((info) => {
|
||||
emit("undo-redo-status-changed", {
|
||||
canUndo: canUndo.value,
|
||||
canRedo: canRedo.value,
|
||||
type: info.type,
|
||||
commandManager,
|
||||
});
|
||||
});
|
||||
|
||||
@@ -907,7 +907,8 @@
|
||||
}
|
||||
emit("changeCanvas", commandData)
|
||||
canvasManager.changeCanvas()
|
||||
if ((command.canUndo || command.canRedo) && props.enabledRedGreenMode) {
|
||||
const type = command.type
|
||||
if (props.enabledRedGreenMode && (type === "undo" || type === "redo")) {
|
||||
setTimeout(async () => {
|
||||
try {
|
||||
const imageData = await canvasManager.exportImage({
|
||||
@@ -1057,7 +1058,10 @@
|
||||
} = {}) => {
|
||||
loading.value = true
|
||||
canvasManager?.canvas?.discardActiveObject()
|
||||
if(isFrontBackUpdata)await canvasManager?.changeCanvas()
|
||||
if (isFrontBackUpdata) {
|
||||
await canvasManager?.setSpecialCliptInfo(true, true)
|
||||
canvasManager.canvas.renderAll()
|
||||
}
|
||||
var base64 = await canvasManager.exportImage({
|
||||
isContainBg,
|
||||
isContainFixed,
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -180,7 +180,7 @@ export class CommandManager {
|
||||
this._recordPerformance("execute", command.constructor.name, duration);
|
||||
|
||||
// 通知状态变化
|
||||
this._notifyStateChange();
|
||||
this._notifyStateChange("execute");
|
||||
|
||||
console.log(`✅ 命令执行成功: ${command.constructor.name}`);
|
||||
return result;
|
||||
@@ -219,7 +219,7 @@ export class CommandManager {
|
||||
this._recordPerformance("undo", command.constructor.name, duration);
|
||||
|
||||
// 通知状态变化
|
||||
this._notifyStateChange();
|
||||
this._notifyStateChange("undo");
|
||||
|
||||
console.log(`✅ 命令撤销成功: ${command.constructor.name}`);
|
||||
return result;
|
||||
@@ -258,7 +258,7 @@ export class CommandManager {
|
||||
this._recordPerformance("redo", command.constructor.name, duration);
|
||||
|
||||
// 通知状态变化
|
||||
this._notifyStateChange();
|
||||
this._notifyStateChange("redo");
|
||||
|
||||
console.log(`✅ 命令重做成功: ${command.constructor.name}`);
|
||||
return result;
|
||||
@@ -298,7 +298,7 @@ export class CommandManager {
|
||||
|
||||
this.undoStack = [];
|
||||
this.redoStack = [];
|
||||
this._notifyStateChange();
|
||||
this._notifyStateChange("clear");
|
||||
// console.log("📝 命令历史已清空");
|
||||
}
|
||||
|
||||
@@ -417,10 +417,12 @@ export class CommandManager {
|
||||
* 通知状态变化
|
||||
* @private
|
||||
*/
|
||||
_notifyStateChange() {
|
||||
_notifyStateChange(type) {
|
||||
if (this.onStateChange) {
|
||||
try {
|
||||
this.onStateChange(this.getState());
|
||||
const obj = this.getState();
|
||||
obj.type = type;
|
||||
this.onStateChange(obj);
|
||||
} catch (error) {
|
||||
console.error("状态变化回调执行失败:", error);
|
||||
}
|
||||
|
||||
@@ -85,7 +85,7 @@ export class LiquifyRealTimeUpdater {
|
||||
|
||||
if (isDrawing && this.config.useDirectUpdate) {
|
||||
// 拖拽过程中使用快速更新(降低质量以提高性能)
|
||||
this._fastUpdate(imageData);
|
||||
await this._fastUpdate(imageData);
|
||||
} else {
|
||||
// 拖拽结束后使用完整更新(最高质量)
|
||||
await this._fullUpdate(imageData);
|
||||
@@ -124,7 +124,7 @@ export class LiquifyRealTimeUpdater {
|
||||
* @param {ImageData} imageData 图像数据
|
||||
* @private
|
||||
*/
|
||||
_fastUpdate(imageData) {
|
||||
async _fastUpdate(imageData) {
|
||||
if (!this.targetObject || !this.targetObject._element) {
|
||||
return;
|
||||
}
|
||||
@@ -138,12 +138,14 @@ export class LiquifyRealTimeUpdater {
|
||||
|
||||
// 直接更新fabric对象的图像源(使用PNG格式保持质量)
|
||||
const targetElement = this.targetObject._element;
|
||||
|
||||
// 方案1: 直接设置src属性(最高性能)
|
||||
const dataURL = this.tempCanvas.toDataURL("image/png", quality);
|
||||
|
||||
if (targetElement.src !== dataURL) {
|
||||
targetElement.src = dataURL;
|
||||
// targetElement.src = dataURL;
|
||||
const image = new Image();
|
||||
image.src = dataURL;
|
||||
await image.decode();
|
||||
this.targetObject.setElement(image);
|
||||
|
||||
// 关键优化:直接设置fabric对象为脏状态,但不立即渲染
|
||||
// this.targetObject.dirty = false; // 标记为不需要立即渲染
|
||||
|
||||
@@ -447,6 +447,7 @@
|
||||
</template>
|
||||
</CanvasEditor>
|
||||
</div>
|
||||
<img src="" alt="" id="canvas-test-dom">
|
||||
</div>
|
||||
</template>
|
||||
<style>
|
||||
@@ -458,6 +459,13 @@
|
||||
height: 600px !important;
|
||||
z-index: 99999999;
|
||||
}
|
||||
#canvas-test-dom{
|
||||
position: fixed;
|
||||
z-index: 9999999999;
|
||||
top: 0;
|
||||
left: 0;
|
||||
pointer-events: none;
|
||||
}
|
||||
</style>
|
||||
<style scoped lang="less">
|
||||
* {
|
||||
|
||||
Reference in New Issue
Block a user