@@ -92,6 +92,8 @@ struct Window { | |||||
DEPRECATED std::shared_ptr<Svg> loadSvg(const std::string& filename) { | DEPRECATED std::shared_ptr<Svg> loadSvg(const std::string& filename) { | ||||
return Svg::load(filename); | return Svg::load(filename); | ||||
} | } | ||||
INTERNAL bool& fbDirtyOnSubpixelChange(); | |||||
}; | }; | ||||
@@ -681,6 +681,9 @@ void ModuleWidget::onHoverKey(const HoverKeyEvent& e) { | |||||
void ModuleWidget::onDragStart(const DragStartEvent& e) { | void ModuleWidget::onDragStart(const DragStartEvent& e) { | ||||
if (e.button == GLFW_MOUSE_BUTTON_LEFT) { | if (e.button == GLFW_MOUSE_BUTTON_LEFT) { | ||||
// HACK Disable FramebufferWidget redrawing subpixels while dragging | |||||
APP->window->fbDirtyOnSubpixelChange() = false; | |||||
// Clear dragRack so dragging in not enabled until mouse is moved a bit. | // Clear dragRack so dragging in not enabled until mouse is moved a bit. | ||||
internal->dragRackPos = math::Vec(NAN, NAN); | internal->dragRackPos = math::Vec(NAN, NAN); | ||||
@@ -691,6 +694,8 @@ void ModuleWidget::onDragStart(const DragStartEvent& e) { | |||||
void ModuleWidget::onDragEnd(const DragEndEvent& e) { | void ModuleWidget::onDragEnd(const DragEndEvent& e) { | ||||
if (e.button == GLFW_MOUSE_BUTTON_LEFT) { | if (e.button == GLFW_MOUSE_BUTTON_LEFT) { | ||||
APP->window->fbDirtyOnSubpixelChange() = true; | |||||
// The next time the module is dragged, it should always move immediately | // The next time the module is dragged, it should always move immediately | ||||
internal->dragEnabled = true; | internal->dragEnabled = true; | ||||
@@ -188,7 +188,7 @@ void FramebufferWidget::draw(const DrawArgs& args) { | |||||
// If drawing to a new subpixel location, rerender in the next frame. | // If drawing to a new subpixel location, rerender in the next frame. | ||||
// Anything less than 0.1 pixels isn't noticeable. | // Anything less than 0.1 pixels isn't noticeable. | ||||
math::Vec offsetFDelta = internal->offsetF.minus(internal->fbOffsetF); | math::Vec offsetFDelta = internal->offsetF.minus(internal->fbOffsetF); | ||||
if (dirtyOnSubpixelChange && offsetFDelta.square() >= std::pow(0.1f, 2)) { | |||||
if (offsetFDelta.square() >= std::pow(0.1f, 2) && dirtyOnSubpixelChange && APP->window->fbDirtyOnSubpixelChange()) { | |||||
// DEBUG("%p dirty subpixel (%f, %f) (%f, %f)", this, VEC_ARGS(internal->offsetF), VEC_ARGS(internal->fbOffsetF)); | // DEBUG("%p dirty subpixel (%f, %f) (%f, %f)", this, VEC_ARGS(internal->offsetF), VEC_ARGS(internal->fbOffsetF)); | ||||
setDirty(); | setDirty(); | ||||
} | } | ||||
@@ -88,6 +88,8 @@ struct Window::Internal { | |||||
std::map<std::string, std::shared_ptr<Font>> fontCache; | std::map<std::string, std::shared_ptr<Font>> fontCache; | ||||
std::map<std::string, std::shared_ptr<Image>> imageCache; | std::map<std::string, std::shared_ptr<Image>> imageCache; | ||||
bool fbDirtyOnSubpixelChange = true; | |||||
}; | }; | ||||
@@ -679,6 +681,11 @@ std::shared_ptr<Image> Window::loadImage(const std::string& filename) { | |||||
} | } | ||||
bool& Window::fbDirtyOnSubpixelChange() { | |||||
return internal->fbDirtyOnSubpixelChange; | |||||
} | |||||
void windowInit() { | void windowInit() { | ||||
int err; | int err; | ||||