diff --git a/VERSION b/VERSION index 347f5833ee6db7495cce808040501bf2c96269a9..9df886c42a1e2082f1471383d986fea4d531f8ac 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 e2517656a6424c81417e22c2e1b630d0532f2ca4..142d456aa398def1a70de0bb6f8bf4873b7b28f5 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 2f950c9e15a4faccfc1f19bc4801e205d86c5e04..d85d8b46391eff5e93ca71589b585b54368a875a 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 ab590fa18e2e9e9fb05535e0cb05fd7dec8d8d57..d55898d15917d8029b82675159798b04622bc364 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 828b796ceaccd67422806f2059e7d11907a2c074..6042b5b2a4145bf91631bac4787da632961de9a5 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 5ee8b8f7122582456e4508b4ef5dc8e7118ff4ab..dfd8b8c06f9803cba724cb490e9e1d7759a457b4 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 439fc2a7a52fc818cd85a03c34f75ad78f1c4e8a..84fc70c5cf56008d1904ae76e9a11ddbeee96bc7 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 84da455f23a34fbe7beb9da3d903e0e21b537a35..f0ff055a328d3584984b2971c8b2bd2feb99c144 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 b2882bb4656b8e0f3b3a2851723e33c068cbaf9d..548851702a3d3f9f17a1f1e563e58625f47204b6 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 9116f89b123b158a28e6e481a10751976cac1a42..f114d03d7b06e5f8430af2a2d5e6da64421146d9 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 da7e9c58ca3f6ffc58a8961c84a02e24c7b11987..427ed31d957fe35a745bfaa1a03f23ba06108585 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 ca3860a147f300db962869fbdf8ffbb363f7ba5d..47e1a37101b9bd6f1ff24751aadaf909fa0f00f7 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 0bcdd57ee6321755e4b3e519b76ee26c2b21e83b..9cf357dd3d04d0496a0b7fc83d0f81a68d4b079d 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 8967af567a56c5c58417f0b6a2e369b1ce66f7ae..5aa53ca29dfc2511da52f9929aab52258e8cdff5 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 44ed4517e83be4ebc758ab84c536b54ab206cf48..07677ab685c176fbd0cf4bf7af8ec0e1e69db075 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 2e6503a59bd43f4032f7e3284073de8d02d1b9c7..2df2a95d611443f3e2d152e590a610f118ad1e1d 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 fc223f3d6d62d3207eb65678f57066c5125db235..200b14babe6036d2870e64e5bee2c1e301fc5408 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 8f669f424818c2121e3f402058fadf00bc3fc17a..c1d01168e794e581b6f86f2c86f7d000ecdf3aed 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 f8b089f183b437a3fc5a2abe8c5c6b570a95bc1e..0b0532224a74829e713842afe98c67c0682393c4 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 2b663cdef9778b9cf5147ab6a09a1354b617bbfc..9de7b29f993c42fa8529825d77df8615c2f803b1 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 ec524c0383b3837a29206d15086f3a2cd74f59ac..41853ef7537d36fd10652653b7cdbd8d7cbd5a60 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 2d0ce6700acda515880318e0ac27bc8df27751e9..7f4ddd0c9fb65e7e063677ec37d7149932775b0e 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 0cafec836b4b987873a94ab1c07eff84e45870a2..f961a8fffa0752bfc95a629d92a69964c80aaf8f 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 4a51c2f6ec368a0cfe878dc37719296bd5753def..6360302f8a8f86c30cf0136a71e9ee8772229bf2 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 c894a3310bc162314d6ae0ae7e8ba3a7e83aea90..a47fafba47cfae18031acb3a1b0ee4aa2b317232 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 70101760240a90eae79033e3ee8c9f5eda69fcc7..28efdc0e8eb5f18d16c433e737ec30bc131ea67c 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 be1d02ca873055a868e0cee082888bd49ead50c8..560eec29e4eac4c3aca6c217988731aa2e9b52ca 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 adaea92f86ef3123cd876c162cc252d115db1a20..372c6db31e13ba2721c8bc8d6984a163c18d4e72 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 68e47b10c255d8e0d5b952da923b7c61b857b2b6..5cdb436fa938aa1edb401317e8c3180216569b32 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 dc1ce12a0d0214f6188ad91df45cf9e656f53073..6babe02c327a68d257a2d71910e3ec535ccf57b6 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 f19072f9ea90fdb10f6a45533dc68b9e9eb92aab..e2ddfc7b52e19772e3821cfea35248b12fd3f96d 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 ed73f179c8c7b8905d5d0837280a1488c257257c..5f41531ce6a704d494e7ccaf5f7702567c3e2fd0 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 1780ef3106b5e24bafa5c5d47b9adc709622a7ff..92e30e1c0d8983cdd8b2834b0cfefb86c03bb99c 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 11ffc290e7e1dfc19295ca08f2f8d06ecf1ae44a..c37803494e4f4491ff936b3e2bbad9ade0601a9e 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 f7a423df0879bdb1d9d33ad817cf3b1f02dff4eb..cc1f1f401f54df04a9d0f9cee815fbe0a7f77593 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 86ce9c6cd0466a9732db98b6fc1505d4c998b9eb..baadd7655fe93a48cf02ca6e226abbc56c9488be 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 5603e7afa0d28977f6c84ca7dd7ce04421f79359..24c49b269daa29db5a994636c0955a8b89229f3f 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>