This commit is contained in:
李志鹏
2025-11-11 14:28:41 +08:00
parent 5f3c4b5ac9
commit 7bc82af120
12 changed files with 30 additions and 13 deletions

View File

@@ -18,6 +18,7 @@ export class FillGroupLayerBackgroundCommand extends Command {
this.canvas = options.canvas; this.canvas = options.canvas;
this.layers = options.layers; this.layers = options.layers;
this.canvasManager = options.canvasManager; this.canvasManager = options.canvasManager;
this.layerManager = options.layerManager;
this.layerId = options.layerId; this.layerId = options.layerId;
this.fillColor = options.fillColor; this.fillColor = options.fillColor;
this.oldFill = null; this.oldFill = null;
@@ -211,6 +212,7 @@ export class FillGroupLayerBackgroundCommand extends Command {
this.group.set({ this.group.set({
id: layerObjects[0]?.id || generateId("group-"), id: layerObjects[0]?.id || generateId("group-"),
layerId: this.layer?.id, layerId: this.layer?.id,
layerName: this.layer?.name,
}); });
// this.group.setCoords(); // this.group.setCoords();
// this.group.setObjectsCoords(); // this.group.setObjectsCoords();
@@ -225,7 +227,7 @@ export class FillGroupLayerBackgroundCommand extends Command {
this.group.clipPath = clipPath; this.group.clipPath = clipPath;
} }
layer.fabricObjects = [ layer.fabricObjects = [
this.group.toObject(["id", "layerId"]) || this.group, this.group.toObject(["id", "layerId", "layerName"]) || this.group,
]; ];
// removeCanvasObjectByObject(this.canvas, layerObjects?.[0]); // removeCanvasObjectByObject(this.canvas, layerObjects?.[0]);
insertObjectAtZIndex(this.canvas, this.group, insertIndex, false, true); insertObjectAtZIndex(this.canvas, this.group, insertIndex, false, true);

View File

@@ -2595,7 +2595,7 @@ export class CreateImageLayerCommand extends Command {
// 生成图层名称 // 生成图层名称
const fileName = const fileName =
this.layerName || `${new Date().toLocaleString()}`; this.layerName || `${new Date().toLocaleTimeString()}`;
this.fabricImage.set({ this.fabricImage.set({
id: this.imageId, id: this.imageId,

View File

@@ -15,6 +15,8 @@ import {
import { createRasterizedImage } from "../utils/rasterizedImage"; import { createRasterizedImage } from "../utils/rasterizedImage";
import { message } from "ant-design-vue"; import { message } from "ant-design-vue";
import { restoreFabricObject } from "../utils/objectHelper"; import { restoreFabricObject } from "../utils/objectHelper";
import i18n from "@/lang/index.ts";
const { t } = i18n.global;
/** /**
* 组合图层命令 * 组合图层命令
@@ -338,7 +340,7 @@ export class RasterizeLayerCommand extends Command {
// 创建新的组合图层 // 创建新的组合图层
this.rasterizedLayer = createLayer({ this.rasterizedLayer = createLayer({
id: this.rasterizedLayerId, id: this.rasterizedLayerId,
name: `${this.layer.name} (组合)`, name: `${this.layer.name} (${t('Canvas.group')})`,
type: LayerType.BITMAP, type: LayerType.BITMAP,
visible: this.layer.visible, visible: this.layer.visible,
locked: this.layer.locked, locked: this.layer.locked,

View File

@@ -1667,6 +1667,7 @@ function stopPressTimer() {
display: flex; display: flex;
align-items: center; align-items: center;
justify-content: center; justify-content: center;
height: 22px;
> i{ > i{
font-size: 1.4rem; font-size: 1.4rem;

View File

@@ -52,7 +52,7 @@
<span class="label iconfont icon-angle"></span> <span class="label iconfont icon-angle"></span>
<input <input
type="number" type="number"
:value="v.angle" :value="Number(Number(v.angle).toFixed(3))"
@change="(e) => changeAngle(e, v)" @change="(e) => changeAngle(e, v)"
/> />
</div> </div>
@@ -267,12 +267,7 @@
arrs.forEach((v) => { arrs.forEach((v) => {
activeObjects.value.forEach((item) => { activeObjects.value.forEach((item) => {
if (item.id === v.id) { if (item.id === v.id) {
keys.forEach((k) => { keys.forEach((key) => (item[key] = v[key]));
item[k] =
typeof v[k] === "number"
? Number(v[k].toFixed(3))
: v[k];
});
} }
}); });
activeObjects.value = [...activeObjects.value]; activeObjects.value = [...activeObjects.value];

View File

@@ -531,10 +531,13 @@ function confirmColorPicker() {
width: 100%; width: 100%;
text-align: center; text-align: center;
cursor: pointer; cursor: pointer;
display: flex;
align-items: center;
justify-content: center;
height: 22px;
> i{ > i{
font-size: 1.4rem; font-size: 1.4rem;
display: block;
transform: rotate(270deg); transform: rotate(270deg);
} }
} }

View File

@@ -715,7 +715,10 @@ export default {
width: 100%; width: 100%;
text-align: center; text-align: center;
cursor: pointer; cursor: pointer;
display: flex;
align-items: center;
justify-content: center;
height: 22px;
> i{ > i{
font-size: 1.4rem; font-size: 1.4rem;
display: block; display: block;

View File

@@ -395,9 +395,15 @@ const handleToolClick = (tool) => {
height: 100%; height: 100%;
padding-top: .5rem; padding-top: .5rem;
padding-bottom: 4rem; padding-bottom: 4rem;
position: relative;
/* overflow-y: auto; */ /* overflow-y: auto; */
/* overflow-x: hidden; */ /* overflow-x: hidden; */
} }
.fillColor-input{
position: absolute;
top: 0;
right: 0;
}
.tools-list{ .tools-list{
display: flex; display: flex;
flex-direction: column; flex-direction: column;

View File

@@ -2,11 +2,12 @@ import { FillGroupLayerBackgroundCommand } from "../commands/FillGroupLayerBackg
import { FillLayerBackgroundCommand } from "../commands/FillLayerBackgroundCommand"; import { FillLayerBackgroundCommand } from "../commands/FillLayerBackgroundCommand";
export class BackgroundFillManager { export class BackgroundFillManager {
constructor({ canvas, layers, commandManager, canvasManager }) { constructor({ canvas, layers, commandManager, canvasManager, layerManager }) {
this.canvas = canvas; this.canvas = canvas;
this.layers = layers; this.layers = layers;
this.commandManager = commandManager; this.commandManager = commandManager;
this.canvasManager = canvasManager; this.canvasManager = canvasManager;
this.layerManager = layerManager;
} }
/** /**
@@ -28,6 +29,7 @@ export class BackgroundFillManager {
layerId, layerId,
fillColor, fillColor,
canvasManager: this.canvasManager, canvasManager: this.canvasManager,
layerManager: this.layerManager,
// 是否实时更新 // 是否实时更新
isRetimeUpdate: !undoable, isRetimeUpdate: !undoable,
}); });

View File

@@ -109,6 +109,7 @@ export class LayerManager {
layers: this.layers, layers: this.layers,
commandManager: this.commandManager, commandManager: this.commandManager,
canvasManager: this.canvasManager, canvasManager: this.canvasManager,
layerManager: this,
}); });
// 编辑器模式draw(绘画)、select(选择)、pan(拖拽) // 编辑器模式draw(绘画)、select(选择)、pan(拖拽)

View File

@@ -1219,6 +1219,7 @@ export default {
basic: '基础', basic: '基础',
flipHorizontal: '水平翻转', flipHorizontal: '水平翻转',
flipVertical: '垂直翻转', flipVertical: '垂直翻转',
group: '组合',
//长毛笔 //长毛笔
FurSettings: '长毛笔设置', FurSettings: '长毛笔设置',
FurLength: '毛发长度', FurLength: '毛发长度',

View File

@@ -1254,6 +1254,7 @@ export default {
basic: 'Basic', basic: 'Basic',
flipHorizontal: 'Horizontal Flip', flipHorizontal: 'Horizontal Flip',
flipVertical: 'Vertical Flip', flipVertical: 'Vertical Flip',
group: 'Group',
//长毛笔 //长毛笔
FurSettings: 'FurSettings', FurSettings: 'FurSettings',
FurLength: 'Fur Length', FurLength: 'Fur Length',