Fixed grab-handle area position 14/37314/4
authorPaul Wisbey <p.wisbey@samsung.com>
Tue, 24 Mar 2015 10:05:29 +0000 (10:05 +0000)
committerPaul Wisbey <p.wisbey@samsung.com>
Tue, 24 Mar 2015 11:38:53 +0000 (11:38 +0000)
Change-Id: I47b564fd3952ae272a6c823957a04a5ef30e8d72

dali-toolkit/internal/text/decorator/text-decorator.cpp
dali-toolkit/internal/text/text-controller.cpp

index 3ec0aa1..d8deaf6 100644 (file)
@@ -326,11 +326,15 @@ struct Decorator::Impl : public ConnectionTracker
       mGrabHandle.SetAnchorPoint( AnchorPoint::TOP_CENTER );
       mGrabHandle.SetDrawMode( DrawMode::OVERLAY );
 
       mGrabHandle.SetAnchorPoint( AnchorPoint::TOP_CENTER );
       mGrabHandle.SetDrawMode( DrawMode::OVERLAY );
 
-      mGrabArea = Actor::New(); // Area that Grab handle responds to, larger than actual handle so easier to move
+      // Area that Grab handle responds to, larger than actual handle so easier to move
 #ifdef DECORATOR_DEBUG
 #ifdef DECORATOR_DEBUG
+      mGrabArea = Toolkit::CreateSolidColorActor( Vector4(1.0f, 0.0f, 0.0f, 0.5f) );
       mGrabArea.SetName( "GrabArea" );
       mGrabArea.SetName( "GrabArea" );
+#else
+      mGrabArea = Actor::New();
 #endif
 #endif
-      mGrabArea.SetPositionInheritanceMode( Dali::USE_PARENT_POSITION );
+      mGrabArea.SetParentOrigin( ParentOrigin::TOP_CENTER );
+      mGrabArea.SetAnchorPoint( AnchorPoint::TOP_CENTER );
       mGrabArea.SetSizeMode( SIZE_RELATIVE_TO_PARENT );
       mGrabArea.SetSizeModeFactor( DEFAULT_GRAB_HANDLE_RELATIVE_SIZE );
       mGrabHandle.Add(mGrabArea);
       mGrabArea.SetSizeMode( SIZE_RELATIVE_TO_PARENT );
       mGrabArea.SetSizeModeFactor( DEFAULT_GRAB_HANDLE_RELATIVE_SIZE );
       mGrabHandle.Add(mGrabArea);
index e3c9ca3..151539c 100644 (file)
@@ -409,11 +409,11 @@ struct Controller::TextInput
       totalHeight += lines[lineIndex].lineSize.height;
       if( y < totalHeight )
       {
       totalHeight += lines[lineIndex].lineSize.height;
       if( y < totalHeight )
       {
-        break;
+        return lineIndex;
       }
     }
 
       }
     }
 
-    return lineIndex;
+    return lineIndex-1;
   }
 
   void GetClosestCursorPosition( CharacterIndex& logical, float& visualX, float& visualY, float& height )
   }
 
   void GetClosestCursorPosition( CharacterIndex& logical, float& visualX, float& visualY, float& height )
@@ -509,7 +509,7 @@ struct Controller::TextInput
 
     float visualX( 0.0f );
     float visualY( 0.0f );
 
     float visualX( 0.0f );
     float visualY( 0.0f );
-    LineIndex lineIndex( 0u );
+    float height( 0.0f );
     const Vector<LineRun>& lineRuns = mVisualModel->mLines;
 
     if( cursorGlyph > 0 )
     const Vector<LineRun>& lineRuns = mVisualModel->mLines;
 
     if( cursorGlyph > 0 )
@@ -521,17 +521,19 @@ struct Controller::TextInput
         visualX += mVisualModel->mGlyphs[ cursorGlyph ].width;
 
       // Find the line height
         visualX += mVisualModel->mGlyphs[ cursorGlyph ].width;
 
       // Find the line height
-      for( GlyphIndex lastGlyph = 0; lineIndex < lineRuns.Count(); ++lineIndex )
+      GlyphIndex lastGlyph( 0 );
+      for( LineIndex lineIndex = 0u; lineIndex < lineRuns.Count(); ++lineIndex )
       {
         lastGlyph = (lineRuns[lineIndex].glyphIndex + lineRuns[lineIndex].numberOfGlyphs);
         if( cursorGlyph < lastGlyph )
         {
       {
         lastGlyph = (lineRuns[lineIndex].glyphIndex + lineRuns[lineIndex].numberOfGlyphs);
         if( cursorGlyph < lastGlyph )
         {
+          height = lineRuns[lineIndex].lineSize.height;
           break;
         }
       }
     }
 
           break;
         }
       }
     }
 
-    mDecorator->SetPosition( PRIMARY_CURSOR, visualX, visualY, lineRuns[lineIndex].lineSize.height );
+    mDecorator->SetPosition( PRIMARY_CURSOR, visualX, visualY, height );
     mDecoratorUpdated = true;
   }
 
     mDecoratorUpdated = true;
   }