feat: 实时更新背景色+选取剪切+选取删除初步开发完成
This commit is contained in:
@@ -1753,7 +1753,7 @@ export class LayerManager {
|
||||
* 更新背景图层颜色
|
||||
* @param {string} backgroundColor 背景颜色
|
||||
*/
|
||||
updateBackgroundColor(backgroundColor) {
|
||||
updateBackgroundColor(backgroundColor, options = {}) {
|
||||
const backgroundLayer = this.layers.value.find(
|
||||
(layer) => layer.isBackground
|
||||
);
|
||||
@@ -1768,10 +1768,14 @@ export class LayerManager {
|
||||
canvas: this.canvas,
|
||||
layers: this.layers,
|
||||
canvasManager: this.canvasManager,
|
||||
layerManger: this,
|
||||
backgroundColor,
|
||||
backgroundColorValue: this.backgroundColor,
|
||||
oldColor: options.oldColor,
|
||||
});
|
||||
|
||||
command.undoable = isBoolean(options.undoable) ? options.undoable : true; // 设置为可撤销
|
||||
|
||||
// 执行命令
|
||||
if (this.commandManager) {
|
||||
this.commandManager.execute(command);
|
||||
|
||||
@@ -133,7 +133,7 @@ export class RedGreenModeManager {
|
||||
this.canvas.on("mouse:up", (event) => {
|
||||
// 可以在这里添加更多逻辑,比如生成图片或更新状态
|
||||
nextTick(() => {
|
||||
requestAnimationFrame(async () => {
|
||||
requestIdleCallback(async () => {
|
||||
if (!this.isInitialized) {
|
||||
console.warn("红绿图模式未初始化,无法处理鼠标事件");
|
||||
return;
|
||||
|
||||
@@ -1,10 +1,8 @@
|
||||
import { fabric } from "fabric-with-all";
|
||||
import { generateId } from "../../utils/helper";
|
||||
import { OperationType } from "../../utils/layerHelper";
|
||||
import {
|
||||
ClearSelectionCommand,
|
||||
CreateSelectionCommand,
|
||||
} from "../../commands/SelectionCommands";
|
||||
import { CreateSelectionCommand } from "../../commands/SelectionCommands";
|
||||
import { ClearSelectionCommand } from "../../commands/LassoCutoutCommand";
|
||||
|
||||
/**
|
||||
* 选区管理器
|
||||
|
||||
Reference in New Issue
Block a user