From 02fb6d53b57cfc18fb8a753c1137a65567c23d87 Mon Sep 17 00:00:00 2001 From: tobspr <> Date: Sat, 30 May 2020 19:42:03 +0200 Subject: [PATCH] Allow hovering pinned shapes to enlarge them --- res/ui/icons/blueprint_marker.png | Bin 0 -> 766 bytes src/css/ingame_hud/pinned_shapes.scss | 40 +++++++++++++++++-------- src/js/changelog.js | 1 + src/js/core/config.js | 2 +- src/js/game/hud/parts/pinned_shapes.js | 11 +++++-- version | 2 +- 6 files changed, 39 insertions(+), 17 deletions(-) create mode 100644 res/ui/icons/blueprint_marker.png diff --git a/res/ui/icons/blueprint_marker.png b/res/ui/icons/blueprint_marker.png new file mode 100644 index 0000000000000000000000000000000000000000..b68100ed39f01b1cb8f454cece15d49ac3aff07a GIT binary patch literal 766 zcmeAS@N?(olHy`uVBq!ia0vp^3LwnE3?yBabR7dyEa{HEjtmSN`?>!lvVtU&J%W50 z7^>757#dm_7=8hT8eT9klo~KFyh>nTu$sZZAYL$MSD+10Vtas3h%1mb1_3K$6H5>> zwKO%g1Of=x$jI6REDj-ovPLkjo*qbxkttA%m9eRXiHS9k8yXr4;Q|dbGPMA)jX`FD zwS&}y85YJSRwgDu1z<}}Ees4Cz}8vm>e_(J2bu{afhK^|TNs*IIXE}~T>`Yl%*+fZ z1#~laZLlGbvMveo3uX|R|Lof#d(P`WZFByd-mt3lcbC`?kF1Gax0$DPcqhybeYbYk zzw~{FBT_%~2wdwG%wF(i$$>&k4vXW$J7j&=1C3!!@^*J&=wOxg0CG4BJR*x382FBW zFymBhK53vJdx@v7EBg~xIYEA_)bM~yK%v8)E{-7WMoz8C2A6A5@v7*|Eg~1d;`OvOKoiPKxQm@4bPOmW|r zq<^51#huYl>SA>I{ik~2sv)!Au-##N@@&Ga^??G3K<}uQxJHzuB$lLFB^RXvDF!10 zBLiInQ(a?&5JPh-LsKhL3vB}fD+7bO5zMJ58glbfGSez?Ygog&`zBC>B*=!~{Irtt o#G+J&^73-M%)IR4 .amountLabel, @@ -64,19 +72,27 @@ grid-row: 1 / 2; } - &.marked .amountLabel { - &::after { - content: " "; - position: absolute; - display: inline-block; - @include S(width, 9px); - @include S(height, 9px); - opacity: 0.8; - @include S(top, -4px); - @include S(left, -4px); - background: uiResource("icons/current_goal_marker.png") center center / contain no-repeat; + &.goal, + &.blueprint { + .amountLabel { + &::after { + content: " "; + position: absolute; + display: inline-block; + @include S(width, 8px); + @include S(height, 8px); + opacity: 0.8; + @include S(top, 4px); + @include S(left, -7px); + background: uiResource("icons/current_goal_marker.png") center center / contain no-repeat; + + @include DarkThemeInvert; + } + } - @include DarkThemeInvert; + &.blueprint .amountLabel::after { + background-image: uiResource("icons/blueprint_marker.png"); + background-size: 90%; } } } diff --git a/src/js/changelog.js b/src/js/changelog.js index af65730a..4d8844c8 100644 --- a/src/js/changelog.js +++ b/src/js/changelog.js @@ -3,6 +3,7 @@ export const CHANGELOG = [ version: "1.1.2", date: "unreleased", entries: [ + "Allow hovering pinned shapes to enlarge them", "Move default key for deleting from 'X' to 'DEL'", "Show confirmation when deleting > 100 buildings", "Reintroduce 'SPACE' keybinding to center on map", diff --git a/src/js/core/config.js b/src/js/core/config.js index c84dee3a..5b802de3 100644 --- a/src/js/core/config.js +++ b/src/js/core/config.js @@ -83,7 +83,7 @@ export const globalConfig = { debug: { /* dev:start */ - // fastGameEnter: true, + fastGameEnter: true, // noArtificialDelays: true, // disableSavegameWrite: true, // showEntityBounds: true, diff --git a/src/js/game/hud/parts/pinned_shapes.js b/src/js/game/hud/parts/pinned_shapes.js index 48ab98f2..1cdfa7ba 100644 --- a/src/js/game/hud/parts/pinned_shapes.js +++ b/src/js/game/hud/parts/pinned_shapes.js @@ -74,10 +74,10 @@ export class HUDPinnedShapes extends BaseHUDPart { } this.handles = []; - this.internalPinShape(currentKey, currentGoal.required, false); + this.internalPinShape(currentKey, currentGoal.required, false, "goal"); if (this.root.hubGoals.isRewardUnlocked(enumHubGoalRewards.reward_blueprints)) { - this.internalPinShape(blueprintShape, null, false); + this.internalPinShape(blueprintShape, null, false, "blueprint"); } for (let i = 0; i < this.pinnedShapes.length; ++i) { @@ -93,14 +93,19 @@ export class HUDPinnedShapes extends BaseHUDPart { * @param {string} key * @param {number} goal * @param {boolean} canUnpin + * @param {string=} className */ - internalPinShape(key, goal, canUnpin = true) { + internalPinShape(key, goal, canUnpin = true, className = null) { const definition = this.root.shapeDefinitionMgr.getShapeFromShortKey(key); const element = makeDiv(this.element, null, ["shape"]); const canvas = definition.generateAsCanvas(120); element.appendChild(canvas); + if (className) { + element.classList.add(className); + } + let detector = null; if (canUnpin) { element.classList.add("unpinable"); diff --git a/version b/version index 8cfbc905..8428158d 100644 --- a/version +++ b/version @@ -1 +1 @@ -1.1.1 \ No newline at end of file +1.1.2 \ No newline at end of file