calculates the required scale of the ink-view to fill the whole view

@param x circle center x
@param y circle center y
@return
421281
private float calculateScale(int x, int y) {
		final float centerX = getWidth() / 2f;
		final float centerY = getHeight() / 2f;
		final float maxDistance = (float) Math.sqrt(centerX * centerX + centerY * centerY);

		final float deltaX = centerX - x;
		final float deltaY = centerY - y;
		final float distance = (float) Math.sqrt(deltaX * deltaX + deltaY * deltaY);
		final float scale = 0.5f + (distance / maxDistance) * 0.5f;
		return scale;
	}
17060
public int pointToPosition(int x, int y) {
        Rect frame = mTouchFrame;
        if (frame == null) {
            mTouchFrame = new Rect();
            frame = mTouchFrame;
        }

        final int count = getChildCount();
        for (int i = count - 1; i >= 0; i--) {
            View child = getChildAt(i);
            if (child.getVisibility() == View.VISIBLE) {
                child.getHitRect(frame);
                if (frame.contains(x, y)) {
                    return mFirstPosition + i;
                }
            }
        }
        return INVALID_POSITION;
    }
947663
function(x, y) {
    var proj = jvm.WorldMap.maps[this.params.map].projection,
        centralMeridian = proj.centralMeridian,
        insets = jvm.WorldMap.maps[this.params.map].insets,
        i,
        inset,
        bbox,
        nx,
        ny;

    for (i = 0; i < insets.length; i++) {
      inset = insets[i];
      bbox = inset.bbox;

      nx = x - (this.transX*this.scale + inset.left*this.scale);
      ny = y - (this.transY*this.scale + inset.top*this.scale);

      nx = (nx / (inset.width * this.scale)) * (bbox[1].x - bbox[0].x) + bbox[0].x;
      ny = (ny / (inset.height * this.scale)) * (bbox[1].y - bbox[0].y) + bbox[0].y;

      if (nx > bbox[0].x && nx < bbox[1].x && ny > bbox[0].y && ny < bbox[1].y) {
        return jvm.Proj[proj.type + '_inv'](nx, -ny, centralMeridian);
      }
    }

    return false;
  }
590518
public void fillRect(int x, int y, int w, int h, Color c) {
        int color = c.getRGB();
        for (int i = x; i < x + w; i++) {
            for (int j = y; j < y + h; j++) {
                setIntColor(i, j, color);
            }
        }
    }
3564
public Coordinate viewToPan(Coordinate coordinate) {
		if (coordinate != null) {
			Vector2D position = new Vector2D(coordinate);
			double scale = mapView.getCurrentScale();
			Coordinate panOrigin = mapView.getPanOrigin();
			
			double translateX = (mapView.getViewState().getX() - panOrigin.getX()) * scale - (mapView.getWidth() / 2);
			double translateY = -(mapView.getViewState().getY() - panOrigin.getY()) * scale - (mapView.getHeight() / 2);
			position.translate(translateX , translateY);
				// TODO: implement rotation support.
			return new Coordinate(position.getX(), position.getY());
		}
		return null;
	}
234106
public static void fillWidth(double x0, double y0, double derivateX, double derivateY, double width, PlotOperator plot)
    {
        double halfWidth = width/2.0;
        if (Math.abs(derivateY) <= Double.MIN_VALUE)
        {
            drawLine((int)(x0), (int)(y0+halfWidth), (int)(x0), (int)(y0-halfWidth), plot);
        }
        else
        {
            double s = derivateX/-derivateY;
            double w2 = halfWidth*halfWidth;
            double x1 = Math.sqrt(w2/(s*s+1));
            double y1 = s*x1;
            drawLine((int)(x0+x1), (int)(y0+y1), (int)(x0-x1), (int)(y0-y1), plot);
        }
    }
744023
public int selectPoint( double x, double y ) {
        double mind = Double.POSITIVE_INFINITY;
        selection = -1;
        for( int i = 0; i < pts.size(); i++ ) {
            Coordinate coordinate = pts.get(i);

            double d = sqr(coordinate.x - x) + sqr(coordinate.y - y);
            if (d < mind && d < EPSILON) {
                mind = d;
                selection = i;
            }
        }
        return selection;
    }
549627
public SVGPath drawTo(double x, double y) {
    return !isStarted() ? moveTo(x, y) : lineTo(x, y);
  }
6516
public void vertex(double x, double y) {
        MODE = LINES;
        this.cornerX.add(x);
        this.cornerY.add(y);
        this.cornerZ.add(0d);
        setNumberOfCorner(this.cornerX.size());
        calcG();
    }
1119809
function (x, y) {
            y = typeof (y) !== "undefined" ? y : x;

            var points = this.points;
            var len = points.length;
            for (var i = 0; i < len; i++) {
                points[i].scale(x, y);
            }
            this.recalc();
            this.updateBounds();
            return this;
        }
234140
public int addPoint(double x, double y) {
		int pointIndex;

		if (this.pointCoordinates == null) {
			this.pointCoordinates = new double[] {x, y};
			this.partIndexes = null;
			pointIndex = 0;
		} else {
			double[] pts = new double[this.pointCoordinates.length + 2];
			System.arraycopy(this.pointCoordinates, 0, pts, 0, this.pointCoordinates.length);
			pointIndex = pts.length - 2;
			pts[pointIndex] = x;
			pts[pointIndex + 1] = y;
			this.pointCoordinates = pts;
			pts = null;

			pointIndex /= 2;
		}

		fireShapeChanged();
		fireElementChanged();

		return pointIndex;
	}
1003810
public Matrix3x2f scaling(float x, float y) {
        m00 = x;
        m01 = 0.0f;
        m10 = 0.0f;
        m11 = y;
        m20 = 0.0f;
        m21 = 0.0f;
        return this;
    }
1091523
public static void fillCircle(Graphics g, Point center, int diameter, Color color){
		fillCircle(g, (int) center.x, (int) center.y, diameter, color);
	}
508731
public Shape<?> findShapeAtPoint(final int x, final int y)
    {
        if (isVisible())
        {
            final SelectionLayer selection = getSelectionLayer();

            if (null != selection)
            {
                final ImageDataPixelColor rgba = selection.getContext().getImageDataPixelColor(x, y);// x,y is adjusted to canvas coordinates in event dispatch

                if (null != rgba)
                {
                    if (rgba.getA() != 255)
                    {
                        return null;
                    }
                    final Shape<?> shape = m_shape_color_map.get(rgba.toBrowserRGB());

                    if ((null != shape) && (shape.isVisible()))
                    {
                        return shape;
                    }
                }
            }
        }
        return null;
    }
1173895
@Pure
	public double doc2fxAngle(double angle) {
		final ZoomableCanvas<?> canvas = getCanvas();
		if (canvas.isInvertedAxisX() != canvas.isInvertedAxisY()) {
			return -angle;
		}
		return angle;
	}
1296159
public static void fillCircle(Graphics g, Point center, int diameter){
		fillCircle(g, (int) center.getX(), (int) center.getY(), diameter);
	}
1073295
public Surface draw (Tile tile, float x, float y) {
    return draw(tile, x, y, tile.width(), tile.height());
  }