Fix template region stacking order
This commit is contained in:
1 parent
a5d73e75d3
commit
5c134ef75f
7 files changed
+49
-9
No files matched your search
@@ -6,6 +6,11 @@ const animationPresets = require('#src/web/public/js/templates/animation-presets
|
||||
const TEMPLATE_NAME_MAX_LENGTH = 255;
|
||||
const REGION_NAME_MAX_LENGTH = 255;
|
||||
|
||||
function normalizeRegionZIndex(value) {
|
||||
const parsed = Number(value);
|
||||
return Number.isFinite(parsed) ? Math.max(1, Math.round(parsed)) : 1;
|
||||
}
|
||||
|
||||
function sanitizeBackgroundColor(value) {
|
||||
const raw = String(value || '').trim();
|
||||
if (/^#[0-9a-fA-F]{6}$/.test(raw) || /^#[0-9a-fA-F]{3}$/.test(raw)) {
|
||||
@@ -185,7 +190,7 @@ function extractTemplateRegions(body) {
|
||||
y: Number(region.y || 0),
|
||||
width: Number(region.width || 100),
|
||||
height: Number(region.height || 100),
|
||||
z_index: Number(region.z_index || 0)
|
||||
z_index: normalizeRegionZIndex(region.z_index)
|
||||
};
|
||||
}).filter((region) => region.region_key && region.label);
|
||||
}
|
||||
@@ -221,7 +226,7 @@ function extractTemplateRegions(body) {
|
||||
y: Number(ys[i] || 0),
|
||||
width: Number(widths[i] || 100),
|
||||
height: Number(heights[i] || 100),
|
||||
z_index: Number(zs[i] || 0)
|
||||
z_index: normalizeRegionZIndex(zs[i])
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user