Fix lint errors on _ for files

This commit is contained in:
Paulo Gustavo Veiga 2021-10-04 17:17:02 -07:00
parent 9457ca6047
commit 7e2ef09295
13 changed files with 118 additions and 118 deletions

View File

@ -40,23 +40,23 @@ const Arrow = new Class({
}, },
setFrom(x, y) { setFrom(x, y) {
this._peer.setFrom(x, y); this.peer.setFrom(x, y);
}, },
setControlPoint(point) { setControlPoint(point) {
this._peer.setControlPoint(point); this.peer.setControlPoint(point);
}, },
setStrokeColor(color) { setStrokeColor(color) {
this._peer.setStrokeColor(color); this.peer.setStrokeColor(color);
}, },
setStrokeWidth(width) { setStrokeWidth(width) {
this._peer.setStrokeWidth(width); this.peer.setStrokeWidth(width);
}, },
setDashed(isDashed, length, spacing) { setDashed(isDashed, length, spacing) {
this._peer.setDashed(isDashed, length, spacing); this.peer.setDashed(isDashed, length, spacing);
}, },
}); });

View File

@ -39,82 +39,82 @@ const CurvedLine = new Class({
$assert(!isNaN(x), 'x must be defined'); $assert(!isNaN(x), 'x must be defined');
$assert(!isNaN(y), 'y must be defined'); $assert(!isNaN(y), 'y must be defined');
this._peer.setFrom(x, y); this.peer.setFrom(x, y);
}, },
setTo(x, y) { setTo(x, y) {
$assert(!isNaN(x), 'x must be defined'); $assert(!isNaN(x), 'x must be defined');
$assert(!isNaN(y), 'y must be defined'); $assert(!isNaN(y), 'y must be defined');
this._peer.setTo(x, y); this.peer.setTo(x, y);
}, },
getFrom() { getFrom() {
return this._peer.getFrom(); return this.peer.getFrom();
}, },
getTo() { getTo() {
return this._peer.getTo(); return this.peer.getTo();
}, },
setShowEndArrow(visible) { setShowEndArrow(visible) {
this._peer.setShowEndArrow(visible); this.peer.setShowEndArrow(visible);
}, },
isShowEndArrow() { isShowEndArrow() {
return this._peer.isShowEndArrow(); return this.peer.isShowEndArrow();
}, },
setShowStartArrow(visible) { setShowStartArrow(visible) {
this._peer.setShowStartArrow(visible); this.peer.setShowStartArrow(visible);
}, },
isShowStartArrow() { isShowStartArrow() {
return this._peer.isShowStartArrow(); return this.peer.isShowStartArrow();
}, },
setSrcControlPoint(control) { setSrcControlPoint(control) {
this._peer.setSrcControlPoint(control); this.peer.setSrcControlPoint(control);
}, },
setDestControlPoint(control) { setDestControlPoint(control) {
this._peer.setDestControlPoint(control); this.peer.setDestControlPoint(control);
}, },
getControlPoints() { getControlPoints() {
return this._peer.getControlPoints(); return this.peer.getControlPoints();
}, },
isSrcControlPointCustom() { isSrcControlPointCustom() {
return this._peer.isSrcControlPointCustom(); return this.peer.isSrcControlPointCustom();
}, },
isDestControlPointCustom() { isDestControlPointCustom() {
return this._peer.isDestControlPointCustom(); return this.peer.isDestControlPointCustom();
}, },
setIsSrcControlPointCustom(isCustom) { setIsSrcControlPointCustom(isCustom) {
this._peer.setIsSrcControlPointCustom(isCustom); this.peer.setIsSrcControlPointCustom(isCustom);
}, },
setIsDestControlPointCustom(isCustom) { setIsDestControlPointCustom(isCustom) {
this._peer.setIsDestControlPointCustom(isCustom); this.peer.setIsDestControlPointCustom(isCustom);
}, },
updateLine(avoidControlPointFix) { updateLine(avoidControlPointFix) {
return this._peer.updateLine(avoidControlPointFix); return this.peer.updateLine(avoidControlPointFix);
}, },
setStyle(style) { setStyle(style) {
this._peer.setLineStyle(style); this.peer.setLineStyle(style);
}, },
getStyle() { getStyle() {
return this._peer.getLineStyle(); return this.peer.getLineStyle();
}, },
setDashed(length, spacing) { setDashed(length, spacing) {
this._peer.setDashed(length, spacing); this.peer.setDashed(length, spacing);
}, },
}); });

View File

@ -18,7 +18,7 @@
const Element = new Class({ // eslint-disable-line no-undef const Element = new Class({ // eslint-disable-line no-undef
initialize(peer, attributes) { initialize(peer, attributes) {
this._peer = peer; this.peer = peer;
if (peer == null) { if (peer == null) {
throw new Error('Element peer can not be null'); throw new Error('Element peer can not be null');
} }
@ -60,11 +60,11 @@ const Element = new Class({ // eslint-disable-line no-undef
}, },
setSize(width, height) { setSize(width, height) {
this._peer.setSize(width, height); this.peer.setSize(width, height);
}, },
setPosition(cx, cy) { setPosition(cx, cy) {
this._peer.setPosition(cx, cy); this.peer.setPosition(cx, cy);
}, },
/** /**
@ -78,15 +78,15 @@ const Element = new Class({ // eslint-disable-line no-undef
* *
*/ */
addEvent(type, listener) { addEvent(type, listener) {
this._peer.addEvent(type, listener); this.peer.addEvent(type, listener);
}, },
trigger(type, event) { trigger(type, event) {
this._peer.trigger(type, event); this.peer.trigger(type, event);
}, },
cloneEvents(from) { cloneEvents(from) {
this._peer.cloneEvents(from); this.peer.cloneEvents(from);
}, },
/** /**
* *
@ -100,7 +100,7 @@ const Element = new Class({ // eslint-disable-line no-undef
* This interace will be invoked passing an event as argument and the 'this' referece in the function will be the element. * This interace will be invoked passing an event as argument and the 'this' referece in the function will be the element.
*/ */
removeEvent(type, listener) { removeEvent(type, listener) {
this._peer.removeEvent(type, listener); this.peer.removeEvent(type, listener);
}, },
/** /**
@ -117,7 +117,7 @@ const Element = new Class({ // eslint-disable-line no-undef
* Todo: Doc * Todo: Doc
*/ */
getFill() { getFill() {
return this._peer.getFill(); return this.peer.getFill();
}, },
/** /**
@ -126,15 +126,15 @@ const Element = new Class({ // eslint-disable-line no-undef
* opacity: Opacity of the fill. It must be less than 1. * opacity: Opacity of the fill. It must be less than 1.
*/ */
setFill(color, opacity) { setFill(color, opacity) {
this._peer.setFill(color, opacity); this.peer.setFill(color, opacity);
}, },
getPosition() { getPosition() {
return this._peer.getPosition(); return this.peer.getPosition();
}, },
getNativePosition() { getNativePosition() {
return this._peer.getNativePosition(); return this.peer.getNativePosition();
}, },
/* /*
@ -156,7 +156,7 @@ const Element = new Class({ // eslint-disable-line no-undef
) { ) {
throw new Error(`Unsupported stroke style: '${style}'`); throw new Error(`Unsupported stroke style: '${style}'`);
} }
this._peer.setStroke(width, style, color, opacity); this.peer.setStroke(width, style, color, opacity);
}, },
_attributeNameToFuncName(attributeKey, prefix) { _attributeNameToFuncName(attributeKey, prefix) {
@ -235,42 +235,42 @@ const Element = new Class({ // eslint-disable-line no-undef
* opacity: A value between 0 and 1. * opacity: A value between 0 and 1.
*/ */
setOpacity(opacity) { setOpacity(opacity) {
this._peer.setStroke(null, null, null, opacity); this.peer.setStroke(null, null, null, opacity);
this._peer.setFill(null, opacity); this.peer.setFill(null, opacity);
}, },
setVisibility(isVisible) { setVisibility(isVisible) {
this._peer.setVisibility(isVisible); this.peer.setVisibility(isVisible);
}, },
isVisible() { isVisible() {
return this._peer.isVisible(); return this.peer.isVisible();
}, },
/** /**
* Move the element to the front * Move the element to the front
*/ */
moveToFront() { moveToFront() {
this._peer.moveToFront(); this.peer.moveToFront();
}, },
/** /**
* Move the element to the back * Move the element to the back
*/ */
moveToBack() { moveToBack() {
this._peer.moveToBack(); this.peer.moveToBack();
}, },
getStroke() { getStroke() {
return this._peer.getStroke(); return this.peer.getStroke();
}, },
setCursor(type) { setCursor(type) {
this._peer.setCursor(type); this.peer.setCursor(type);
}, },
getParent() { getParent() {
return this._peer.getParent(); return this.peer.getParent();
}, },
}); });

View File

@ -36,7 +36,7 @@ const Elipse = new Class({
}, },
getSize() { getSize() {
return this._peer.getSize(); return this.peer.getSize();
}, },
}); });

View File

@ -21,18 +21,18 @@ const TransformUtil = require('./peer/utils/TransformUtils').default;
const Font = new Class({ const Font = new Class({
initialize(fontFamily, textPeer) { initialize(fontFamily, textPeer) {
const font = `Toolkit.default.create${fontFamily}Font();`; const font = `Toolkit.default.create${fontFamily}Font();`;
this._peer = eval(font); this.peer = eval(font);
this._textPeer = textPeer; this._textPeer = textPeer;
}, },
getHtmlSize() { getHtmlSize() {
const scale = TransformUtil.workoutScale(this._textPeer); const scale = TransformUtil.workoutScale(this._textPeer);
return this._peer.getHtmlSize(scale); return this.peer.getHtmlSize(scale);
}, },
getGraphSize() { getGraphSize() {
const scale = TransformUtil.workoutScale(this._textPeer); const scale = TransformUtil.workoutScale(this._textPeer);
return this._peer.getGraphSize(scale); return this.peer.getGraphSize(scale);
}, },
getFontScale() { getFontScale() {
@ -40,39 +40,39 @@ const Font = new Class({
}, },
getSize() { getSize() {
return this._peer.getSize(); return this.peer.getSize();
}, },
getStyle() { getStyle() {
return this._peer.getStyle(); return this.peer.getStyle();
}, },
getWeight() { getWeight() {
return this._peer.getWeight(); return this.peer.getWeight();
}, },
getFontFamily() { getFontFamily() {
return this._peer.getFontFamily(); return this.peer.getFontFamily();
}, },
setSize(size) { setSize(size) {
return this._peer.setSize(size); return this.peer.setSize(size);
}, },
setStyle(style) { setStyle(style) {
return this._peer.setStyle(style); return this.peer.setStyle(style);
}, },
setWeight(weight) { setWeight(weight) {
return this._peer.setWeight(weight); return this.peer.setWeight(weight);
}, },
getFont() { getFont() {
return this._peer.getFont(); return this.peer.getFont();
}, },
getWidthMargin() { getWidthMargin() {
return this._peer.getWidthMargin(); return this.peer.getWidthMargin();
}, },
}); });

View File

@ -39,19 +39,19 @@ const Group = new Class({
*/ */
removeChild(element) { removeChild(element) {
if (!$defined(element)) { if (!$defined(element)) {
throw 'Child element can not be null'; throw new Error('Child element can not be null');
} }
if (element == this) { if (element == this) {
throw "It's not possible to add the group as a child of itself"; throw new Error("It's not possible to add the group as a child of itself");
} }
const elementType = element.getType(); const elementType = element.getType();
if (elementType == null) { if (elementType == null) {
throw `It seems not to be an element ->${element}`; throw new Error(`It seems not to be an element ->${element}`);
} }
this._peer.removeChild(element._peer); this.peer.removeChild(element.peer);
}, },
/** /**
@ -59,23 +59,23 @@ const Group = new Class({
*/ */
append(element) { append(element) {
if (!$defined(element)) { if (!$defined(element)) {
throw 'Child element can not be null'; throw Error('Child element can not be null');
} }
if (element == this) { if (element == this) {
throw "It's not posible to add the group as a child of itself"; throw new Error("It's not posible to add the group as a child of itself");
} }
const elementType = element.getType(); const elementType = element.getType();
if (elementType == null) { if (elementType == null) {
throw `It seems not to be an element ->${element}`; throw new Error(`It seems not to be an element ->${element}`);
} }
if (elementType == 'Workspace') { if (elementType == 'Workspace') {
throw 'A group can not have a workspace as a child'; throw new Error('A group can not have a workspace as a child');
} }
this._peer.append(element._peer); this.peer.append(element.peer);
}, },
getType() { getType() {
@ -90,46 +90,46 @@ const Group = new Class({
* they are simple numbers, not CSS length quantities. * they are simple numbers, not CSS length quantities.
*/ */
setCoordSize(width, height) { setCoordSize(width, height) {
this._peer.setCoordSize(width, height); this.peer.setCoordSize(width, height);
}, },
setCoordOrigin(x, y) { setCoordOrigin(x, y) {
this._peer.setCoordOrigin(x, y); this.peer.setCoordOrigin(x, y);
}, },
getCoordOrigin() { getCoordOrigin() {
return this._peer.getCoordOrigin(); return this.peer.getCoordOrigin();
}, },
getSize() { getSize() {
return this._peer.getSize(); return this.peer.getSize();
}, },
setFill(color, opacity) { setFill() {
throw 'Unsupported operation. Fill can not be set to a group'; throw new Error('Unsupported operation. Fill can not be set to a group');
}, },
setStroke(width, style, color, opacity) { setStroke() {
throw 'Unsupported operation. Stroke can not be set to a group'; throw new Error('Unsupported operation. Stroke can not be set to a group');
}, },
getCoordSize() { getCoordSize() {
return this._peer.getCoordSize(); return this.peer.getCoordSize();
}, },
appendDomChild(DomElement) { appendDomChild(DomElement) {
if (!$defined(DomElement)) { if (!$defined(DomElement)) {
throw 'Child element can not be null'; throw new Error('Child element can not be null');
} }
if (DomElement == this) { if (DomElement == this) {
throw "It's not possible to add the group as a child of itself"; throw new Error('Its not possible to add the group as a child of itself');
} }
this._peer._native.append(DomElement); this.peer._native.append(DomElement);
}, },
setOpacity(value) { setOpacity(value) {
this._peer.setOpacity(value); this.peer.setOpacity(value);
}, },
}); });

View File

@ -30,15 +30,15 @@ const Image = new Class({
}, },
setHref(href) { setHref(href) {
this._peer.setHref(href); this.peer.setHref(href);
}, },
getHref() { getHref() {
return this._peer.getHref(); return this.peer.getHref();
}, },
getSize() { getSize() {
return this._peer.getSize(); return this.peer.getSize();
}, },
}); });

View File

@ -34,19 +34,19 @@ const Line = new Class({
}, },
setFrom(x, y) { setFrom(x, y) {
this._peer.setFrom(x, y); this.peer.setFrom(x, y);
}, },
setTo(x, y) { setTo(x, y) {
this._peer.setTo(x, y); this.peer.setTo(x, y);
}, },
getFrom() { getFrom() {
return this._peer.getFrom(); return this.peer.getFrom();
}, },
getTo() { getTo() {
return this._peer.getTo(); return this.peer.getTo();
}, },
/** /**
@ -54,7 +54,7 @@ const Line = new Class({
* Can have values "none | block | classic | diamond | oval | open | chevron | doublechevron" * Can have values "none | block | classic | diamond | oval | open | chevron | doublechevron"
* */ * */
setArrowStyle(startStyle, endStyle) { setArrowStyle(startStyle, endStyle) {
this._peer.setArrowStyle(startStyle, endStyle); this.peer.setArrowStyle(startStyle, endStyle);
}, },
setPosition(cx, cy) { setPosition(cx, cy) {

View File

@ -36,19 +36,19 @@ const PolyLine = new Class({
}, },
setFrom(x, y) { setFrom(x, y) {
this._peer.setFrom(x, y); this.peer.setFrom(x, y);
}, },
setTo(x, y) { setTo(x, y) {
this._peer.setTo(x, y); this.peer.setTo(x, y);
}, },
setStyle(style) { setStyle(style) {
this._peer.setStyle(style); this.peer.setStyle(style);
}, },
getStyle() { getStyle() {
return this._peer.getStyle(); return this.peer.getStyle();
}, },
buildCurvedPath(dist, x1, y1, x2, y2) { buildCurvedPath(dist, x1, y1, x2, y2) {

View File

@ -50,7 +50,7 @@ const Rect = new Class({
}, },
getSize() { getSize() {
return this._peer.getSize(); return this.peer.getSize();
}, },
}); });

View File

@ -30,68 +30,68 @@ const Text = new Class({
}, },
setText(text) { setText(text) {
this._peer.setText(text); this.peer.setText(text);
}, },
setTextAlignment(align) { setTextAlignment(align) {
$assert(align, 'align can not be null'); $assert(align, 'align can not be null');
this._peer.setTextAlignment(align); this.peer.setTextAlignment(align);
}, },
setTextSize(width, height) { setTextSize(width, height) {
this._peer.setContentSize(width, height); this.peer.setContentSize(width, height);
}, },
getText() { getText() {
return this._peer.getText(); return this.peer.getText();
}, },
setFont(font, size, style, weight) { setFont(font, size, style, weight) {
this._peer.setFont(font, size, style, weight); this.peer.setFont(font, size, style, weight);
}, },
setColor(color) { setColor(color) {
this._peer.setColor(color); this.peer.setColor(color);
}, },
getColor() { getColor() {
return this._peer.getColor(); return this.peer.getColor();
}, },
setStyle(style) { setStyle(style) {
this._peer.setStyle(style); this.peer.setStyle(style);
}, },
setWeight(weight) { setWeight(weight) {
this._peer.setWeight(weight); this.peer.setWeight(weight);
}, },
setFontFamily(family) { setFontFamily(family) {
this._peer.setFontFamily(family); this.peer.setFontFamily(family);
}, },
getFont() { getFont() {
return this._peer.getFont(); return this.peer.getFont();
}, },
setSize(size) { setSize(size) {
this._peer.setSize(size); this.peer.setSize(size);
}, },
getHtmlFontSize() { getHtmlFontSize() {
return this._peer.getHtmlFontSize(); return this.peer.getHtmlFontSize();
}, },
getWidth() { getWidth() {
return this._peer.getWidth(); return this.peer.getWidth();
}, },
getHeight() { getHeight() {
return parseInt(this._peer.getHeight()); return parseInt(this.peer.getHeight());
}, },
getFontHeight() { getFontHeight() {
const lines = this._peer.getText().split('\n').length; const lines = this.peer.getText().split('\n').length;
return Math.round(this.getHeight() / lines); return Math.round(this.getHeight() / lines);
}, },
}); });

View File

@ -36,7 +36,7 @@ const Workspace = new Class({
defaultAttributes[key] = attributes[key]; defaultAttributes[key] = attributes[key];
} }
this.parent(peer, defaultAttributes); this.parent(peer, defaultAttributes);
this._htmlContainer.append(this._peer._native); this._htmlContainer.append(this.peer._native);
}, },
getType() { getType() {
@ -59,7 +59,7 @@ const Workspace = new Class({
throw 'A workspace can not have a workspace as a child'; throw 'A workspace can not have a workspace as a child';
} }
this._peer.append(element._peer); this.peer.append(element.peer);
}, },
addItAsChildTo(element) { addItAsChildTo(element) {
@ -102,7 +102,7 @@ const Workspace = new Class({
if ($defined(height)) { if ($defined(height)) {
this._htmlContainer.css('height', height); this._htmlContainer.css('height', height);
} }
this._peer.setSize(width, height); this.peer.setSize(width, height);
}, },
/** /**
@ -113,21 +113,21 @@ const Workspace = new Class({
* they are simple numbers, not CSS length quantities. * they are simple numbers, not CSS length quantities.
*/ */
setCoordSize(width, height) { setCoordSize(width, height) {
this._peer.setCoordSize(width, height); this.peer.setCoordSize(width, height);
}, },
/** /**
* @Todo: Complete Doc * @Todo: Complete Doc
*/ */
setCoordOrigin(x, y) { setCoordOrigin(x, y) {
this._peer.setCoordOrigin(x, y); this.peer.setCoordOrigin(x, y);
}, },
/** /**
* @Todo: Complete Doc * @Todo: Complete Doc
*/ */
getCoordOrigin() { getCoordOrigin() {
return this._peer.getCoordOrigin(); return this.peer.getCoordOrigin();
}, },
// Private method declaration area // Private method declaration area
@ -168,7 +168,7 @@ const Workspace = new Class({
}, },
getCoordSize() { getCoordSize() {
return this._peer.getCoordSize(); return this.peer.getCoordSize();
}, },
/** /**
@ -188,7 +188,7 @@ const Workspace = new Class({
throw `It seems not to be an element ->${element}`; throw `It seems not to be an element ->${element}`;
} }
this._peer.removeChild(element._peer); this.peer.removeChild(element.peer);
}, },
dumpNativeChart() { dumpNativeChart() {

View File

@ -40,7 +40,7 @@
var text = new web2d.Text(); var text = new web2d.Text();
overflowWorkspace.append(text); overflowWorkspace.append(text);
var scale = web2d.TransformUtils.workoutScale(text._peer); var scale = web2d.TransformUtils.workoutScale(text.peer);
text.setText(textval + " " + scale.height); text.setText(textval + " " + scale.height);
text.setFont(font, fontSizeval, style, modifier); text.setFont(font, fontSizeval, style, modifier);
text.setPosition(0, 0); text.setPosition(0, 0);