Compare commits

..

No commits in common. "a2fa16949ad10d096a361a53bc3bb49a5af5e0cb" and "d7fe7609000cab22d8ba0552fcc736d7b227c537" have entirely different histories.

3 changed files with 9 additions and 24 deletions

View file

@ -124,7 +124,7 @@ Canvas {
\qmlproperty int LogGraphCanvas::maxgradx
Max power of the logarithmic scaled on the x axis in logarithmic mode.
*/
property int maxgradx: 90
property int maxgradx: 20
/*!
\qmlproperty var LogGraphCanvas::imageLoaders

View file

@ -94,13 +94,9 @@ Item {
property int positionChangeTimer: 0
function updatePosition(deltaX, deltaY) {
const unauthorized = [NaN, Infinity, -Infinity]
const xmin = (Modules.Canvas.px2x(Modules.Canvas.x2px(settingsInstance.xmin)-deltaX))
const ymax = settingsInstance.ymax + deltaY/canvas.yzoom
if(!unauthorized.includes(xmin))
settingsInstance.xmin = xmin
if(!unauthorized.includes(ymax))
settingsInstance.ymax = ymax.toFixed(4)
settingsInstance.xmin = (Modules.Canvas.px2x(Modules.Canvas.x2px(settingsInstance.xmin)-deltaX))
settingsInstance.ymax += deltaY/canvas.yzoom
settingsInstance.ymax = settingsInstance.ymax.toFixed(4)
settingsInstance.changed()
parent.positionChanged(deltaX, deltaY)
@ -144,14 +140,11 @@ Item {
}
let newXZoom = (settingsInstance.xzoom+xZoomDelta).toFixed(0)
let newYZoom = (settingsInstance.yzoom+yZoomDelta).toFixed(0)
// Check if we need to have more precision
if(newXZoom < 10)
if(newXZoom == settingsInstance.xzoom) // No change, allow more precision.
newXZoom = (settingsInstance.xzoom+xZoomDelta).toFixed(4)
if(newYZoom < 10)
if(newYZoom == settingsInstance.yzoom) // No change, allow more precision.
newYZoom = (settingsInstance.yzoom+yZoomDelta).toFixed(4)
if(newXZoom > 0.5)
settingsInstance.xzoom = newXZoom
if(newYZoom > 0.5)
settingsInstance.yzoom = newYZoom
settingsInstance.changed()
}

View file

@ -139,15 +139,7 @@ class CanvasAPI extends Module {
* Max power of the logarithmic scaled on the x axis in logarithmic mode.
* @returns {number}
*/
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))))
)
)
}
get maxgradx() { return this._canvas.maxgradx }
//
// Methods to draw the canvas