From 3a411874afce7aacb11383d36cfa5e86ad064aaf Mon Sep 17 00:00:00 2001 From: Victor Cebollada Date: Mon, 5 Oct 2015 14:24:32 +0100 Subject: [PATCH] Change default grab/selection handles. Change-Id: I958f287f5b79a65f0d9250ebc970c8df0752db65 Signed-off-by: Victor Cebollada --- ...r_center.png => cursor_handler_ball_center.png} | Bin dali-toolkit/images/cursor_handler_drop_center.png | Bin 0 -> 3231 bytes ...dle_left.png => selection_handle_ball_left.png} | Bin ...e_right.png => selection_handle_ball_right.png} | Bin dali-toolkit/images/selection_handle_drop_left.png | Bin 0 -> 3230 bytes .../images/selection_handle_drop_right.png | Bin 0 -> 3236 bytes .../controls/text-controls/text-field-impl.cpp | 5 +- .../internal/text/decorator/text-decorator.cpp | 106 ++++++++++++++------- .../internal/text/decorator/text-decorator.h | 17 ++++ .../styles/480x800/dali-toolkit-default-theme.json | 8 +- .../720x1280/dali-toolkit-default-theme.json | 8 +- 11 files changed, 100 insertions(+), 44 deletions(-) rename dali-toolkit/images/{cursor_handler_center.png => cursor_handler_ball_center.png} (100%) create mode 100644 dali-toolkit/images/cursor_handler_drop_center.png rename dali-toolkit/images/{selection_handle_left.png => selection_handle_ball_left.png} (100%) rename dali-toolkit/images/{selection_handle_right.png => selection_handle_ball_right.png} (100%) create mode 100644 dali-toolkit/images/selection_handle_drop_left.png create mode 100644 dali-toolkit/images/selection_handle_drop_right.png diff --git a/dali-toolkit/images/cursor_handler_center.png b/dali-toolkit/images/cursor_handler_ball_center.png similarity index 100% rename from dali-toolkit/images/cursor_handler_center.png rename to dali-toolkit/images/cursor_handler_ball_center.png diff --git a/dali-toolkit/images/cursor_handler_drop_center.png b/dali-toolkit/images/cursor_handler_drop_center.png new file mode 100644 index 0000000000000000000000000000000000000000..a9a2b9ebc642a10454032011fce3be45229daad2 GIT binary patch literal 3231 zcmV;Q3}Ew#P)Oz@Z0f2-7z;ux~O9+4z06=<WDR*FRcSTFz- zW=q650N5=6FiBTtNC2?60Km==3$g$R3;-}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URu-`` zfwUh1S%7u`-FR(mo%6N*Sb{ z&^gbGE_Ep@=bf?#Tr0BJE4t@BU`3R=4+MJSY0;!Az!tsp8K}mHDONR_mvl2iJ69zw z#|X$GjMk8(9ZBPnI_amR2{ZeZdc>YZl#-+oNlQsb3@~6v(sb7Wmc z6^%RpW_<`}3u2>Z9q=G!Dn35h^NmKM2OgyqyPIP|%%q%Sza>jU2@`Qi`ogB9Hl%wViZj|AzRyOTGvWAxuj8D5=`+ z(y0Z9l5UvUr{w#w5W->zfo4~SEEa9Exe_4-SBiS(u>c%&A#?yN6#b-X3U~|D+YqW} z-%iDj!*Udylr$&lo}}xNu4J!%WW{D((rYu@mE$;$<2a7vIF92uj^p$te*rLrD=XKk Rhpqqs002ovPDHLkV1g^k`1t?; literal 0 HcmV?d00001 diff --git a/dali-toolkit/images/selection_handle_left.png b/dali-toolkit/images/selection_handle_ball_left.png similarity index 100% rename from dali-toolkit/images/selection_handle_left.png rename to dali-toolkit/images/selection_handle_ball_left.png diff --git a/dali-toolkit/images/selection_handle_right.png b/dali-toolkit/images/selection_handle_ball_right.png similarity index 100% rename from dali-toolkit/images/selection_handle_right.png rename to dali-toolkit/images/selection_handle_ball_right.png diff --git a/dali-toolkit/images/selection_handle_drop_left.png b/dali-toolkit/images/selection_handle_drop_left.png new file mode 100644 index 0000000000000000000000000000000000000000..d9ed8b8906cce59cb194dcb6d71251c244e0407b GIT binary patch literal 3230 zcmV;P3}N$$P)Oz@Z0f2-7z;ux~O9+4z06=<WDR*FRcSTFz- zW=q650N5=6FiBTtNC2?60Km==3$g$R3;-}uh=nNt1bYBr$Ri_o0EC$U6h`t_Jn<{8 z5a%iY0C<_QJh>z}MS)ugEpZ1|S1ukX&Pf+56gFW3VVXcL!g-k)GJ!M?;PcD?0HBc- z5#WRK{dmp}uFlRjj{U%*%WZ25jX z{P*?XzTzZ-GF^d31o+^>%=Ap99M6&ogks$0k4OBs3;+Bb(;~!4V!2o<6ys46agIcq zjPo+3B8fthDa9qy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eb8wFFT)5#mILDJ*xMhj^zu|E%+?T}t_wg$i?tS9^n>ioi8}KSo_YbVVM6Qv0 zjhBhKZ(t(#+VX0G&hI#1!ovAFo_D$P3_g^y*uAoilZ|3jBX=0d_T`v8CBPEWu~I zZLZNVJeWESOM8csGz0oL6<2W;S8)|raTQl_6<2W;S8)|raTQl_6*qhS0JLBJj8r-2 Q#{d8T07*qoM6N<$f}qL~PXGV_ literal 0 HcmV?d00001 diff --git a/dali-toolkit/images/selection_handle_drop_right.png b/dali-toolkit/images/selection_handle_drop_right.png new file mode 100644 index 0000000000000000000000000000000000000000..f66b26b4acfc76b251d8b46ac45bdb1369ba47d5 GIT binary patch literal 3236 zcmV;V3|sSwP)Oz@Z0f2-7z;ux~O9+4z06=<WDR*FRcSTFz- zW=q650N5=6FiBTtNC2?60Km==3$g$R3;-}uh=nNt1bYBr$Ri_o0EC$U6h`t_Jn<{8 z5a%iY0C<_QJh>z}MS)ugEpZ1|S1ukX&Pf+56gFW3VVXcL!g-k)GJ!M?;PcD?0HBc- z5#WRK{dmp}uFlRjj{U%*%WZ25jX z{P*?XzTzZ-GF^d31o+^>%=Ap99M6&ogks$0k4OBs3;+Bb(;~!4V!2o<6ys46agIcq zjPo+3B8fthDa9qy|77CdEc*jK-!%ZRYCZvbku9iQV*~a}ClFY4z~c7+0P?$U!PF=S z1Au6Q;m>#f??3%Vpd|o+W=WE9003S@Bra6Svp>fO002awfhw>;8}z{#EWidF!3EsG z3;bXU&9EIRU@z1_9W=mEXoiz;4lcq~xDGvV5BgyU zp1~-*fe8db$Osc*A=-!mVv1NJjtCc-h4>-CNCXm#Bp}I%6j35eku^v$Qi@a{RY)E3 zJ#qp$hg?Rwkvqr$GJ^buyhkyVfwECO)C{#lxu`c9ghrwZ&}4KmnvWKso6vH!8a<3Q zq36)6Xb;+tK10Vaz~~qUGsJ8#F2=(`u{bOVlVi)VBCHIn#u~6ztOL7=^<&SmcLWlF zMZgI*1b0FpVIDz9SWH+>*hr`#93(Um+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o z4K@u`jhx2fBXC4{U8Qn{*%*B$Ge=nny$HAYq{=vy|sI0 z_vss+H_qMky?OB#|JK!>IX&II^LlUh#rO5!7TtbwC;iULyV-Xq?ybB}ykGP{?LpZ? z-G|jbTmIbG@7#ZCz;~eY(cDM(28Dyq{*m>M4?_iynUBkc4TkHUI6gT!;y-fz>HMcd z&t%Ugo)`Y2{>!cx7B7DI)$7;J(U{Spm-3gBzioV_{p!H$8L!*M!p0uH$#^p{Ui4P` z?ZJ24cOCDe-w#jZd?0@)|7iKK^;6KN`;!@ylm7$*nDhK&GcDTy000JJOGiWi00000 z0Qp0^e*gdg32;bRa{vGf6951U69E94oEQKA00(qQO+^Ra3Iz=p7u;HY%K!iY)=5M` zRA}Dq*g=SnK^({N&nylO%E^tSoRouXa!}5Slv2vg$=!(yr5qfzCpmLg+d8Pt0a11@ zvet!c2@#PJd$7+qn76h!YZp83ygSXWrl+2s=l_4c{pXqa{U>x?cN^C*5kmN(B89H& zVh91=;A#T>SOr{+G4|b?#|>P;v)bT#>M)K=n63?Ou_kc=4{C(#X#(dkvlie+{_^?5 zc#P}VRvTRJos*cw8LY2mTK-N?a2gM5s9e8x<3289Lv58?tZ5v@+Zy3|PUldXuGPW8 z2OKQzaB{)HbL_#_wY;D#rJXomYvtfOcHmv9%FSntzY(WOPRm!BbDSs%mwQFqg)ODv zW(SaGv=rPR8quw#;O?caJEu04g8MuGtMsMhCO)1y&s?cZT-s<~AY{m~kXFl2r7HIl zw=(6pTLP@#Tb@OZ6X&sEFwReLah2oW@$1A)$$ze=b-0Nms}TD&_NVJmv^)#R3r_xL z-1n&)F9x<$Kld$t*cjqJPQ_8faBv%A{L?rPW1NaB(@c!EnableTextInput( mDecorator ); // Forward input events to controller - EnableGestureDetection( static_cast( Gesture::Tap | Gesture::Pan |Gesture::LongPress ) ); + EnableGestureDetection( static_cast( Gesture::Tap | Gesture::Pan | Gesture::LongPress ) ); GetTapGestureDetector().SetMaximumTapsRequired( 2 ); self.TouchedSignal().Connect( this, &TextField::OnTouched ); @@ -904,6 +904,9 @@ void TextField::OnInitialize() mDecorator->SetBoundingBox( Rect( 0.0f, 0.0f, stageSize.width, stageSize.height ) ); } + // Flip vertically the 'left' selection handle + mDecorator->FlipHandleVertically( LEFT_SELECTION_HANDLE, true ); + // Fill-parent area by default self.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::WIDTH ); self.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::HEIGHT ); diff --git a/dali-toolkit/internal/text/decorator/text-decorator.cpp b/dali-toolkit/internal/text/decorator/text-decorator.cpp index 8d55300..1af079c 100644 --- a/dali-toolkit/internal/text/decorator/text-decorator.cpp +++ b/dali-toolkit/internal/text/decorator/text-decorator.cpp @@ -85,9 +85,6 @@ Integration::Log::Filter* gLogFilter( Integration::Log::Filter::New(Debug::NoLog // Local Data namespace { - -const char* DEFAULT_GRAB_HANDLE_IMAGE_RELEASED( DALI_IMAGE_DIR "cursor_handler_center.png" ); - const int DEFAULT_POPUP_OFFSET( -100.0f ); // Vertical offset of Popup from cursor or handles position. const Dali::Vector3 DEFAULT_GRAB_HANDLE_RELATIVE_SIZE( 1.25f, 1.5f, 1.0f ); @@ -219,6 +216,7 @@ struct Decorator::Impl : public ConnectionTracker active( false ), visible( false ), pressed( false ), + verticallyFlippedPreferred( false ), horizontallyFlipped( false ), verticallyFlipped( false ) { @@ -236,8 +234,9 @@ struct Decorator::Impl : public ConnectionTracker bool active : 1; bool visible : 1; bool pressed : 1; - bool horizontallyFlipped : 1; ///< Whether the handle has been horizontally flipped. - bool verticallyFlipped : 1; ///< Whether the handle has been vertically flipped. + bool verticallyFlippedPreferred : 1; ///< Whether the handle is preferred to be vertically flipped. + bool horizontallyFlipped : 1; ///< Whether the handle has been horizontally flipped. + bool verticallyFlipped : 1; ///< Whether the handle has been vertically flipped. }; struct PopupImpl @@ -623,7 +622,7 @@ struct Decorator::Impl : public ConnectionTracker void SetSelectionHandleMarkerSize( HandleImpl& handle ) { - if ( handle.markerActor ) + if( handle.markerActor ) { handle.markerActor.SetSize( 0, handle.lineHeight ); } @@ -634,11 +633,6 @@ struct Decorator::Impl : public ConnectionTracker HandleImpl& grabHandle = mHandle[GRAB_HANDLE]; if( !grabHandle.actor ) { - if( !mHandleImages[GRAB_HANDLE][HANDLE_IMAGE_RELEASED] ) - { - SetHandleImage( GRAB_HANDLE, HANDLE_IMAGE_RELEASED, ResourceImage::New( DEFAULT_GRAB_HANDLE_IMAGE_RELEASED ) ); - } - grabHandle.actor = ImageActor::New( mHandleImages[GRAB_HANDLE][HANDLE_IMAGE_RELEASED] ); grabHandle.actor.SetSortModifier( DECORATION_DEPTH_INDEX ); grabHandle.actor.SetAnchorPoint( AnchorPoint::TOP_CENTER ); @@ -681,7 +675,7 @@ struct Decorator::Impl : public ConnectionTracker void CreateHandleMarker( HandleImpl& handle, Image& image, HandleType handleType ) { - if ( image ) + if( image ) { handle.markerActor = ImageActor::New( image ); handle.markerActor.SetColor( mHandleColor ); @@ -689,12 +683,12 @@ struct Decorator::Impl : public ConnectionTracker handle.markerActor.SetResizePolicy ( ResizePolicy::FIXED, Dimension::HEIGHT ); - if ( LEFT_SELECTION_HANDLE == handleType ) + if( LEFT_SELECTION_HANDLE == handleType ) { handle.markerActor.SetAnchorPoint( AnchorPoint::BOTTOM_RIGHT ); handle.markerActor.SetParentOrigin( ParentOrigin::TOP_RIGHT ); } - else if ( RIGHT_SELECTION_HANDLE == handleType ) + else if( RIGHT_SELECTION_HANDLE == handleType ) { handle.markerActor.SetAnchorPoint( AnchorPoint::BOTTOM_LEFT ); handle.markerActor.SetParentOrigin( ParentOrigin::TOP_LEFT ); @@ -798,7 +792,10 @@ struct Decorator::Impl : public ConnectionTracker // Check if the grab handle exceeds the boundaries of the decoration box. // At the moment only the height is checked for the grab handle. - grabHandle.verticallyFlipped = ( grabHandleWorldPosition.y + grabHandle.size.height > mBoundingBox.w ); + + grabHandle.verticallyFlipped = ( grabHandle.verticallyFlippedPreferred && + ( ( grabHandleWorldPosition.y - grabHandle.lineHeight - grabHandle.size.height ) > mBoundingBox.y ) ) || + ( grabHandleWorldPosition.y + grabHandle.size.height > mBoundingBox.w ); // The grab handle 'y' position in local coords. // If the grab handle exceeds the bottom of the decoration box, @@ -821,7 +818,7 @@ struct Decorator::Impl : public ConnectionTracker Vector2 handleWorldPosition; CalculateHandleWorldCoordinates( handle, handleWorldPosition ); - // Whether to flip the handle. + // Whether to flip the handle (horizontally). bool flipHandle = isPrimaryHandle ? mFlipLeftSelectionHandleDirection : mFlipRightSelectionHandleDirection; // Whether to flip the handles if they are crossed. @@ -834,6 +831,21 @@ struct Decorator::Impl : public ConnectionTracker // Does not flip if both conditions are true (double flip) flipHandle = flipHandle != ( crossFlip || mHandlePreviousCrossed ); + // Will flip the handles vertically if the user prefers it. + bool verticallyFlippedPreferred = handle.verticallyFlippedPreferred; + + if( crossFlip || mHandlePreviousCrossed ) + { + if( isPrimaryHandle ) + { + verticallyFlippedPreferred = mHandle[RIGHT_SELECTION_HANDLE].verticallyFlippedPreferred; + } + else + { + verticallyFlippedPreferred = mHandle[LEFT_SELECTION_HANDLE].verticallyFlippedPreferred; + } + } + // Check if the selection handle exceeds the boundaries of the decoration box. const bool exceedsLeftEdge = ( isPrimaryHandle ? !flipHandle : flipHandle ) && ( handleWorldPosition.x - handle.size.width < mBoundingBox.x ); @@ -864,7 +876,9 @@ struct Decorator::Impl : public ConnectionTracker } // Whether to flip the handle vertically. - handle.verticallyFlipped = ( handleWorldPosition.y + handle.size.height > mBoundingBox.w ); + handle.verticallyFlipped = ( verticallyFlippedPreferred && + ( ( handleWorldPosition.y - handle.lineHeight - handle.size.height ) > mBoundingBox.y ) ) || + ( handleWorldPosition.y + handle.size.height > mBoundingBox.w ); // The primary selection handle 'y' position in local coords. // If the handle exceeds the bottom of the decoration box, @@ -894,18 +908,27 @@ struct Decorator::Impl : public ConnectionTracker } // Chooses between the released or pressed image. It checks whether the pressed image exists. - const HandleImageType imageType = ( handle.pressed ? ( mHandleImages[type][HANDLE_IMAGE_PRESSED] ? HANDLE_IMAGE_PRESSED : HANDLE_IMAGE_RELEASED ) : HANDLE_IMAGE_RELEASED ); + if( handle.actor ) + { + const HandleImageType imageType = ( handle.pressed ? ( mHandleImages[type][HANDLE_IMAGE_PRESSED] ? HANDLE_IMAGE_PRESSED : HANDLE_IMAGE_RELEASED ) : HANDLE_IMAGE_RELEASED ); - handle.actor.SetImage( mHandleImages[type][imageType] ); + handle.actor.SetImage( mHandleImages[type][imageType] ); + } if( HANDLE_TYPE_COUNT != markerType ) { - const HandleImageType markerImageType = ( handle.pressed ? ( mHandleImages[markerType][HANDLE_IMAGE_PRESSED] ? HANDLE_IMAGE_PRESSED : HANDLE_IMAGE_RELEASED ) : HANDLE_IMAGE_RELEASED ); - handle.markerActor.SetImage( mHandleImages[markerType][markerImageType] ); + if( handle.markerActor ) + { + const HandleImageType markerImageType = ( handle.pressed ? ( mHandleImages[markerType][HANDLE_IMAGE_PRESSED] ? HANDLE_IMAGE_PRESSED : HANDLE_IMAGE_RELEASED ) : HANDLE_IMAGE_RELEASED ); + handle.markerActor.SetImage( mHandleImages[markerType][markerImageType] ); + } } // Whether to flip the handle vertically. - handle.actor.SetOrientation( handle.verticallyFlipped ? ANGLE_180 : ANGLE_0, Vector3::XAXIS ); + if( handle.actor ) + { + handle.actor.SetOrientation( handle.verticallyFlipped ? ANGLE_180 : ANGLE_0, Vector3::XAXIS ); + } } void CreateHighlight() @@ -1196,26 +1219,34 @@ struct Decorator::Impl : public ConnectionTracker float AlternatePopUpPositionRelativeToCursor() { + const float popupHeight = 120.0f; // todo Set as a MaxSize Property in Control or retrieve from CopyPastePopup class. + const float BOTTOM_HANDLE_BOTTOM_OFFSET = 1.5; //todo Should be a property + float alternativePosition=0.0f;; - if ( mPrimaryCursor ) // Secondary cursor not used for paste + if( mPrimaryCursor ) // Secondary cursor not used for paste { - Cursor cursor = PRIMARY_CURSOR; - alternativePosition = mCursor[cursor].position.y; + alternativePosition = mCursor[PRIMARY_CURSOR].position.y + popupHeight; } - const float popupHeight = 120.0f; // todo Set as a MaxSize Property in Control or retrieve from CopyPastePopup class. + const HandleImpl& grabHandle = mHandle[GRAB_HANDLE]; + const HandleImpl& selectionPrimaryHandle = mHandle[LEFT_SELECTION_HANDLE]; + const HandleImpl& selectionSecondaryHandle = mHandle[RIGHT_SELECTION_HANDLE]; - if( mHandle[GRAB_HANDLE].active ) + if( grabHandle.active ) { // If grab handle enabled then position pop-up below the grab handle. - const Vector2 grabHandleSize( 59.0f, 56.0f ); // todo - const float BOTTOM_HANDLE_BOTTOM_OFFSET = 1.5; //todo Should be a property - alternativePosition += grabHandleSize.height + popupHeight + BOTTOM_HANDLE_BOTTOM_OFFSET ; + alternativePosition = grabHandle.position.y + grabHandle.size.height + popupHeight + BOTTOM_HANDLE_BOTTOM_OFFSET; + } - else + else if( selectionPrimaryHandle.active || selectionSecondaryHandle.active ) { - alternativePosition += popupHeight; + const float maxHeight = std::max( selectionPrimaryHandle.size.height, + selectionSecondaryHandle.size.height ); + const float maxY = std::max( selectionPrimaryHandle.position.y, + selectionSecondaryHandle.position.y ); + + alternativePosition = maxY + maxHeight + popupHeight + BOTTOM_HANDLE_BOTTOM_OFFSET; } return alternativePosition; @@ -1231,7 +1262,6 @@ struct Decorator::Impl : public ConnectionTracker mCopyPastePopup.actor.SetY( alternativeYPosition ); } - void SetUpPopupPositionNotifications( ) { // Note Property notifications ignore any set anchor point so conditions must allow for this. Default is Top Left. @@ -1638,6 +1668,16 @@ const Vector2& Decorator::GetPosition( HandleType handleType ) const return mImpl->mHandle[handleType].position; } +void Decorator::FlipHandleVertically( HandleType handleType, bool flip ) +{ + mImpl->mHandle[handleType].verticallyFlippedPreferred = flip; +} + +bool Decorator::IsHandleVerticallyFlipped( HandleType handleType ) const +{ + return mImpl->mHandle[handleType].verticallyFlippedPreferred; +} + void Decorator::FlipSelectionHandlesOnCrossEnabled( bool enable ) { mImpl->mFlipSelectionHandlesOnCross = enable; diff --git a/dali-toolkit/internal/text/decorator/text-decorator.h b/dali-toolkit/internal/text/decorator/text-decorator.h index 4e36fa7..4bcd012 100644 --- a/dali-toolkit/internal/text/decorator/text-decorator.h +++ b/dali-toolkit/internal/text/decorator/text-decorator.h @@ -397,6 +397,23 @@ public: const Vector2& GetPosition( HandleType handleType ) const; /** + * @brief Whether to flip vertically a handle. + * + * @param[in] handleType The handle to flip vertically. + * @param[in] flip Whether to flip vertically. + */ + void FlipHandleVertically( HandleType handleType, bool flip ); + + /** + * @brief Retrieves whether the handle is vertically flipped. + * + * @param[in] handleType The handle to query. + * + * @return @e ture if the handle is vertically flipped. + */ + bool IsHandleVerticallyFlipped( HandleType handleType ) const; + + /** * @brief Whether to flip the selection handles as soon as they are crossed. * * By default they flip when the handle is released. diff --git a/dali-toolkit/styles/480x800/dali-toolkit-default-theme.json b/dali-toolkit/styles/480x800/dali-toolkit-default-theme.json index c45b44e..eee8bcb 100644 --- a/dali-toolkit/styles/480x800/dali-toolkit-default-theme.json +++ b/dali-toolkit/styles/480x800/dali-toolkit-default-theme.json @@ -65,11 +65,9 @@ distributing this software or its derivatives. "secondary-cursor-color":[0.0,0.72,0.9,1.0], "cursor-width":1, "selection-highlight-color":[0.75,0.96,1.0,1.0], - "grab-handle-image": { "filename":"{DALI_IMAGE_DIR}cursor_handler_center.png" }, - "selection-handle-image-left" : {"filename":"{DALI_IMAGE_DIR}selection_handle_left.png" }, - "selection-handle-image-right": {"filename":"{DALI_IMAGE_DIR}selection_handle_right.png" }, - "selection-handle-marker-image-left":{ "filename":"{DALI_IMAGE_DIR}selection_marker_left.png" }, - "selection-handle-marker-image-right":{ "filename":"{DALI_IMAGE_DIR}selection_marker_right.png" } + "grab-handle-image" : "{DALI_IMAGE_DIR}cursor_handler_drop_center.png", + "selection-handle-image-left" : {"filename":"{DALI_IMAGE_DIR}selection_handle_drop_left.png" }, + "selection-handle-image-right": {"filename":"{DALI_IMAGE_DIR}selection_handle_drop_right.png" } }, "textfield-font-size-0": diff --git a/dali-toolkit/styles/720x1280/dali-toolkit-default-theme.json b/dali-toolkit/styles/720x1280/dali-toolkit-default-theme.json index 694e2db..ec1b1c1 100644 --- a/dali-toolkit/styles/720x1280/dali-toolkit-default-theme.json +++ b/dali-toolkit/styles/720x1280/dali-toolkit-default-theme.json @@ -65,11 +65,9 @@ distributing this software or its derivatives. "secondary-cursor-color":[0.0,0.72,0.9,1.0], "cursor-width":3, "selection-highlight-color":[0.75,0.96,1.0,1.0], - "grab-handle-image": { "filename":"{DALI_IMAGE_DIR}cursor_handler_center.png" }, - "selection-handle-image-left" : {"filename":"{DALI_IMAGE_DIR}selection_handle_left.png" }, - "selection-handle-image-right": {"filename":"{DALI_IMAGE_DIR}selection_handle_right.png" }, - "selection-handle-marker-image-left":{ "filename":"{DALI_IMAGE_DIR}selection_marker_left.png" }, - "selection-handle-marker-image-right":{ "filename":"{DALI_IMAGE_DIR}selection_marker_right.png" } + "grab-handle-image" : "{DALI_IMAGE_DIR}cursor_handler_drop_center.png", + "selection-handle-image-left" : {"filename":"{DALI_IMAGE_DIR}selection_handle_drop_left.png" }, + "selection-handle-image-right": {"filename":"{DALI_IMAGE_DIR}selection_handle_drop_right.png" } }, "textfield-font-size-0": -- 2.7.4