Skip to content

Commit e98b577

Browse files
authored
Merge pull request #62 from godswearhats/hats-dev
Fixes bug #50
2 parents 843d46e + 741e39b commit e98b577

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed

README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,8 @@ The start, rotate and stop callbacks provide the following in the ui argument of
6969
* `element`: The jQuery element being rotated.
7070
* `angle`: An object containing information about the rotation angle, with the following keys:
7171
* `start`: The angle at the begining of the rotation.
72-
* `current`: The current angle of the rotation.
72+
* `current`: The current angle of the rotation in radians.
73+
* `degrees`: The current angle of the rotation in degrees.
7374
* `stop`: The angle at the end of the rotation.
7475

7576
Note that you should define a height and width for anything that you make rotatable, as the rotation happens around the center point of the element, and when you don't define these things, it could look and feel a little a strange. Alternatively, specify the center of rotation as mentioned earlier.

jquery.ui.rotatable.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@
9292
var previousRotateAngle = this.elementCurrentAngle
9393
this.elementCurrentAngle = rotateAngle
9494

95-
// Plugins callbacks need to be called first.
95+
// Plugins callbacks need to be called first.
9696
this._propagate('rotate', event)
9797

9898
if (this._propagate('rotate', event) === false) {
@@ -170,6 +170,7 @@
170170
angle: {
171171
start: this.elementStartAngle,
172172
current: this.elementCurrentAngle,
173+
degrees: this._angleInDegrees(this.elementCurrentAngle),
173174
stop: this.elementStopAngle
174175
}
175176
}
@@ -183,7 +184,7 @@
183184

184185
// calculates the degrees for a given angle in radians
185186
_angleInDegrees: function (radians) {
186-
return radians * 180 / Math.PI
187+
return Math.abs(radians) * 180 / Math.PI
187188
},
188189

189190
// calculates the center of the element

0 commit comments

Comments
 (0)