Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
tinchox5 committed Jul 21, 2024
1 parent 3007a99 commit fcff4cb
Show file tree
Hide file tree
Showing 5 changed files with 36 additions and 27 deletions.
15 changes: 8 additions & 7 deletions src/js/orbit-label.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,18 +23,21 @@ export class OrbitLabel extends HTMLElement {
pointer-events: none;
}
svg > * {
svg * {
pointer-events: stroke;
}
text {
font-size: inherit;
}
path {
fill: transparent;
stroke: var(--color, transparent);
transition: stroke 0.3s;
}
:host(:hover) path {
stroke: var(--hover-color, transparent);
cursor: pointer;
stroke: var(--hover-color, var(--color));
}
Expand All @@ -49,13 +52,11 @@ export class OrbitLabel extends HTMLElement {

const observer = new MutationObserver((mutations) => {
mutations.forEach((mutation) => {
if (mutation.type === 'attributes') {
this.update();
}
});
});

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

}

Expand Down Expand Up @@ -86,7 +87,7 @@ export class OrbitLabel extends HTMLElement {
textPath.parentElement.setAttribute('textLength', path.getTotalLength());
}

text.style.fontSize = `calc(${fontSize} / (100 / (${length} / var(--o-orbit-number))))`
text.style.fontSize = `calc(${fontSize} * (100 / (${length}) * (12 / var(--o-orbit-number) ))`


textPath.textContent = this.textContent.trim();
Expand Down
23 changes: 14 additions & 9 deletions src/js/orbit-progress.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@

export class OrbitProgress extends HTMLElement {
static get observedAttributes() {
return ['value', 'shape', 'bar-color', 'bg-color', 'max', 'width', 'height'];
}

constructor() {
super();
Expand All @@ -19,7 +16,7 @@ export class OrbitProgress extends HTMLElement {
overflow: visible;
pointer-events: none;
}
svg > * {
svg * {
pointer-events: stroke;
}
.progress-bar {
Expand All @@ -31,8 +28,8 @@ export class OrbitProgress extends HTMLElement {
stroke: var(--bgcolor, transparent);
}
:host(:hover) .progress-bar {
stroke: var(--hover-color, var(--o-cyan-light));
cursor: pointer;
stroke: var(--hover-color, var(--color));
}
</style>
<svg viewBox="0 0 100 100">
Expand All @@ -41,14 +38,22 @@ export class OrbitProgress extends HTMLElement {
<path class="progress-bar"></path>
</svg>
`;


}



connectedCallback() {
this.update();
}

attributeChangedCallback() {
this.update();
const observer = new MutationObserver((mutations) => {
mutations.forEach((mutation) => {
this.update();
});
});

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

update() {
Expand Down
22 changes: 12 additions & 10 deletions src/js/orbit-sector.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,17 @@
overflow: visible;
pointer-events: none;
}
svg * {
pointer-events: stroke;
}
.sector {
stroke: var(--color, var(--o-cyan-light));
transition: stroke 0.3s;
}
:host(:hover) .sector {
stroke: var(--hover-color, var(--o-cyan-light));
cursor: pointer;
stroke: var(--hover-color, var(--color));
}
</style>
<svg viewBox="0 0 100 100">
Expand All @@ -37,14 +40,13 @@
this.update();

const observer = new MutationObserver((mutations) => {
mutations.forEach((mutation) => {
if (mutation.type === 'attributes') {
this.update();
}
});
});

observer.observe(this, { attributes: true });
mutations.forEach((mutation) => {
this.update();
});
});

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

}

update() {
Expand Down
1 change: 1 addition & 0 deletions src/scss/_satellite.scss
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
justify-content: center;
align-items: center;
border-radius: 50%; /* Circle by default */
pointer-events: all;
}

.satellite.at-center {
Expand Down
2 changes: 1 addition & 1 deletion src/scss/_utilities.scss
Original file line number Diff line number Diff line change
Expand Up @@ -220,5 +220,5 @@ o-progress.rounded,o-label.rounded {
}

.dev-orbit * {
border: 1px dashed var(--o-cyan) !important;
border: 0.2px solid var(--o-cyan) !important;
}

0 comments on commit fcff4cb

Please sign in to comment.