##// END OF EJS Templates
Multi selection improvements
trabillard -
r1119:8c4e23ece78b
parent child
Show More
@@ -842,16 +842,24 void VisualizationGraphWidget::onMousePress(QMouseEvent *event) noexcept
842 if (isSelectionZoneMode) {
842 if (isSelectionZoneMode) {
843 auto isMultiSelectionClick = event->modifiers().testFlag(MULTI_ZONE_SELECTION_MODIFIER);
843 auto isMultiSelectionClick = event->modifiers().testFlag(MULTI_ZONE_SELECTION_MODIFIER);
844 auto selectionZoneItemUnderCursor = impl->selectionZoneAt(event->pos(), plot());
844 auto selectionZoneItemUnderCursor = impl->selectionZoneAt(event->pos(), plot());
845 if (selectionZoneItemUnderCursor && isLeftClick) {
845
846 selectionZoneItemUnderCursor->setAssociatedEditedZones(
846
847 parentVisualizationWidget()->selectionZoneManager().selectedItems());
847 if (selectionZoneItemUnderCursor && !selectionZoneItemUnderCursor->selected()
848 && !isMultiSelectionClick) {
849 parentVisualizationWidget()->selectionZoneManager().select(
850 {selectionZoneItemUnderCursor});
848 }
851 }
849 else if (!isMultiSelectionClick && isLeftClick) {
852 else if (!selectionZoneItemUnderCursor && !isMultiSelectionClick && isLeftClick) {
850 parentVisualizationWidget()->selectionZoneManager().clearSelection();
853 parentVisualizationWidget()->selectionZoneManager().clearSelection();
851 }
854 }
852 else {
855 else {
853 // No selection change
856 // No selection change
854 }
857 }
858
859 if (selectionZoneItemUnderCursor && isLeftClick) {
860 selectionZoneItemUnderCursor->setAssociatedEditedZones(
861 parentVisualizationWidget()->selectionZoneManager().selectedItems());
862 }
855 }
863 }
856
864
857
865
@@ -1,5 +1,7
1 #include "Visualization/VisualizationSelectionZoneItem.h"
1 #include "Visualization/VisualizationSelectionZoneItem.h"
2 #include "Visualization/VisualizationGraphWidget.h"
2 #include "Visualization/VisualizationGraphWidget.h"
3 #include "Visualization/VisualizationSelectionZoneManager.h"
4 #include "Visualization/VisualizationWidget.h"
3
5
4 const QString &DEFAULT_COLOR = QStringLiteral("#E79D41");
6 const QString &DEFAULT_COLOR = QStringLiteral("#E79D41");
5
7
@@ -344,6 +346,12 void VisualizationSelectionZoneItem::mousePressEvent(QMouseEvent *event, const Q
344 void VisualizationSelectionZoneItem::mouseMoveEvent(QMouseEvent *event, const QPointF &startPos)
346 void VisualizationSelectionZoneItem::mouseMoveEvent(QMouseEvent *event, const QPointF &startPos)
345 {
347 {
346 if (isEditionEnabled()) {
348 if (isEditionEnabled()) {
349 if (!selected()) {
350 // Force the item to be selected during the edition
351 parentGraphWidget()->parentVisualizationWidget()->selectionZoneManager().setSelected(
352 this, true);
353 }
354
347 auto axis = impl->m_Plot->axisRect()->axis(QCPAxis::atBottom);
355 auto axis = impl->m_Plot->axisRect()->axis(QCPAxis::atBottom);
348 auto pixelDiff = event->pos().x() - startPos.x();
356 auto pixelDiff = event->pos().x() - startPos.x();
349 auto diff = impl->pixelSizeToAxisXSize(pixelDiff);
357 auto diff = impl->pixelSizeToAxisXSize(pixelDiff);
General Comments 4
Under Review
author

Auto status change to "Under Review"

Approved

Status change > Approved

Approved

Status change > Approved

You need to be logged in to leave comments. Login now