mirror of
https://github.com/pandorafms/pandorafms.git
synced 2025-07-30 09:15:15 +02:00
Merge branch 'ent-9424-reloj-de-consola-visual-se-superpone-a-fecha' into 'develop'
fixed size digital clock pandora_enterprise#9424 See merge request artica/pandorafms!5112
This commit is contained in:
commit
c5f6e43886
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@ -525,17 +525,21 @@ export default class Clock extends Item<ClockProps> {
|
|||||||
const element: HTMLDivElement = document.createElement("div");
|
const element: HTMLDivElement = document.createElement("div");
|
||||||
element.className = "digital-clock";
|
element.className = "digital-clock";
|
||||||
|
|
||||||
const { width } = this.getElementSize(); // Destructuring assigment: http://es6-features.org/#ObjectMatchingShorthandNotation
|
const { width, height } = this.getElementSize(); // Destructuring assigment: http://es6-features.org/#ObjectMatchingShorthandNotation
|
||||||
|
let modified = width;
|
||||||
|
if (height < width) {
|
||||||
|
modified = height;
|
||||||
|
}
|
||||||
|
|
||||||
// Calculate font size to adapt the font to the item size.
|
// Calculate font size to adapt the font to the item size.
|
||||||
const baseTimeFontSize = 20; // Per 100px of width.
|
const baseTimeFontSize = 35; // Per 100px of width.
|
||||||
const dateFontSizeMultiplier = 0.5;
|
const dateFontSizeMultiplier = 0.5;
|
||||||
const tzFontSizeMultiplier = 6 / this.props.clockTimezone.length;
|
const tzFontSizeMultiplier = 6 / this.props.clockTimezone.length;
|
||||||
const timeFontSize = (baseTimeFontSize * width) / 100;
|
const timeFontSize = (baseTimeFontSize * modified) / 100;
|
||||||
const dateFontSize =
|
const dateFontSize =
|
||||||
(baseTimeFontSize * dateFontSizeMultiplier * width) / 100;
|
(baseTimeFontSize * dateFontSizeMultiplier * modified) / 100;
|
||||||
const tzFontSize = Math.min(
|
const tzFontSize = Math.min(
|
||||||
(baseTimeFontSize * tzFontSizeMultiplier * width) / 100,
|
(baseTimeFontSize * tzFontSizeMultiplier * modified) / 100,
|
||||||
(width / 100) * 10
|
(width / 100) * 10
|
||||||
);
|
);
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user