Stand/Stand/CommandStreamingPos.hpp
2024-10-16 11:20:42 +08:00

38 lines
755 B
C++

#pragma once
#include "CommandToggle.hpp"
namespace Stand
{
class CommandStreamingPos : public CommandToggle
{
private:
CommandPositionSelection* const pos_sel;
public:
explicit CommandStreamingPos(CommandList* const parent, CommandPositionSelection* const pos_sel)
: CommandToggle(parent, LOC("LKSTRMFCS"), { CMDNAME("lockstreamingfocus") }), pos_sel(pos_sel)
{
}
void onEnable(Click& click) final
{
Camgr::freecam_focus_allowed = false;
registerScriptTickEventHandler(click, [this]
{
if (m_on)
{
if (!pos_sel->is_being_changed)
{
Camgr::lock_focus(pos_sel->pos);
}
return true;
}
Camgr::freecam_focus_allowed = true;
Camgr::unlock_focus();
return false;
});
}
};
}