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

Method OnClicked

Source/UIGrid.cpp:261–354  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

259}
260
261void UIGrid::OnClicked(float x, float y, bool right)
262{
263 if (right)
264 return;
265
266 mClick = true;
267 mLastClickWasClear = false;
268
269 float clickHeight, clickWidth;
270 GridCell cell = GetGridCellAt(x, y, &clickHeight, &clickWidth);
271 int dataIndex = GetDataIndex(cell.mCol, cell.mRow);
272 float oldValue = mData[dataIndex];
273
274 if (mGridMode == kMultislider || mGridMode == kMultisliderBipolar || mGridMode == kMultisliderGrow)
275 {
276 if (CanAdjustMultislider())
277 {
278 mData[dataIndex] = clickHeight;
279 }
280 else
281 {
282 if (mData[dataIndex] > 0)
283 {
284 mData[dataIndex] = 0;
285 mLastClickWasClear = true;
286 }
287 else
288 {
289 mData[dataIndex] = mStrength;
290 }
291 }
292 }
293 else if (mGridMode == kHorislider)
294 {
295 if (CanAdjustMultislider())
296 {
297 mData[dataIndex] = clickWidth;
298 }
299 else
300 {
301 float val = mStrength;
302
303 if (mSingleColumn)
304 {
305 for (int i = 0; i < MAX_GRID_ROWS; ++i)
306 {
307 if (mData[GetDataIndex(cell.mCol, i)] != 0)
308 val = mData[GetDataIndex(cell.mCol, i)];
309 }
310 }
311
312 if (mClickSubdivisions != 1)
313 val = GetSubdividedValue(clickWidth);
314
315 if (mData[dataIndex] == val)
316 {
317 mData[dataIndex] = 0;
318 mLastClickWasClear = true;

Callers

nothing calls this directly

Calls 1

GridUpdatedMethod · 0.45

Tested by

no test coverage detected