Skip to content

Commit

Permalink
Update canvasmouseinteractions.cpp
Browse files Browse the repository at this point in the history
Clicking hovered text box with text tool will open text editor.

#411
  • Loading branch information
rodlie committed Jan 12, 2025
1 parent 926050e commit aa65f78
Showing 1 changed file with 16 additions and 11 deletions.
27 changes: 16 additions & 11 deletions src/core/canvasmouseinteractions.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -272,19 +272,24 @@ void Canvas::handleLeftButtonMousePress(const eMouseEvent& e) {
addBoxToSelection(newPath.get());

mCurrentRectangle = newPath.get();
} else if(mCurrentMode == CanvasMode::textCreate) {
const auto newPath = enve::make_shared<TextBox>();
newPath->planCenterPivotPosition();
newPath->setFontFamilyAndStyle(mDocument.fFontFamily,
mDocument.fFontStyle);
newPath->setFontSize(mDocument.fFontSize);
mCurrentContainer->addContained(newPath);
newPath->setAbsolutePos(e.fPos);
} else if (mCurrentMode == CanvasMode::textCreate) {
if (enve_cast<TextBox*>(mHoveredBox)) {
setCurrentBox(mHoveredBox);
emit openTextEditor();
} else {
const auto newPath = enve::make_shared<TextBox>();
newPath->planCenterPivotPosition();
newPath->setFontFamilyAndStyle(mDocument.fFontFamily,
mDocument.fFontStyle);
newPath->setFontSize(mDocument.fFontSize);
mCurrentContainer->addContained(newPath);
newPath->setAbsolutePos(e.fPos);

mCurrentTextBox = newPath.get();
mCurrentTextBox = newPath.get();

clearBoxesSelection();
addBoxToSelection(newPath.get());
clearBoxesSelection();
addBoxToSelection(newPath.get());
}
}
}

Expand Down

0 comments on commit aa65f78

Please sign in to comment.