diff --git a/src/adaptors/UBSvgSubsetAdaptor.cpp b/src/adaptors/UBSvgSubsetAdaptor.cpp index 80917eab..bc572989 100644 --- a/src/adaptors/UBSvgSubsetAdaptor.cpp +++ b/src/adaptors/UBSvgSubsetAdaptor.cpp @@ -2415,6 +2415,7 @@ UBGraphicsCurtainItem* UBSvgSubsetAdaptor::UBSvgSubsetReader::curtainItemFromSvg QRectF rect = curtainItem->rect(); rect.setWidth(svgWidth.toString().toFloat()); rect.setHeight(svgHeight.toString().toFloat()); + rect.translate(-rect.center()); curtainItem->setRect(rect); diff --git a/src/board/UBBoardView.cpp b/src/board/UBBoardView.cpp index 372eba7e..2eed5112 100644 --- a/src/board/UBBoardView.cpp +++ b/src/board/UBBoardView.cpp @@ -634,18 +634,38 @@ UBBoardView::mouseDoubleClickEvent (QMouseEvent *event) } void -UBBoardView::wheelEvent (QWheelEvent *event) +UBBoardView::wheelEvent (QWheelEvent *wheelEvent) { - if (isInteractive () && event->orientation () == Qt::Vertical) + if (isInteractive () && wheelEvent->orientation () == Qt::Vertical) { // Too many wheelEvent are sent, how should we handle them to "smoothly" zoom ? // something like zoom( pow(zoomFactor, event->delta() / 120) ) + // use DateTime man, store last event time, and if if less than 300ms than this is one big scroll // and move scroll with one const speed. // so, you no will related with scroll event count } -// event->accept (); - QGraphicsView::wheelEvent(event); + + QList selItemsList = scene()->selectedItems(); + // if NO have selected items, than no need process mouse wheel. just exist + if( selItemsList.count() > 0 ) + { + // only one selected item possible, so we will work with first item only + QGraphicsItem * selItem = selItemsList[0]; + + // get items list under mouse cursor + QPointF scenePos = mapToScene(wheelEvent->pos()); + QList itemsList = scene()->items(scenePos); + + QBool isSlectedAndMouseHower = itemsList.contains(selItem); + if(isSlectedAndMouseHower) + { + wheelEvent->accept(); + QGraphicsView::wheelEvent(wheelEvent); + } + + } + } void @@ -895,4 +915,3 @@ UBBoardView::setToolCursor (int tool) } } - diff --git a/src/domain/UBGraphicsItemDelegate.cpp b/src/domain/UBGraphicsItemDelegate.cpp index 5f2d24ad..00f1f200 100644 --- a/src/domain/UBGraphicsItemDelegate.cpp +++ b/src/domain/UBGraphicsItemDelegate.cpp @@ -195,12 +195,12 @@ bool UBGraphicsItemDelegate::weelEvent(QGraphicsSceneWheelEvent *event) { if( mDelegated->isSelected() ) { - event->accept(); +// event->accept(); return true; } else { - event->ignore(); +// event->ignore(); return false; } } diff --git a/src/domain/UBGraphicsProxyWidget.cpp b/src/domain/UBGraphicsProxyWidget.cpp index f3b3cc10..48242b99 100644 --- a/src/domain/UBGraphicsProxyWidget.cpp +++ b/src/domain/UBGraphicsProxyWidget.cpp @@ -105,7 +105,10 @@ void UBGraphicsProxyWidget::mouseReleaseEvent(QGraphicsSceneMouseEvent *event) void UBGraphicsProxyWidget::wheelEvent(QGraphicsSceneWheelEvent *event) { if( mDelegate->weelEvent(event) ) + { QGraphicsProxyWidget::wheelEvent(event); + event->accept(); + } }