Skip to content

Commit

Permalink
Reverted some of the rounding changes introduced into #49 (Fixes #51).
Browse files Browse the repository at this point in the history
It turns out browsers accept sub-pixel values, but render by truncating the value. This means when we use limited precision the values do not get rounded the same way after the rectangle is repainted. This is what caused the skipping issue in #51.

Also disabled some unecessary logging lines.
  • Loading branch information
atruskie committed Dec 13, 2013
1 parent e52e622 commit 1d7d0a3
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 10 deletions.
4 changes: 2 additions & 2 deletions src/baw.configuration.tpl.js
Original file line number Diff line number Diff line change
Expand Up @@ -154,8 +154,8 @@ angular.module('bawApp.configuration', ['url'])
minAudioDurationSeconds: 2.0
},
unitConverter: {
precisionSeconds: 3,
precisionHertz: 0
precisionSeconds: 9,
precisionHertz: 6

}
});
2 changes: 2 additions & 0 deletions src/common/jquery.drawabox.js
Original file line number Diff line number Diff line change
Expand Up @@ -188,6 +188,8 @@
resize: function (event, ui) { contextData.options.boxResizing($newBox); },
stop: function (event, ui) { contextData.options.boxResized($newBox); }
});
// temporary function used for testing a bug
// window.hack = function(left, top) {$newBox.css({left:left, top:top}); contextData.options.boxMoved($newBox)};
$newBox.draggable({
containment: 'parent',
drag: function (event, ui) { contextData.options.boxMoving($newBox); },
Expand Down
14 changes: 7 additions & 7 deletions src/components/directives/bawAnnotationViewer.js
Original file line number Diff line number Diff line change
Expand Up @@ -483,37 +483,37 @@ bawds.directive('bawAnnotationViewer',
scope.$drawaboxElement.drawabox({
"selectionCallbackTrigger": "mousedown",
"newBox": function (element, newBox) {
drawaboxUpdatesModel(scope, null, newBox, DRAWABOX_ACTION_CREATE);
console.log("newBox", newBox, false);
drawaboxUpdatesModel(scope, null, newBox, DRAWABOX_ACTION_CREATE);
},
"boxSelected": function (element, selectedBox) {
console.log("boxSelected", selectedBox);
//console.log("boxSelected", selectedBox);
drawaboxUpdatesModel(scope, scope.model.audioEvents[element[0].annotationViewerIndex],
selectedBox,
DRAWABOX_ACTION_SELECT, true);
},
"boxResizing": function (element, box) {
console.log("boxResizing");
//console.log("boxResizing");
drawaboxUpdatesModel(scope, scope.model.audioEvents[element[0].annotationViewerIndex], box,
DRAWABOX_ACTION_RESIZE_OR_MOVE, true);
},
"boxResized": function (element, box) {
console.log("boxResized");
//console.log("boxResized");
drawaboxUpdatesModel(scope, scope.model.audioEvents[element[0].annotationViewerIndex], box,
DRAWABOX_ACTION_RESIZE_OR_MOVE, false);
},
"boxMoving": function (element, box) {
console.log("boxMoving");
//console.log("boxMoving");
drawaboxUpdatesModel(scope, scope.model.audioEvents[element[0].annotationViewerIndex], box,
DRAWABOX_ACTION_RESIZE_OR_MOVE, true);
},
"boxMoved": function (element, box) {
console.log("boxMoved");
//console.log("boxMoved");
drawaboxUpdatesModel(scope, scope.model.audioEvents[element[0].annotationViewerIndex], box,
DRAWABOX_ACTION_RESIZE_OR_MOVE, false);
},
"boxDeleted": function (element, deletedBox) {
console.log("boxDeleted");
//console.log("boxDeleted");
// TODO: delete index bound watcher... do not change array layout, keep it sparse...
// ...but only after server operation is a success
drawaboxUpdatesModel(scope, scope.model.audioEvents[element[0].annotationViewerIndex],
Expand Down
2 changes: 1 addition & 1 deletion src/components/services/unitConverter.js
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ uc.factory("bawApp.unitConverter", ['conf.constants', function (constants) {
}
}

console.debug("unitConverter:calculateUnitConversions: unit update calculated successfully");
//console.debug("unitConverter:calculateUnitConversions: unit update calculated successfully");
return result;
}

Expand Down

0 comments on commit 1d7d0a3

Please sign in to comment.