void ScenarioModel::setDurationAndGrow(const TimeValue& newDuration) { ///* Should work but does not ? /*StandardDisplacementPolicy::setEventPosition(*this, endEvent()->id(), newDuration, endEvent()->heightPercentage(), [&] (ProcessModel* p, const TimeValue& t) { p->expandProcess(ExpandMode::Grow, t); }); */ auto& eev = endEvent(); eev.setDate(newDuration); timeNode(eev.timeNode()).setDate(newDuration); emit eventMoved(eev.id()); this->setDuration(newDuration); }
void ScenarioModel::setDurationAndScale(const TimeValue& newDuration) { double scale = newDuration / duration(); // Is it recursive ?? Make a scale() method on the constraint, maybe ? // TODO we should only have to set the date of the event / constraint for(TimeNodeModel* timenode : m_timeNodes) { timenode->setDate(timenode->date() * scale); // Since events will also move we do not need // to move the timenode. } for(EventModel* event : m_events) { event->setDate(event->date() * scale); emit eventMoved(event->id()); } for(ConstraintModel* constraint : m_constraints) { constraint->setStartDate(constraint->startDate() * scale); // Note : scale the min / max. ConstraintModel::Algorithms::changeAllDurations(*constraint, constraint->defaultDuration() * scale); for(auto& process : constraint->processes()) { process->setDurationAndScale(constraint->defaultDuration() * scale); } emit constraintMoved(constraint->id()); } this->setDuration(newDuration); }
void ScrollView::touchMoved( po::scene::TouchEvent& event ) { eventMoved( event.getId(), event.getLocalPos() ); }
void ScrollView::mouseDrag( po::scene::MouseEvent& event ) { eventMoved( 0, event.getLocalPos() ); }