fix: ensure canvas renders when dialog opens
Fixed canvas visualization not painting sometimes by: - Adding `open` prop check before rendering - Adding `open` to useEffect dependencies - Adding dimension validation for dynamic canvas sizes - Ensures canvas properly renders when dialog becomes visible Affected dialogs: DynamicsParameterDialog, TimeBasedParameterDialog, AdvancedParameterDialog 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -91,6 +91,8 @@ export function AdvancedParameterDialog({
|
||||
|
||||
// Draw visual feedback
|
||||
React.useEffect(() => {
|
||||
if (!open) return;
|
||||
|
||||
const canvas = canvasRef.current;
|
||||
if (!canvas) return;
|
||||
|
||||
@@ -210,7 +212,7 @@ export function AdvancedParameterDialog({
|
||||
ctx.moveTo(0, height / 2);
|
||||
ctx.lineTo(width, height / 2);
|
||||
ctx.stroke();
|
||||
}, [parameters, effectType]);
|
||||
}, [parameters, effectType, open]);
|
||||
|
||||
const handleApply = () => {
|
||||
onApply({ ...parameters, type: effectType } as AdvancedParameters);
|
||||
|
||||
Reference in New Issue
Block a user