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:
Daniel Rodriguez 2022-10-14 08:10:58 +00:00
commit c5f6e43886
3 changed files with 11 additions and 7 deletions

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -525,17 +525,21 @@ export default class Clock extends Item<ClockProps> {
const element: HTMLDivElement = document.createElement("div");
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.
const baseTimeFontSize = 20; // Per 100px of width.
const baseTimeFontSize = 35; // Per 100px of width.
const dateFontSizeMultiplier = 0.5;
const tzFontSizeMultiplier = 6 / this.props.clockTimezone.length;
const timeFontSize = (baseTimeFontSize * width) / 100;
const timeFontSize = (baseTimeFontSize * modified) / 100;
const dateFontSize =
(baseTimeFontSize * dateFontSizeMultiplier * width) / 100;
(baseTimeFontSize * dateFontSizeMultiplier * modified) / 100;
const tzFontSize = Math.min(
(baseTimeFontSize * tzFontSizeMultiplier * width) / 100,
(baseTimeFontSize * tzFontSizeMultiplier * modified) / 100,
(width / 100) * 10
);