~jstys-z/helioviewer.org/client5

« back to all changes in this revision

Viewing changes to lib/helioviewer/TileLayer.js

Renamed getClosestImage() "x" & "y" return values to the more intuitive "centerX" & "centerY" parameters. Limited precision of offsets to reflect highest available precision.

Show diffs side-by-side

added added

removed removed

Lines of Context:
83
83
     * @param {Boolean} zoomLevelChanged Whether or not the zoom level has been changed
84
84
     */
85
85
    reset: function (zoomLevelChanged) {
86
 
        this.scaleFactor  = this.scale / this.viewport.getImageScale();  
 
86
        this.scaleFactor  = (this.scale / this.viewport.getImageScale()).toPrecision(8);  
87
87
        
88
88
        // Update relevant dimensions
89
89
        this.relWidth  = this.width  * this.scaleFactor;
90
90
        this.relHeight = this.height * this.scaleFactor;
91
91
        
92
92
        // Offset image
93
 
        this.offsetX = ((this.width  / 2) - this.x) * this.scaleFactor;
94
 
        this.offsetY = ((this.height / 2) - this.y) * this.scaleFactor;
 
93
        this.offsetX = (((this.width  / 2) - this.centerX).toPrecision(8) * this.scaleFactor).toPrecision(8);
 
94
        this.offsetY = (((this.height / 2) - this.centerY).toPrecision(8) * this.scaleFactor).toPrecision(8);
95
95
        
96
96
        this.domNode.css({
97
97
            "left": this.offsetX,