Convert snap distance in pixels into buffer in degres, for searching around mouse It changes at each zoom change.
357761
function computeBuffer() {
            this._buffer = map.layerPointToLatLng(new L.Point(0,0)).lat -
                           map.layerPointToLatLng(new L.Point(this.options.snapDistance, 0)).lat;
        }
77844
def pixelToMap(pX, pY, geoTransform):
    
    pX = np.asarray(pX, dtype=float)
    pY = np.asarray(pY, dtype=float)
    pX += 0.5
    pY += 0.5
    mX, mY = applyGeoTransform(pX, pY, geoTransform)
    return mX, mY
26455
function(bounds, zoomChanged, dragging) {
        var display = this.visibility;
        if (!this.isBaseLayer) {
            display = display && this.inRange;
        }
        this.display(display);
    }
1177024
function(x, y) {
        var renderer = this.renderer;

        var ratio = this.downSampleRatio;
        x = Math.ceil(ratio * x);
        y = Math.ceil(ratio * (this.height - y));

        this._frameBuffer.bind(renderer);
        var pixel = new Uint8Array(4);
        var _gl = renderer.gl;
        // TODO out of bounds ?
        // preserveDrawingBuffer ?
        _gl.readPixels(x, y, 1, 1, _gl.RGBA, _gl.UNSIGNED_BYTE, pixel);
        this._frameBuffer.unbind(renderer);
        // Skip interpolated pixel because of anti alias
        if (pixel[3] === 255) {
            var id = unpackID(pixel[0], pixel[1], pixel[2]);
            if (id) {
                var el = this._lookupTable[id - this.lookupOffset];
                return el;
            }
        }
    }
1108288
def from_pixel(cls, pixel_x=0, pixel_y=0, zoom=None):
        """"""
        max_pixel = (2 ** zoom) * TILE_SIZE
        assert 0 <= pixel_x <= max_pixel, 'Point X needs to be a value between 0 and (2^zoom) * 256.'
        assert 0 <= pixel_y <= max_pixel, 'Point Y needs to be a value between 0 and (2^zoom) * 256.'
        meter_x = pixel_x * resolution(zoom) - ORIGIN_SHIFT
        meter_y = pixel_y * resolution(zoom) - ORIGIN_SHIFT
        meter_x, meter_y = cls._sign_meters(meters=(meter_x, meter_y), pixels=(pixel_x, pixel_y), zoom=zoom)
        return cls.from_meters(meter_x=meter_x, meter_y=meter_y)
1359162
function detectZoomRanges(zooms) {
    var ranges = [];
    var currentRange = [];
    for (var i = 0, z = zooms[0]; i <= zooms.length; i++, z = zooms[i]) {
        if (currentRange.length < 2) {
            currentRange.push(z);
            continue;
        }
        if (currentRange.length === 2) {
            if (z === currentRange[1] + 1) {
                currentRange[1] = z;
            } else {
                ranges.push(currentRange);
                currentRange = [];
            }
        }
    }
    if (currentRange.length > 0) {
        ranges.push(currentRange);
    }
    return ranges;
}
995228
function fpsToPoint(index, fps_val, min, delta) {
            return [
                canvas_w - index,
                canvas_h - canvas_h * (fps_val - min) / delta
            ];
        }
534423
function() {
				that.debug.groupStart( 'mouseNear' ); // %REMOVE_LINE%

				updateSize( that, this );
				var offset = that.holdDistance,
					size = this.size;

				// Determine neighborhood by element dimensions and offsets.
				if ( size && inBetween( that.mouse.y, size.top - offset, size.bottom + offset ) && inBetween( that.mouse.x, size.left - offset, size.right + offset ) ) {
					that.debug.logEnd( 'Mouse is near.' ); // %REMOVE_LINE%
					return true;
				}

				that.debug.logEnd( 'Mouse isn\'t near.' ); // %REMOVE_LINE%
				return false;
			}
153301
def convertPixelXYToLngLat(self, pixelX, pixelY, level):
        '''
        
        '''
        mapSize = self.getMapDimensionsByZoomLevel(level)
        x = (self.clipValue(pixelX, 0, mapSize - 1) / mapSize) - 0.5
        y = 0.5 - (self.clipValue(pixelY, 0, mapSize - 1) / mapSize)

        lat = 90 - 360 * math.atan(math.exp(-y * 2 * math.pi)) / math.pi
        lng = 360 * x

        return (lng, lat)
523973
public int[] MetersToTile( double mx, double my, int zoom ) {
        int[] p = MetersToPixels(mx, my, zoom);
        return PixelsToTile(p[0], p[1]);
    }
1056327
def on_change_high_mouse_cursor(self, event):
        
        if self.ie_open and self.ie.show_box.GetValue() != "specimens":
            return
        pos = event.GetPosition()
        width, height = self.canvas4.get_width_height()
        pos[1] = height - pos[1]
        xpick_data, ypick_data = pos
        xdata_org = self.high_EA_xdata
        ydata_org = self.high_EA_ydata
        data_corrected = self.high_level_eqarea.transData.transform(
            vstack([xdata_org, ydata_org]).T)
        xdata, ydata = data_corrected.T
        xdata = list(map(float, xdata))
        ydata = list(map(float, ydata))
        e = 4e0

        if self.high_EA_setting == "Zoom":
            self.canvas4.SetCursor(wx.Cursor(wx.CURSOR_CROSS))
        else:
            self.canvas4.SetCursor(wx.Cursor(wx.CURSOR_ARROW))
        if not self.high_EA_xdata or not self.high_EA_ydata:
            return
        for i, (x, y) in enumerate(zip(xdata, ydata)):
            if 0 < sqrt((x-xpick_data)**2. + (y-ypick_data)**2.) < e:
                self.canvas4.SetCursor(wx.Cursor(wx.CURSOR_HAND))
                break
        event.Skip()
793088
def cropped(self, t0, t1):
        """"""
        return Line(self.point(t0), self.point(t1))
1374560
public double[] PixelsToMeters( double px, double py, int zoom ) {
        double res = Resolution(zoom);
        double mx = px * res - originShift;
        double my = py * res - originShift;
        return new double[]{mx, my};
    }
1132770
def affine(self, pixelbuffer=0):
        
        return Affine(
            self.pixel_x_size,
            0,
            self.bounds(pixelbuffer).left,
            0,
            -self.pixel_y_size,
            self.bounds(pixelbuffer).top
        )
1370051
function (event) {
            var delta = Math.max(-1, Math.min(1, (event.wheelDelta || -event.detail)));
            var zoom = 0;

            if (delta < 0 && this._zoomLevel < this._zoomMax) {
                // Zoom in
                zoom = this._zoomLevel < 1 ? 0.01 : 0.03;
            }
            else if (delta > 0 && this._zoomLevel > this._zoomMin) {
                // Zoom out
                zoom = this._zoomLevel < 1 ? -0.01 : -0.03;
            }
            else {
                return;
            }

            // Calculate middle point change for zoom change
            var x = ((this._image.w / 2) + this._image.x) * zoom;
            var y = ((this._image.h / 2) + this._image.y) * zoom;

            // Adjust zoom
            this._zoomLevel += zoom;

            // Then move back to old middle point
            this._image.move({
              x: -x / this._zoomLevel,
              y: -y / this._zoomLevel
            });

            this.redraw();
        }
1091898
def Y_tighter(self):
        """"""
        self.parent.value('y_distance', self.parent.value('y_distance') / 1.4)
        self.parent.traces.display()
1254673
def zoom_in_pixel(self, curr_pixel):
        
        low_frag = curr_pixel[0]
        high_frag = curr_pixel[1]
        level = curr_pixel[2]
        if level > 0:
            str_level = str(level)
            low_sub_low = self.spec_level[str_level]["fragments_dict"][
                low_frag
            ]["sub_low_index"]
            low_sub_high = self.spec_level[str_level]["fragments_dict"][
                low_frag
            ]["sub_high_index"]
            high_sub_low = self.spec_level[str_level]["fragments_dict"][
                high_frag
            ]["sub_low_index"]
            high_sub_high = self.spec_level[str_level]["fragments_dict"][
                high_frag
            ]["sub_high_index"]
            vect = [low_sub_low, low_sub_high, high_sub_low, high_sub_high]
            new_pix_low = min(vect)
            new_pix_high = max(vect)
            new_level = level - 1
            new_pixel = [new_pix_low, new_pix_high, new_level]
        else:
            new_pixel = curr_pixel
        return new_pixel