mirror of
https://github.com/muerwre/orchidmap-front.git
synced 2025-04-26 03:26:41 +07:00
fixed bound fitting
This commit is contained in:
parent
acedb845af
commit
4416fa5d64
4 changed files with 33 additions and 16 deletions
|
@ -357,10 +357,25 @@ export class Editor {
|
|||
};
|
||||
|
||||
fitDrawing = (): void => {
|
||||
if (this.poly.isEmpty) return;
|
||||
if (!this.poly.isEmpty) {
|
||||
const poly_bounds = this.poly.poly.getBounds();
|
||||
|
||||
const bounds = this.poly.poly.getBounds();
|
||||
if (bounds && Object.values(bounds)) this.map.map.fitBounds(bounds);
|
||||
if (poly_bounds && Object.values(poly_bounds).length) {
|
||||
this.map.map.fitBounds(poly_bounds);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if (!this.stickers.isEmpty) {
|
||||
const stickers_bounds = this.stickers.layer.getBounds();
|
||||
|
||||
if (stickers_bounds && Object.values(stickers_bounds).length) {
|
||||
this.map.map.fitBounds(stickers_bounds);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
// no bounds to fit. better do something later
|
||||
};
|
||||
|
||||
setInitialData = (): void => {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue