From d156fa3110793731ebe6a738e70ee87bf0c32a59 Mon Sep 17 00:00:00 2001 From: Bela Bohlender Date: Wed, 26 Jun 2024 13:10:48 +0200 Subject: [PATCH] fix: svg not showing in vanilla uikit --- examples/vanilla/index.ts | 2 +- packages/uikit/src/vanilla/svg.ts | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/examples/vanilla/index.ts b/examples/vanilla/index.ts index 9f608293..de12bd74 100644 --- a/examples/vanilla/index.ts +++ b/examples/vanilla/index.ts @@ -58,7 +58,7 @@ const c = new Content({ flexShrink: 0, height: 100, backgroundColor: 'black' }) const loader = new GLTFLoader() loader.load('example.glb', (gltf) => c.add(gltf.scene)) const del = new Delete({ width: 100, flexShrink: 0 }) -const svg = new Svg({ src: 'example.svg', height: '20%', flexShrink: 0 }) +const svg = new Svg({ src: 'example.svg', width: 100, height: 100, flexShrink: 0 }) const text = new Text('Hello World', { fontSize: 40, flexShrink: 0 }) const a = new Container({ flexShrink: 0, alignSelf: 'stretch', flexGrow: 1, backgroundColor: 'blue' }) const x = new Container({ diff --git a/packages/uikit/src/vanilla/svg.ts b/packages/uikit/src/vanilla/svg.ts index 6075816d..b2c364a2 100644 --- a/packages/uikit/src/vanilla/svg.ts +++ b/packages/uikit/src/vanilla/svg.ts @@ -1,5 +1,5 @@ import { AllOptionalProperties } from '../properties/default.js' -import { Parent, createParentContextSignal, bindHandlers } from './utils.js' +import { Parent, createParentContextSignal, bindHandlers, setupParentContextSignal } from './utils.js' import { ReadonlySignal, Signal, effect, signal, untracked } from '@preact/signals-core' import { Subscriptions, initialize, unsubscribeSubscriptions } from '../utils.js' import { SvgProperties, createSvg } from '../components/svg.js' @@ -18,6 +18,7 @@ export class Svg extends Parent { constructor(properties?: SvgProperties, defaultProperties?: AllOptionalProperties) { super() this.matrixAutoUpdate = false + setupParentContextSignal(this.parentContextSignal, this) this.propertiesSignal = signal(properties) this.defaultPropertiesSignal = signal(defaultProperties)