popupMenu: Force submenu arrow rotation angles to multiples of 90
When you open or close a PopupSubMenu the arrow icon rotates, but the code previously assumed that the starting angle was a multiple of 90. If you click the submenu fast enough the rotation could overlap with the previous rotation and you'd get something that wasn't a multiple of 90. Now we ensure that the ending arrowRotation angle is always a multiple of 90 regardless of what the starting angle is. https://bugzilla.gnome.org/show_bug.cgi?id=728927
This commit is contained in:
parent
62481f4b7c
commit
dc5618558f
@ -922,8 +922,10 @@ const PopupSubMenu = new Lang.Class({
|
|||||||
let [minHeight, naturalHeight] = this.actor.get_preferred_height(-1);
|
let [minHeight, naturalHeight] = this.actor.get_preferred_height(-1);
|
||||||
this.actor.height = 0;
|
this.actor.height = 0;
|
||||||
this.actor._arrowRotation = this._arrow.rotation_angle_z;
|
this.actor._arrowRotation = this._arrow.rotation_angle_z;
|
||||||
|
let angle = this.actor._arrowRotation;
|
||||||
|
// animate to the first multiple of 90 greater than current angle
|
||||||
Tweener.addTween(this.actor,
|
Tweener.addTween(this.actor,
|
||||||
{ _arrowRotation: this.actor._arrowRotation + 90,
|
{ _arrowRotation: angle - angle % 90 + 90,
|
||||||
height: naturalHeight,
|
height: naturalHeight,
|
||||||
time: 0.25,
|
time: 0.25,
|
||||||
onUpdateScope: this,
|
onUpdateScope: this,
|
||||||
@ -955,8 +957,10 @@ const PopupSubMenu = new Lang.Class({
|
|||||||
|
|
||||||
if (animate) {
|
if (animate) {
|
||||||
this.actor._arrowRotation = this._arrow.rotation_angle_z;
|
this.actor._arrowRotation = this._arrow.rotation_angle_z;
|
||||||
|
let angle = this.actor._arrowRotation;
|
||||||
|
// animate to the first multiple of 90 less than current angle
|
||||||
Tweener.addTween(this.actor,
|
Tweener.addTween(this.actor,
|
||||||
{ _arrowRotation: this.actor._arrowRotation - 90,
|
{ _arrowRotation: (angle - 1) - (angle - 1) % 90,
|
||||||
height: 0,
|
height: 0,
|
||||||
time: 0.25,
|
time: 0.25,
|
||||||
onUpdateScope: this,
|
onUpdateScope: this,
|
||||||
|
Loading…
Reference in New Issue
Block a user