- Updated the backend documentation in CONTRIBUTING.md and README.md to reflect changes in application structure and API endpoints. - Enhanced the frontend components in MapView.vue for better handling of context menu actions. - Added new types and interfaces in TypeScript for improved type safety in the frontend. - Introduced new utility classes for managing characters and markers in the map. - Updated .gitignore to include .vscode directory for better development environment management.
53 lines
1.1 KiB
Go
53 lines
1.1 KiB
Go
package app
|
|
|
|
import (
|
|
"encoding/json"
|
|
"fmt"
|
|
"os"
|
|
"time"
|
|
|
|
"go.etcd.io/bbolt"
|
|
)
|
|
|
|
type zoomproc struct {
|
|
c Coord
|
|
m int
|
|
}
|
|
|
|
func (a *App) doRebuildZooms() {
|
|
needProcess := map[zoomproc]struct{}{}
|
|
saveGrid := map[zoomproc]string{}
|
|
|
|
a.db.Update(func(tx *bbolt.Tx) error {
|
|
b := tx.Bucket([]byte("grids"))
|
|
if b == nil {
|
|
return nil
|
|
}
|
|
b.ForEach(func(k, v []byte) error {
|
|
grid := GridData{}
|
|
json.Unmarshal(v, &grid)
|
|
needProcess[zoomproc{grid.Coord.Parent(), grid.Map}] = struct{}{}
|
|
saveGrid[zoomproc{grid.Coord, grid.Map}] = grid.ID
|
|
return nil
|
|
})
|
|
tx.DeleteBucket([]byte("tiles"))
|
|
return nil
|
|
})
|
|
|
|
for g, id := range saveGrid {
|
|
f := fmt.Sprintf("%s/grids/%s.png", a.gridStorage, id)
|
|
if _, err := os.Stat(f); err != nil {
|
|
continue
|
|
}
|
|
a.SaveTile(g.m, g.c, 0, fmt.Sprintf("grids/%s.png", id), time.Now().UnixNano())
|
|
}
|
|
for z := 1; z <= 5; z++ {
|
|
process := needProcess
|
|
needProcess = map[zoomproc]struct{}{}
|
|
for p := range process {
|
|
a.updateZoomLevel(p.m, p.c, z)
|
|
needProcess[zoomproc{p.c.Parent(), p.m}] = struct{}{}
|
|
}
|
|
}
|
|
}
|