src/layer/L.CanvasLayer.ScalarField.js
function() {
        const bounds = this._pixelBounds();
        const pixelSize = (bounds.max.x - bounds.min.x) / this._field.nCols;

        var stride = Math.max(
            1,
            Math.floor(1.2 * this.options.vectorSize / pixelSize)
        );

        const ctx = this._getDrawingContext();
        ctx.strokeStyle = this.options.color;

        var currentBounds = this._map.getBounds();

        for (var y = 0; y < this._field.height; y = y + stride) {
            for (var x = 0; x < this._field.width; x = x + stride) {
                let [lon, lat] = this._field._lonLatAtIndexes(x, y);
                let v = this._field.valueAt(lon, lat);
                let center = L.latLng(lat, lon);
                if (v !== null && currentBounds.contains(center)) {
                    let cell = new Cell(
                        center,
                        v,
                        this.cellXSize,
                        this.cellYSize
                    );
                    this._drawArrow(cell, ctx);
                }
            }
        }
    }
function() {
        const bounds = this._pixelBounds();
        const pixelSize = (bounds.max.x - bounds.min.x) / this._field.nCols;

        var stride = Math.max(
            1,
            Math.floor(1.2 * this.options.vectorSize / pixelSize)
        );

        const ctx = this._getDrawingContext();
        ctx.strokeStyle = this.options.color;

        var currentBounds = this._map.getBounds();

        for (var y = 0; y < this._field.height; y = y + stride) {
            for (var x = 0; x < this._field.width; x = x + stride) {
                let [lon, lat] = this._field._lonLatAtIndexes(x, y);
                let v = this._field.valueAt(lon, lat);
                let center = L.latLng(lat, lon);
                if (v !== null && currentBounds.contains(center)) {
                    let cell = new Cell(
                        center,
                        v,
                        this.cellXSize,
                        this.cellYSize
                    );
                    this._drawArrow(cell, ctx);
                }
            }
        }
    }
function ( ) { const bounds = this . _pixelBounds ( ) ; const pixelSize = ( bounds . max . x - bounds . min . x ) / this . _field . nCols ; var stride = Math . max ( 1 , Math . floor ( 1.2 * this . options . vectorSize / pixelSize ) ) ; const ctx = this . _getDrawingContext ( ) ; ctx . strokeStyle = this . options . color ; var currentBounds = this . _map . getBounds ( ) ; for ( var y = 0 ; y < this . _field . height ; y = y + stride ) { for ( var x = 0 ; x < this . _field . width ; x = x + stride ) { let [ lon , lat ] = this . _field . _lonLatAtIndexes ( x , y ) ; let v = this . _field . valueAt ( lon , lat ) ; let center = L . latLng ( lat , lon ) ; if ( v !== null && currentBounds . contains ( center ) ) { let cell = new Cell ( center , v , this . cellXSize , this . cellYSize ) ; this . _drawArrow ( cell , ctx ) ; } } } }
Draws the field as a set of arrows. Direction from 0 to 360 is assumed.
Draws the field as a set of arrows . Direction from 0 to 360 is assumed .