-
-
Save sGerli/ab47b106b7b125f145b0d29ee0cae8e8 to your computer and use it in GitHub Desktop.
FitbitOS rotate clipping issue. `-` indicates directory
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import clock from "clock"; | |
import document from "document"; | |
import userSettings from "user-settings" | |
import * as util from "../common/utils"; | |
clock.granularity = "minutes"; // seconds, minutes, hours | |
let timeLabel = document.getElementById("timeLabel"); | |
let indicatorSection = document.getElementById("indicatorSection"); | |
clock.ontick = (evt) => { | |
let today = new Date(); | |
let date = today.getDate(); | |
let day = today.toLocaleString().substring(0, 3); | |
let month = today.toString().split(' ')[1]; | |
//dateText.text = `${day} ${date} ${month}`; | |
//dateBottomText.text = `${day} ${date} ${month}`; | |
let hours = today.getHours(); | |
let finalHours = hours; | |
let mins = util.zeroPad(today.getMinutes()); | |
// Adjust for 24h and 12h | |
// if (userSettings.preferences.clockDisplay == "24h") finalHours = util.zeroPad(hours); | |
if (userSettings.preferences.clockDisplay == "12h" && hours > 12) { | |
finalHours-=12; | |
} | |
if (userSettings.preferences.clockDisplay == "12h" && hours == 0) finalHours = 12; // Start in 12 and not 0 if 12h | |
if (userSettings.preferences.clockDisplay == "12h") { | |
if (hours >= 12) { | |
indicatorSection.style.display = "inline"; | |
} else { | |
indicatorSection.style.display = "none"; | |
} | |
} else { | |
indicatorSection.style.display = "none"; | |
finalHours = util.zeroPad(finalHours) | |
} | |
timeLabel.text = `${finalHours}:${mins}` | |
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Add zero in front of numbers < 10 | |
export function zeroPad(i) { | |
if (i < 10) { | |
i = "0" + i; | |
} | |
return i; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!-- Copyright iGerli --> | |
<svg> | |
<g transform="translate(0,70) rotate(-9)"> | |
<use href="#timeBanner" /> | |
</g> | |
</svg> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* Copyright iGerli-*/ | |
.clockSection { | |
width: 120%; | |
height: 100; | |
x: -10%; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!-- Copyright iGerli --> | |
<svg> | |
<defs> | |
<link rel="stylesheet" href="styles.css" /> | |
<link rel="import" href="/mnt/sysassets/widgets_common.gui" /> | |
<symbol id="timeBanner"> | |
<svg> | |
<gradientRect class="clockSection" | |
gradient-type="linear" | |
gradient-x1="0" gradient-y1="0" | |
gradient-x2="100%" gradient-y2="0" | |
gradient-color1="#F45C43" | |
gradient-color2="#EB3349" /> | |
</svg> | |
<text x="47%" y="87" id="timeLabel" | |
font-family="Colfax-Black" fill="black" | |
font-size="104" font-weight="bold" | |
text-anchor="middle" text-length="8" /> | |
<svg id="indicatorSection" display="none"> | |
<gradientRect width="20%" height="3" x="80%" y="105" | |
gradient-type="linear" | |
gradient-x1="0" gradient-y1="0" | |
gradient-x2="100%" gradient-y2="0" | |
gradient-color1="#F45C43" | |
gradient-color2="#EB3349" /> | |
</svg> | |
</symbol> | |
</defs> | |
</svg> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment