zoomx / controlp5

Automatically exported from code.google.com/p/controlp5
0 stars 0 forks source link

Matrix setMode(ControlP5.SINGLE_ROW) doesn't work #91

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
Create a matrix, and use setMode(ControlP5.SINGLE_ROW) so that only one item 
per row can be selected.

It ignores this and works in the same way as if it was set to 
ControlP5.SINGLE_COLUMN.

The bug is trivial to fix in matrix.java, lines 148-158, check out the two 
loops below, they are exactly the same, whereas in single_row, it should clear 
the row not the column.

case (SINGLE_COLUMN):
    for (int i = 0; i < _myCellY; i++) {
        _myCells[tX][i] = 0;
    }
    _myCells[tX][tY] = (!isMarkerActive) ? 1 : _myCells[tX][tY];
    break;
case (SINGLE_ROW):
    for (int i = 0; i < _myCellY; i++) {
       _myCells[tX][i] = 0;
    }
    _myCells[tX][tY] = (!isMarkerActive) ? 1 : _myCells[tX][tY];

The single_row case should be
    for (int i = 0; i < _myCellX; i++) {
       _myCells[i][tX] = 0;
    }

Original issue reported on code.google.com by joemarsh...@gmail.com on 7 Jan 2015 at 8:02