p.set(p.x, p.y + offset);
public void onEmit (Keyboard.Event event) { if (event instanceof Keyboard.KeyEvent) { Keyboard.KeyEvent kevent = (Keyboard.KeyEvent)event; if (kevent.key == pivotKey && kevent.down) { pivot = new Point(x, y); } } } });
protected float axisDistance (Point start, Point end) { if (start == null || end == null) return 0; float value; if (_direction == Direction.UP || _direction == Direction.DOWN) value = end.y() - start.y(); else value = end.x() - start.x(); return _axisSwipe ? Math.abs(value) : value * _directionModifier; }
@Override public void onEnd (Pointer.Interaction iact) { // just dispatch a click if the pointer didn't move very far if (_maxDeltaSq < maxClickDeltaSq()) { clicked.emit(iact.event); return; } // if not, maybe impart some velocity float dragTime = (float)(iact.event.time - _prevStamp); if (dragTime > 0) { Point delta = new Point(_cur.x - _prev.x, _cur.y - _prev.y); Point dragVel = delta.mult(1 / dragTime); float dragSpeed = dragVel.distance(0, 0); if (dragSpeed > maxFlickSpeed) { dragVel.multLocal(maxFlickSpeed / dragSpeed); dragSpeed = maxFlickSpeed; } _vel.set(dragVel); _vel.multLocal(flickXfer); float sx = Math.signum(_vel.x), sy = Math.signum(_vel.y); _accel.x = -sx * friction; _accel.y = -sy * friction; } }
/** Multiplies this point by a scale factor. * @return a a reference to this point, for chaining. */ public Point multLocal (float s) { return mult(s, this); }
/** Multiplies this point by a scale factor. * @return a a reference to this point, for chaining. */ public Point multLocal (float s) { return mult(s, this); }
Point mappoint = googleMap.getProjection().toScreenLocation(new LatLng(latitude, longitude)); mappoint.set(mappoint.x, mappoint.y-30); googleMap.animateCamera(CameraUpdateFactory.newLatLng(googleMap.getProjection().fromScreenLocation(mappoint)));
public void onEmit (Keyboard.Event event) { if (event instanceof Keyboard.KeyEvent) { Keyboard.KeyEvent kevent = (Keyboard.KeyEvent)event; if (kevent.key == pivotKey && kevent.down) { pivot = new Point(x, y); } } } });
@Override // from IPoint public Point clone () { return new Point(this); }
public double distanceFrom(Point other){ double distance = 0.0; double dx = Math.abs(other.x() - this.x()); double dy = Math.abs(other.y() - this.y()); if (dx > dy) { double ratio = dy/dx; distance = dx*Math.sqrt(1.0+ratio*ratio); } else { double ratio = dx/dy; distance = dy*Math.sqrt(1.+ratio*ratio); } return distance; }
@Override public void onProvideShadowMetrics(Point shadowSize, Point shadowTouchPoint) { super.onProvideShadowMetrics(shadowSize, shadowTouchPoint); shadowTouchPoint.set(touchPointXCoord, touchPointYCoord); }
/** * Sets the left and top of the view area relative to that of the content the next time the * container is laid out. This is needed if the caller invalidates the content and needs * to then set a scroll position which may be out of range for the old size. */ public void queueScroll (float x, float y) { _queuedScroll = new Point(x, y); }
/** * Constructs a point at the specified coordinates. */ public Point (float x, float y) { set(x, y); }
/** Creates a new event and initializes {@link #trigger} and {@link #menu}. */ public Pop (Element<?> trigger, Menu menu, Event.XY pointer) { if (menu == null) throw new IllegalArgumentException(); this.menu = menu; this.trigger = trigger; this.pointer = pointer == null ? null : new Point(pointer); }
/** * Returns true if a coordinate on the screen touches a {@link Layer.HasSize}. */ public static boolean hitTest(Layer.HasSize layer, float x, float y) { Point point = screenToLayer(layer, x, y); return ( point.x() >= 0 && point.y() >= 0 && point.x() <= layer.width() && point.y() <= layer.height()); }
/** * Converts an event to coordinates consumed by {@link #onTrack}. By default, simply uses * the local x, y. */ protected void toPoint (Pointer.Interaction iact, Point dest) { dest.set(iact.local.x, iact.local.y); }
public TextureData (DataInputStream istream) throws IOException { symbol = istream.readUTF(); origin = new Point(istream.readFloat(), istream.readFloat()); rect = new float[] { istream.readFloat(), istream.readFloat(), istream.readFloat(), istream.readFloat() }; }