mirror of
https://github.com/a-nyx/maputnik-with-pmtiles.git
synced 2024-12-28 16:41:17 +01:00
Fixed undo/redo
This commit is contained in:
parent
f09cc25a3b
commit
3e2927e6a4
1 changed files with 16 additions and 3 deletions
|
@ -370,12 +370,23 @@ export default class App extends React.Component {
|
||||||
}
|
}
|
||||||
|
|
||||||
onUndo = () => {
|
onUndo = () => {
|
||||||
const activeStyle = this.revisionStore.undo()
|
let activeStyle;
|
||||||
|
|
||||||
|
// Check our dirty style state first, otherwise just undo to that state.
|
||||||
|
if (isEqual(this.state.mapStyle, this.state.hopefulMapStyle)) {
|
||||||
|
activeStyle = this.revisionStore.undo()
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
activeStyle = this.state.mapStyle;
|
||||||
|
}
|
||||||
|
|
||||||
const messages = undoMessages(this.state.hopefulMapStyle, activeStyle)
|
const messages = undoMessages(this.state.hopefulMapStyle, activeStyle)
|
||||||
this.saveStyle(activeStyle)
|
this.saveStyle(activeStyle)
|
||||||
this.setState({
|
this.setState({
|
||||||
mapStyle: activeStyle,
|
|
||||||
infos: messages,
|
infos: messages,
|
||||||
|
mapStyle: activeStyle,
|
||||||
|
hopefulMapStyle: activeStyle,
|
||||||
|
errors: [],
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -384,8 +395,10 @@ export default class App extends React.Component {
|
||||||
const messages = redoMessages(this.state.hopefulMapStyle, activeStyle)
|
const messages = redoMessages(this.state.hopefulMapStyle, activeStyle)
|
||||||
this.saveStyle(activeStyle)
|
this.saveStyle(activeStyle)
|
||||||
this.setState({
|
this.setState({
|
||||||
mapStyle: activeStyle,
|
|
||||||
infos: messages,
|
infos: messages,
|
||||||
|
mapStyle: activeStyle,
|
||||||
|
hopefulMapStyle: activeStyle,
|
||||||
|
errors: [],
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue