@@ -6,6 +6,10 @@ import {
66import {
77 assignedFixationColor ,
88 dropShadowInnerSize ,
9+ dropShadowMaxBoldness ,
10+ dropShadowMinBoldness ,
11+ dropShadowOffsetX ,
12+ dropShadowOffsetY ,
913 dropShadowOpacityEnd ,
1014 dropShadowOpacityStart ,
1115 dropShadowPasses ,
@@ -83,6 +87,7 @@ export const indicesRenderer = ( indicesCanvas: Ref<HTMLCanvasElement | null> )
8387 const fontScaleUpPerIterOutside = 2 * movePerIterOutside ;
8488 const fontScaleUpPerIterInside = 2 * movePerIterInside ;
8589 const numberToShow = ( idx + 1 ) . toString ( ) ;
90+ const boldnessStep = ( dropShadowMaxBoldness . value - dropShadowMinBoldness . value ) / dropShadowPasses . value ;
8691
8792 let totalOffset = 0 ;
8893
@@ -95,14 +100,14 @@ export const indicesRenderer = ( indicesCanvas: Ref<HTMLCanvasElement | null> )
95100 for ( let i = 0 ; i < dropShadowPasses . value ; i ++ ) {
96101 const fontSize = scale ( indicesFontSize . value + ( fontScaleUpPerIterOutside * i ) ) ;
97102
98- ctx ! . font = fontSize + 'px ' + indicesFontFamily . value ;
103+ ctx ! . font = 'normal ' + ( dropShadowMinBoldness . value + ( boldnessStep * i ) ) + ' ' + fontSize + 'px ' + indicesFontFamily . value ;
99104 ctx ! . fillStyle = `rgba( 0, 0, 0, ${ dropShadowOpacityStart . value + ( opacityPerStep * i ) } )` ;
100- const aspect = ctx ! . measureText ( toDisplay ) . width / fontSize ;
105+ const w = ctx ! . measureText ( toDisplay ) . width / width ;
101106
102107 ctx ! . fillText (
103108 toDisplay ,
104- scale ( originalToCanvasCoordinates ( ( fixation . x ! + fixationRadius . value ) - ( movePerIterOutside * i * aspect ) , 'x' ) ) + totalOffset ,
105- scale ( originalToCanvasCoordinates ( ( fixation . y ! - fixationRadius . value ) + ( movePerIterOutside * i ) , 'y' ) )
109+ scale ( originalToCanvasCoordinates ( ( fixation . x ! + fixationRadius . value ) + ( w / 2 ) , 'x' ) ) + totalOffset + dropShadowOffsetX . value ,
110+ scale ( originalToCanvasCoordinates ( ( fixation . y ! - fixationRadius . value ) + ( movePerIterOutside * i ) + dropShadowOffsetY . value , 'y' ) )
106111 ) ;
107112 }
108113
@@ -112,7 +117,7 @@ export const indicesRenderer = ( indicesCanvas: Ref<HTMLCanvasElement | null> )
112117 const fontSize = scale ( indicesFontSize . value
113118 - ( 2 * dropShadowInnerSize . value ) + ( fontScaleUpPerIterInside * i ) ) ;
114119
115- ctx ! . font = fontSize + 'px ' + indicesFontFamily . value ;
120+ ctx ! . font = 'normal ' + ( dropShadowMinBoldness . value + ( boldnessStep * i ) ) + ' ' + fontSize + 'px ' + indicesFontFamily . value ;
116121 ctx ! . fillStyle = `rgba( 0, 0, 0, ${ dropShadowOpacityEnd . value - ( opacityPerStep * i ) } )` ;
117122 const aspect = ctx ! . measureText ( toDisplay ) . width / fontSize ;
118123
@@ -147,7 +152,11 @@ export const indicesRenderer = ( indicesCanvas: Ref<HTMLCanvasElement | null> )
147152 dropShadowOpacityStart ,
148153 dropShadowOpacityEnd ,
149154 dropShadowPasses ,
150- dropShadowSize
155+ dropShadowSize ,
156+ dropShadowOffsetX ,
157+ dropShadowOffsetY ,
158+ dropShadowMinBoldness ,
159+ dropShadowMaxBoldness
151160 ] , render ) ;
152161
153162 onMounted ( ( ) => {
0 commit comments