mirror of https://github.com/stella-emu/stella.git
Improve zooming
This commit is contained in:
parent
c53fb6ab00
commit
47457664e2
|
@ -85,15 +85,15 @@ void TiaZoomWidget::zoom(int level)
|
||||||
if(myZoomLevel == level)
|
if(myZoomLevel == level)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
// TODO: zoom to center
|
// zoom to click position
|
||||||
//int x = myXOff + myNumCols / 2;
|
int x = (myXOff << 1) + myClickX / myZoomLevel;
|
||||||
//int y = myYOff + myNumRows / 2;
|
int y = myYOff + myClickY / myZoomLevel;
|
||||||
|
|
||||||
myZoomLevel = level;
|
myZoomLevel = level;
|
||||||
myNumCols = ((_w - 4) >> 1) / myZoomLevel;
|
myNumCols = ((_w - 4) >> 1) / myZoomLevel;
|
||||||
myNumRows = (_h - 4) / myZoomLevel;
|
myNumRows = (_h - 4) / myZoomLevel;
|
||||||
|
|
||||||
//setPos(x, y);
|
setPos(x, y);
|
||||||
|
|
||||||
recalc();
|
recalc();
|
||||||
}
|
}
|
||||||
|
@ -140,6 +140,19 @@ void TiaZoomWidget::handleMouseUp(int x, int y, MouseButton b, int clickCount)
|
||||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
void TiaZoomWidget::handleMouseWheel(int x, int y, int direction)
|
void TiaZoomWidget::handleMouseWheel(int x, int y, int direction)
|
||||||
{
|
{
|
||||||
|
/*
|
||||||
|
// TODO: zoom towards mouse point
|
||||||
|
myClickX = (x - getAbsX()) / myZoomLevel + myXOff * 1;
|
||||||
|
myClickY = (y - getAbsY()) / myZoomLevel + myYOff * 1;
|
||||||
|
setPos(myClickX, myClickY);
|
||||||
|
|
||||||
|
if(direction > 0)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
}*/
|
||||||
|
|
||||||
if(direction > 0)
|
if(direction > 0)
|
||||||
handleEvent(Event::UIDown);
|
handleEvent(Event::UIDown);
|
||||||
else
|
else
|
||||||
|
|
Loading…
Reference in New Issue