Show building on hover (pls don't break package.json)

This commit is contained in:
Chunkybanana 2022-12-21 22:25:22 +00:00
parent 58ea4f8213
commit 25c0b60ec6
2 changed files with 12 additions and 1 deletions

1
package-lock.json generated
View file

@ -12083,6 +12083,7 @@
},
"vue-panzoom": {
"version": "git+ssh://git@github.com/thepaperpilot/vue-panzoom.git#fa3cc91f6842cdfbd1bfb433c75cac01f177fe2d",
"integrity": "sha512-d4URo4PVl2jCFG1WNY+5lDQ8nloOVLf2gFLqE+TLNmF43+F/STgld0A58uf9aq2xbaupVJdZAp/prGtve9ESRQ==",
"from": "vue-panzoom@https://github.com/thepaperpilot/vue-panzoom.git",
"requires": {
"panzoom": "^9.4.1"

View file

@ -254,6 +254,7 @@ const factory = createLayer(id, () => {
const graphicContainer = new Graphics();
let spriteContainer = new Container();
const movingBlocks = new Container();
let hoverSprite = new Sprite();
spriteContainer.zIndex = 0;
movingBlocks.zIndex = 1;
@ -591,6 +592,7 @@ const factory = createLayer(id, () => {
spriteContainer.x = movingBlocks.x = calculatedX;
spriteContainer.y = movingBlocks.y = calculatedY;
graphicContainer.removeChild(hoverSprite);
if (
isMouseHoverShown.value &&
compSelected.value !== "cursor" &&
@ -604,6 +606,14 @@ const factory = createLayer(id, () => {
blockSize,
blockSize
);
const factoryBaseData = FACTORY_COMPONENTS[compSelected.value];
const sheet = Assets.get(factoryBaseData.imageSrc);
hoverSprite = new Sprite(sheet);
hoverSprite.x = roundDownTo(mouseCoords.x - tx, blockSize) + tx - blockSize / 2;
hoverSprite.y = roundDownTo(mouseCoords.y - ty, blockSize) + ty - blockSize / 2;
hoverSprite.width = blockSize;
hoverSprite.height = blockSize;
graphicContainer.addChild(hoverSprite);
}
}
watchEffect(updateGraphics);
@ -862,7 +872,7 @@ const factory = createLayer(id, () => {
onMouseenter={() => onComponentMouseEnter(key)}
onMouseleave={() => onComponentMouseLeave()}
onClick={() => onCompClick(key)}
></img>
/>
);
})}
</div>