Upping logarithmic graduation limit to 309 (maximum before Infinity, probably some dragons to be had there)

This commit is contained in:
Adsooi 2024-09-17 01:35:47 +02:00
parent d7fe760900
commit 91e4220397
Signed by: Ad5001
GPG key ID: EF45F9C6AFE20160
2 changed files with 10 additions and 8 deletions

View file

@ -120,12 +120,6 @@ Canvas {
*/ */
property bool showygrad: false property bool showygrad: false
/*!
\qmlproperty int LogGraphCanvas::maxgradx
Max power of the logarithmic scaled on the x axis in logarithmic mode.
*/
property int maxgradx: 20
/*! /*!
\qmlproperty var LogGraphCanvas::imageLoaders \qmlproperty var LogGraphCanvas::imageLoaders
Dictionary of format {image: [callback.image data]} containing data for defered image loading. Dictionary of format {image: [callback.image data]} containing data for defered image loading.

View file

@ -17,7 +17,7 @@
*/ */
import { Module } from "./modules.mjs" import { Module } from "./modules.mjs"
import { textsup } from "./utils.mjs" import { textsup, roundAwayFromZero } from "./utils.mjs"
import { Expression } from "./mathlib.mjs" import { Expression } from "./mathlib.mjs"
import Latex from "./math/latex.mjs" import Latex from "./math/latex.mjs"
@ -139,7 +139,15 @@ class CanvasAPI extends Module {
* Max power of the logarithmic scaled on the x axis in logarithmic mode. * Max power of the logarithmic scaled on the x axis in logarithmic mode.
* @returns {number} * @returns {number}
*/ */
get maxgradx() { return this._canvas.maxgradx } get maxgradx() {
return Math.min(
309, // 10e309 = Infinity (beyond this land be dragons)
Math.max(
Math.ceil(Math.abs(Math.log10(this.xmin))),
Math.ceil(Math.abs(Math.log10(this.px2x(this.width))))
)
)
}
// //
// Methods to draw the canvas // Methods to draw the canvas