|
|
@ -629,9 +629,9 @@ bool UBGraphicsScene::inputDeviceRelease() |
|
|
|
|
|
|
|
|
|
|
|
if (mCurrentStroke && mCurrentStroke->polygons().empty()){ |
|
|
|
if (mCurrentStroke && mCurrentStroke->polygons().empty()){ |
|
|
|
delete mCurrentStroke; |
|
|
|
delete mCurrentStroke; |
|
|
|
mCurrentStroke = NULL; |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
mCurrentStroke = NULL; |
|
|
|
return accepted; |
|
|
|
return accepted; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -794,7 +794,7 @@ void UBGraphicsScene::eraseLineTo(const QPointF &pEndPoint, const qreal &pWidth) |
|
|
|
{ |
|
|
|
{ |
|
|
|
#pragma omp critical |
|
|
|
#pragma omp critical |
|
|
|
{ |
|
|
|
{ |
|
|
|
// Compele remove item
|
|
|
|
// Compete remove item
|
|
|
|
intersectedItems << pi; |
|
|
|
intersectedItems << pi; |
|
|
|
intersectedPolygons << QList<QPolygonF>(); |
|
|
|
intersectedPolygons << QList<QPolygonF>(); |
|
|
|
} |
|
|
|
} |
|
|
@ -813,30 +813,29 @@ void UBGraphicsScene::eraseLineTo(const QPointF &pEndPoint, const qreal &pWidth) |
|
|
|
|
|
|
|
|
|
|
|
for(int i=0; i<intersectedItems.size(); i++) |
|
|
|
for(int i=0; i<intersectedItems.size(); i++) |
|
|
|
{ |
|
|
|
{ |
|
|
|
if (intersectedPolygons[i].empty()) |
|
|
|
// item who intersects with eraser
|
|
|
|
{ |
|
|
|
UBGraphicsPolygonItem *intersectedPolygonItem = intersectedItems[i]; |
|
|
|
removeItem(intersectedItems[i]); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
else |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
UBGraphicsPolygonItem *pi = intersectedItems[i]; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (!intersectedPolygons[i].empty()) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
// intersected polygons generated as QList<QPolygon> QPainterPath::toFillPolygons(),
|
|
|
|
|
|
|
|
// so each intersectedPolygonItem has one or couple of QPolygons who should be removed from it.
|
|
|
|
for(int j = 0; j < intersectedPolygons[i].size(); j++) |
|
|
|
for(int j = 0; j < intersectedPolygons[i].size(); j++) |
|
|
|
{ |
|
|
|
{ |
|
|
|
QPolygonF p = intersectedPolygons[i][j]; |
|
|
|
// create small polygon from couple of polygons to replace particular erased polygon
|
|
|
|
if (j==0) |
|
|
|
UBGraphicsPolygonItem* polygonItem = new UBGraphicsPolygonItem(intersectedPolygons[i][j], intersectedPolygonItem->parentItem()); |
|
|
|
pi->setPolygon(intersectedPolygons[i][j]); |
|
|
|
|
|
|
|
else |
|
|
|
intersectedPolygonItem->copyItemParameters(polygonItem);
|
|
|
|
{ |
|
|
|
polygonItem->setStroke(intersectedPolygonItem->stroke()); |
|
|
|
UBGraphicsPolygonItem* polygonItem = new UBGraphicsPolygonItem(intersectedPolygons[i][j], pi->parentItem()); |
|
|
|
polygonItem->setStrokesGroup(intersectedPolygonItem->strokesGroup()); |
|
|
|
pi->copyItemParameters(polygonItem); |
|
|
|
intersectedPolygonItem->strokesGroup()->addToGroup(polygonItem); |
|
|
|
|
|
|
|
mAddedItems << polygonItem; |
|
|
|
polygonItem->setStroke(pi->stroke()); |
|
|
|
|
|
|
|
polygonItem->setStrokesGroup(pi->strokesGroup()); |
|
|
|
|
|
|
|
pi->strokesGroup()->addToGroup(polygonItem); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//remove full polygon item for replace it by couple of polygons who creates the same stroke without a part which intersects with eraser
|
|
|
|
|
|
|
|
mRemovedItems << intersectedPolygonItem; |
|
|
|
|
|
|
|
removeItem(intersectedPolygonItem); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if (!intersectedItems.empty()) |
|
|
|
if (!intersectedItems.empty()) |
|
|
|