08-08-2022 05:21
08-08-2022 05:21
Hi
I have a need to create a set of three tumblers that will allow the setting of values up to 9999.99 however with the default text size for a tumbler I cannot get all three to fit on the Versa 2 display. Having tried to set the font-size for the individual items, their text and/or the tumbler nothing seems to change the text size such that I can reduce the width of each tumbler to fit. Can anyone give me some pointers as to what I am doing wrong?
styles.css (tried to date):
#tumbler-1k { x: 30; width: 80; height: 70%; }
.onekitem { height: 90; }
.onekitem text { font-size: 30; fill: fb-orange; x: 100%; text-anchor: end; }
or
#tumbler-1k { x: 30; width: 80; height: 70%; }
.onekitem { height: 90; font-size: 30; }
.onekitem text { fill: fb-orange; x: 100%; text-anchor: end; }
or
#tumbler-1k { x: 30; width: 80; height: 70%; }
.onekitem { font-size: 30; height: 90; }
.onekitem text { fill: fb-orange; x: 100%; text-anchor: end; }
Answered! Go to the Best Answer.
08-09-2022 14:52
08-09-2022 14:52
it actually works with scaling 🙂
I guess much easier than trying to change the hardcoded fontSize per <set>
08-09-2022 05:59 - edited 08-09-2022 06:07
08-09-2022 05:59 - edited 08-09-2022 06:07
I never worked with tumbler, but perhaps those properties just don't get applied on the uses via css.
It seems that <use>s get rendered before css gets applied
you might try to change them in your index.view inside the use with a <set>
08-09-2022 13:51
08-09-2022 13:51
It's possible that the font sizes are hard-coded into the component animations. I don't know if this is the right file, but have a look in "...\@fitbitsimulator\resources\static\devicesim\win\atlas\Resources\v2\widgets\tumblerview_widget.defs". This contains
<animate attributeName='font-size' begin='highlight+0.1' end='unhighlight' dur='0.1' to='100'/>
<animate attributeName='font-size' begin='unhighlight' end='highlight' to='80'/>
It MIGHT be possible to change the animation attributes in JS, but doing so might break other aspects of the tumbler.
I can't think how that could be over-ridden in CSS.
I wonder what would happen if the tumber were wrapped in a <g>...
08-09-2022 14:05
08-09-2022 14:05
Perhaps wrapping in a <g> and then just scaling the whole tumbler might work 🤔
08-09-2022 14:16
08-09-2022 14:16
That's what I was wondering. If only I could think of someone who loves wrapping stuff in <g>s... 😉
08-09-2022 14:24
08-09-2022 14:24
Hah! Never underestimate the power of a good old <g>
08-09-2022 14:52
08-09-2022 14:52
it actually works with scaling 🙂
I guess much easier than trying to change the hardcoded fontSize per <set>
08-09-2022 14:56
08-09-2022 14:56
Wow, nice! Does it touch and swipe sensibly?
08-09-2022 14:59 - edited 08-09-2022 15:06
08-09-2022 14:59 - edited 08-09-2022 15:06
although... The fontSize can be overwritten per item individually with
<set href="value/text" attributeName="font-size" to="40" />
08-09-2022 15:02 - edited 08-09-2022 15:05
08-09-2022 15:02 - edited 08-09-2022 15:05
yes 😄
(edit: not tested on device, but doing nicely on sim)
08-09-2022 15:10
08-09-2022 15:10
It seems that the size of the 59 is different to that of the 01. Is that because you only over-rode some of the items? I still suspect that the animation hard-coding could interfere.
08-09-2022 15:16
08-09-2022 15:16
yes...and yes 😞
The overwritten values only stay as long as the items haven't been animated to the hardcoded value of 80
So the only way to manipulate fontSize longterm seems to be the scaling.
08-09-2022 15:27
08-09-2022 15:27
The <g> solution seems like the neatest.
It is possible to change the 'to' attribute of animations in code, but there may be more to it than that.
08-09-2022 15:35
08-09-2022 15:35
yeah, I tried to implement the animation in <set>, but doesn't work...
They don't have an id unfortunately, so they might also be hard to access from js 😞
But at least the <g> is working nice. Good you mentioned it
08-10-2022 08:45
08-10-2022 08:45
Thanks both,
That has worked a treat. 😀👍
08-10-2022 08:49
08-10-2022 08:49
Nice! 👍🙂