koishi-plugin-haulmp-tools 1.0.3 → 1.0.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/lib/command/locate.js
CHANGED
|
@@ -364,12 +364,12 @@ async function doMapShot(ctx, info, p, nearby) {
|
|
|
364
364
|
info,
|
|
365
365
|
nearby: nearby.map((n) => ({ lng: n.lon, lat: n.lat, name: n.name, km: n.km })),
|
|
366
366
|
}),
|
|
367
|
-
|
|
367
|
+
25000,
|
|
368
368
|
resetPage,
|
|
369
369
|
)
|
|
370
370
|
const t2 = Date.now()
|
|
371
371
|
await new Promise((r) => setTimeout(r, 120))
|
|
372
|
-
const buf = await withTimeout(page.screenshot({ encoding: 'binary', type: 'png' }),
|
|
372
|
+
const buf = await withTimeout(page.screenshot({ encoding: 'binary', type: 'png' }), 15000, resetPage)
|
|
373
373
|
ctx.logger('haulmp').info('updateView %dms | 截图 %dms', t2 - t1, Date.now() - t2)
|
|
374
374
|
return buf
|
|
375
375
|
} catch (e) {
|
|
@@ -500,7 +500,7 @@ function apply(ctx, config) {
|
|
|
500
500
|
dist: near.km.toFixed(0),
|
|
501
501
|
id: p.id,
|
|
502
502
|
// 供 Canvas 兜底页使用的数值字段
|
|
503
|
-
lng,
|
|
503
|
+
lng: lon,
|
|
504
504
|
lat,
|
|
505
505
|
bearing: bearingDeg,
|
|
506
506
|
bearingText,
|
|
@@ -102,7 +102,8 @@ window.updateView = async function (data) { el('wrap').style.display = 'block'
|
|
|
102
102
|
await new Promise((res) => {
|
|
103
103
|
const t0 = performance.now()
|
|
104
104
|
const check = () => {
|
|
105
|
-
|
|
105
|
+
// 软件渲染(SwiftShader,无 GPU 服务器)下瓦片栅格化明显更慢,留足等待
|
|
106
|
+
if ((map.loaded() && map.areTilesLoaded()) || performance.now() - t0 > 12000) {
|
|
106
107
|
res()
|
|
107
108
|
} else {
|
|
108
109
|
setTimeout(check, 100)
|
|
@@ -110,7 +111,7 @@ window.updateView = async function (data) { el('wrap').style.display = 'block'
|
|
|
110
111
|
}
|
|
111
112
|
setTimeout(check, 60)
|
|
112
113
|
})
|
|
113
|
-
await new Promise((r) => setTimeout(r,
|
|
114
|
+
await new Promise((r) => setTimeout(r, 220))
|
|
114
115
|
return true
|
|
115
116
|
}
|
|
116
117
|
|