05-13-2020 12:28
05-13-2020 12:28
Hi,
I'm trying to use a maquee text for displaying a potentially long string of text (https://dev.fitbit.com/build/guides/user-interface/svg-components/text/) :
However, if i'm doing a very long text like this :
<use id="txtStatus" href="#marquee-text" width="120" mode="1" value="50">
<rect width="100%" height="100%" fill="black" opacity="0.2" />
<set href="group/text" attributeName="text-buffer" to="Very long text Very long text Very long text Very long text Very long text Very long text Very long text Very long text Very long text Very long text Very long text Very long text " />
<set href="group/separator" attributeName="width" to="100" />
</use>
I got an error in the console "Error 7 Too big string". As it's a fitbit provided componenet, i'm not sure where to set the text-length to be able to fit my large string.
I tried adding a
<set href="group/text" attributeName="text-length" to="256">
But to no avail...
Does anyone know how to set the max string length on the marquee ? Or are the component open source somewhere so we can have a reference on that ?
Answered! Go to the Best Answer.
05-15-2020 10:24
05-15-2020 10:24
Got it to work !
I was happy to find the widgets svg source code in the emulator files. It allowed me to undestand the structure of the marquee and find what parameter to target.
In the end, you can expand the marquee string length above 64 chars by doing this :
<use id="txtStatus" href="#marquee-text" width="100%" mode="1" value="50">
<set href="group/text" attributeName="text-length" to="512" />
<set href="group/copy" attributeName="text-length" to="512" />
<set href="group/text" attributeName="text-buffer" to="very long text very long text very long text very long text very long text very long text very long text very long text very long text very long text very long text " />
<set href="group/separator" attributeName="width" to="100" />
</use>
You have to target the text-length of both the "text" element and of the "copy element" (which make total sense in retrospect)
05-15-2020 10:24
05-15-2020 10:24
Got it to work !
I was happy to find the widgets svg source code in the emulator files. It allowed me to undestand the structure of the marquee and find what parameter to target.
In the end, you can expand the marquee string length above 64 chars by doing this :
<use id="txtStatus" href="#marquee-text" width="100%" mode="1" value="50">
<set href="group/text" attributeName="text-length" to="512" />
<set href="group/copy" attributeName="text-length" to="512" />
<set href="group/text" attributeName="text-buffer" to="very long text very long text very long text very long text very long text very long text very long text very long text very long text very long text very long text " />
<set href="group/separator" attributeName="width" to="100" />
</use>
You have to target the text-length of both the "text" element and of the "copy element" (which make total sense in retrospect)
05-15-2020 12:25
05-15-2020 12:25
Thanks for sharing this solution!