summaryrefslogtreecommitdiff
path: root/svx/source
diff options
context:
space:
mode:
authorTomaž Vajngerl <quikee@gmail.com>2013-07-27 14:32:46 +0200
committerTomaž Vajngerl <quikee@gmail.com>2013-07-28 11:49:53 +0200
commitfbd059fb60fc0afca20eec7ea26e0ae9beb384e4 (patch)
tree2f9dd3253de47174311d01d1dfb4e02a09b1e0c5 /svx/source
parent1fc099999313d61159ea45f02d80a1bf1b913fbe (diff)
fdo#38144 Fix calculation of tick size in snapping to frame margin
Change-Id: I36aa24880f28cb011e0b48e3b817c97a28475119
Diffstat (limited to 'svx/source')
-rw-r--r--svx/source/dialog/svxruler.cxx9
1 files changed, 6 insertions, 3 deletions
diff --git a/svx/source/dialog/svxruler.cxx b/svx/source/dialog/svxruler.cxx
index 41e377f9fbe8..1c9021eba109 100644
--- a/svx/source/dialog/svxruler.cxx
+++ b/svx/source/dialog/svxruler.cxx
@@ -434,18 +434,21 @@ SvxRuler::~SvxRuler()
long SvxRuler::MakePositionSticky(long aPosition, bool aSnapToFrameMargin) const
{
- long aLeftFramePosition = ConvertHPosPixel(GetLeftFrameMargin());
+ long aLeftFramePosition = ConvertHPosPixel(GetLeftFrameMargin());
long aRightFramePosition = ConvertHPosPixel(GetRightFrameMargin());
+
long aTick = GetCurrentRulerUnit().nTick1;
+ long aTickPixel = pEditWin->LogicToPixel(Size(0, aTick), GetCurrentMapMode()).Height();
long aHalfTick = aTick / 2;
+ long aHalfTickPixel = aTickPixel / 2;
if (aSnapToFrameMargin)
{
- if (aPosition > aLeftFramePosition - aHalfTick && aPosition < aLeftFramePosition + aHalfTick)
+ if (aPosition > aLeftFramePosition - aHalfTickPixel && aPosition < aLeftFramePosition + aHalfTickPixel)
{
return aLeftFramePosition;
}
- else if (aPosition > aRightFramePosition - aHalfTick && aPosition < aRightFramePosition + aHalfTick)
+ else if (aPosition > aRightFramePosition - aHalfTickPixel && aPosition < aRightFramePosition + aHalfTickPixel)
{
return aRightFramePosition;
}