p.set(p.x, p.y + offset);
Point mappoint = googleMap.getProjection().toScreenLocation(new LatLng(latitude, longitude)); mappoint.set(mappoint.x, mappoint.y-30); googleMap.animateCamera(CameraUpdateFactory.newLatLng(googleMap.getProjection().fromScreenLocation(mappoint)));
@Override public void onProvideShadowMetrics(Point shadowSize, Point shadowTouchPoint) { super.onProvideShadowMetrics(shadowSize, shadowTouchPoint); shadowTouchPoint.set(touchPointXCoord, touchPointYCoord); }
/** * Constructs a point at the specified coordinates. */ public Point (float x, float y) { set(x, y); }
public void onProvideShadowMetrics(Point shadowSize, Point shadowTouchPoint) { final View view = mView.get(); if (view != null) { shadowSize.set(view.getWidth(), view.getHeight()); shadowTouchPoint.set(shadowSize.x / 2, shadowSize.y / 2); } else { Log.e(View.VIEW_LOG_TAG, "Asked for drag thumb metrics but no view"); } }
public static Point localPos (Position ev, Point dest) { dest.set(ev.localX(), ev.localY()); return dest; } }
private Point queryCursorPosition () { xpos.rewind(); ypos.rewind(); glfwGetCursorPos(window, xpos, ypos); cpos.set((float)xpos.get(), (float)ypos.get()); return cpos; }
/** Inverse transforms a point as specified, storing the result in the point provided. * @return a reference to the result point, for chaining. */ public static Point inverseTransform (float x, float y, float sx, float sy, float rotation, float tx, float ty, Point result) { x -= tx; y -= ty; // untranslate float sinnega = FloatMath.sin(-rotation), cosnega = FloatMath.cos(-rotation); float nx = (x * cosnega - y * sinnega); // unrotate float ny = (x * sinnega + y * cosnega); return result.set(nx / sx, ny / sy); // unscale }
/** * Constructs a point with coordinates equal to the supplied point. */ public Point (XY p) { set(p.x(), p.y()); }
private void dispatchSolo (Event event) { Layer hitLayer = LayerUtil.getHitLayer(root, scratch.set(event.x, event.y)); if (hitLayer != null) new Interaction(hitLayer, bubble, true).dispatch(event); } }
@Override public void onEmit (Event event) { // start a new interaction on START, if we don't already have one if (currentIact == null && event.kind.isStart) { Layer hitLayer = LayerUtil.getHitLayer(root, scratch.set(event.x, event.y)); if (hitLayer != null) currentIact = new Interaction(hitLayer, bubble); } // dispatch the event to the interaction if (currentIact != null) currentIact.dispatch(event); // if this is END or CANCEL, clear out the current interaction if (event.kind.isEnd) currentIact = null; } }
@Override // from Transform public Point inverseTransform (IPoint p, Point into) { float x = p.x() - tx, y = p.y() - ty; float det = m00 * m11 - m01 * m10; if (Math.abs(det) == 0f) { // determinant is zero; matrix is not invertible throw new NoninvertibleTransformException(this.toString()); } float rdet = 1 / det; return into.set((x * m11 - y * m10) * rdet, (y * m00 - x * m01) * rdet); }
/** * Converts the supplied point from coordinates relative to its parent * to coordinates relative to the specified layer. The results are stored * into {@code into}, which is returned for convenience. */ public static Point parentToLayer(Layer layer, XY point, Point into) { layer.transform().inverseTransform(into.set(point), into); into.x += layer.originX(); into.y += layer.originY(); return into; }
@Override // from IPoint public Point rotate (float angle, Point result) { float x = x(), y = y(); float sina = FloatMath.sin(angle), cosa = FloatMath.cos(angle); return result.set(x*cosa - y*sina, x*sina + y*cosa); }
@Override public Point inverseTransform(IPoint p, Point into) { float m00 = m00(), m01 = m01(), m10 = m10(), m11 = m11(); float x = p.x() - tx(), y = p.y() - ty(); float det = m00 * m11 - m01 * m10; if (Math.abs(det) == 0f) { // determinant is zero; matrix is not invertible throw new NoninvertibleTransformException(this.toString()); } float rdet = 1 / det; return into.set((x * m11 - y * m10) * rdet, (y * m00 - x * m01) * rdet); }
@Override public Point transform(IPoint p, Point into) { float x = p.x(), y = p.y(); return into.set(m00() * x + m10() * y + tx(), m01() * x + m11() * y + ty()); }
@Override // from interface IArc public Point startPoint (Point target) { float a = FloatMath.toRadians(angleStart()); return target.set(x() + (1f + FloatMath.cos(a)) * width() / 2f, y() + (1f - FloatMath.sin(a)) * height() / 2f); }
/** * Computes the point inside the bounds of the rectangle that's closest to the given point, * writing the result into {@code out}. * @return {@code out} for call chaining convenience. */ public static Point closestInteriorPoint (IRectangle r, IPoint p, Point out) { out.set(MathUtil.clamp(p.x(), r.minX(), r.maxX()), MathUtil.clamp(p.y(), r.minY(), r.maxY())); return out; }
@Override // from interface IArc public Point endPoint (Point target) { float a = FloatMath.toRadians(angleStart() + angleExtent()); return target.set(x() + (1f + FloatMath.cos(a)) * width() / 2f, y() + (1f - FloatMath.sin(a)) * height() / 2f); }