forked from zhouruizhe/gmTouringMiniApp
fix(map): 收敛 regionchange 回写回路,修复选中标点后地图抽动
AI Code Review / review (pull_request) Successful in 2m11s
AI Code Review / review (pull_request) Successful in 2m11s
选中标点后地图在左右/上下反复抽动,根因是视口回写形成了自激回路: map 的 longitude/latitude/scale 绑定到 store,而 regionchange 又无条件把 地图当前中心点写回 store —— 写 store 触发地图移动,移动结束回传一个 「差一点点」的中心点,再写回,再移动。上一个提交把中心点改成从 detail.centerLocation 同步读取后,回路里原本靠 getCenterLocation 异步跳变 掩盖住的这一点噪声就直接闭合了。 两道闸: - 只接受手势造成的变化。causedBy 为 update(我们自己改绑定值或调 includePoints 触发)时 store 已是权威值,不回写。老基础库拿不到 causedBy 时退化到下一道闸。 - 所有回写走 commitViewport,经 isSignificantViewportChange 过滤掉小于 1e-4 度 / 0.01 级的变化。远小于任何一次真实拖动,足以吸收量化噪声。 顺带修一个 H5 构建回归(1bcdd40 引入):uni 的 H5 路由生成器按路径推导 组件标识,pages/poi/detail 与 pages-poi/detail 都归一成 PagesPoiDetail, 重复声明导致 build:h5 失败。兼容跳板必须留在旧路径上,所以改名分包路由 pages-poi/detail -> pages-poi/poi-detail。
This commit is contained in:
@@ -19,8 +19,10 @@ const expectedPages = [
|
||||
// 点位详情页放在 pages-poi 分包里,连带 800×600 大图一起按需下载,
|
||||
// 否则 30 张大图会把主包顶过 2 MB 上限。
|
||||
const expectedSubPackageRoot = 'pages-poi'
|
||||
const expectedSubPackagePages = ['detail']
|
||||
const poiDetailPath = `${expectedSubPackageRoot}/detail`
|
||||
// 分包页文件名不能是 detail:uni 的 H5 路由表按路径生成组件标识,`pages-poi/detail`
|
||||
// 和上面兼容跳板的 `pages/poi/detail` 会同时归一化成 PagesPoiDetail,重复声明直接编译失败。
|
||||
const expectedSubPackagePages = ['poi-detail']
|
||||
const poiDetailPath = `${expectedSubPackageRoot}/poi-detail`
|
||||
const expectedTabPages = [
|
||||
'pages/map/index',
|
||||
'pages/assistant/index',
|
||||
|
||||
Reference in New Issue
Block a user