Compare commits
No commits in common. "a2fa16949ad10d096a361a53bc3bb49a5af5e0cb" and "d7fe7609000cab22d8ba0552fcc736d7b227c537" have entirely different histories.
a2fa16949a
...
d7fe760900
3 changed files with 9 additions and 24 deletions
|
@ -124,7 +124,7 @@ Canvas {
|
||||||
\qmlproperty int LogGraphCanvas::maxgradx
|
\qmlproperty int LogGraphCanvas::maxgradx
|
||||||
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.
|
||||||
*/
|
*/
|
||||||
property int maxgradx: 90
|
property int maxgradx: 20
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
\qmlproperty var LogGraphCanvas::imageLoaders
|
\qmlproperty var LogGraphCanvas::imageLoaders
|
||||||
|
|
|
@ -94,13 +94,9 @@ Item {
|
||||||
property int positionChangeTimer: 0
|
property int positionChangeTimer: 0
|
||||||
|
|
||||||
function updatePosition(deltaX, deltaY) {
|
function updatePosition(deltaX, deltaY) {
|
||||||
const unauthorized = [NaN, Infinity, -Infinity]
|
settingsInstance.xmin = (Modules.Canvas.px2x(Modules.Canvas.x2px(settingsInstance.xmin)-deltaX))
|
||||||
const xmin = (Modules.Canvas.px2x(Modules.Canvas.x2px(settingsInstance.xmin)-deltaX))
|
settingsInstance.ymax += deltaY/canvas.yzoom
|
||||||
const ymax = settingsInstance.ymax + deltaY/canvas.yzoom
|
settingsInstance.ymax = settingsInstance.ymax.toFixed(4)
|
||||||
if(!unauthorized.includes(xmin))
|
|
||||||
settingsInstance.xmin = xmin
|
|
||||||
if(!unauthorized.includes(ymax))
|
|
||||||
settingsInstance.ymax = ymax.toFixed(4)
|
|
||||||
settingsInstance.changed()
|
settingsInstance.changed()
|
||||||
parent.positionChanged(deltaX, deltaY)
|
parent.positionChanged(deltaX, deltaY)
|
||||||
|
|
||||||
|
@ -144,15 +140,12 @@ Item {
|
||||||
}
|
}
|
||||||
let newXZoom = (settingsInstance.xzoom+xZoomDelta).toFixed(0)
|
let newXZoom = (settingsInstance.xzoom+xZoomDelta).toFixed(0)
|
||||||
let newYZoom = (settingsInstance.yzoom+yZoomDelta).toFixed(0)
|
let newYZoom = (settingsInstance.yzoom+yZoomDelta).toFixed(0)
|
||||||
// Check if we need to have more precision
|
if(newXZoom == settingsInstance.xzoom) // No change, allow more precision.
|
||||||
if(newXZoom < 10)
|
|
||||||
newXZoom = (settingsInstance.xzoom+xZoomDelta).toFixed(4)
|
newXZoom = (settingsInstance.xzoom+xZoomDelta).toFixed(4)
|
||||||
if(newYZoom < 10)
|
if(newYZoom == settingsInstance.yzoom) // No change, allow more precision.
|
||||||
newYZoom = (settingsInstance.yzoom+yZoomDelta).toFixed(4)
|
newYZoom = (settingsInstance.yzoom+yZoomDelta).toFixed(4)
|
||||||
if(newXZoom > 0.5)
|
settingsInstance.xzoom = newXZoom
|
||||||
settingsInstance.xzoom = newXZoom
|
settingsInstance.yzoom = newYZoom
|
||||||
if(newYZoom > 0.5)
|
|
||||||
settingsInstance.yzoom = newYZoom
|
|
||||||
settingsInstance.changed()
|
settingsInstance.changed()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -139,15 +139,7 @@ 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() {
|
get maxgradx() { return this._canvas.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
|
||||||
|
|
Loading…
Reference in a new issue