mirror of
https://github.com/gyurix1968/guacamole-client.git
synced 2025-09-06 13:17:41 +00:00
Refactor arc to include drawing direction.
This commit is contained in:
@@ -289,8 +289,9 @@ Guacamole.Client = function(tunnel) {
|
|||||||
var radius = parseInt(parameters[3]);
|
var radius = parseInt(parameters[3]);
|
||||||
var startAngle = parseFloat(parameters[4]);
|
var startAngle = parseFloat(parameters[4]);
|
||||||
var endAngle = parseFloat(parameters[5]);
|
var endAngle = parseFloat(parameters[5]);
|
||||||
|
var negative = parseInt(parameters[6]);
|
||||||
|
|
||||||
layer.arc(x, y, radius, startAngle, endAngle);
|
layer.arc(x, y, radius, startAngle, endAngle, negative != 0);
|
||||||
|
|
||||||
},
|
},
|
||||||
|
|
||||||
|
@@ -619,10 +619,7 @@ Guacamole.Layer = function(width, height) {
|
|||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Add the specified arc to the current path. Drawing direction is
|
* Add the specified arc to the current path.
|
||||||
* determined by the start and end angles. To draw clockwise, ensure
|
|
||||||
* the end angle is greater than the start angle. To draw counterclockwise,
|
|
||||||
* ensure the end angle is less than the start angle.
|
|
||||||
*
|
*
|
||||||
* @param {Number} x The X coordinate of the center of the circle which
|
* @param {Number} x The X coordinate of the center of the circle which
|
||||||
* will contain the arc.
|
* will contain the arc.
|
||||||
@@ -631,8 +628,10 @@ Guacamole.Layer = function(width, height) {
|
|||||||
* @param {Number} radius The radius of the circle.
|
* @param {Number} radius The radius of the circle.
|
||||||
* @param {Number} startAngle The starting angle of the arc, in radians.
|
* @param {Number} startAngle The starting angle of the arc, in radians.
|
||||||
* @param {Number} endAngle The ending angle of the arc, in radians.
|
* @param {Number} endAngle The ending angle of the arc, in radians.
|
||||||
|
* @param {Boolean} negative Whether the arc should be drawn in order of
|
||||||
|
* decreasing angle.
|
||||||
*/
|
*/
|
||||||
this.arc = function(x, y, radius, startAngle, endAngle) {
|
this.arc = function(x, y, radius, startAngle, endAngle, negative) {
|
||||||
scheduleTask(function() {
|
scheduleTask(function() {
|
||||||
|
|
||||||
// Start a new path if current path is closed
|
// Start a new path if current path is closed
|
||||||
@@ -642,7 +641,7 @@ Guacamole.Layer = function(width, height) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (layer.autosize != 0) fitRect(x, y, 0, 0);
|
if (layer.autosize != 0) fitRect(x, y, 0, 0);
|
||||||
displayContext.arc(x, y, radius, startAngle, endAngle, endAngle < startAngle);
|
displayContext.arc(x, y, radius, startAngle, endAngle, negative);
|
||||||
|
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
Reference in New Issue
Block a user