+ // Consume to avoid pop-ups accidentally closing, when handle is outside of pop-up area
+ return true;
+ }
+
+ // Popup
+
+ float AlternatePopUpPositionRelativeToCursor()
+ {
+ float alternativePosition=0.0f;;
+
+ /*
+ if ( mPrimaryCursor ) // Secondary cursor not used for paste
+ {
+ Cursor cursor = PRIMARY_CURSOR;
+ alternativePosition = mCursor[cursor].position.y;
+ }
+ */
+ const float popupHeight = 120.0f; // todo Set as a MaxSize Property in Control or retrieve from CopyPastePopup class.
+
+ if( mHandle[GRAB_HANDLE].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 ;
+ }
+ else
+ {
+ alternativePosition += popupHeight;
+ }
+
+ return alternativePosition;
+ }
+
+ void PopUpLeavesVerticalBoundary( PropertyNotification& source )
+ {
+ float alternativeYPosition=0.0f;
+ // todo use AlternatePopUpPositionRelativeToSelectionHandles() if text is highlighted
+ // if can't be positioned above, then position below row.
+ alternativeYPosition = AlternatePopUpPositionRelativeToCursor();
+
+ mCopyPastePopup.SetY( alternativeYPosition );
+ }
+
+
+ void SetUpPopUpPositionNotifications( )
+ {
+ // Note Property notifications ignore any set anchor point so conditions must allow for this. Default is Top Left.
+
+ // Exceeding vertical boundary
+
+ Vector4 worldCoordinatesBoundingBox;
+ LocalToWorldCoordinatesBoundingBox( mBoundingBox, worldCoordinatesBoundingBox );
+
+ float popupHeight = mCopyPastePopup.GetRelayoutSize( Dimension::HEIGHT);
+
+ PropertyNotification verticalExceedNotification = mCopyPastePopup.AddPropertyNotification( Actor::Property::WORLD_POSITION_Y,
+ OutsideCondition( worldCoordinatesBoundingBox.y + popupHeight/2,
+ worldCoordinatesBoundingBox.w - popupHeight/2 ) );
+
+ verticalExceedNotification.NotifySignal().Connect( this, &Decorator::Impl::PopUpLeavesVerticalBoundary );