feat: implement brush availability hints and enhance layer rendering order
This commit is contained in:
@@ -17,7 +17,7 @@ export function renderLayers(context: WebGlRendererContext, document: ImageDocum
|
||||
if (!artboard.visible) continue;
|
||||
const clipRect = documentRectToScreenRect(context.canvas, artboard.bounds, editor.viewport);
|
||||
const maskLayerIds = collectMaskLayerIds(artboard.layers);
|
||||
for (const layer of artboard.layers) renderLayer(context, document, editor, layer, imageTextureRenderer, clipRect, maskLayerIds);
|
||||
for (const layer of renderStack(artboard.layers)) renderLayer(context, document, editor, layer, imageTextureRenderer, clipRect, maskLayerIds);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -39,7 +39,7 @@ function renderLayer(
|
||||
if (!effectiveClipRect) return;
|
||||
|
||||
if (layer.type === "group") {
|
||||
for (const child of layer.children) renderLayer(context, document, editor, child, imageTextureRenderer, effectiveClipRect, maskLayerIds);
|
||||
for (const child of renderStack(layer.children)) renderLayer(context, document, editor, child, imageTextureRenderer, effectiveClipRect, maskLayerIds);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -79,6 +79,10 @@ function renderLayer(
|
||||
if (insetRect) clearScreenRect(context, insetRect, imageLayerInsetColor);
|
||||
}
|
||||
|
||||
function renderStack(layers: readonly Layer[]) {
|
||||
return [...layers].reverse();
|
||||
}
|
||||
|
||||
function resolveLayerClipRect(
|
||||
context: WebGlRendererContext,
|
||||
document: ImageDocument,
|
||||
|
||||
Reference in New Issue
Block a user