Started using ES2015 inheritance for the whiteboard models instead of the auxiliary function created by the transpiler.

This commit is contained in:
Maxim Khlobystov 2016-01-13 18:30:58 -05:00
parent e74ebe25fb
commit a844cb9356
7 changed files with 41 additions and 53 deletions

View File

@ -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() {

View File

@ -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);
})();

View File

@ -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);
})();

View File

@ -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;

View File

@ -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);
})();

View File

@ -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);
})();

View File

@ -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;
})();