mirror of
https://github.com/teoxoy/factorio-blueprint-editor.git
synced 2025-01-18 02:58:31 +02:00
fixed 2 bugs
This commit is contained in:
parent
75b28de9ab
commit
7e6d655eb9
@ -63,7 +63,7 @@ export class Blueprint {
|
||||
this.setTileIds()
|
||||
|
||||
// TODO: if entity has placeable-off-grid flag then take the next one
|
||||
const firstEntityTopLeft = this.entity(1).topLeft()
|
||||
const firstEntityTopLeft = this.firstEntity().topLeft()
|
||||
|
||||
const offsetX = G.sizeBPContainer.width / 64 - (firstEntityTopLeft.x % 1 !== 0 ? -0.5 : 0)
|
||||
const offsetY = G.sizeBPContainer.height / 64 - (firstEntityTopLeft.y % 1 !== 0 ? -0.5 : 0)
|
||||
@ -106,6 +106,10 @@ export class Blueprint {
|
||||
return e.entity()
|
||||
}
|
||||
|
||||
firstEntity() {
|
||||
return this.rawEntities.first().entity()
|
||||
}
|
||||
|
||||
undo(
|
||||
pre: (hist: any) => void,
|
||||
post: (hist: any) => void
|
||||
@ -338,11 +342,11 @@ export class Blueprint {
|
||||
return {
|
||||
x: [...this.rawEntities.keys()].reduce(
|
||||
(best: number, ent: any) => xcomp(best, this.entity(ent)[f]().x),
|
||||
this.rawEntities.first().entity()[f]().x
|
||||
this.firstEntity()[f]().x
|
||||
),
|
||||
y: [...this.rawEntities.keys()].reduce(
|
||||
(best: number, ent: any) => ycomp(best, this.entity(ent)[f]().y),
|
||||
this.rawEntities.first().entity()[f]().y
|
||||
this.firstEntity()[f]().y
|
||||
)
|
||||
}
|
||||
}
|
||||
@ -362,7 +366,7 @@ export class Blueprint {
|
||||
// TODO: make this behave more like in Factorio
|
||||
const entities: Map<string, number> = new Map()
|
||||
|
||||
for (let i = 1; i <= this.rawEntities.size; i++) {
|
||||
for (const i of [...this.rawEntities.keys()]) {
|
||||
const name = this.entity(i).name
|
||||
|
||||
const value = entities.get(name)
|
||||
|
Loading…
Reference in New Issue
Block a user