模式地图支持按住ctrl或alt后方向键功能变为缩放 close #101

This commit is contained in:
MrZ626
2021-07-06 21:05:24 +08:00
parent f3d8c6b98a
commit 5ceb59daae

View File

@@ -159,22 +159,26 @@ function scene.update()
end end
if F then if F then
mapCam.keyCtrl=true mapCam.keyCtrl=true
moveMap(dx,dy) if kb.isDown("lctrl","rctrl","lalt","ralt")then
local x,y=getPos() scene.wheelMoved(nil,(dy-dx)*.026)
for name,M in next,MODES do else
if RANKS[name]and M.x then moveMap(dx,dy)
local SEL local x,y=getPos()
local s=M.size for name,M in next,MODES do
if M.shape==1 then if RANKS[name]and M.x then
if x>M.x-s and x<M.x+s and y>M.y-s and y<M.y+s then SEL=name end local SEL
elseif M.shape==2 then local s=M.size
if abs(x-M.x)+abs(y-M.y)<s then SEL=name end if M.shape==1 then
elseif M.shape==3 then if x>M.x-s and x<M.x+s and y>M.y-s and y<M.y+s then SEL=name end
if(x-M.x)^2+(y-M.y)^2<s^2 then SEL=name end elseif M.shape==2 then
end if abs(x-M.x)+abs(y-M.y)<s then SEL=name end
if SEL and mapCam.sel~=SEL then elseif M.shape==3 then
mapCam.sel=SEL if(x-M.x)^2+(y-M.y)^2<s^2 then SEL=name end
SFX.play('click') end
if SEL and mapCam.sel~=SEL then
mapCam.sel=SEL
SFX.play('click')
end
end end
end end
end end