void TimelineIndicator::mouseDrag (const MouseEvent& ev) { if (! dragable()) return; Rectangle<int> r (getBoundsInParent()); dragger.dragComponent (this, ev, nullptr); int snap = shouldSnap ? timeline()->pixelSnap (getBoundsInParent().getX()) : getBoundsInParent().getX(); setBounds (r); // reset it back to normal if (snap != lastSnap || ! shouldSnap) { setBounds (snap, 0, 1, timeline()->getHeight()); pos.setValue (getUnits()); lastSnap = snap; } }
void PWidget::processEvent(PKeyEvent *key, PTouchEvent *touch) { if (dragable()) { touch->lock(this); qlog(QString("%1 dragging").arg(name)); } //do something if (touch->event == PRESS) setFocus(); standardNextPrev(key); if (touch->event == RELEASE && touch->locked()) { touch->unlock(); qlog(QString("%1 dropped").arg(name)); } }
void TimelineIndicator::mouseDown (const MouseEvent& ev) { if (dragable()) dragger.startDraggingComponent (this, ev); }