mirror of
https://github.com/tobspr/shapez.io.git
synced 2024-10-27 20:34:29 +00:00
Fix pinned shapes not being removable
This commit is contained in:
parent
7dccc1a844
commit
f3dcdeb2b8
@ -17,13 +17,10 @@
|
||||
grid-template-rows: 1fr 1fr;
|
||||
@include S(margin-bottom, 4px);
|
||||
color: #333438;
|
||||
// text-shadow: #{D(1px)} #{D(1px)} 0 rgba(0, 10, 20, 0.2);
|
||||
|
||||
&.unpinable {
|
||||
> canvas {
|
||||
cursor: pointer;
|
||||
pointer-events: all;
|
||||
}
|
||||
&.removable {
|
||||
cursor: pointer;
|
||||
pointer-events: all;
|
||||
}
|
||||
|
||||
> canvas {
|
||||
@ -31,16 +28,9 @@
|
||||
@include S(height, 25px);
|
||||
grid-column: 1 / 2;
|
||||
grid-row: 1 / 3;
|
||||
pointer-events: all;
|
||||
transition: transform 0.1s ease-in-out;
|
||||
transform-origin: D(2px) center;
|
||||
will-change: transform;
|
||||
position: relative;
|
||||
pointer-events: none;
|
||||
z-index: 20;
|
||||
&:hover {
|
||||
transform: scale(2);
|
||||
z-index: 21;
|
||||
}
|
||||
position: relative;
|
||||
}
|
||||
|
||||
> .amountLabel,
|
||||
|
@ -217,11 +217,11 @@ export class HUDPinnedShapes extends BaseHUDPart {
|
||||
|
||||
let detector = null;
|
||||
if (canUnpin) {
|
||||
element.classList.add("unpinable");
|
||||
element.classList.add("removable");
|
||||
detector = new ClickDetector(element, {
|
||||
consumeEvents: true,
|
||||
preventDefault: true,
|
||||
targetOnly: true,
|
||||
targetOnly: false,
|
||||
});
|
||||
detector.click.add(() => this.unpinShape(key));
|
||||
} else {
|
||||
@ -294,6 +294,7 @@ export class HUDPinnedShapes extends BaseHUDPart {
|
||||
* @param {string} key
|
||||
*/
|
||||
unpinShape(key) {
|
||||
console.log("unpin", key);
|
||||
arrayDeleteValue(this.pinnedShapes, key);
|
||||
this.rerenderFull();
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user