Debug output for sc_zoom

Signed-off-by: Sebastian Ramacher <sebastian+dev@ramacher.at>
This commit is contained in:
Sebastian Ramacher 2016-11-06 18:40:55 +01:00
parent bcdc7aba05
commit 9b5dceac17

View file

@ -1375,19 +1375,25 @@ sc_zoom(girara_session_t* session, girara_argument_t* argument, girara_event_t*
/* specify new zoom value */
if (argument->n == ZOOM_IN) {
girara_debug("Increasing zoom by %f.", zoom_step - 1.0);
zathura_document_set_scale(zathura->document, old_zoom * zoom_step);
} else if (argument->n == ZOOM_OUT) {
girara_debug("Decreasing zoom by %f.", zoom_step - 1.0);
zathura_document_set_scale(zathura->document, old_zoom / zoom_step);
} else if (argument->n == ZOOM_SPECIFIC) {
if (t == 0) {
girara_debug("Setting zoom to 1.");
zathura_document_set_scale(zathura->document, 1.0);
} else {
girara_debug("Setting zoom to %f.", t / 100.0);
zathura_document_set_scale(zathura->document, t / 100.0);
}
} else if (argument->n == ZOOM_SMOOTH) {
const double dy = (event != NULL) ? event->y : 1.0;
zathura_document_set_scale(zathura->document, old_zoom + zoom_step * dy);
const double dy = (event != NULL) ? event->y : 1.0;
girara_debug("Increasing zoom by %f.", zoom_step * dy - 1.0);
zathura_document_set_scale(zathura->document, old_zoom + zoom_step * dy);
} else {
girara_debug("Setting zoom to 1.");
zathura_document_set_scale(zathura->document, 1.0);
}
@ -1397,9 +1403,11 @@ sc_zoom(girara_session_t* session, girara_argument_t* argument, girara_event_t*
const double new_zoom = zathura_document_get_scale(zathura->document);
if (fabs(new_zoom - old_zoom) <= DBL_EPSILON) {
girara_debug("New and old zoom level are too close: %f vs. %f, diff = %f", new_zoom, old_zoom, fabs(new_zoom - old_zoom));
return false;
}
girara_debug("Re-rendering with new zoom level %f.", new_zoom);
render_all(zathura);
refresh_view(zathura);