Permalink
Browse files

Fix trim selection and removed entities still visible

  • Loading branch information...
feragon committed Jul 8, 2016
1 parent 40b888f commit 13ac87c753f3fa8f0873f2515ccf846b7b1a24ec
Showing with 14 additions and 26 deletions.
  1. +1 −0 lcviewernoqt/managers/dragmanager.cpp
  2. +13 −21 lcviewerqt/lcadviewer.cpp
  3. +0 −5 lcviewerqt/lcadviewer.h
@@ -145,6 +145,7 @@ void DragManager::onMouseRelease() {
for(auto entity : entities) {
_builder->append(entity);
_selectedEntities.remove(entity);
_tempEntities->removeEntity(entity);
}
_builder->execute();
View
@@ -18,7 +18,7 @@
using namespace LCViewer;
LCADViewer::LCADViewer(QWidget *parent) :
QWidget(parent), _docCanvas(nullptr), _mouseScrollKeyActive(false), _disableSelection(false), _operationActive(false), _scale(1.0), _zoomMin(0.05), _zoomMax(20.0), _scaleLineWidth(false) {
QWidget(parent), _docCanvas(nullptr), _mouseScrollKeyActive(false), _operationActive(false), _scale(1.0), _zoomMin(0.05), _zoomMax(20.0), _scaleLineWidth(false) {
setMouseTracking(true);
this->_altKeyActive = false;
@@ -163,7 +163,7 @@ void LCADViewer::mouseMoveEvent(QMouseEvent *event) {
this->_docCanvas->pan(event->pos().x(), event->pos().y());
}
} else {
if (!startSelectPos.isNull() && !_disableSelection) {
if (!startSelectPos.isNull()) {
bool occopies = startSelectPos.x() < event->pos().x();
_docCanvas->makeSelectionDevice(
std::min(startSelectPos.x(), event->pos().x()) , std::min(startSelectPos.y(), event->pos().y()),
@@ -182,26 +182,25 @@ void LCADViewer::mousePressEvent(QMouseEvent *event) {
startSelectPos = event->pos();
if(!_operationActive) {
_dragManager->onMousePress();
}
if (!_ctrlKeyActive) {
_docCanvas->removeSelection();
}
if(!_operationActive) {
_dragManager->onMousePress();
_disableSelection = _dragManager->entityDragged();
posX = event->x();
posY = event->y();
if(_dragManager->entityDragged()) {
startSelectPos = QPoint();
}
switch (event->buttons()) {
case Qt::MiddleButton: {
_mouseScrollKeyActive = true;
}
break;
switch (event->buttons()) {
case Qt::MiddleButton: {
_mouseScrollKeyActive = true;
}
break;
}
_docCanvas->device_to_user(&posX, &posY);
emit mousePressEvent();
}
@@ -237,13 +236,6 @@ std::shared_ptr<DocumentCanvas> LCADViewer::documentCanvas() const {
return _docCanvas;
}
double LCADViewer::x() {
return posX;
}
double LCADViewer::y() {
return posY;
}
void LCADViewer::setOperationActive(bool operationActive) {
_operationActive = operationActive;
View
@@ -68,8 +68,6 @@ class LCADViewer : public QWidget {
void setDragManager(DragManager_SPtr dragManager);
std::shared_ptr<DocumentCanvas> documentCanvas() const;
void autoScale() const {documentCanvas()->autoScale();}
double x();
double y();
void setOperationActive(bool operationActive);
@@ -103,7 +101,6 @@ class LCADViewer : public QWidget {
bool _ctrlKeyActive;
std::shared_ptr<DocumentCanvas> _docCanvas;
bool _mouseScrollKeyActive;
bool _disableSelection;
bool _operationActive;
@@ -115,8 +112,6 @@ class LCADViewer : public QWidget {
int v_ = 0;
int h_ = 0;
double posX;
double posY;
// When set to true, the line width on screen will scale with teh zoom factor
bool _scaleLineWidth;

0 comments on commit 13ac87c

Please sign in to comment.