(svn r23316) -Feature: Add ability to zoom in to 2x and 4x level.
This commit is contained in:
@@ -39,6 +39,7 @@
|
||||
#include "engine_func.h"
|
||||
#include "station_base.h"
|
||||
#include "tilehighlight_func.h"
|
||||
#include "zoom_func.h"
|
||||
|
||||
#include "table/strings.h"
|
||||
|
||||
@@ -2014,7 +2015,7 @@ struct VehicleDetailsWindow : Window {
|
||||
case VLD_WIDGET_MIDDLE_DETAILS: {
|
||||
/* For other vehicles, at the place of the matrix. */
|
||||
bool rtl = _current_text_dir == TD_RTL;
|
||||
uint sprite_width = max<uint>(GetSprite(v->GetImage(rtl ? DIR_E : DIR_W, EIT_IN_DETAILS), ST_NORMAL)->width, 70U) + WD_FRAMERECT_LEFT + WD_FRAMERECT_RIGHT;
|
||||
uint sprite_width = max<uint>(UnScaleByZoom(GetSprite(v->GetImage(rtl ? DIR_E : DIR_W, EIT_IN_DETAILS), ST_NORMAL)->width, ZOOM_LVL_GUI), 70U) + WD_FRAMERECT_LEFT + WD_FRAMERECT_RIGHT;
|
||||
|
||||
uint text_left = r.left + (rtl ? 0 : sprite_width);
|
||||
uint text_right = r.right - (rtl ? sprite_width : 0);
|
||||
@@ -2551,7 +2552,7 @@ public:
|
||||
case VVW_WIDGET_CENTER_MAIN_VIEH: {// center main view
|
||||
const Window *mainwindow = FindWindowById(WC_MAIN_WINDOW, 0);
|
||||
/* code to allow the main window to 'follow' the vehicle if the ctrl key is pressed */
|
||||
if (_ctrl_pressed && mainwindow->viewport->zoom == ZOOM_LVL_NORMAL) {
|
||||
if (_ctrl_pressed && mainwindow->viewport->zoom <= ZOOM_LVL_OUT_4X) {
|
||||
mainwindow->viewport->follow_vehicle = v->index;
|
||||
} else {
|
||||
ScrollMainWindowTo(v->x_pos, v->y_pos, v->z_pos);
|
||||
@@ -2725,7 +2726,7 @@ int GetVehicleWidth(Vehicle *v, EngineImageType image_type)
|
||||
bool rtl = _current_text_dir == TD_RTL;
|
||||
SpriteID sprite = v->GetImage(rtl ? DIR_E : DIR_W, image_type);
|
||||
const Sprite *real_sprite = GetSprite(sprite, ST_NORMAL);
|
||||
vehicle_width = real_sprite->width;
|
||||
vehicle_width = UnScaleByZoom(real_sprite->width, ZOOM_LVL_GUI);
|
||||
|
||||
break;
|
||||
}
|
||||
|
Reference in New Issue
Block a user