Sha256: e46f3b2939337eb75f6752be0430dfc5a4e4035fb19f13ec79aa5f8c869b4746

Contents?: true

Size: 876 Bytes

Versions: 8

Compression:

Stored size: 876 Bytes

Contents

define(['tools'], function(Tools){
    var _ = Tools._;

    function scale(domains, ranges, _options){
        var width = Math.abs(ranges.x[1] - ranges.x[0]);
        var height = Math.abs(ranges.y[1] - ranges.y[0]);
        this.offset = {x: 0, y:0};
        this.scale = 1;
        return this;
    }

    scale.prototype.init = function(projection){
        this.projection = projection;
    };

    scale.prototype.get = function(longitude, latitude){
        var point = this.projection([longitude, latitude]);
        return {
            x: point[0]*this.scale + this.offset.x,
            y: point[1]*this.scale + this.offset.y
        };
    };

    scale.prototype.setTranslate = function(x, y){
        this.offset.x = x;
        this.offset.y = y;
    };

    scale.prototype.setScale = function(scale){
        this.scale = scale;
    };

    return scale;
});

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
nyaplot-0.1.6 lib/mapnya/js/src/components/scale.js
nyaplot-0.1.5 lib/mapnya/js/src/components/scale.js
nyaplot-0.1.4 lib/mapnya/js/src/components/scale.js
nyaplot-0.2.0.rc1 lib/mapnya/js/src/components/scale.js
nyaplot-0.1.3 lib/mapnya/js/src/components/scale.js
nyaplot-0.1.2 lib/mapnya/js/src/components/scale.js
nyaplot-0.1.1 lib/mapnya/js/src/components/scale.js
nyaplot-0.1.0 lib/mapnya/js/src/components/scale.js