@@ -280,17 +280,15 @@ function renderNode(node: NodeInstance, ctx: RenderContext): string {
280280
281281function renderEvent ( event : EventInstance , ctx : RenderContext ) : string {
282282 const wrapper = document . querySelector ( `[data-id="${ event . id } "]` ) as HTMLElement ;
283+ if ( ! wrapper ) return '' ;
283284
284- // Get text from DOM or fallback to data
285- let eventName = event . name ;
286- let eventType = '' ;
285+ const zoom = getZoom ( ) ;
287286
288- if ( wrapper ) {
289- const nameEl = wrapper . querySelector ( '.event-name' ) ;
290- const typeEl = wrapper . querySelector ( '.event-type' ) ;
291- eventName = nameEl ?. textContent || event . name ;
292- eventType = typeEl ?. textContent || '' ;
293- }
287+ // Get text from DOM
288+ const nameEl = wrapper . querySelector ( '.event-name' ) ;
289+ const typeEl = wrapper . querySelector ( '.event-type' ) ;
290+ const eventName = nameEl ?. textContent || event . name ;
291+ const eventType = typeEl ?. textContent || '' ;
294292
295293 // Position is center-origin, so position IS the center
296294 const cx = event . position . x ;
@@ -299,15 +297,24 @@ function renderEvent(event: EventInstance, ctx: RenderContext): string {
299297
300298 const parts : string [ ] = [ ] ;
301299
302- // Diamond background
303- parts . push (
304- `<rect x="${ cx - EVENT . diamondOffset } " y="${ cy - EVENT . diamondOffset } " width="${ EVENT . diamondSize } " height="${ EVENT . diamondSize } " rx="4" fill="${ ctx . theme . surfaceRaised } " transform="rotate(45 ${ cx } ${ cy } )"/>`
305- ) ;
300+ // Get diamond element and its dimensions from DOM
301+ const diamondEl = wrapper . querySelector ( '.diamond' ) as HTMLElement ;
302+ if ( diamondEl ) {
303+ const diamondRect = diamondEl . getBoundingClientRect ( ) ;
304+ const diamondSize = diamondRect . width / zoom ; // Diamond is square
305+ const diamondOffset = diamondSize / 2 ;
306+ const borderRadius = parseFloat ( getComputedStyle ( diamondEl ) . borderRadius ) || 4 ;
306307
307- // Diamond border
308- parts . push (
309- `<rect x="${ cx - EVENT . diamondOffset } " y="${ cy - EVENT . diamondOffset } " width="${ EVENT . diamondSize } " height="${ EVENT . diamondSize } " rx="4" fill="none" stroke="${ ctx . theme . edge } " stroke-width="1" transform="rotate(45 ${ cx } ${ cy } )"/>`
310- ) ;
308+ // Diamond background
309+ parts . push (
310+ `<rect x="${ cx - diamondOffset } " y="${ cy - diamondOffset } " width="${ diamondSize } " height="${ diamondSize } " rx="${ borderRadius } " fill="${ ctx . theme . surfaceRaised } " transform="rotate(45 ${ cx } ${ cy } )"/>`
311+ ) ;
312+
313+ // Diamond border
314+ parts . push (
315+ `<rect x="${ cx - diamondOffset } " y="${ cy - diamondOffset } " width="${ diamondSize } " height="${ diamondSize } " rx="${ borderRadius } " fill="none" stroke="${ ctx . theme . edge } " stroke-width="1" transform="rotate(45 ${ cx } ${ cy } )"/>`
316+ ) ;
317+ }
311318
312319 // Labels
313320 if ( ctx . options . showLabels ) {
0 commit comments