From a844cb9356e9bb6acc94c2d0e64a07cc5d137728 Mon Sep 17 00:00:00 2001 From: Maxim Khlobystov Date: Wed, 13 Jan 2016 18:30:58 -0500 Subject: [PATCH] Started using ES2015 inheritance for the whiteboard models instead of the auxiliary function created by the transpiler. --- .../whiteboard_models/whiteboard_cursor.js | 7 +++++-- .../whiteboard_models/whiteboard_ellipse.js | 12 ++++-------- .../whiteboard_models/whiteboard_line.js | 14 +++++--------- .../whiteboard_models/whiteboard_poll.js | 18 ++++++++++-------- .../whiteboard_models/whiteboard_rect.js | 17 +++++++++-------- .../whiteboard_models/whiteboard_text.js | 12 ++++-------- .../whiteboard_models/whiteboard_triangle.js | 14 ++++---------- 7 files changed, 41 insertions(+), 53 deletions(-) diff --git a/bigbluebutton-html5/app/client/whiteboard_models/whiteboard_cursor.js b/bigbluebutton-html5/app/client/whiteboard_models/whiteboard_cursor.js index 3841f87e12..f1d8770a8d 100755 --- a/bigbluebutton-html5/app/client/whiteboard_models/whiteboard_cursor.js +++ b/bigbluebutton-html5/app/client/whiteboard_models/whiteboard_cursor.js @@ -1,4 +1,8 @@ -const bind = function(fn, me) { return function() { return fn.apply(me, arguments); }; }; +const bind = function(fn, me) { + return function() { + return fn.apply(me, arguments); + }; +}; this.WhiteboardCursorModel = (function() { class WhiteboardCursorModel { @@ -14,7 +18,6 @@ this.WhiteboardCursorModel = (function() { this.color = "#ff6666"; } this.cursor = null; - this.paper; } draw() { diff --git a/bigbluebutton-html5/app/client/whiteboard_models/whiteboard_ellipse.js b/bigbluebutton-html5/app/client/whiteboard_models/whiteboard_ellipse.js index 2e46a0a226..25d2c9d259 100755 --- a/bigbluebutton-html5/app/client/whiteboard_models/whiteboard_ellipse.js +++ b/bigbluebutton-html5/app/client/whiteboard_models/whiteboard_ellipse.js @@ -1,12 +1,8 @@ -const extend = function(child, parent) { for (let key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; }, hasProp = {}.hasOwnProperty; - -this.WhiteboardEllipseModel = (function(superClass) { - extend(WhiteboardEllipseModel, superClass); - - class WhiteboardEllipseModel { +this.WhiteboardEllipseModel = (function() { + class WhiteboardEllipseModel extends WhiteboardToolModel { constructor(paper) { + super(paper); this.paper = paper; - WhiteboardEllipseModel.__super__.constructor.call(this, this.paper); this.definition = [0, 0, 0, 0, "#000", "0px"]; } @@ -94,4 +90,4 @@ this.WhiteboardEllipseModel = (function(superClass) { } return WhiteboardEllipseModel; -})(WhiteboardToolModel); +})(); diff --git a/bigbluebutton-html5/app/client/whiteboard_models/whiteboard_line.js b/bigbluebutton-html5/app/client/whiteboard_models/whiteboard_line.js index 6a1b8d5baa..9b00a48e89 100755 --- a/bigbluebutton-html5/app/client/whiteboard_models/whiteboard_line.js +++ b/bigbluebutton-html5/app/client/whiteboard_models/whiteboard_line.js @@ -1,14 +1,10 @@ -let MAX_PATHS_IN_SEQUENCE, extend = function(child, parent) { for(let key in parent) { if(hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; }, hasProp = {}.hasOwnProperty; +let MAX_PATHS_IN_SEQUENCE = 30; -MAX_PATHS_IN_SEQUENCE = 30; - -this.WhiteboardLineModel = (function(superClass) { - extend(WhiteboardLineModel, superClass); - - class WhiteboardLineModel { +this.WhiteboardLineModel = (function() { + class WhiteboardLineModel extends WhiteboardToolModel { constructor(paper) { + super(paper); this.paper = paper; - WhiteboardLineModel.__super__.constructor.call(this, this.paper); this.definition = ["", "#000", "0px"]; } @@ -98,4 +94,4 @@ this.WhiteboardLineModel = (function(superClass) { } return WhiteboardLineModel; -})(WhiteboardToolModel); +})(); diff --git a/bigbluebutton-html5/app/client/whiteboard_models/whiteboard_poll.js b/bigbluebutton-html5/app/client/whiteboard_models/whiteboard_poll.js index 308e0aefe0..b3f1182d0a 100755 --- a/bigbluebutton-html5/app/client/whiteboard_models/whiteboard_poll.js +++ b/bigbluebutton-html5/app/client/whiteboard_models/whiteboard_poll.js @@ -1,15 +1,17 @@ -let calculateFontAndWidth, getRenderedTextSize, bind = function(fn, me) { return function() { return fn.apply(me, arguments); }; }, extend = function(child, parent) { for (let key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; }, hasProp = {}.hasOwnProperty; +let calculateFontAndWidth, getRenderedTextSize; +let bind = function(fn, me) { + return function() { + return fn.apply(me, arguments); + }; +}; -this.WhiteboardPollModel = (function(superClass) { - extend(WhiteboardPollModel, superClass); - - class WhiteboardPollModel { +this.WhiteboardPollModel = (function() { + class WhiteboardPollModel extends WhiteboardToolModel { constructor(paper1) { + super(paper1); this.paper = paper1; this.make = bind(this.make, this); - WhiteboardPollModel.__super__.constructor.call(this, this.paper); this.definition = [0, 0, 0, 0, "#333333", "2px", "#ffffff"]; - this.paper; } make(startingData) { @@ -192,7 +194,7 @@ this.WhiteboardPollModel = (function(superClass) { } return WhiteboardPollModel; -})(WhiteboardToolModel); +})(); calculateFontAndWidth = function(textArray, calcFontSize, width, height, x, y) { let calculatedData, flag, i, j, k, l, len, line, m, maxDigitWidth, maxLeftWidth, maxLineHeight, maxLineWidth, maxRightWidth, ref, ref1, spanHeight, spanWidth, test; diff --git a/bigbluebutton-html5/app/client/whiteboard_models/whiteboard_rect.js b/bigbluebutton-html5/app/client/whiteboard_models/whiteboard_rect.js index dcb0377391..f55496a93f 100755 --- a/bigbluebutton-html5/app/client/whiteboard_models/whiteboard_rect.js +++ b/bigbluebutton-html5/app/client/whiteboard_models/whiteboard_rect.js @@ -1,15 +1,16 @@ -const bind = function(fn, me) { return function() { return fn.apply(me, arguments); }; }, extend = function(child, parent) { for (let key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; }, hasProp = {}.hasOwnProperty; +const bind = function(fn, me) { + return function() { + return fn.apply(me, arguments); + }; +}; -this.WhiteboardRectModel = (function(superClass) { - extend(WhiteboardRectModel, superClass); - - class WhiteboardRectModel { +this.WhiteboardRectModel = (function() { + class WhiteboardRectModel extends WhiteboardToolModel{ constructor(paper) { + super(paper); this.paper = paper; this.make = bind(this.make, this); - WhiteboardRectModel.__super__.constructor.call(this, this.paper); this.definition = [0, 0, 0, 0, "#000", "0px"]; - this.paper; } make(startingData) { @@ -96,4 +97,4 @@ this.WhiteboardRectModel = (function(superClass) { } return WhiteboardRectModel; -})(WhiteboardToolModel); +})(); diff --git a/bigbluebutton-html5/app/client/whiteboard_models/whiteboard_text.js b/bigbluebutton-html5/app/client/whiteboard_models/whiteboard_text.js index 9ec8fd6b8d..a81e7754ab 100755 --- a/bigbluebutton-html5/app/client/whiteboard_models/whiteboard_text.js +++ b/bigbluebutton-html5/app/client/whiteboard_models/whiteboard_text.js @@ -1,14 +1,10 @@ -const extend = function(child, parent) { for(let key in parent) { if(hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; }, hasProp = {}.hasOwnProperty; - -this.WhiteboardTextModel = (function(superClass) { +this.WhiteboardTextModel = (function() { let checkDashPosition, checkWidth; - extend(WhiteboardTextModel, superClass); - - class WhiteboardTextModel { + class WhiteboardTextModel extends WhiteboardToolModel { constructor(paper) { + super(paper); this.paper = paper; - WhiteboardTextModel.__super__.constructor.call(this, this.paper); this.definition = [0, 0, 0, 0, "#000", 0, 0, ""]; } @@ -212,4 +208,4 @@ this.WhiteboardTextModel = (function(superClass) { }; return WhiteboardTextModel; -})(WhiteboardToolModel); +})(); diff --git a/bigbluebutton-html5/app/client/whiteboard_models/whiteboard_triangle.js b/bigbluebutton-html5/app/client/whiteboard_models/whiteboard_triangle.js index 4def41fd2b..0739241438 100755 --- a/bigbluebutton-html5/app/client/whiteboard_models/whiteboard_triangle.js +++ b/bigbluebutton-html5/app/client/whiteboard_models/whiteboard_triangle.js @@ -1,12 +1,8 @@ -const extend = function(child, parent) { for(let key in parent) { if(hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; }, hasProp = {}.hasOwnProperty; - -this.WhiteboardTriangleModel = (function(superClass) { - extend(WhiteboardTriangleModel, superClass); - - class WhiteboardTriangleModel { +this.WhiteboardTriangleModel = (function() { + class WhiteboardTriangleModel extends WhiteboardToolModel { constructor(paper) { + super(paper); this.paper = paper; - WhiteboardTriangleModel.__super__.constructor.call(this, this.paper); this.definition = [0, 0, 0, 0, "#000", "0px"]; } @@ -103,6 +99,4 @@ this.WhiteboardTriangleModel = (function(superClass) { } return WhiteboardTriangleModel; -})(WhiteboardToolModel); - -WhiteboardTriangleModel; +})();