1
0
mirror of https://github.com/tobspr/shapez.io.git synced 2026-03-02 03:39:21 +00:00

Allow hovering pinned shapes to enlarge them

This commit is contained in:
tobspr
2020-05-30 19:42:03 +02:00
parent 576bd3166f
commit 02fb6d53b5
6 changed files with 39 additions and 17 deletions

View File

@@ -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");