mirror of
https://github.com/aseprite/aseprite.git
synced 2025-03-29 19:20:09 +00:00
Keep a render::Zoom instead of percentage "int" value in ZoomCommand()
This commit is contained in:
parent
9fa26dc2f4
commit
34adca2933
@ -33,13 +33,14 @@ protected:
|
||||
|
||||
private:
|
||||
Action m_action;
|
||||
int m_percentage;
|
||||
render::Zoom m_zoom;
|
||||
};
|
||||
|
||||
ZoomCommand::ZoomCommand()
|
||||
: Command("Zoom",
|
||||
"Zoom",
|
||||
CmdUIOnlyFlag)
|
||||
, m_zoom(1, 1)
|
||||
{
|
||||
}
|
||||
|
||||
@ -52,7 +53,8 @@ void ZoomCommand::onLoadParams(const Params& params)
|
||||
|
||||
std::string percentage = params.get("percentage");
|
||||
if (!percentage.empty()) {
|
||||
m_percentage = std::strtol(percentage.c_str(), NULL, 10);
|
||||
m_zoom = render::Zoom::fromScale(
|
||||
std::strtod(percentage.c_str(), NULL) / 100.0);
|
||||
m_action = Set;
|
||||
}
|
||||
}
|
||||
@ -74,7 +76,7 @@ void ZoomCommand::onExecute(Context* context)
|
||||
zoom.out();
|
||||
break;
|
||||
case Set:
|
||||
zoom = render::Zoom::fromScale(double(m_percentage) / 100.0);
|
||||
zoom = m_zoom;
|
||||
break;
|
||||
}
|
||||
|
||||
@ -93,7 +95,7 @@ std::string ZoomCommand::onGetFriendlyName() const
|
||||
text += " out";
|
||||
break;
|
||||
case Set:
|
||||
text += " " + base::convert_to<std::string>(m_percentage) + "%";
|
||||
text += " " + base::convert_to<std::string>(int(100.0*m_zoom.scale())) + "%";
|
||||
break;
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user