Fix knob control on 2.5.5
This commit is contained in:
parent
86db82170e
commit
c783a1c604
@ -50,6 +50,7 @@ function KnobController($element, $scope, $document) {
|
|||||||
|
|
||||||
vm.value = 0;
|
vm.value = 0;
|
||||||
vm.error = '';
|
vm.error = '';
|
||||||
|
vm.newValue = 0;
|
||||||
|
|
||||||
var knob = angular.element('.knob', $element),
|
var knob = angular.element('.knob', $element),
|
||||||
knobContainer = angular.element('#knob-container', $element),
|
knobContainer = angular.element('#knob-container', $element),
|
||||||
@ -145,9 +146,11 @@ function KnobController($element, $scope, $document) {
|
|||||||
turn(degreeToRatio(currentDeg));
|
turn(degreeToRatio(currentDeg));
|
||||||
rotation = currentDeg;
|
rotation = currentDeg;
|
||||||
startDeg = -1;
|
startDeg = -1;
|
||||||
|
rpcUpdateValue(vm.newValue);
|
||||||
});
|
});
|
||||||
|
|
||||||
knob.on('mousedown touchstart', (e) => {
|
knob.on('mousedown touchstart', (e) => {
|
||||||
|
moving = false;
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
var offset = knob.offset();
|
var offset = knob.offset();
|
||||||
var center = {
|
var center = {
|
||||||
@ -158,7 +161,7 @@ function KnobController($element, $scope, $document) {
|
|||||||
var a, b, deg, tmp,
|
var a, b, deg, tmp,
|
||||||
rad2deg = 180/Math.PI;
|
rad2deg = 180/Math.PI;
|
||||||
|
|
||||||
knob.on('mousemove.rem touchmove.rem', (e) => {
|
$document.on('mousemove.rem touchmove.rem', (e) => {
|
||||||
moving = true;
|
moving = true;
|
||||||
e = (e.originalEvent.touches) ? e.originalEvent.touches[0] : e;
|
e = (e.originalEvent.touches) ? e.originalEvent.touches[0] : e;
|
||||||
|
|
||||||
@ -209,6 +212,9 @@ function KnobController($element, $scope, $document) {
|
|||||||
});
|
});
|
||||||
|
|
||||||
$document.on('mouseup.rem touchend.rem',() => {
|
$document.on('mouseup.rem touchend.rem',() => {
|
||||||
|
if(moving) {
|
||||||
|
rpcUpdateValue(vm.newValue);
|
||||||
|
}
|
||||||
knob.off('.rem');
|
knob.off('.rem');
|
||||||
$document.off('.rem');
|
$document.off('.rem');
|
||||||
rotation = currentDeg;
|
rotation = currentDeg;
|
||||||
@ -269,12 +275,12 @@ function KnobController($element, $scope, $document) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function turn(ratio) {
|
function turn(ratio) {
|
||||||
var value = (vm.minValue + (vm.maxValue - vm.minValue)*ratio).toFixed(vm.ctx.decimals);
|
vm.newValue = (vm.minValue + (vm.maxValue - vm.minValue)*ratio).toFixed(vm.ctx.decimals);
|
||||||
if (canvasBar.value != value) {
|
if (canvasBar.value != vm.newValue) {
|
||||||
canvasBar.value = value;
|
canvasBar.value = vm.newValue;
|
||||||
}
|
}
|
||||||
updateColor(canvasBar.getValueColor());
|
updateColor(canvasBar.getValueColor());
|
||||||
onValue(value);
|
onValue(vm.newValue);
|
||||||
}
|
}
|
||||||
|
|
||||||
function setValue(value) {
|
function setValue(value) {
|
||||||
@ -303,7 +309,7 @@ function KnobController($element, $scope, $document) {
|
|||||||
$scope.$applyAsync(() => {
|
$scope.$applyAsync(() => {
|
||||||
vm.value = formatValue(value);
|
vm.value = formatValue(value);
|
||||||
checkValueSize();
|
checkValueSize();
|
||||||
rpcUpdateValue(value);
|
// rpcUpdateValue(vm.newValue);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user