float captureHeight = 0.0f;
float capturePosX = 0.0f;
float capturePosY = 0.0f;
- float adjustPoxX = 0.0f;
- float adjustPoxY = 0.0f;
+ float adjustPosX = 0.0f;
+ float adjustPosY = 0.0f;
FloatRectangle cursorBounds(0.0f, 0.0f, 0.0f, 0.0f);
FloatRectangle captureBounds(0.0f, 0.0f, 0.0f, 0.0f);
GET_SHAPE_CONFIG(EDIT::COPYPASTE_MAGNIFIER_CAPTURE_POSITION_Y, pEdit->GetOrientation(), capturePosY);
FloatRectangle textObjectBounds = pEditPresenter->GetTextBoundsF();
- captureBounds.x = cursorBounds.x - captureWidth/2.0f;
+
+ // textobject minimum width/height
+ if (pEdit->GetBoundsF().width < textObjectBounds.width)
+ {
+ textObjectBounds.width = pEdit->GetBoundsF().width - pEdit->GetHorizontalMarginF(EDIT_TEXT_LEFT_MARGIN) - pEdit->GetHorizontalMarginF(EDIT_TEXT_RIGHT_MARGIN);
+ }
+
+ captureBounds.x = cursorBounds.x + cursorBounds.width/2.0f - captureWidth/2.0f;
captureBounds.y = cursorBounds.y + cursorBounds.height/2.0f - captureHeight/2.0f;
captureBounds.width = captureWidth;
captureBounds.height = captureHeight;
captureBounds = textObjectBounds.GetIntersection(captureBounds);
- if (captureBounds.width < captureWidth && captureBounds.x < textObjectBounds.x + textObjectBounds.width - captureBounds.width)
+ if ((cursorBounds.x + cursorBounds.width/2.0f) - captureBounds.x < captureWidth/2.0f)
{
- adjustPoxX = captureWidth - captureBounds.width;
+ adjustPosX = captureWidth/2.0f - (cursorBounds.x + cursorBounds.width/2.0f - captureBounds.x);
}
+
if (captureBounds.height < captureHeight && captureBounds.y < captureHeight)
{
- adjustPoxY = captureHeight - captureBounds.height;
+ adjustPosY = captureHeight - captureBounds.height;
}
Bitmap* pOriginalBitmp = pEdit->GetCapturedBitmapN(true);
r = bitmap.Scale(CoordinateSystem::AlignToDevice(FloatDimension(bitmap.GetActualWidth()*1.5f, bitmap.GetActualHeight()*1.5f)));
SysTryCatch(NID_UI_CTRL, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
- canvas.DrawBitmap(CoordinateSystem::AlignToDevice(FloatPoint(capturePosX + adjustPoxX*1.5f, capturePosY + adjustPoxY*1.5f)), bitmap);
+ canvas.DrawBitmap(CoordinateSystem::AlignToDevice(FloatPoint(capturePosX + adjustPosX*1.5f, capturePosY + adjustPosY*1.5f)), bitmap);
delete pOriginalBitmp;