fix: Resize behavior for clock
Use option value instead of offset of elements.
This commit is contained in:
parent
d5dfacb9a9
commit
31457088da
1 changed files with 7 additions and 3 deletions
|
|
@ -61,6 +61,7 @@ tags:
|
|||
this.#resize();
|
||||
window.addEventListener('resize', () => this.#resize());
|
||||
|
||||
// console.debug(this);
|
||||
if (this.options.debug) {
|
||||
console.group('Clock');
|
||||
console.info('\nOptions:', this.options, '\n\n');
|
||||
|
|
@ -77,13 +78,16 @@ tags:
|
|||
part.element.style.width = this.options.size + 'px';
|
||||
}
|
||||
|
||||
part.element.width = part.element.offsetWidth;
|
||||
part.element.height = part.element.offsetHeight;
|
||||
// part.element.width = part.element.offsetWidth;
|
||||
// part.element.height = part.element.offsetHeight;
|
||||
part.element.width = this.options.size;
|
||||
part.element.height = this.options.size;
|
||||
|
||||
this.draw();
|
||||
});
|
||||
}
|
||||
|
||||
// TODO: Zuweisung von shapes zu parts anpassen
|
||||
draw() {
|
||||
// TODO: Nur geänderte Teile löschen
|
||||
this.parts.forEach(part => {
|
||||
|
|
@ -303,7 +307,6 @@ tags:
|
|||
}
|
||||
|
||||
#createContext(names) {
|
||||
let parts = [];
|
||||
const wrap = document.createElement('div');
|
||||
|
||||
wrap.style.position = 'relative';
|
||||
|
|
@ -444,6 +447,7 @@ tags:
|
|||
clock.draw();
|
||||
|
||||
// TODO: Alternative mit requestAnimationFrame()
|
||||
// TODO: Möglichkeit für Start/Stop wie bei TimeDisplay
|
||||
setInterval(() => {
|
||||
clock.update();
|
||||
}, 1000);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue