Ruberband selection now works better.

This commit is contained in:
Justin Marshall
2020-07-06 16:20:36 -07:00
parent f1e75e4a63
commit f4964c83e9
2 changed files with 21 additions and 7 deletions
+12 -5
View File
@@ -1032,11 +1032,18 @@ bool CellClass::ScreenCoordsToIsoTile(int x, int y, int &tileX, int &tileY) {
void CellClass::ConvertIsoCoordsToScreen(int& x, int& y) {
int tileX, tileY;
if (!CellClass::ScreenCoordsToIsoTile(x, y, tileX, tileY)) {
return;
}
x = tileX * CELL_PIXEL_W;
y = tileY * CELL_PIXEL_H;
x = x - (ScreenWidth / 2);
y = y + (ScreenWidth / 4);
float tempPt_x = (2 * y + x);
float tempPt_y = (2 * y - x);
//x = floor(tempPt_x / (CELL_PIXEL_W)) * CELL_PIXEL_W;
//y = floor(tempPt_y / (CELL_PIXEL_H)) * CELL_PIXEL_H;
x = tempPt_x - CELL_PIXEL_W;
y = tempPt_y - CELL_PIXEL_H;
Console_Printf("%d %d\n", x, y);
}
bool CellClass::ScreenCoordsToIsoCoords(COORDINATE screenCoord, COORDINATE& isoCoord) {
+9 -2
View File
@@ -3298,7 +3298,7 @@ int DisplayClass::TacticalClass::Action(unsigned flags, KeyNumType & key)
** intercepted and possible rubber-band mode is flagged.
*/
if (flags & LEFTRELEASE) {
Map.Mouse_Left_Release(cell, x, y, object, action);
Map.Mouse_Left_Release(cell, screenX, screenY, object, action);
}
/*
@@ -3886,7 +3886,14 @@ void DisplayClass::Mouse_Left_Release(CELL cell, int x, int y, ObjectClass * obj
if (IsRubberBand) {
Refresh_Band();
Select_These(XYP_Coord(BandX, BandY), XYP_Coord(x, y));
int _BandX = BandX;
int _BandY = BandY;
int _x = x;
int _y = y;
CellClass::ConvertIsoCoordsToScreen(_BandX, _BandY);
CellClass::ConvertIsoCoordsToScreen(_x, _y);
Select_These(XYP_Coord(_BandX, _BandY), XYP_Coord(_x, _y));
Set_Default_Mouse(MOUSE_NORMAL, wsmall);
IsRubberBand = false;