mirror of
https://github.com/SoftFever/OrcaSlicer.git
synced 2025-07-11 16:57:53 -06:00
Support tree interface extended with mouse event handling and refresh callback.
This commit is contained in:
parent
f6591f000e
commit
91a79e0343
2 changed files with 31 additions and 0 deletions
|
@ -1635,6 +1635,12 @@ SlicedSupports SLASupportTree::slice(float layerh, float init_layerh) const
|
||||||
return {};
|
return {};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Here we should implement the support editing
|
||||||
|
void SLASupportTree::mouse_event(const MouseEvent &)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
SLASupportTree::SLASupportTree(const Model& model,
|
SLASupportTree::SLASupportTree(const Model& model,
|
||||||
const SupportConfig& cfg,
|
const SupportConfig& cfg,
|
||||||
const Controller& ctl): m_impl(new Impl())
|
const Controller& ctl): m_impl(new Impl())
|
||||||
|
|
|
@ -106,10 +106,25 @@ public:
|
||||||
SLASupportsStoppedException(): std::runtime_error("") {}
|
SLASupportsStoppedException(): std::runtime_error("") {}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/// A simple type carrying mouse event info. For support editing purposes
|
||||||
|
struct MouseEvent {
|
||||||
|
enum Buttons {
|
||||||
|
M_RIGHT, M_LEFT, M_MIDDLE
|
||||||
|
} button;
|
||||||
|
|
||||||
|
enum Type {
|
||||||
|
ENGAGE, RELEASE, MOVE
|
||||||
|
} type;
|
||||||
|
|
||||||
|
Vec3d coords;
|
||||||
|
};
|
||||||
|
|
||||||
/// The class containing mesh data for the generated supports.
|
/// The class containing mesh data for the generated supports.
|
||||||
class SLASupportTree {
|
class SLASupportTree {
|
||||||
class Impl;
|
class Impl;
|
||||||
std::unique_ptr<Impl> m_impl;
|
std::unique_ptr<Impl> m_impl;
|
||||||
|
std::function<void()> m_vcallback;
|
||||||
|
|
||||||
Impl& get() { return *m_impl; }
|
Impl& get() { return *m_impl; }
|
||||||
const Impl& get() const { return *m_impl; }
|
const Impl& get() const { return *m_impl; }
|
||||||
|
|
||||||
|
@ -144,6 +159,16 @@ public:
|
||||||
|
|
||||||
/// Get the sliced 2d layers of the support geometry.
|
/// Get the sliced 2d layers of the support geometry.
|
||||||
SlicedSupports slice(float layerh, float init_layerh = -1.0) const;
|
SlicedSupports slice(float layerh, float init_layerh = -1.0) const;
|
||||||
|
|
||||||
|
/// The function to call when mouse events should be propagated to the
|
||||||
|
/// supports for editing
|
||||||
|
void mouse_event(const MouseEvent&);
|
||||||
|
|
||||||
|
/// The provided callback will be called if the supports change their shape
|
||||||
|
/// or need to be repainted
|
||||||
|
inline void on_supports_changed(std::function<void()> callback) {
|
||||||
|
m_vcallback = callback;
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue