@Override public void onDrag (Pointer.Interaction iact) { _prev.set(_cur); _prevStamp = _curStamp; getPosition(iact, _cur); _curStamp = iact.event.time; float dx = _cur.x - _start.x, dy = _cur.y - _start.y; setPosition(_origPos.x + dx, _origPos.y + dy); _maxDeltaSq = Math.max(dx * dx + dy * dy, _maxDeltaSq); // for the purposes of capturing the event stream, dx and dy are capped by their ranges dx = _position.x - _origPos.x; dy = _position.y - _origPos.y; if (dx * dx + dy * dy >= maxClickDeltaSq()) iact.capture(); }
@Override public void onDrag (Pointer.Interaction iact) { if (start == 0) return; // ignore if we were disabled at gesture start float frac = updateFracs(iact.event.x, iact.event.y); if (!untransing) { // if the beginning of the gesture is not "more" in the untrans direction than not, // ignore the rest the interaction (note: _offFrac is always positive but frac is // positive if it's in the untrans direction and negative otherwise) if (_offFrac > frac) { start = 0; return; } // TODO: we should probably ignore small movements in all directions before we // commit to this gesture or not; if someone always jerks their finger to the right // before beginning an interaction, that would always disable an up or down gesture // before it ever had a chance to get started... oh, humans // the first time we start untransing, do _udir.init() & setViz untransing = true; _target = _prev; _target.screen.setActive(true); _udir.init(_cur.screen, _prev.screen); iact.capture(); } _udir.update(_cur.screen, _prev.screen, frac); _transPct = frac; }
public void onStart (Pointer.Interaction iact) { iact.capture(); } });
/** * A method called as soon as the minimum flick distance is exceeded. * @param iact the pointer interaction being processed at the time we detected this state. */ protected void minFlickExceeded (Pointer.Interaction iact) { iact.capture(); // capture the interaction by default }
@Override public void onPress (Pointer.Interaction iact) { super.onPress(iact); iact.capture(); _conn = _owner.root().iface.frame.connect(new Slot<Clock>() { public void onEmit (Clock clock) { update(clock); } }); }
@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; } }