Skip to content

Commit

Permalink
A bit harsh in movement, but this fixes the marker and eraser move bugs
Browse files Browse the repository at this point in the history
  • Loading branch information
aliasaria committed Dec 17, 2020
1 parent 9d1aa0d commit cb1475d
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions client/script.js
Original file line number Diff line number Diff line change
Expand Up @@ -762,6 +762,24 @@ function adjustCard(offsets, doSync) {
});
}

//adjusts the marker and eraser after a board resize
function adjustMarker(originalSize, newSize) {
//remove any y positioning. Makes a harsh jump but works as a hack
$("#marker,#eraser").css('top','');
// console.log( "markerleft: " + $('#marker').css('left') );
// console.log( "size: " + newSize.width);

//if either has gone over the edge of the board, just bring it in
if ( parseFloat($('#marker').css('left')) > newSize.width - 100)
{
$('#marker').css('left', newSize.width-100 + 'px' );
}
if ( parseFloat($('#eraser').css('left')) > newSize.width - 100)
{
$('#eraser').css('left', newSize.width-100 + 'px' );
}
}

//////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////

Expand Down Expand Up @@ -944,6 +962,7 @@ $(function() {
$(".board-outline").bind("resizestop", function(event, ui) {
boardResizeHappened(event, ui.size);
adjustCard(offsets, true);
adjustMarker(ui.originalSize, ui.size);
});
})();

Expand Down

1 comment on commit cb1475d

@aliasaria
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixes #128

Please sign in to comment.