Skip to content

Commit

Permalink
Fixing Codacy nitpicks in JS
Browse files Browse the repository at this point in the history
  • Loading branch information
jonoomph committed Sep 30, 2024
1 parent 6dc4364 commit a2051ca
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 10 deletions.
1 change: 0 additions & 1 deletion src/timeline/js/directives/ruler.js
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,6 @@ App.directive("tlScrollableTracks", function () {
// Pans the timeline (on middle mouse click and drag)
element.on("mousemove", function (e) {
if (is_scrolling) {
console.log("scope.getTimelineWidth(0): " + scope.getTimelineWidth(0));
var difference = {x: starting_mouse_position.x - e.pageX, y: starting_mouse_position.y - e.pageY};
var newPos = {
x: Math.max(0, Math.min(starting_scrollbar.x + difference.x, scope.getTimelineWidth(0) - element.width())),
Expand Down
18 changes: 9 additions & 9 deletions src/timeline/js/directives/track.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,10 @@
* along with OpenShot Library. If not, see <http://www.gnu.org/licenses/>.
*/


App.directive('tlTrack', function () {
/* global App, timeline, snapToFPSGridTime pixelToTime */
App.directive("tlTrack", function () {
return {
restrict: 'A',
restrict: "A",
link: function (scope, element) {
var startX, startWidth, isResizing = false, newDuration, minimumWidth;

Expand All @@ -39,7 +39,7 @@ App.directive('tlTrack', function () {
};

// Delegate the mousedown event to the parent element for dynamically created resize-handle
element.on('mousedown', '.track-resize-handle', function(event) {
element.on("mousedown", ".track-resize-handle", function(event) {
// Start resizing logic
isResizing = true;
startX = event.pageX;
Expand All @@ -49,8 +49,8 @@ App.directive('tlTrack', function () {
minimumWidth = getFurthestRightEdge() * scope.pixelsPerSecond;

// Attach document-wide mousemove and mouseup events
$(document).on('mousemove', resizeTrack);
$(document).on('mouseup', stopResizing);
$(document).on("mousemove", resizeTrack);
$(document).on("mouseup", stopResizing);
event.preventDefault();
});

Expand All @@ -75,12 +75,12 @@ App.directive('tlTrack', function () {

// Function to stop resizing when the mouse button is released
function stopResizing() {
if (!isResizing) return;
if (!isResizing) {return;}
isResizing = false;

// Clean up the document-wide event listeners
$(document).off('mousemove', resizeTrack);
$(document).off('mouseup', stopResizing);
$(document).off("mousemove", resizeTrack);
$(document).off("mouseup", stopResizing);

// Finalize the new duration on the timeline (if valid)
if (newDuration !== null) {
Expand Down

0 comments on commit a2051ca

Please sign in to comment.