1
0
mirror of https://github.com/zenorogue/hyperrogue.git synced 2025-10-20 00:17:39 +00:00

reworked some modifier keys

This commit is contained in:
Zeno Rogue
2020-04-19 22:43:16 +02:00
parent 5e0aac5e92
commit 009b05c919
2 changed files with 67 additions and 67 deletions

View File

@@ -262,22 +262,16 @@ EX namespace mapeditor {
EX editwhat ew, ewsearch;
EX bool autochoose = ISMOBILE;
EX void scaleall(ld z) {
EX void scaleall(ld z, bool keep_mouse) {
// (mx,my) = (xcb,ycb) + ss * (xpos,ypos) + (mrx,mry) * scale
// (mrx,mry) * (scale-scale') =
// ss * ((xpos',ypos')-(xpos,ypos))
// mx = xb + ssiz*xpos + mrx * scale
// mx = xb + ssiz*xpos' + mrx * scale'
ld mrx = (.0 + mousex - current_display->xcenter) / vpconf.scale;
ld mry = (.0 + mousey - current_display->ycenter) / vpconf.scale;
if(vid.xres > vid.yres) {
vpconf.xposition += (vpconf.scale - vpconf.scale*z) * mrx / current_display->scrsize;
vpconf.yposition += (vpconf.scale - vpconf.scale*z) * mry / current_display->scrsize;
if(keep_mouse) {
ld mrx = (.0 + mousex - current_display->xcenter) / vpconf.scale;
ld mry = (.0 + mousey - current_display->ycenter) / vpconf.scale;
if(vid.xres > vid.yres) {
vpconf.xposition += (vpconf.scale - vpconf.scale*z) * mrx / current_display->scrsize;
vpconf.yposition += (vpconf.scale - vpconf.scale*z) * mry / current_display->scrsize;
}
}
vpconf.scale *= z;