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

Fix scrollbar size #71

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
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
4 changes: 4 additions & 0 deletions client-data/board.css
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@ html, body, svg {
font-family: Liberation sans, sans-serif;
}

#board {
overflow: hidden;
}

#canvas {
transform-origin: 0 0;
}
Expand Down
14 changes: 11 additions & 3 deletions client-data/js/board.js
Original file line number Diff line number Diff line change
Expand Up @@ -377,14 +377,22 @@ function updateDocumentTitle() {
//List of hook functions that will be applied to messages before sending or drawing them
function resizeCanvas(m) {
//Enlarge the canvas whenever something is drawn near its border
var x = m.x | 0, y = m.y | 0
var x = m.x | 0, y = m.y | 0;
var MAX_BOARD_SIZE = 65536; // Maximum value for any x or y on the board
if (x > Tools.svg.width.baseVal.value - 2000) {
Tools.svg.width.baseVal.value = Math.min(x + 2000, MAX_BOARD_SIZE);
}
if (y > Tools.svg.height.baseVal.value - 2000) {
Tools.svg.height.baseVal.value = Math.min(y + 2000, MAX_BOARD_SIZE);
}
resizeBoard();
}

function resizeBoard() {
// Update board container size
var board = document.getElementById("board");
board.style.width = Tools.svg.width.baseVal.value * Tools.getScale() + "px";
board.style.height = Tools.svg.height.baseVal.value * Tools.getScale() + "px";
}

function updateUnreadCount(m) {
Expand All @@ -408,10 +416,10 @@ Tools.setScale = function setScale(scale) {
}, 1000);
Tools.scale = scale;
return scale;
}
};
Tools.getScale = function getScale() {
return Tools.scale;
}
};

//List of hook functions that will be applied to tools before adding them
Tools.toolHooks = [
Expand Down
1 change: 1 addition & 0 deletions client-data/tools/zoom/zoom.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@
origin.scrollX + origin.x * (newScale - oldScale),
origin.scrollY + origin.y * (newScale - oldScale)
);
resizeBoard();
}

var animation = null;
Expand Down