You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Feb 28, 2023. It is now read-only.
We already have the min and max X and Y coordinates of the graph at our disposal. By using them we could compare the width / height of the graph to the dimensions of the LÖVE window. If the graph's rectangle gets too big the camera zoom can be calculated as:
screenW / graphW and screenH / graphH
We just need the smaller value since zooming is always using the same value for x and y scaling. I played around with some code, but this isn't working correctly atm (the zoom isn't working correctly once the graph gets too big):
localfunctioncalculateZoom(zoom, dt)
localw, h= (maxX*zoom-minX*zoom), (maxY*zoom-minY*zoom);
localsw, sh=love.graphics.getDimensions();
-- Automatic Zoom.localratioW, ratioH=sw/w, sh/h;
zoom=ratioW<=ratioHandratioWorratioH;
-- Clamp value and return it.returnmath.max(CAMERA_MAX_ZOOM, math.min(zoom, CAMERA_MIN_ZOOM));
end
I am taking the "current" camera zoom into account since we need to check if the "scaled" version of the graph fits the screen.
The text was updated successfully, but these errors were encountered:
We already have the min and max X and Y coordinates of the graph at our disposal. By using them we could compare the width / height of the graph to the dimensions of the LÖVE window. If the graph's rectangle gets too big the camera zoom can be calculated as:
We just need the smaller value since zooming is always using the same value for x and y scaling. I played around with some code, but this isn't working correctly atm (the zoom isn't working correctly once the graph gets too big):
I am taking the "current" camera
zoom
into account since we need to check if the "scaled" version of the graph fits the screen.The text was updated successfully, but these errors were encountered: