Merge pull request #42 from ok2/codex/fix-pixel-jump-in-0-f-markers
Fix marker jitter in analog clock
This commit is contained in:
commit
4f7f47dc1c
5
clock.js
5
clock.js
@ -74,8 +74,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Unified radius based on the actual clock size
|
// Unified radius based on the actual clock size
|
||||||
const rect = clock.getBoundingClientRect();
|
const baseRadius = clock.offsetWidth / 2;
|
||||||
const baseRadius = rect.width / 2;
|
|
||||||
|
|
||||||
// Tick lengths relative to the clock radius
|
// Tick lengths relative to the clock radius
|
||||||
const lenBig = baseRadius * 0.12;
|
const lenBig = baseRadius * 0.12;
|
||||||
@ -86,7 +85,7 @@
|
|||||||
|
|
||||||
// Distance from center for the marker digits so they sit just inside big ticks
|
// Distance from center for the marker digits so they sit just inside big ticks
|
||||||
const markerSize = markers[0] ? markers[0].offsetWidth : 0;
|
const markerSize = markers[0] ? markers[0].offsetWidth : 0;
|
||||||
const markerRadius = outerR - lenBig - markerSize * getMarkerOffset(rect.width);
|
const markerRadius = outerR - lenBig - markerSize * getMarkerOffset(clock.offsetWidth);
|
||||||
|
|
||||||
markers.forEach((m, i) => {
|
markers.forEach((m, i) => {
|
||||||
const angle = (i / 16) * 2 * Math.PI;
|
const angle = (i / 16) * 2 * Math.PI;
|
||||||
|
|||||||
@ -447,6 +447,10 @@ body.fullscreen-clock .clock-label {
|
|||||||
text-shadow: 0 0 6px rgba(0, 255, 255, 0.9), 0 0 12px rgba(0, 255, 255, 0.7);
|
text-shadow: 0 0 6px rgba(0, 255, 255, 0.9), 0 0 12px rgba(0, 255, 255, 0.7);
|
||||||
box-shadow: none;
|
box-shadow: none;
|
||||||
transform-origin: center;
|
transform-origin: center;
|
||||||
|
font-variant-numeric: tabular-nums;
|
||||||
|
user-select: none;
|
||||||
|
pointer-events: none;
|
||||||
|
will-change: transform;
|
||||||
z-index: 1;
|
z-index: 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user