Skip to content

Commit

Permalink
fix chart may not update after the map is resized
Browse files Browse the repository at this point in the history
  • Loading branch information
plainheart committed Jan 7, 2024
1 parent 402f622 commit 44423c8
Showing 1 changed file with 9 additions and 6 deletions.
15 changes: 9 additions & 6 deletions src/AMapView.js
Original file line number Diff line number Diff line change
Expand Up @@ -150,8 +150,9 @@ const AMapView = {
}

if (resizeEnable) {
let resizeHandler = function() {
getInstanceByDom(api.getDom()).resize()
let resizeHandler = () => {
clearTimeout(this._resizeTimeout)
this._resizeTimeout = setTimeout(() => getInstanceByDom(api.getDom()).resize(), 0)
}
if (!_isAMap2X && largeMode) {
resizeHandler = throttle(resizeHandler, 20, true)
Expand All @@ -163,6 +164,7 @@ const AMapView = {
},

dispose() {
clearTimeout(this._resizeTimeout)
clearLogMap()
const component = this.__model
if (component) {
Expand All @@ -173,11 +175,12 @@ const AMapView = {
component.coordinateSystem.setAMap(null)
component.coordinateSystem = null
}
delete this._moveHandler
delete this._resizeHandler
delete this._moveStartHandler
delete this._moveEndHandler
}
delete this._moveHandler
delete this._moveStartHandler
delete this._moveEndHandler
delete this._resizeHandler
delete this._resizeTimeout
}
}

Expand Down

0 comments on commit 44423c8

Please sign in to comment.