Skip to content

Commit

Permalink
Fix implicit type conversions in EditSelection
Browse files Browse the repository at this point in the history
  • Loading branch information
Technius committed Aug 4, 2021
1 parent e13cfbc commit 18e18dd
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
10 changes: 5 additions & 5 deletions src/control/tools/EditSelection.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -248,15 +248,15 @@ auto EditSelection::getSourceLayer() -> Layer* { return this->sourceLayer; }
*/
auto EditSelection::getXOnViewAbsolute() -> int {
double zoom = view->getXournal()->getZoom();
return this->view->getX() + this->getXOnView() * zoom;
return this->view->getX() + static_cast<int>(this->getXOnView() * zoom);
}

/**
* Get the Y coordinate in View coordinates (absolute)
*/
auto EditSelection::getYOnViewAbsolute() -> int {
double zoom = view->getXournal()->getZoom();
return this->view->getY() + this->getYOnView() * zoom;
return this->view->getY() + static_cast<int>(this->getYOnView() * zoom);
}

/**
Expand Down Expand Up @@ -561,7 +561,7 @@ void EditSelection::mouseMove(double mouseX, double mouseY, bool alt) {

if (v && v != this->view) {
XournalView* xournal = this->view->getXournal();
auto pageNr = xournal->getControl()->getDocument()->indexOf(v->getPage());
const auto pageNr = xournal->getControl()->getDocument()->indexOf(v->getPage());

xournal->pageSelected(pageNr);

Expand Down Expand Up @@ -609,7 +609,7 @@ auto EditSelection::getPageViewUnderCursor() -> XojPageView* {


Layout* layout = gtk_xournal_get_layout(this->view->getXournal()->getWidget());
XojPageView* v = layout->getPageViewAt(hx, hy);
XojPageView* v = layout->getPageViewAt(static_cast<int>(hx), static_cast<int>(hy));

return v;
}
Expand Down Expand Up @@ -941,7 +941,7 @@ void EditSelection::serialize(ObjectOutputStream& out) {
this->contents->serialize(out);
out.endObject();

out.writeInt(this->getElements()->size());
out.writeInt(static_cast<int>(this->getElements()->size()));
for (Element* e: *this->getElements()) { e->serialize(out); }
}

Expand Down
2 changes: 1 addition & 1 deletion src/control/tools/EditSelection.h
Original file line number Diff line number Diff line change
Expand Up @@ -314,7 +314,7 @@ class EditSelection: public ElementContainer, public Serializeable {
/**
* Mouse coordinates for moving / resizing
*/
CursorSelectionType mouseDownType;
CursorSelectionType mouseDownType = CURSOR_SELECTION_NONE;
double relMousePosX{};
double relMousePosY{};
double relMousePosRotX{};
Expand Down

0 comments on commit 18e18dd

Please sign in to comment.