MCPcopy Create free account
hub / github.com/BespokeSynth/BespokeSynth / OnClicked

Method OnClicked

Source/Minimap.cpp:265–287  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

263}
264
265void Minimap::OnClicked(float x, float y, bool right)
266{
267 if (mGrid->TestClick(x, y, right, true))
268 {
269 float gridX, gridY;
270 mGrid->GetPosition(gridX, gridY, true);
271 GridCell cell = mGrid->GetGridCellAt(x - gridX, y - gridY);
272 int number = cell.mCol + cell.mRow + '1';
273 if (GetKeyModifiers() == kModifier_Shift)
274 TheSynth->GetLocationZoomer()->WriteCurrentLocation(number);
275 else
276 TheSynth->GetLocationZoomer()->MoveToLocation(number);
277 }
278 else
279 {
280 ofRectangle boundingBox;
281 ofRectangle viewport = TheSynth->GetDrawRect();
282 ComputeBoundingBox(boundingBox);
283 ofVec2f viewportCoords = CoordsToViewport(boundingBox, x, y);
284 TheSynth->SetDrawOffset(ofVec2f(-viewportCoords.x + viewport.width / 2, -viewportCoords.y + viewport.height / 2));
285 mClick = true;
286 }
287}
288
289void Minimap::MouseReleased()
290{

Callers

nothing calls this directly

Calls 9

GetKeyModifiersFunction · 0.85
ofVec2fClass · 0.85
WriteCurrentLocationMethod · 0.80
GetLocationZoomerMethod · 0.80
MoveToLocationMethod · 0.80
TestClickMethod · 0.45
GetPositionMethod · 0.45
GetGridCellAtMethod · 0.45
SetDrawOffsetMethod · 0.45

Tested by

no test coverage detected