Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
tinchox5 committed Jul 20, 2024
1 parent 825b9fd commit 5073a69
Show file tree
Hide file tree
Showing 11 changed files with 699 additions and 299 deletions.
Binary file added assets/alarm-clock.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
5 changes: 3 additions & 2 deletions assets/css/orbit.min.css

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion assets/css/orbit.min.css.map

Large diffs are not rendered by default.

Binary file added assets/hours.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/minutes.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/moon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified assets/watch.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
964 changes: 671 additions & 293 deletions examples/watch.html

Large diffs are not rendered by default.

17 changes: 15 additions & 2 deletions src/js/orbit-label.js
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,15 @@ export class OrbitLabel extends HTMLElement {
}
})
})

observer.observe(this, { attributes: true })

// const textoObserver = new MutationObserver(() => {
// this.update();
// });
// textoObserver.observe(this, { childList: true, subtree: true });



}
update() {
const svg = this.createSVGElement();
Expand Down Expand Up @@ -122,7 +129,7 @@ createTextPath(pathId, path) {
} else if (textAnchor === 'end') {
const textLength = text.textContent.length;
const pathLength = path.getTotalLength();
const startOffset = (pathLength - textLength + gap) / 2 ;
const startOffset = (pathLength - textLength - gap * 4) / 2 ;

textPath.setAttribute('startOffset', startOffset);
}
Expand Down Expand Up @@ -161,9 +168,15 @@ getAttributes() {
if (this.classList.contains('outer-orbit')) {
innerOuter = strokeWithPercentage * 2
}
if (this.classList.contains('quarter-outer-orbit')) {
innerOuter = strokeWithPercentage * 3.75
}
if (this.classList.contains('inner-orbit')) {
innerOuter = 0
}
if (this.classList.contains('quarter-inner-orbit')) {
innerOuter = strokeWithPercentage * 0.75
}
const realRadius = 50 + innerOuter - strokeWithPercentage
const labelAngle = calcularExpresionCSS(rawAngle)

Expand Down
3 changes: 2 additions & 1 deletion src/scss/_orbit-class.scss
Original file line number Diff line number Diff line change
Expand Up @@ -108,12 +108,13 @@ alineada tambien.
- el gap en label no anda super duper con texto invertido
- agregar quarters a secto, label, progress
+ dar vuelta texto camniando 1 por 0.. meterlo en function
+ ver orbit reduce que no anda del todo bien , tmpoco en label
*/
.orbit, [class*='orbit-']:not(.orbit-zone) {
container-name: orbit;
--o-diameter: calc(var(--o-orbit-number) * var(--o-lenght) / #{$max-orbits});
--o-diameter: calc(var(--o-orbit-number) * var(--o-lenght) / #{$max-orbits} * var(--o-orbit-ratio, 1));
--o-radius: calc(var(--o-diameter) / 2);
width: calc(var(--o-diameter) / var(--o-ellipse-x));
height: calc(var(--o-diameter) / var(--o-ellipse-y));
Expand Down
7 changes: 7 additions & 0 deletions src/scss/_utilities.scss
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,13 @@ $max-gaps: calc($max-orbiters / 2);
Sector, Progress and Vector size-ratio
Can be used in parent elements or in each orbiter class
*/
@for $i from 0 through 10 {
$percent: calc($i * 10);
$value: if($i == 0, 1, 1 - calc($i / 10));
.orbit.reduce-#{$percent}, [class*='orbit-']:not(.orbit-zone).reduce-#{$percent} {
--o-orbit-ratio: #{$value};
}
}

@for $i from 0 through 10 {
$percent: calc($i * 10);
Expand Down

0 comments on commit 5073a69

Please sign in to comment.