From 3224077cb0bf94c02573d32ad87a1fa8f29ad594 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tom=C3=A1=C5=A1=20Hozman?= <tomas.hozman@pm.me> Date: Tue, 23 Aug 2022 12:57:23 +0200 Subject: [PATCH] updated simple sticker --- VERSION | 2 +- .../static/js/templates/banner-name-left.js | 2 - .../static/js/templates/banner-name-right.js | 2 - generator/static/js/templates/billboard.js | 2 - .../js/templates/bottom-slogan-full-width.js | 6 +- .../js/templates/bottom-slogan-person.js | 4 - .../static/js/templates/bottom-slogan.js | 3 +- .../cover-static-name-and-logo-left.js | 1 - .../templates/cover-static-name-and-logo.js | 1 - generator/static/js/templates/cover.js | 1 - .../static/js/templates/eu-big-text-image.js | 6 +- .../static/js/templates/eu-icons-image.js | 6 +- .../static/js/templates/eu-image-slogan.js | 3 +- .../static/js/templates/event-text-bottom.js | 1 - .../static/js/templates/event-text-right.js | 1 - .../static/js/templates/humans-no-quotes.js | 1 - generator/static/js/templates/humans.js | 3 +- .../static/js/templates/left-corner-slogan.js | 1 - .../static/js/templates/nalodeni-story.js | 1 - generator/static/js/templates/nalodeni.js | 4 - .../no-image-big-text-icon-with-terciary.js | 1 - .../js/templates/no-image-big-text-icon.js | 1 - .../static/js/templates/no-image-icon-text.js | 1 - .../static/js/templates/no-image-quote.js | 1 - .../no-image-text-icon-vertical-logo.js | 3 +- .../js/templates/no-image-text-more-info.js | 3 +- generator/static/js/templates/poll.js | 1 - .../templates/poster-bottom-slogan-no-icon.js | 1 - .../js/templates/poster-bottom-slogan.js | 1 - .../poster-center-slogan-icons-no-image.js | 1 - .../poster-center-slogan-no-image.js | 3 +- generator/static/js/templates/poster-event.js | 1 - .../static/js/templates/right-big-text.js | 1 - .../static/js/templates/sticker-number.js | 383 +++++++++--------- .../templates/story-full-width-rectangle.js | 6 +- .../js/templates/story-with-rectangle.js | 3 +- generator/templates/generator.html | 4 +- 37 files changed, 213 insertions(+), 253 deletions(-) diff --git a/VERSION b/VERSION index 347f5833..9df886c4 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -1.4.1 +1.4.2 diff --git a/generator/static/js/templates/banner-name-left.js b/generator/static/js/templates/banner-name-left.js index e2517656..142d456a 100644 --- a/generator/static/js/templates/banner-name-left.js +++ b/generator/static/js/templates/banner-name-left.js @@ -7,8 +7,6 @@ class BannerNameLeft extends Template { "primaryText", "primaryColorScheme", "primaryImagePosition", - "primaryTextHighlight", - "nameText", "underNameText", "secondaryNameText", "secondaryUnderNameText", diff --git a/generator/static/js/templates/banner-name-right.js b/generator/static/js/templates/banner-name-right.js index 2f950c9e..d85d8b46 100644 --- a/generator/static/js/templates/banner-name-right.js +++ b/generator/static/js/templates/banner-name-right.js @@ -7,8 +7,6 @@ class BannerNameRight extends Template { "primaryText", "primaryColorScheme", "primaryImagePosition", - "primaryTextHighlight", - "nameText", "underNameText", "terciaryText" ]; diff --git a/generator/static/js/templates/billboard.js b/generator/static/js/templates/billboard.js index ab590fa1..d55898d1 100644 --- a/generator/static/js/templates/billboard.js +++ b/generator/static/js/templates/billboard.js @@ -7,8 +7,6 @@ class Billboard extends Template { "primaryText", "primaryColorScheme", "primaryImagePosition", - "primaryTextHighlight", - "nameText", "underNameText" ]; diff --git a/generator/static/js/templates/bottom-slogan-full-width.js b/generator/static/js/templates/bottom-slogan-full-width.js index 828b796c..6042b5b2 100644 --- a/generator/static/js/templates/bottom-slogan-full-width.js +++ b/generator/static/js/templates/bottom-slogan-full-width.js @@ -8,8 +8,7 @@ class BottomSloganFullWidth extends Template { "nameText", "primaryColorScheme", "logoIsCenter", - "primaryImagePosition", - "primaryTextHighlight" + "primaryImagePosition" ]; primaryColorSchemes = [ @@ -28,9 +27,6 @@ class BottomSloganFullWidth extends Template { "requesterTextColor" ]; - lightLogoDefaultSource = "/static/images/logos/default-light.png"; - darkLogoDefaultSource = "/static/images/logos/default-dark.png"; - aspectRatio = 1; defaultResolution = 2000; diff --git a/generator/static/js/templates/bottom-slogan-person.js b/generator/static/js/templates/bottom-slogan-person.js index 5ee8b8f7..dfd8b8c0 100644 --- a/generator/static/js/templates/bottom-slogan-person.js +++ b/generator/static/js/templates/bottom-slogan-person.js @@ -9,7 +9,6 @@ class BottomSloganPerson extends Template { "underNameText", "primaryColorScheme", "primaryImagePosition", - "primaryTextHighlight", "iconImage" ]; @@ -29,9 +28,6 @@ class BottomSloganPerson extends Template { "requesterTextColor" ]; - lightLogoDefaultSource = "/static/images/logos/default-light.png"; - darkLogoDefaultSource = "/static/images/logos/default-dark.png"; - iconImage = null; iconSource = ""; diff --git a/generator/static/js/templates/bottom-slogan.js b/generator/static/js/templates/bottom-slogan.js index 439fc2a7..84fc70c5 100644 --- a/generator/static/js/templates/bottom-slogan.js +++ b/generator/static/js/templates/bottom-slogan.js @@ -13,8 +13,7 @@ class BottomSloganTemplate extends Template { "iconImage", "iconText", "nameColorScheme", - "logoIsCenter", - "primaryTextHighlight" + "logoIsCenter" ]; locationSource = null; diff --git a/generator/static/js/templates/cover-static-name-and-logo-left.js b/generator/static/js/templates/cover-static-name-and-logo-left.js index 84da455f..f0ff055a 100644 --- a/generator/static/js/templates/cover-static-name-and-logo-left.js +++ b/generator/static/js/templates/cover-static-name-and-logo-left.js @@ -7,7 +7,6 @@ class CoverStaticNameAndLogoLeft extends Template { "primaryText", "primaryColorScheme", "primaryImagePosition", - "primaryTextHighlight", "nameText", "secondaryText", "terciaryText", diff --git a/generator/static/js/templates/cover-static-name-and-logo.js b/generator/static/js/templates/cover-static-name-and-logo.js index b2882bb4..54885170 100644 --- a/generator/static/js/templates/cover-static-name-and-logo.js +++ b/generator/static/js/templates/cover-static-name-and-logo.js @@ -7,7 +7,6 @@ class CoverStaticNameAndLogo extends Template { "primaryText", "primaryColorScheme", "primaryImagePosition", - "primaryTextHighlight", "nameText", "secondaryText", "terciaryText", diff --git a/generator/static/js/templates/cover.js b/generator/static/js/templates/cover.js index 9116f89b..f114d03d 100644 --- a/generator/static/js/templates/cover.js +++ b/generator/static/js/templates/cover.js @@ -7,7 +7,6 @@ class Cover extends Template { "primaryText", "primaryColorScheme", "primaryImagePosition", - "primaryTextHighlight", "nameText", "secondaryText", "terciaryText", diff --git a/generator/static/js/templates/eu-big-text-image.js b/generator/static/js/templates/eu-big-text-image.js index da7e9c58..427ed31d 100644 --- a/generator/static/js/templates/eu-big-text-image.js +++ b/generator/static/js/templates/eu-big-text-image.js @@ -7,8 +7,7 @@ class EuBigTextImage extends Template { "primaryText", "secondaryText", "primaryColorScheme", - "primaryImagePosition", - "primaryTextHighlight" + "primaryImagePosition" ]; primaryColorSchemes = [ @@ -29,9 +28,6 @@ class EuBigTextImage extends Template { secondaryText = ""; - lightLogoDefaultSource = "/static/images/logos/default-light.png"; - darkLogoDefaultSource = "/static/images/logos/default-dark.png"; - aspectRatio = 1; defaultResolution = 2000; diff --git a/generator/static/js/templates/eu-icons-image.js b/generator/static/js/templates/eu-icons-image.js index ca3860a1..47e1a371 100644 --- a/generator/static/js/templates/eu-icons-image.js +++ b/generator/static/js/templates/eu-icons-image.js @@ -7,8 +7,7 @@ class EuIconsImage extends Template { "fiveIconSet", "primaryText", "primaryColorScheme", - "primaryImagePosition", - "primaryTextHighlight" + "primaryImagePosition" ]; primaryColorSchemes = [ @@ -27,9 +26,6 @@ class EuIconsImage extends Template { "requesterTextColor" ]; - lightLogoDefaultSource = "/static/images/logos/default-light.png"; - darkLogoDefaultSource = "/static/images/logos/default-dark.png"; - iconSet = [ { "source": "", diff --git a/generator/static/js/templates/eu-image-slogan.js b/generator/static/js/templates/eu-image-slogan.js index 0bcdd57e..9cf357dd 100644 --- a/generator/static/js/templates/eu-image-slogan.js +++ b/generator/static/js/templates/eu-image-slogan.js @@ -9,8 +9,7 @@ class EuImageSlogan extends Template { "underNameText", "secondaryText", "primaryColorScheme", - "primaryImagePosition", - "primaryTextHighlight" + "primaryImagePosition" ]; primaryColorSchemes = [ diff --git a/generator/static/js/templates/event-text-bottom.js b/generator/static/js/templates/event-text-bottom.js index 8967af56..5aa53ca2 100644 --- a/generator/static/js/templates/event-text-bottom.js +++ b/generator/static/js/templates/event-text-bottom.js @@ -11,7 +11,6 @@ class EventTextBottom extends Template { "locationText", "primaryColorScheme", "primaryImagePosition", - "primaryTextHighlight", "nameText", "secondaryText", "terciaryText" diff --git a/generator/static/js/templates/event-text-right.js b/generator/static/js/templates/event-text-right.js index 44ed4517..07677ab6 100644 --- a/generator/static/js/templates/event-text-right.js +++ b/generator/static/js/templates/event-text-right.js @@ -11,7 +11,6 @@ class EventTextRight extends Template { "locationText", "primaryColorScheme", "primaryImagePosition", - "primaryTextHighlight", "nameText", "secondaryText", "terciaryText" diff --git a/generator/static/js/templates/humans-no-quotes.js b/generator/static/js/templates/humans-no-quotes.js index 2e6503a5..2df2a95d 100644 --- a/generator/static/js/templates/humans-no-quotes.js +++ b/generator/static/js/templates/humans-no-quotes.js @@ -7,7 +7,6 @@ class HumansNoQuote extends Template { "nameText", "secondaryText", "primaryImagePosition", - "primaryTextHighlight", "primaryColorScheme" ]; diff --git a/generator/static/js/templates/humans.js b/generator/static/js/templates/humans.js index fc223f3d..200b14ba 100644 --- a/generator/static/js/templates/humans.js +++ b/generator/static/js/templates/humans.js @@ -6,8 +6,7 @@ class Humans extends Template { "primaryImage", "primaryText", "nameText", - "primaryImagePosition", - "primaryTextHighlight" + "primaryImagePosition" ]; changeableColors = [ diff --git a/generator/static/js/templates/left-corner-slogan.js b/generator/static/js/templates/left-corner-slogan.js index 8f669f42..c1d01168 100644 --- a/generator/static/js/templates/left-corner-slogan.js +++ b/generator/static/js/templates/left-corner-slogan.js @@ -8,7 +8,6 @@ class LeftCornerSloganTemplate extends Template { "primaryText", "primaryColorScheme", "primaryImagePosition", - "primaryTextHighlight", "secondaryText", ]; diff --git a/generator/static/js/templates/nalodeni-story.js b/generator/static/js/templates/nalodeni-story.js index f8b089f1..0b053222 100644 --- a/generator/static/js/templates/nalodeni-story.js +++ b/generator/static/js/templates/nalodeni-story.js @@ -8,7 +8,6 @@ class NalodeniStory extends Template { "secondaryText", "primaryColorScheme", "primaryImagePosition", - "primaryTextHighlight", "iconImage" ]; diff --git a/generator/static/js/templates/nalodeni.js b/generator/static/js/templates/nalodeni.js index 2b663cde..9de7b29f 100644 --- a/generator/static/js/templates/nalodeni.js +++ b/generator/static/js/templates/nalodeni.js @@ -10,7 +10,6 @@ class Nalodeni extends Template { "underNameText", "primaryColorScheme", "primaryImagePosition", - "primaryTextHighlight", "iconImage" ]; @@ -30,9 +29,6 @@ class Nalodeni extends Template { "requesterTextColor" ]; - lightLogoDefaultSource = "/static/images/logos/default-light.png"; - darkLogoDefaultSource = "/static/images/logos/default-dark.png"; - iconImage = null; iconSource = ""; diff --git a/generator/static/js/templates/no-image-big-text-icon-with-terciary.js b/generator/static/js/templates/no-image-big-text-icon-with-terciary.js index ec524c03..41853ef7 100644 --- a/generator/static/js/templates/no-image-big-text-icon-with-terciary.js +++ b/generator/static/js/templates/no-image-big-text-icon-with-terciary.js @@ -8,7 +8,6 @@ class NoImageBigTextIconWithTerciary extends Template { "terciaryText", "primaryColorScheme", "iconImage", - "primaryTextHighlight", "backgroundHasPattern" ]; diff --git a/generator/static/js/templates/no-image-big-text-icon.js b/generator/static/js/templates/no-image-big-text-icon.js index 2d0ce670..7f4ddd0c 100644 --- a/generator/static/js/templates/no-image-big-text-icon.js +++ b/generator/static/js/templates/no-image-big-text-icon.js @@ -7,7 +7,6 @@ class NoImageBigTextIcon extends Template { "terciaryText", "primaryColorScheme", "iconImage", - "primaryTextHighlight", "backgroundHasPattern" ]; diff --git a/generator/static/js/templates/no-image-icon-text.js b/generator/static/js/templates/no-image-icon-text.js index 0cafec83..f961a8ff 100644 --- a/generator/static/js/templates/no-image-icon-text.js +++ b/generator/static/js/templates/no-image-icon-text.js @@ -6,7 +6,6 @@ class NoImageIconText extends Template { "primaryText", "primaryColorScheme", "iconImage", - "primaryTextHighlight", "backgroundHasPattern" ]; diff --git a/generator/static/js/templates/no-image-quote.js b/generator/static/js/templates/no-image-quote.js index 4a51c2f6..6360302f 100644 --- a/generator/static/js/templates/no-image-quote.js +++ b/generator/static/js/templates/no-image-quote.js @@ -8,7 +8,6 @@ class NoImageQuote extends Template { "primaryColorScheme", "nameColorScheme", "iconImage", - "primaryTextHighlight", "backgroundHasPattern" ]; diff --git a/generator/static/js/templates/no-image-text-icon-vertical-logo.js b/generator/static/js/templates/no-image-text-icon-vertical-logo.js index c894a331..a47fafba 100644 --- a/generator/static/js/templates/no-image-text-icon-vertical-logo.js +++ b/generator/static/js/templates/no-image-text-icon-vertical-logo.js @@ -7,8 +7,7 @@ class NoImageTextIconVerticalLogo extends Template { "primaryText", "nameText", "iconText", - "iconImage", - "primaryTextHighlight" + "iconImage" ]; iconImage = null; diff --git a/generator/static/js/templates/no-image-text-more-info.js b/generator/static/js/templates/no-image-text-more-info.js index 70101760..28efdc0e 100644 --- a/generator/static/js/templates/no-image-text-more-info.js +++ b/generator/static/js/templates/no-image-text-more-info.js @@ -8,8 +8,7 @@ class NoImageTextMoreInfo extends Template { "nameText", "terciaryText", "iconText", - "iconImage", - "primaryTextHighlight" + "iconImage" ]; iconImage = null; diff --git a/generator/static/js/templates/poll.js b/generator/static/js/templates/poll.js index be1d02ca..560eec29 100644 --- a/generator/static/js/templates/poll.js +++ b/generator/static/js/templates/poll.js @@ -8,7 +8,6 @@ class Poll extends Template { "primaryText", "primaryColorScheme", "primaryImagePosition", - "primaryTextHighlight", "twoReactionSet" ]; diff --git a/generator/static/js/templates/poster-bottom-slogan-no-icon.js b/generator/static/js/templates/poster-bottom-slogan-no-icon.js index adaea92f..372c6db3 100644 --- a/generator/static/js/templates/poster-bottom-slogan-no-icon.js +++ b/generator/static/js/templates/poster-bottom-slogan-no-icon.js @@ -10,7 +10,6 @@ class PosterBottomSloganTemplateNoIcon extends Template { "terciaryColorScheme", "primaryImagePosition", "locationImage", - "primaryTextHighlight", "underNameText", "terciaryText", "qrCode" diff --git a/generator/static/js/templates/poster-bottom-slogan.js b/generator/static/js/templates/poster-bottom-slogan.js index 68e47b10..5cdb436f 100644 --- a/generator/static/js/templates/poster-bottom-slogan.js +++ b/generator/static/js/templates/poster-bottom-slogan.js @@ -15,7 +15,6 @@ class PosterBottomSloganTemplate extends Template { "iconImage", "iconText", "nameColorScheme", - "primaryTextHighlight", "underNameText", "terciaryText", "qrCode" diff --git a/generator/static/js/templates/poster-center-slogan-icons-no-image.js b/generator/static/js/templates/poster-center-slogan-icons-no-image.js index dc1ce12a..6babe02c 100644 --- a/generator/static/js/templates/poster-center-slogan-icons-no-image.js +++ b/generator/static/js/templates/poster-center-slogan-icons-no-image.js @@ -5,7 +5,6 @@ class PosterCenterSloganIconsNoImage extends Template { "logoImage", "primaryText", "primaryColorScheme", - "primaryTextHighlight", "secondaryText", "qrCode", "fourIconSet" diff --git a/generator/static/js/templates/poster-center-slogan-no-image.js b/generator/static/js/templates/poster-center-slogan-no-image.js index f19072f9..e2ddfc7b 100644 --- a/generator/static/js/templates/poster-center-slogan-no-image.js +++ b/generator/static/js/templates/poster-center-slogan-no-image.js @@ -4,8 +4,7 @@ class PosterCenterSloganNoImage extends Template { changeableAttributes = [ "logoImage", "primaryText", - "primaryColorScheme", - "primaryTextHighlight" + "primaryColorScheme" ]; defaultResolution = 4430; diff --git a/generator/static/js/templates/poster-event.js b/generator/static/js/templates/poster-event.js index ed73f179..5f41531c 100644 --- a/generator/static/js/templates/poster-event.js +++ b/generator/static/js/templates/poster-event.js @@ -10,7 +10,6 @@ class PosterEvent extends Template { "locationText", "primaryColorScheme", "primaryImagePosition", - "primaryTextHighlight", "secondaryText", "terciaryText" ]; diff --git a/generator/static/js/templates/right-big-text.js b/generator/static/js/templates/right-big-text.js index 1780ef31..92e30e1c 100644 --- a/generator/static/js/templates/right-big-text.js +++ b/generator/static/js/templates/right-big-text.js @@ -9,7 +9,6 @@ class RightBigTextTemplate extends Template { "primaryColorScheme", "primaryImagePosition", "iconImage", - "primaryTextHighlight", "secondaryText" ]; diff --git a/generator/static/js/templates/sticker-number.js b/generator/static/js/templates/sticker-number.js index 11ffc290..c3780349 100644 --- a/generator/static/js/templates/sticker-number.js +++ b/generator/static/js/templates/sticker-number.js @@ -60,67 +60,72 @@ class StickerNumber extends Template { this.canvas.width, this.canvas.height ); - // Draw foreground circle - this.context.fillStyle = this.foregroundColor; - - this.context.beginPath(); - this.context.arc( - this.canvas.width / 2, // Center position - this.canvas.height / 2, // Center position - foregroundCircleWidth / 2, // Radius - 0, - 2 * Math.PI, - false - ); - this.context.closePath(); - - this.context.fill(); - const classRef = this; - - const primaryTextRGB = hexToRgb(this.primaryTextColor); let locationHeight = 0; - this.context.globalCompositeOperation = "source-atop"; - - if (this.locationSource !== null) { - const locationImageLoadPromise = new Promise( - resolve => { - const locationImage = new Image(); - - locationImage.onload = function() { - const locationWidth = foregroundCircleWidth; - locationHeight = (this.height * (locationWidth / this.width)); + if (this.showNumberLabel) { + // Draw foreground circle + this.context.fillStyle = this.foregroundColor; + + this.context.beginPath(); + this.context.arc( + this.canvas.width / 2, // Center position + this.canvas.height / 2, // Center position + foregroundCircleWidth / 2, // Radius + 0, + 2 * Math.PI, + false + ); + this.context.closePath(); + + this.context.fill(); + + const primaryTextRGB = hexToRgb(this.primaryTextColor); + + this.context.globalCompositeOperation = "source-atop"; + + if (this.locationSource !== null) { + const locationImageLoadPromise = new Promise( + resolve => { + const locationImage = new Image(); - classRef.context.drawImage( - colorizeImage( - this, - locationWidth, - locationHeight, - primaryTextRGB.r, - primaryTextRGB.g, - primaryTextRGB.b - ), - (classRef.canvas.width - foregroundCircleWidth) / 2, - Math.ceil( - classRef.canvas.height - - Math.floor((classRef.canvas.height - foregroundCircleWidth) / 2) - - locationHeight * 0.95, // Slightly imprecise positioning and/or tilted bottom bits - ), - locationWidth, locationHeight - ); + locationImage.onload = function() { + const locationWidth = foregroundCircleWidth; + locationHeight = (this.height * (locationWidth / this.width)); + + classRef.context.drawImage( + colorizeImage( + this, + locationWidth, + locationHeight, + primaryTextRGB.r, + primaryTextRGB.g, + primaryTextRGB.b + ), + (classRef.canvas.width - foregroundCircleWidth) / 2, + Math.ceil( + classRef.canvas.height + - Math.floor((classRef.canvas.height - foregroundCircleWidth) / 2) + - locationHeight * 0.95, // Slightly imprecise positioning and/or tilted bottom bits + ), + locationWidth, locationHeight + ); + + resolve(); + } - resolve(); + locationImage.src = classRef.locationSource; } - - locationImage.src = classRef.locationSource; - } - ); - - await locationImageLoadPromise; + ); + + await locationImageLoadPromise; + } } - this.context.fillStyle = this.primaryTextColor; + this.context.fillStyle = ( + (this.showNumberLabel) ? + this.primaryTextColor : this.foregroundColor + ); // Create number label if (this.showNumberLabel) { @@ -165,17 +170,25 @@ class StickerNumber extends Template { primaryTextMaxWidth = ( this.canvas.width - (this.canvas.width - foregroundCircleWidth) - ) * 0.7; // Avoid text overlapping into the circle + ) * ( + (this.showNumberLabel) ? + 0.7 : 1 + ); // Avoid text overlapping into the circle } - primaryTextFontSize -= locationHeight; - - this.context.font = `${primaryTextFontSize}px 'Bebas Neue'`; + if (this.showNumberLabel) { + primaryTextFontSize -= locationHeight; + } else { + primaryTextFontSize += (this.canvas.width - foregroundCircleWidth); + } - while (this.context.measureText(this.primaryText).width > primaryTextMaxWidth) { - primaryTextFontSize -= 2; + do { this.context.font = `${primaryTextFontSize}px 'Bebas Neue'`; - } + + if (this.context.measureText(this.primaryText).width > primaryTextMaxWidth) { + primaryTextFontSize -= 2; + } + } while (this.context.measureText(this.primaryText).width > primaryTextMaxWidth); this.context.fillText( this.primaryText, @@ -213,140 +226,142 @@ class StickerNumber extends Template { this.context.globalCompositeOperation = "source-over"; - // Create top text - const topTextWidth = ( - this.canvas.width - ( - this.canvas.width - - foregroundCircleWidth - - secondaryTopTextFontSize * 1.5 - ) - ); - - this.context.font = `${topTextFontSize}px 'Bebas Neue'`; - - while (this.context.measureText(TOP_TEXT).width > topTextMaxWidth) { - topTextFontSize -= 2; + if (this.showNumberLabel) { + // Create top text + const topTextWidth = ( + this.canvas.width - ( + this.canvas.width + - foregroundCircleWidth + - secondaryTopTextFontSize * 1.5 + ) + ); + this.context.font = `${topTextFontSize}px 'Bebas Neue'`; - } - - this.context.drawImage( - getCircularText( - TOP_TEXT, - topTextWidth, - 0, - "center", - false, - true, - "Bebas Neue", - `${topTextFontSize}px`, - this.secondaryTextColor, - 0 - ), - (this.canvas.width - topTextWidth) / 2, (this.canvas.height - topTextWidth) / 2, - topTextWidth, topTextWidth - ); - - // Create first side icon - the cross - const secondaryTextRGB = hexToRgb(this.secondaryTextColor); - - const crossSideIconLoadPromise = new Promise( - resolve => { - const cross = new Image(); - - cross.onload = function() { - const crossHeight = (this.height * (sideIconWidth / this.width)); + + while (this.context.measureText(TOP_TEXT).width > topTextMaxWidth) { + topTextFontSize -= 2; + this.context.font = `${topTextFontSize}px 'Bebas Neue'`; + } + + this.context.drawImage( + getCircularText( + TOP_TEXT, + topTextWidth, + 0, + "center", + false, + true, + "Bebas Neue", + `${topTextFontSize}px`, + this.secondaryTextColor, + 0 + ), + (this.canvas.width - topTextWidth) / 2, (this.canvas.height - topTextWidth) / 2, + topTextWidth, topTextWidth + ); + + // Create first side icon - the cross + const secondaryTextRGB = hexToRgb(this.secondaryTextColor); + + const crossSideIconLoadPromise = new Promise( + resolve => { + const cross = new Image(); - classRef.context.drawImage( - colorizeImage( - this, - sideIconWidth, - crossHeight, - secondaryTextRGB.r, - secondaryTextRGB.g, - secondaryTextRGB.b - ), - ( - (classRef.canvas.width - foregroundCircleWidth) / 2 - - sideIconWidth - ) / 2, - (classRef.canvas.height - crossHeight) / 2, - sideIconWidth, crossHeight - ); + cross.onload = function() { + const crossHeight = (this.height * (sideIconWidth / this.width)); + + classRef.context.drawImage( + colorizeImage( + this, + sideIconWidth, + crossHeight, + secondaryTextRGB.r, + secondaryTextRGB.g, + secondaryTextRGB.b + ), + ( + (classRef.canvas.width - foregroundCircleWidth) / 2 + - sideIconWidth + ) / 2, + (classRef.canvas.height - crossHeight) / 2, + sideIconWidth, crossHeight + ); + + resolve(); + } - resolve(); + cross.src = "static/images/sticker-cross.png"; } - - cross.src = "static/images/sticker-cross.png"; - } - ); - - // Create first side icon - the check - const checkSideIconLoadPromise = new Promise( - resolve => { - const cross = new Image(); - - cross.onload = function() { - const checkHeight = (this.height * (sideIconWidth / this.width)); + ); + + // Create first side icon - the check + const checkSideIconLoadPromise = new Promise( + resolve => { + const cross = new Image(); - classRef.context.drawImage( - colorizeImage( - this, - sideIconWidth, - checkHeight, - secondaryTextRGB.r, - secondaryTextRGB.g, - secondaryTextRGB.b - ), - classRef.canvas.width - ( - (classRef.canvas.width - foregroundCircleWidth) / 2 - + sideIconWidth - ) / 2, - (classRef.canvas.height - checkHeight) / 2, - sideIconWidth, checkHeight - ); + cross.onload = function() { + const checkHeight = (this.height * (sideIconWidth / this.width)); + + classRef.context.drawImage( + colorizeImage( + this, + sideIconWidth, + checkHeight, + secondaryTextRGB.r, + secondaryTextRGB.g, + secondaryTextRGB.b + ), + classRef.canvas.width - ( + (classRef.canvas.width - foregroundCircleWidth) / 2 + + sideIconWidth + ) / 2, + (classRef.canvas.height - checkHeight) / 2, + sideIconWidth, checkHeight + ); + + resolve(); + } - resolve(); + cross.src = "static/images/sticker-check.png"; } - - cross.src = "static/images/sticker-check.png"; - } - ); - - await checkSideIconLoadPromise; - - // Create bottom secondary text - const secondaryTextWidth = ( - this.canvas.width - ( - this.canvas.width - - foregroundCircleWidth - - secondaryTopTextFontSize * 1.9 - ) - ); - - this.context.font = `${secondaryTextFontSize}px 'Bebas Neue'`; - - while (this.context.measureText(this.secondaryText).width > secondaryTextMaxWidth) { - secondaryTextFontSize -= 2; + ); + + await checkSideIconLoadPromise; + + // Create bottom secondary text + const secondaryTextWidth = ( + this.canvas.width - ( + this.canvas.width + - foregroundCircleWidth + - secondaryTopTextFontSize * 1.9 + ) + ); + this.context.font = `${secondaryTextFontSize}px 'Bebas Neue'`; + + while (this.context.measureText(this.secondaryText).width > secondaryTextMaxWidth) { + secondaryTextFontSize -= 2; + this.context.font = `${secondaryTextFontSize}px 'Bebas Neue'`; + } + + this.context.drawImage( + getCircularText( + this.secondaryText, + secondaryTextWidth, + 180, + "center", + false, + false, + "Bebas Neue", + `${secondaryTextFontSize}px`, + this.secondaryTextColor, + 0 + ), + (this.canvas.width - secondaryTextWidth) / 2, (this.canvas.height - secondaryTextWidth) / 2, + secondaryTextWidth, secondaryTextWidth + ); } - this.context.drawImage( - getCircularText( - this.secondaryText, - secondaryTextWidth, - 180, - "center", - false, - false, - "Bebas Neue", - `${secondaryTextFontSize}px`, - this.secondaryTextColor, - 0 - ), - (this.canvas.width - secondaryTextWidth) / 2, (this.canvas.height - secondaryTextWidth) / 2, - secondaryTextWidth, secondaryTextWidth - ); - this.redrawing = false; } diff --git a/generator/static/js/templates/story-full-width-rectangle.js b/generator/static/js/templates/story-full-width-rectangle.js index f7a423df..cc1f1f40 100644 --- a/generator/static/js/templates/story-full-width-rectangle.js +++ b/generator/static/js/templates/story-full-width-rectangle.js @@ -8,8 +8,7 @@ class StoryWithFullWidthRectangleTemplate extends Template { "nameText", "primaryColorScheme", "nameColorScheme", - "primaryImagePosition", - "primaryTextHighlight" + "primaryImagePosition" ]; primaryColorSchemes = [ @@ -35,9 +34,6 @@ class StoryWithFullWidthRectangleTemplate extends Template { "requesterTextColor" ]; - lightLogoDefaultSource = "/static/images/logos/default-light.png"; - darkLogoDefaultSource = "/static/images/logos/default-dark.png"; - aspectRatio = 0.5625; defaultResolution = 1920; diff --git a/generator/static/js/templates/story-with-rectangle.js b/generator/static/js/templates/story-with-rectangle.js index 86ce9c6c..baadd765 100644 --- a/generator/static/js/templates/story-with-rectangle.js +++ b/generator/static/js/templates/story-with-rectangle.js @@ -10,8 +10,7 @@ class StoryWithRectangleTemplate extends Template { "primaryColorScheme", "nameColorScheme", "secondaryColorScheme", - "primaryImagePosition", - "primaryTextHighlight" + "primaryImagePosition" ]; primaryColorSchemes = [ diff --git a/generator/templates/generator.html b/generator/templates/generator.html index 5603e7af..24c49b26 100644 --- a/generator/templates/generator.html +++ b/generator/templates/generator.html @@ -861,7 +861,7 @@ > <label for="show-number-label" - >Zobrazit označení čísla</label> + >Zobrazit složitější prvky samolepky</label> </section> <section id="gradient-wrapper"> @@ -1817,7 +1817,7 @@ <label for="sticker-show-number-label" - >Zobrazit označení čísla</label> + >Zobrazit složitější prvky samolepky</label> </div> <br> -- GitLab