feat: add background fill functionality for layers
- Implemented FillLayerBackgroundCommand to fill the background of layers with a specified color. - Introduced BackgroundFillManager to manage background fill operations. - Updated LayerManager to include fillLayerBackground method. - Enhanced LayersPanel with a color picker for filling layer backgrounds. - Modified RasterizeLayerCommand to reflect changes in terminology and functionality. - Adjusted LayerSort to ensure filled layers are rendered at the correct z-index. - Updated relevant utility functions and components to support new fill feature.
This commit is contained in:
@@ -96,6 +96,10 @@ export class LayerSort {
|
||||
* @returns {number} 更新后的z-index
|
||||
*/
|
||||
processLayerObjects(layer, currentZIndex, zIndexMap) {
|
||||
if (layer.fill) {
|
||||
// 如果图层有填充,则填充在最底层
|
||||
zIndexMap.set(layer.fill.id, currentZIndex++);
|
||||
}
|
||||
// 检查是否有子图层(组图层)
|
||||
if (layer.children?.length > 0) {
|
||||
// 处理每个子图层
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { isArray } from "lodash-es";
|
||||
import { fill, isArray } from "lodash-es";
|
||||
|
||||
/**
|
||||
* 图层关联工具类
|
||||
@@ -193,6 +193,8 @@ export function simplifyLayers(layers) {
|
||||
.filter((obj) => obj !== null)
|
||||
: [],
|
||||
children: layer.children && isArray(layer.children) ? simplifyLayers(layer.children) : [],
|
||||
fill: layer?.fill || null,
|
||||
fillColor: layer.fillColor,
|
||||
};
|
||||
|
||||
return simplifiedLayer;
|
||||
|
||||
Reference in New Issue
Block a user