Corrected an issue with the compass as objects

preferencesAboutTextFull
shibakaneki 13 years ago
parent ef45f3fce3
commit f37ba1b39f
  1. 47
      src/domain/UBGraphicsScene.cpp

@ -508,10 +508,31 @@ bool UBGraphicsScene::inputDeviceRelease()
UBDrawingController *dc = UBDrawingController::drawingController();
// TODO: Find a way to detect that we just did a compass drawing and replace the mArcPolygonItem just below
if (dc->isDrawingTool() || mDrawWithCompass)
{
if (mCurrentStroke)
if(mArcPolygonItem){
if(eDrawingMode_Vector == dc->drawingMode()){
UBGraphicsStrokesGroup* pStrokes = new UBGraphicsStrokesGroup();
// Add the arc
mAddedItems.remove(mArcPolygonItem);
removeItem(mArcPolygonItem);
UBCoreGraphicsScene::removeItemFromDeletion(mArcPolygonItem);
pStrokes->addToGroup(mArcPolygonItem);
// Add the center cross
foreach(QGraphicsItem* item, mAddedItems){
removeItem(item);
UBCoreGraphicsScene::removeItemFromDeletion(item);
pStrokes->addToGroup(item);
}
mAddedItems.clear();
mAddedItems << pStrokes;
addItem(pStrokes);
mDrawWithCompass = false;
}
}else if (mCurrentStroke)
{
if(eDrawingMode_Vector == dc->drawingMode()){
UBGraphicsStrokesGroup* pStrokes = new UBGraphicsStrokesGroup();
@ -535,28 +556,6 @@ bool UBGraphicsScene::inputDeviceRelease()
delete mCurrentStroke;
mCurrentStroke = 0;
}
}else if(mArcPolygonItem){
if(eDrawingMode_Vector == dc->drawingMode()){
UBGraphicsStrokesGroup* pStrokes = new UBGraphicsStrokesGroup();
// Add the arc
mAddedItems.remove(mArcPolygonItem);
removeItem(mArcPolygonItem);
UBCoreGraphicsScene::removeItemFromDeletion(mArcPolygonItem);
pStrokes->addToGroup(mArcPolygonItem);
// Add the center cross
foreach(QGraphicsItem* item, mAddedItems){
removeItem(item);
UBCoreGraphicsScene::removeItemFromDeletion(item);
pStrokes->addToGroup(item);
}
mAddedItems.clear();
mAddedItems << pStrokes;
addItem(pStrokes);
mDrawWithCompass = false;
}
}
}

Loading…
Cancel
Save