mirror of
https://github.com/UpsilonNumworks/Upsilon.git
synced 2026-01-19 00:37:25 +01:00
[apps/shared] FunctionGoToParameterController update the range version
of the graph controller to avoid reinitializing the cursor position when graph controller view appears. Otherwise, goto controller would set the cursor position, update the range consequently and then the graph controller would reinitialize the cursor position.
This commit is contained in:
@@ -24,10 +24,16 @@ bool FunctionGoToParameterController::setParameterAtIndex(int parameterIndex, do
|
||||
assert(parameterIndex == 0);
|
||||
FunctionApp * myApp = FunctionApp::app();
|
||||
ExpiringPointer<Function> function = myApp->functionStore()->modelForRecord(m_record);
|
||||
float y = function->evaluateAtAbscissa(f, myApp->localContext());
|
||||
double y = function->evaluateAtAbscissa(f, myApp->localContext());
|
||||
m_cursor->moveTo(f, y);
|
||||
m_graphRange->centerAxisAround(CurveViewRange::Axis::X, m_cursor->x());
|
||||
m_graphRange->centerAxisAround(CurveViewRange::Axis::Y, m_cursor->y());
|
||||
/* The range might have evolved to center around the cursor but we don't want
|
||||
* to reinit the cursor position when displaying the graph controller. To
|
||||
* prevent this, we update the snapshot range version in order to make the
|
||||
* graph controller as if the range has not evolved since last appearance. */
|
||||
uint32_t * snapshotRangeVersion = static_cast<FunctionApp::Snapshot *>(myApp->snapshot())->rangeVersion();
|
||||
*snapshotRangeVersion = m_graphRange->rangeChecksum();
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user