Fix duration formatting (#91)
* Fix duration formatting * Lint fix --------- Co-authored-by: github-action linter <githubaction@githubaction.com>
This commit is contained in:
1 parent
a675811488
commit
bdaaf17785
5 files changed
+48
-9
No files matched your search
@@ -33,7 +33,7 @@ function OnContentSet() as void
|
||||
else
|
||||
m.top.FindNode("liveRect").visible = false
|
||||
if content.lengthSeconds <> invalid and content.lengthSeconds <> 0
|
||||
m.top.FindNode("durationLabel").text = TimeUtils.GetFormattedTime(content.lengthSeconds)
|
||||
SetDurationText(TimeUtils.GetFormattedTime(content.lengthSeconds))
|
||||
m.top.FindNode("durationRect").visible = true
|
||||
else
|
||||
m.top.FindNode("durationRect").visible = false
|
||||
@@ -42,6 +42,18 @@ function OnContentSet() as void
|
||||
|
||||
end function
|
||||
|
||||
function SetDurationText(text as string)
|
||||
label = m.top.FindNode("durationLabel")
|
||||
rect = m.top.FindNode("durationRect")
|
||||
rectParent = rect.getParent()
|
||||
|
||||
label.text = text
|
||||
size = label.localBoundingRect()
|
||||
|
||||
rect.width = size.width + 16
|
||||
rect.translation = [rectParent.width - rect.width, 162]
|
||||
end function
|
||||
|
||||
function OnThumbnailLoadFailed() as void
|
||||
if m.thumbnail.loadStatus <> "failed"
|
||||
return
|
||||
|
||||
@@ -17,18 +17,18 @@
|
||||
<Rectangle
|
||||
id="durationRect"
|
||||
width="60"
|
||||
height="25"
|
||||
height="26"
|
||||
color="0x000000"
|
||||
opacity="0.8"
|
||||
translation="[290, 162]"
|
||||
>
|
||||
<Label
|
||||
width="60"
|
||||
height="25"
|
||||
height="26"
|
||||
id="durationLabel"
|
||||
horizAlign="center"
|
||||
vertAlign="center"
|
||||
font="font:SmallestSystemFont"
|
||||
translation="[8, 0]"
|
||||
/>
|
||||
</Rectangle>
|
||||
<Rectangle
|
||||
|
||||
Reference in new issue
Block a user