mirror of
https://github.com/ToolJet/ToolJet
synced 2026-05-24 09:28:31 +00:00
Typecasting Float to Integer and back to avoid floating point precision errors (#423)
https://stackoverflow.com/questions/3439040/why-does-adding-two-decimals-in-javascript-produce-a-wrong-result https://stackoverflow.com/questions/1458633/how-to-deal-with-floating-point-number-precision-in-javascript Co-authored-by: xrimpy <=>
This commit is contained in:
parent
cc4f97ca88
commit
d35b2032bc
1 changed files with 6 additions and 6 deletions
|
|
@ -433,8 +433,8 @@ class Editor extends React.Component {
|
||||||
this.setState({ showQuerySearchField: !this.state.showQuerySearchField });
|
this.setState({ showQuerySearchField: !this.state.showQuerySearchField });
|
||||||
}
|
}
|
||||||
|
|
||||||
onVersionDeploy = (versionId) => {
|
onVersionDeploy = (versionId) => {
|
||||||
this.setState({ app: {
|
this.setState({ app: {
|
||||||
...this.state.app,
|
...this.state.app,
|
||||||
current_version_id: versionId
|
current_version_id: versionId
|
||||||
}})
|
}})
|
||||||
|
|
@ -535,7 +535,7 @@ class Editor extends React.Component {
|
||||||
<div className="canvas-buttons">
|
<div className="canvas-buttons">
|
||||||
<button
|
<button
|
||||||
className="btn btn-light mx-2"
|
className="btn btn-light mx-2"
|
||||||
onClick={() => this.setState({ zoomLevel: zoomLevel - 0.1 })}
|
onClick={() => this.setState({ zoomLevel: ((Math.round(zoomLevel*10) - 1)/10).toFixed(1) }) }
|
||||||
disabled={zoomLevel <= 0.6}
|
disabled={zoomLevel <= 0.6}
|
||||||
role="button"
|
role="button"
|
||||||
>
|
>
|
||||||
|
|
@ -544,8 +544,8 @@ class Editor extends React.Component {
|
||||||
<small>{zoomLevel * 100}%</small>
|
<small>{zoomLevel * 100}%</small>
|
||||||
<button
|
<button
|
||||||
className="btn btn-light mx-2"
|
className="btn btn-light mx-2"
|
||||||
onClick={() => this.setState({ zoomLevel: zoomLevel + 0.1 })}
|
onClick={() => this.setState({ zoomLevel: ((Math.round(zoomLevel*10) + 1)/10).toFixed(1) }) }
|
||||||
disabled={zoomLevel === 1}
|
disabled={zoomLevel >= 1.0}
|
||||||
role="button"
|
role="button"
|
||||||
>
|
>
|
||||||
<img src="/assets/images/icons/zoom-in.svg" width="12" height="12" />
|
<img src="/assets/images/icons/zoom-in.svg" width="12" height="12" />
|
||||||
|
|
@ -863,7 +863,7 @@ class Editor extends React.Component {
|
||||||
<div className="editor-sidebar">
|
<div className="editor-sidebar">
|
||||||
<div className="col-md-12">
|
<div className="col-md-12">
|
||||||
<div>
|
<div>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue