started implementing new page feature

This commit is contained in:
Bea 2020-04-15 22:31:09 +02:00
parent 24601c2c6c
commit 3d44b680c4
2 changed files with 12 additions and 2 deletions

View File

@ -379,6 +379,11 @@ $(document).ready(function () {
})
});
// add page
$("#addPageBtn").click(function () {
whiteboard.addPage();
});
// upload json containing steps
$("#uploadJsonBtn").click(function () {
$("#myFile").click();

View File

@ -1,5 +1,6 @@
var whiteboard = {
isMultiTouch: false,
pages: 1,
canvas: null,
ctx: null,
drawcolor: "black",
@ -70,15 +71,15 @@ var whiteboard = {
.append(_this.textContainer)
.append(_this.mouseOverlay);
this.canvas = $("#whiteboardCanvas")[0];
this.canvas.height = $(window).height();
this.canvas.width = $(window).width();
this.canvas.height = $(window).height() * pages;
this.ctx = this.canvas.getContext("2d");
this.oldGCO = this.ctx.globalCompositeOperation;
$(window).resize(function () { //Handle resize
var dbCp = JSON.parse(JSON.stringify(_this.drawBuffer)); //Copy the buffer
_this.canvas.width = $(window).width();
_this.canvas.height = $(window).height(); //Set new canvas height
_this.canvas.height = $(window).height() * pages; //Set new canvas height
_this.drawBuffer = [];
_this.loadData(dbCp); //draw old content in
});
@ -622,6 +623,10 @@ var whiteboard = {
_this.drawBuffer = [];
_this.drawId = 0;
},
addPage: function () {
pages += 1;
},
setStrokeThickness(thickness) {
var _this = this;
_this.thickness = thickness;