Merge branch 'develop' of github.com:Sankore/Sankore-3.1 into claudio-dev

preferencesAboutTextFull
Claudio Valerio 12 years ago
commit 0c555c9ccb
  1. 2
      Sankore_3.1.pro
  2. 17
      resources/library/interactivities/Separe phrase.wgt/scripts/app.js
  3. 35
      src/domain/UBGraphicsDelegateFrame.cpp
  4. 3
      src/domain/UBGraphicsDelegateFrame.h
  5. 7
      src/domain/UBGraphicsStrokesGroup.cpp

@ -11,7 +11,7 @@ CONFIG += debug_and_release \
VERSION_MAJ = 2 VERSION_MAJ = 2
VERSION_MIN = 00 VERSION_MIN = 00
VERSION_TYPE = b # a = alpha, b = beta, r = release, other => error VERSION_TYPE = b # a = alpha, b = beta, r = release, other => error
VERSION_PATCH = 08 VERSION_PATCH = 09
VERSION = "$${VERSION_MAJ}.$${VERSION_MIN}.$${VERSION_TYPE}.$${VERSION_PATCH}" VERSION = "$${VERSION_MAJ}.$${VERSION_MIN}.$${VERSION_TYPE}.$${VERSION_PATCH}"
VERSION = $$replace(VERSION, "\\.r", "") VERSION = $$replace(VERSION, "\\.r", "")

@ -18,6 +18,15 @@ function createElements( phrase )
return s; return s;
} }
function createChain( phrase )
{
var arr = phrase.split(" ");
var result = "";
for( var i = 0; i < arr.length; i++ )
result += '<div class="letterCont">' + createElements(arr[i]) + '</div>';
return result;
}
$(document).ready(function() $(document).ready(function()
{ {
@ -135,9 +144,8 @@ $(document).ready(function()
// store the text // store the text
w.setData( "phrase", phrase ); w.setData( "phrase", phrase );
// remove all dots (they are to be set during the exercise) // remove all dots (they are to be set during the exercise)
phrase = phrase.replace( / /g, '' ); //phrase = phrase.replace( / /g, '' );
// create the html // create the html
if(window.sankore && sankore.preference("ordSplPhrasesState", "") == "1" && flag){ if(window.sankore && sankore.preference("ordSplPhrasesState", "") == "1" && flag){
@ -147,7 +155,7 @@ $(document).ready(function()
flag = false; flag = false;
} }
else else
w.setViewContent( createElements( phrase ) ); w.setViewContent( createChain( phrase ) );
// the behaviour // the behaviour
@ -241,7 +249,7 @@ $(document).ready(function()
if( this.className.indexOf( "fixed" ) != -1 ){ if( this.className.indexOf( "fixed" ) != -1 ){
phrase += ' '; phrase += ' ';
} }
else if( this.className.indexOf( "dash" ) != -1 ){ else if( (this.className.indexOf( "dash" ) != -1) || (this.className.indexOf( "letterCont" ) != -1) ){
return; return;
} }
else{ else{
@ -249,7 +257,6 @@ $(document).ready(function()
phrase += ch; phrase += ch;
} }
}); });
//alert(phrase + " | " + this.getData( "phrase" ))
if( phrase == this.getData( "phrase" ) ){ if( phrase == this.getData( "phrase" ) ){
this.elements.containerView.addClass( "answerRight" ); this.elements.containerView.addClass( "answerRight" );
} }

@ -49,6 +49,8 @@ UBGraphicsDelegateFrame::UBGraphicsDelegateFrame(UBGraphicsItemDelegate* pDelega
, mTotalTranslateX(0) , mTotalTranslateX(0)
, mTotalTranslateY(0) , mTotalTranslateY(0)
, mOperationMode(Scaling) , mOperationMode(Scaling)
, mFlippedX(false)
, mFlippedY(false)
, mMirrorX(false) , mMirrorX(false)
, mMirrorY(false) , mMirrorY(false)
{ {
@ -379,6 +381,12 @@ QSizeF UBGraphicsDelegateFrame::resizeDelegate(qreal moveX, qreal moveY)
return incVector; return incVector;
} }
void UBGraphicsDelegateFrame::scaleByPos(qreal scaleX, qreal scaleY)
{
}
void UBGraphicsDelegateFrame::mouseMoveEvent(QGraphicsSceneMouseEvent *event) void UBGraphicsDelegateFrame::mouseMoveEvent(QGraphicsSceneMouseEvent *event)
{ {
if (None == mCurrentTool) if (None == mCurrentTool)
@ -451,6 +459,7 @@ void UBGraphicsDelegateFrame::mouseMoveEvent(QGraphicsSceneMouseEvent *event)
scaleX = -2*mFrameWidth/width; scaleX = -2*mFrameWidth/width;
}else{ }else{
scaleX = -1; scaleX = -1;
mFlippedX = !mFlippedX;
} }
} }
mScaleX = scaleX; mScaleX = scaleX;
@ -480,6 +489,7 @@ void UBGraphicsDelegateFrame::mouseMoveEvent(QGraphicsSceneMouseEvent *event)
scaleY = -2*mFrameWidth/width; scaleY = -2*mFrameWidth/width;
}else{ }else{
scaleY = -1; scaleY = -1;
mFlippedY = !mFlippedY;
} }
} }
mScaleY = scaleY; mScaleY = scaleY;
@ -543,11 +553,34 @@ void UBGraphicsDelegateFrame::mouseMoveEvent(QGraphicsSceneMouseEvent *event)
QPointF ref; QPointF ref;
// we just detects coordinates of corner before and after scaling and then moves object at diff between them. // we just detects coordinates of corner before and after scaling and then moves object at diff between them.
if (resizingBottomRight() && mMirrorX) if (resizingBottomRight() && (mMirrorX || mMirrorY))
{
if (mFlippedX && !mMirrorX && mFlippedY)// && !mMirrorY)
{
mTranslateX += mInitialTransform.map(delegated()->boundingRect().bottomLeft()).x() - tr.map(delegated()->boundingRect().bottomLeft()).x();
mTranslateY += mInitialTransform.map(delegated()->boundingRect().bottomLeft()).y() - tr.map(delegated()->boundingRect().bottomLeft()).y();
}
else if ((mFlippedX || mMirrorX) && (mFlippedY || mMirrorY))
{
mTranslateX += mInitialTransform.map(delegated()->boundingRect().bottomRight()).x() - tr.map(delegated()->boundingRect().bottomRight()).x();
mTranslateY += mInitialTransform.map(delegated()->boundingRect().bottomRight()).y() - tr.map(delegated()->boundingRect().bottomRight()).y();
}
else if (mFlippedX || mMirrorX)
{
mTranslateX += mInitialTransform.map(delegated()->boundingRect().topRight()).x() - tr.map(delegated()->boundingRect().topRight()).x();
mTranslateY += mInitialTransform.map(delegated()->boundingRect().topRight()).y() - tr.map(delegated()->boundingRect().topRight()).y();
}
else if (mFlippedY || mMirrorY)
{
mTranslateX += mInitialTransform.map(delegated()->boundingRect().bottomLeft()).x() - tr.map(delegated()->boundingRect().bottomLeft()).x();
mTranslateY += mInitialTransform.map(delegated()->boundingRect().bottomLeft()).y() - tr.map(delegated()->boundingRect().bottomLeft()).y();
}
else
{ {
mTranslateX += mInitialTransform.map(delegated()->boundingRect().bottomRight()).x() - tr.map(delegated()->boundingRect().bottomRight()).x(); mTranslateX += mInitialTransform.map(delegated()->boundingRect().bottomRight()).x() - tr.map(delegated()->boundingRect().bottomRight()).x();
mTranslateY += mInitialTransform.map(delegated()->boundingRect().bottomRight()).y() - tr.map(delegated()->boundingRect().bottomRight()).y(); mTranslateY += mInitialTransform.map(delegated()->boundingRect().bottomRight()).y() - tr.map(delegated()->boundingRect().bottomRight()).y();
} }
}
else else
{ {
mTranslateX += mInitialTransform.map(delegated()->boundingRect().topLeft()).x() - tr.map(delegated()->boundingRect().topLeft()).x(); mTranslateX += mInitialTransform.map(delegated()->boundingRect().topLeft()).x() - tr.map(delegated()->boundingRect().topLeft()).x();

@ -40,6 +40,7 @@ class UBGraphicsDelegateFrame: public QGraphicsRectItem, public QObject
QPointF getFixedPointFromPos(); QPointF getFixedPointFromPos();
QSizeF getResizeVector(qreal moveX, qreal moveY); QSizeF getResizeVector(qreal moveX, qreal moveY);
QSizeF resizeDelegate(qreal moveX, qreal moveY); QSizeF resizeDelegate(qreal moveX, qreal moveY);
void scaleByPos(qreal scaleX, qreal scaleY);
virtual void mouseMoveEvent(QGraphicsSceneMouseEvent *event); virtual void mouseMoveEvent(QGraphicsSceneMouseEvent *event);
virtual void mouseReleaseEvent(QGraphicsSceneMouseEvent *event); virtual void mouseReleaseEvent(QGraphicsSceneMouseEvent *event);
@ -124,6 +125,8 @@ class UBGraphicsDelegateFrame: public QGraphicsRectItem, public QObject
OperationMode mOperationMode; OperationMode mOperationMode;
QGraphicsItem* delegated(); QGraphicsItem* delegated();
bool mFlippedX;
bool mFlippedY;
bool mMirrorX; bool mMirrorX;
bool mMirrorY; bool mMirrorY;
bool mResizing; bool mResizing;

@ -124,8 +124,13 @@ UBItem* UBGraphicsStrokesGroup::deepCopy() const
UBGraphicsPolygonItem *polygon = dynamic_cast<UBGraphicsPolygonItem*>(child); UBGraphicsPolygonItem *polygon = dynamic_cast<UBGraphicsPolygonItem*>(child);
if (polygon){ if (polygon){
QGraphicsItem* pItem = dynamic_cast<QGraphicsItem*>(polygon->deepCopy()); UBGraphicsPolygonItem *polygonCopy = dynamic_cast<UBGraphicsPolygonItem*>(polygon->deepCopy());
if (polygonCopy)
{
QGraphicsItem* pItem = dynamic_cast<QGraphicsItem*>(polygonCopy);
copy->addToGroup(pItem); copy->addToGroup(pItem);
polygonCopy->setStrokesGroup(copy);
}
} }
} }

Loading…
Cancel
Save