mirror of
https://github.com/tobspr/shapez.io.git
synced 2025-06-13 13:04:03 +00:00
Fixed Formatting
This commit is contained in:
parent
a54db45999
commit
5644c41057
@ -245,14 +245,14 @@ export class HUDMassSelector extends BaseHUDPart {
|
|||||||
for(let x = realTileStart.x; x <= realTileEnd.x; ++x) {
|
for(let x = realTileStart.x; x <= realTileEnd.x; ++x) {
|
||||||
for(let y = realTileStart.y; y <= realTileEnd.y; ++y) {
|
for(let y = realTileStart.y; y <= realTileEnd.y; ++y) {
|
||||||
|
|
||||||
let entities = []
|
let entities = []
|
||||||
if(this.root.keyMapper.getBinding(KEYMAPPINGS.massSelect.massSelectSelectMultiLayer).pressed)
|
if(this.root.keyMapper.getBinding(KEYMAPPINGS.massSelect.massSelectSelectMultiLayer).pressed)
|
||||||
entities = this.root.map.getLayersContentsMultipleXY(x, y);
|
entities = this.root.map.getLayersContentsMultipleXY(x, y);
|
||||||
else
|
else
|
||||||
entities = [this.root.map.getLayerContentXY(x, y, this.root.currentLayer)];
|
entities = [this.root.map.getLayerContentXY(x, y, this.root.currentLayer)];
|
||||||
|
|
||||||
for(let i = 0; i < entities.length; ++i){
|
for(let i = 0; i < entities.length; ++i){
|
||||||
let entity = entities[i];
|
let entity = entities[i];
|
||||||
if(entity !== null && this.root.logic.canDeleteBuilding(entity))
|
if(entity !== null && this.root.logic.canDeleteBuilding(entity))
|
||||||
this.selectedUids.add(entity.uid);
|
this.selectedUids.add(entity.uid);
|
||||||
}
|
}
|
||||||
@ -300,52 +300,52 @@ export class HUDMassSelector extends BaseHUDPart {
|
|||||||
const renderedUids = new Set();
|
const renderedUids = new Set();
|
||||||
|
|
||||||
|
|
||||||
let isMultiLayerPressed = this.root.keyMapper.getBinding(KEYMAPPINGS.massSelect.massSelectSelectMultiLayer).pressed;
|
let isMultiLayerPressed = this.root.keyMapper.getBinding(KEYMAPPINGS.massSelect.massSelectSelectMultiLayer).pressed;
|
||||||
|
|
||||||
|
|
||||||
for(let x = realTileStart.x; x <= realTileEnd.x; ++x) {
|
for(let x = realTileStart.x; x <= realTileEnd.x; ++x) {
|
||||||
for(let y = realTileStart.y; y <= realTileEnd.y; ++y) {
|
for(let y = realTileStart.y; y <= realTileEnd.y; ++y) {
|
||||||
|
|
||||||
let entities = []
|
let entities = []
|
||||||
if(isMultiLayerPressed)
|
if(isMultiLayerPressed)
|
||||||
entities = this.root.map.getLayersContentsMultipleXY(x, y);
|
entities = this.root.map.getLayersContentsMultipleXY(x, y);
|
||||||
else
|
else
|
||||||
entities = [this.root.map.getLayerContentXY(x, y, this.root.currentLayer)];
|
entities = [this.root.map.getLayerContentXY(x, y, this.root.currentLayer)];
|
||||||
|
|
||||||
for(let i = 0; i < entities.length; ++i) {
|
for(let i = 0; i < entities.length; ++i) {
|
||||||
let component = entities[i];
|
let component = entities[i];
|
||||||
if(component && this.root.logic.canDeleteBuilding(component)) {
|
if(component && this.root.logic.canDeleteBuilding(component)) {
|
||||||
// Prevent rendering the overlay twice
|
// Prevent rendering the overlay twice
|
||||||
const uid = component.uid;
|
const uid = component.uid;
|
||||||
if(renderedUids.has(uid)) {
|
if(renderedUids.has(uid)) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
renderedUids.add(uid);
|
renderedUids.add(uid);
|
||||||
|
|
||||||
|
|
||||||
const staticComp = component.components.StaticMapEntity;
|
const staticComp = component.components.StaticMapEntity;
|
||||||
|
|
||||||
const bounds = staticComp.getTileSpaceBounds();
|
const bounds = staticComp.getTileSpaceBounds();
|
||||||
|
|
||||||
parameters.context.beginPath();
|
parameters.context.beginPath();
|
||||||
if(this.root.currentLayer === "wires" || component.layer === "regular"){
|
if(this.root.currentLayer === "wires" || component.layer === "regular"){
|
||||||
parameters.context.fillStyle = THEME.map.selectionOverlay;
|
parameters.context.fillStyle = THEME.map.selectionOverlay;
|
||||||
parameters.context.beginRoundedRect(
|
parameters.context.beginRoundedRect(
|
||||||
bounds.x * globalConfig.tileSize + boundsBorder,
|
bounds.x * globalConfig.tileSize + boundsBorder,
|
||||||
bounds.y * globalConfig.tileSize + boundsBorder,
|
bounds.y * globalConfig.tileSize + boundsBorder,
|
||||||
bounds.w * globalConfig.tileSize - 2 * boundsBorder,
|
bounds.w * globalConfig.tileSize - 2 * boundsBorder,
|
||||||
bounds.h * globalConfig.tileSize - 2 * boundsBorder,
|
bounds.h * globalConfig.tileSize - 2 * boundsBorder,
|
||||||
2
|
2
|
||||||
);
|
);
|
||||||
}else{
|
}else{
|
||||||
MapChunkView.drawSingleWiresOverviewTile({
|
MapChunkView.drawSingleWiresOverviewTile({
|
||||||
context: parameters.context,
|
context: parameters.context,
|
||||||
x: bounds.x * globalConfig.tileSize + boundsBorder,
|
x: bounds.x * globalConfig.tileSize + boundsBorder,
|
||||||
y: bounds.y * globalConfig.tileSize + boundsBorder,
|
y: bounds.y * globalConfig.tileSize + boundsBorder,
|
||||||
entity: component,
|
entity: component,
|
||||||
tileSizePixels: globalConfig.tileSize * 1.01,
|
tileSizePixels: globalConfig.tileSize * 1.01,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
parameters.context.fill();
|
parameters.context.fill();
|
||||||
}
|
}
|
||||||
@ -359,25 +359,25 @@ export class HUDMassSelector extends BaseHUDPart {
|
|||||||
const entity = this.root.entityMgr.findByUid(uid);
|
const entity = this.root.entityMgr.findByUid(uid);
|
||||||
const staticComp = entity.components.StaticMapEntity;
|
const staticComp = entity.components.StaticMapEntity;
|
||||||
const bounds = staticComp.getTileSpaceBounds();
|
const bounds = staticComp.getTileSpaceBounds();
|
||||||
parameters.context.beginPath();
|
parameters.context.beginPath();
|
||||||
if(this.root.currentLayer === "wires" || entity.layer === "regular"){
|
if(this.root.currentLayer === "wires" || entity.layer === "regular"){
|
||||||
parameters.context.fillStyle = THEME.map.selectionOverlay;
|
parameters.context.fillStyle = THEME.map.selectionOverlay;
|
||||||
parameters.context.beginRoundedRect(
|
parameters.context.beginRoundedRect(
|
||||||
bounds.x * globalConfig.tileSize + boundsBorder,
|
bounds.x * globalConfig.tileSize + boundsBorder,
|
||||||
bounds.y * globalConfig.tileSize + boundsBorder,
|
bounds.y * globalConfig.tileSize + boundsBorder,
|
||||||
bounds.w * globalConfig.tileSize - 2 * boundsBorder,
|
bounds.w * globalConfig.tileSize - 2 * boundsBorder,
|
||||||
bounds.h * globalConfig.tileSize - 2 * boundsBorder,
|
bounds.h * globalConfig.tileSize - 2 * boundsBorder,
|
||||||
2
|
2
|
||||||
);
|
);
|
||||||
}else{
|
}else{
|
||||||
MapChunkView.drawSingleWiresOverviewTile({
|
MapChunkView.drawSingleWiresOverviewTile({
|
||||||
context: parameters.context,
|
context: parameters.context,
|
||||||
x: bounds.x * globalConfig.tileSize + boundsBorder,
|
x: bounds.x * globalConfig.tileSize + boundsBorder,
|
||||||
y: bounds.y * globalConfig.tileSize + boundsBorder,
|
y: bounds.y * globalConfig.tileSize + boundsBorder,
|
||||||
entity: entity,
|
entity: entity,
|
||||||
tileSizePixels: globalConfig.tileSize * 1.01,
|
tileSizePixels: globalConfig.tileSize * 1.01,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
parameters.context.fill();
|
parameters.context.fill();
|
||||||
});
|
});
|
||||||
|
|||||||
@ -90,8 +90,8 @@ export const KEYMAPPINGS = {
|
|||||||
|
|
||||||
massSelect: {
|
massSelect: {
|
||||||
massSelectStart: { keyCode: 17 }, // CTRL
|
massSelectStart: { keyCode: 17 }, // CTRL
|
||||||
massSelectSelectMultiple: { keyCode: 16 }, // SHIFT
|
massSelectSelectMultiple: { keyCode: 16 }, // SHIFT
|
||||||
massSelectSelectMultiLayer: { keyCode: 18 }, // Alt
|
massSelectSelectMultiLayer: { keyCode: 18 }, // Alt
|
||||||
massSelectCopy: { keyCode: key("C") },
|
massSelectCopy: { keyCode: key("C") },
|
||||||
massSelectCut: { keyCode: key("X") },
|
massSelectCut: { keyCode: key("X") },
|
||||||
confirmMassDelete: { keyCode: 46 }, // DEL
|
confirmMassDelete: { keyCode: 46 }, // DEL
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user