fixed z-index issue
This commit is contained in:
parent
7a72aa7fa7
commit
130c11bfa1
@ -21,6 +21,7 @@ import type { CanvasElement as CanvasElementType } from '../../types/constructor
|
||||
import type { ResolvedTransitionSettings } from '../../types/transition';
|
||||
import type { PreloadCacheProvider } from '../../hooks/video';
|
||||
import { isInfoPanelElementType } from '../../lib/elementDefaults';
|
||||
import { normalizeZIndexValue } from '../../lib/elementStyles';
|
||||
|
||||
interface CanvasElementProps {
|
||||
element: CanvasElementType;
|
||||
@ -136,6 +137,10 @@ const CanvasElement: React.FC<CanvasElementProps> = ({
|
||||
top: `${yClamped}%`,
|
||||
transform: 'translate(-50%, -50%)',
|
||||
};
|
||||
const zIndex = normalizeZIndexValue(element.zIndex);
|
||||
if (zIndex !== undefined) {
|
||||
positionStyle.zIndex = zIndex;
|
||||
}
|
||||
|
||||
// Add appear animation to outer div (ALWAYS - for WYSIWYG)
|
||||
// Animation is applied to outer div to keep positioning hack working
|
||||
|
||||
@ -20,6 +20,7 @@ import type { CanvasElement } from '../types/constructor';
|
||||
import type { ResolvedTransitionSettings } from '../types/transition';
|
||||
import type { PreloadCacheProvider } from '../hooks/video';
|
||||
import { isInfoPanelElementType } from '../lib/elementDefaults';
|
||||
import { normalizeZIndexValue } from '../lib/elementStyles';
|
||||
|
||||
interface RuntimeElementProps {
|
||||
element: CanvasElement;
|
||||
@ -115,6 +116,10 @@ const RuntimeElement: React.FC<RuntimeElementProps> = ({
|
||||
transform: `translate(-50%, -50%)${rotation ? ` rotate(${rotation}deg)` : ''}`,
|
||||
pointerEvents: 'auto',
|
||||
};
|
||||
const zIndex = normalizeZIndexValue(element.zIndex);
|
||||
if (zIndex !== undefined) {
|
||||
positionStyle.zIndex = zIndex;
|
||||
}
|
||||
|
||||
// Add appear animation to outer div
|
||||
// Animation stays on outer div to keep positioning hack working
|
||||
|
||||
@ -267,6 +267,16 @@ const getTrimmedValue = (value: unknown): string => {
|
||||
return String(value).trim();
|
||||
};
|
||||
|
||||
export const normalizeZIndexValue = (
|
||||
value: unknown,
|
||||
): CSSProperties['zIndex'] | undefined => {
|
||||
const zIndexValue = getTrimmedValue(value);
|
||||
if (!zIndexValue) return undefined;
|
||||
|
||||
const parsed = Number(zIndexValue);
|
||||
return Number.isFinite(parsed) ? parsed : undefined;
|
||||
};
|
||||
|
||||
/**
|
||||
* Build React CSSProperties from element style properties.
|
||||
* Handles type coercion for special properties like opacity and zIndex.
|
||||
@ -326,13 +336,8 @@ export function buildElementStyle(
|
||||
}
|
||||
|
||||
// Handle zIndex (needs numeric conversion, already in style from loop but override with number)
|
||||
const zIndexValue = getTrimmedValue(source.zIndex);
|
||||
if (zIndexValue) {
|
||||
const parsed = Number(zIndexValue);
|
||||
if (Number.isFinite(parsed)) {
|
||||
style.zIndex = parsed;
|
||||
}
|
||||
}
|
||||
const zIndex = normalizeZIndexValue(source.zIndex);
|
||||
if (zIndex !== undefined) style.zIndex = zIndex;
|
||||
|
||||
return style;
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user