From 048585128815b69aba51e63ef8b37ffb3860e0f9 Mon Sep 17 00:00:00 2001 From: Em Lazer-Walker Date: Wed, 3 Jun 2020 11:57:58 -0400 Subject: [PATCH 1/3] Add JSDoc comments for additional PaperScope methods --- src/core/PaperScope.js | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/src/core/PaperScope.js b/src/core/PaperScope.js index 02f092002c..d07e3d10bc 100644 --- a/src/core/PaperScope.js +++ b/src/core/PaperScope.js @@ -265,6 +265,19 @@ var PaperScope = Base.extend(/** @lends PaperScope# */{ return this; }, + /** + * Returns a valid HTML canvas you can use. Internally, this may reuse an existing canvas. + * + * This either accepts width and height as two arguments, or you can pass in an object with "width" and "height" properties. + * + * @param {Number|Object} width + * @param {Number} height + * + * @option width {Number} + * @option height {Number} + * + * @returns {HTMLCanvasElement} + */ createCanvas: function(width, height) { return CanvasProvider.getCanvas(width, height); }, @@ -277,9 +290,11 @@ var PaperScope = Base.extend(/** @lends PaperScope# */{ paper = this; }, + /** + * Remove all projects, views and tools. + * This also removes the installed event handlers. + */ clear: function() { - // Remove all projects, views and tools. - // This also removes the installed event handlers. var projects = this.projects, tools = this.tools; for (var i = projects.length - 1; i >= 0; i--) From 5f5ff30b9c2db11a1b7b90557ad3cfbba78a1e10 Mon Sep 17 00:00:00 2001 From: Em Lazer-Walker Date: Thu, 4 Jun 2020 10:36:36 -0400 Subject: [PATCH 2/3] Word-wrap PaperScope JSDocs --- src/core/PaperScope.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/core/PaperScope.js b/src/core/PaperScope.js index d07e3d10bc..37cca4d332 100644 --- a/src/core/PaperScope.js +++ b/src/core/PaperScope.js @@ -266,9 +266,11 @@ var PaperScope = Base.extend(/** @lends PaperScope# */{ }, /** - * Returns a valid HTML canvas you can use. Internally, this may reuse an existing canvas. + * Returns a valid HTML canvas you can use. + * Internally, this may reuse an existing canvas. * - * This either accepts width and height as two arguments, or you can pass in an object with "width" and "height" properties. + * This either accepts width and height as two arguments, or you can pass + * in an object with "width" and "height" properties. * * @param {Number|Object} width * @param {Number} height From 17e6be0ac3f10ad7f628c59288a044929b2af7aa Mon Sep 17 00:00:00 2001 From: Em Lazer-Walker Date: Tue, 9 Jun 2020 15:07:34 -0400 Subject: [PATCH 3/3] Split up createCanvas docs into two separate blocks --- src/core/PaperScope.js | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/src/core/PaperScope.js b/src/core/PaperScope.js index 37cca4d332..aae6dbd612 100644 --- a/src/core/PaperScope.js +++ b/src/core/PaperScope.js @@ -266,20 +266,26 @@ var PaperScope = Base.extend(/** @lends PaperScope# */{ }, /** - * Returns a valid HTML canvas you can use. + * Returns a valid HTML canvas you can use. * Internally, this may reuse an existing canvas. * - * This either accepts width and height as two arguments, or you can pass - * in an object with "width" and "height" properties. - * - * @param {Number|Object} width + * @param {Number} width * @param {Number} height * + * @returns {HTMLCanvasElement} + */ + + /** + * Returns a valid HTML canvas you can use. + * Internally, this may reuse an existing canvas. + * + * @param {Object} options An object containing the canvas width / height + * * @option width {Number} * @option height {Number} * * @returns {HTMLCanvasElement} - */ + */ createCanvas: function(width, height) { return CanvasProvider.getCanvas(width, height); },