Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added an option to allow counter clockwise. #27

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 16 additions & 1 deletion src/roundslider.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@
disabled: false,
keyboardAction: true,
mouseScrollAction: false,
counterClockwise: false,
lineCap: "square",
sliderType: "default",
circleShape: "full",
Expand All @@ -60,7 +61,7 @@
return {
numberType: ["min", "max", "step", "radius", "width", "startAngle"],
booleanType: ["animation", "showTooltip", "editableTooltip", "readOnly", "disabled",
"keyboardAction", "mouseScrollAction"],
"keyboardAction", "mouseScrollAction","counterClockwise"],
stringType: ["sliderType", "circleShape", "handleShape", "lineCap"]
};
},
Expand Down Expand Up @@ -556,6 +557,12 @@

// internal methods
_changeSliderValue: function (value, angle) {
if (this.options.counterClockwise){
value = value * -1;
if (value < 0){
value = 0;
}
}
var oAngle = this._oriAngle(angle), lAngle = this._limitAngle(angle);
if (!this._rangeSlider && !this._showRange) {

Expand Down Expand Up @@ -1186,6 +1193,14 @@

// the options value holds the updated defaults value
this.options = $.extend({}, this.defaults, options);
if (this.options.counterClockwise){
var max = this.options.max;
var min = this.options.min;
console.log(min + " : " + max);
this.options.min = max * -1;
this.options.max = min;
this.options.scope = this.options.scope * -1;
}
if (this._raise("beforeCreate") !== false) {
this._init();
this._raise("create");
Expand Down