Another NSMatrix problem…

Well, I’ve been defeated again by the Matrix.

I intended to make a compass orient itself the same angle that I drag the mouse through cells of the matrix.

But when you click on a cell, and then extend the selection, it doesn’t matter if you drag up, left, or in any direction, the matrix always returns a rectangular block of cells, in which the first cell is up left and the last one is bottom right.

I thought that getting selectedCells())'s objectAtIndex_(0) would give the first clicked cell and selectedCells()'s lastObject()) the last one, but. no. As soon as you release the mouse, NSMatrix returns the ordered block of cells, as if I released the mouse on the bottom right end. So my compass is always oriented from 0 to 90 degrees.

The solution should be a mouse down - mouse up pair, and calculate the difference of coordinates. But I know that NSMatrix’s origin is up left, and the mouse origin is bottom left.

If you have understand my problem, please help me!

This problem has been solved here : http://macscripter.net/viewtopic.php?id=36305