boxpointer: don't draw the arrow overlapping the corners

In some circumstances, a boxpointer would draw itself with the arrow
partially overlapping the rounded corner, causing things to not line
up correctly. Don't do that.

And while we're at it, don't draw the pointer very very close to the
corner either, since it looks odd if the corner flows directly into
the arrow.

https://bugzilla.gnome.org/show_bug.cgi?id=635393
This commit is contained in:
Dan Winship 2010-11-22 14:10:42 -05:00
parent eb2ee3f259
commit 6adc12368c

View File

@ -11,7 +11,7 @@ const POPUP_ANIMATION_TIME = 0.15;
/**
* BoxPointer:
* @side: A St.Side type; currently only St.Side.TOP is implemented
* @side: side to draw the arrow on
* @binProperties: Properties to set on contained bin
*
* An actor which displays a triangle "arrow" pointing to a given
@ -272,7 +272,9 @@ BoxPointer.prototype = {
// edge by the same distance as the main part of the box is
// separated from its sourceActor
let primary = global.get_primary_monitor();
let arrowRise = this.actor.get_theme_node().get_length('-arrow-rise');
let themeNode = this.actor.get_theme_node();
let arrowRise = themeNode.get_length('-arrow-rise');
let borderRadius = themeNode.get_length('-arrow-border-radius');
let resX, resY;
@ -298,13 +300,13 @@ BoxPointer.prototype = {
case St.Side.BOTTOM:
switch (alignment) {
case St.Align.START:
resX = sourceX;
resX = sourceX - 2 * borderRadius;
break;
case St.Align.MIDDLE:
resX = sourceX - Math.floor((natWidth - sourceWidth) / 2);
break;
case St.Align.END:
resX = sourceX - (natWidth - sourceWidth);
resX = sourceX - (natWidth - sourceWidth) + 2 * borderRadius;
break;
}
@ -318,13 +320,13 @@ BoxPointer.prototype = {
case St.Side.RIGHT:
switch (alignment) {
case St.Align.START:
resY = sourceY;
resY = sourceY - 2 * borderRadius;
break;
case St.Align.MIDDLE:
resY = sourceY - Math.floor((natHeight - sourceHeight) / 2);
break;
case St.Align.END:
resY = sourceY - (natHeight - sourceHeight);
resY = sourceY - (natHeight - sourceHeight) + 2 * borderRadius;
break;
}