8#ifndef ImGuiLayer_DEFINED
9#define ImGuiLayer_DEFINED
54 float availWidth = std::max(ImGui::GetContentRegionAvailWidth(), 1.0f);
55 fPos = ImGui::GetCursorScreenPos();
56 fSize = ImVec2(availWidth, availWidth * aspect);
90 ImGui::SetCursorScreenPos(ImVec2(
center.fX - 5,
center.fY - 5));
91 ImGui::InvisibleButton(
"", ImVec2(10, 10));
93 if (ImGui::IsItemActive() && ImGui::IsMouseDragging(0)) {
95 ImGuiIO& io = ImGui::GetIO();
104 if (tooltip && ImGui::IsItemHovered()) {
105 ImGui::SetTooltip(
"x: %.3f\ny: %.3f", p->fX, p->fY);
static constexpr const T & SkTPin(const T &x, const T &lo, const T &hi)
static SkScalar center(float pos0, float pos1)
bool onMouse(int x, int y, skui::InputState state, skui::ModifierKey modifiers) override
void onAttach(sk_app::Window *window) override
void onPaint(SkSurface *) override
void onPrePaint() override
bool onMouseWheel(float delta, int x, int y, skui::ModifierKey modifiers) override
std::function< void(SkCanvas *)> SkiaWidgetFunc
void setScaleFactor(float scaleFactor)
bool onKey(skui::Key key, skui::InputState state, skui::ModifierKey modifiers) override
void skiaWidget(const ImVec2 &size, SkiaWidgetFunc func)
bool onChar(SkUnichar c, skui::ModifierKey modifiers) override
bool setPolyToPoly(const SkPoint src[], const SkPoint dst[], int count)
void mapXY(SkScalar x, SkScalar y, SkPoint *result) const
skia_private::STArray< 4, ImVec2, true > fScreenPoints
void dragPoint(SkPoint *p, bool tooltip=false, ImU32 color=0xFFFFFFFF)
DragCanvas(const void *id, SkPoint tl={ 0.0f, 0.0f }, SkPoint br={ 1.0f, 1.0f }, float aspect=-1.0f)
void fillColor(ImU32 color)
constexpr float x() const