mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-10-08 14:51:32 +00:00
enable prefer-const rule for tslint, fix issues (#4409)
* enable prefer-const rule for tslint, fix issues * Update content-node-selector.component.spec.ts * Update content-node-selector.component.spec.ts * fix const * fix lint issues * update tests * update tests * update tests * fix code * fix page class
This commit is contained in:
committed by
Eugenio Romano
parent
26c5982a1a
commit
a7a48e8b2b
@@ -58,14 +58,14 @@ export class RaphaelMultilineTextDirective extends RaphaelBase implements OnInit
|
||||
}
|
||||
|
||||
draw(position: Point, text: string) {
|
||||
let textPaper = this.paper.text(position.x + this.TEXT_PADDING, position.y + this.TEXT_PADDING, text).attr({
|
||||
const textPaper = this.paper.text(position.x + this.TEXT_PADDING, position.y + this.TEXT_PADDING, text).attr({
|
||||
'text-anchor': 'middle',
|
||||
'font-family': 'Arial',
|
||||
'font-size': '11',
|
||||
'fill': '#373e48'
|
||||
});
|
||||
|
||||
let formattedText = this.formatText(textPaper, text, this.elementWidth);
|
||||
const formattedText = this.formatText(textPaper, text, this.elementWidth);
|
||||
textPaper.attr({
|
||||
'text': formattedText
|
||||
});
|
||||
@@ -74,17 +74,18 @@ export class RaphaelMultilineTextDirective extends RaphaelBase implements OnInit
|
||||
}
|
||||
|
||||
private formatText(textPaper, text, elementWidth) {
|
||||
let pText = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ';
|
||||
const pText = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ';
|
||||
textPaper.attr({
|
||||
'text': pText
|
||||
});
|
||||
let letterWidth = textPaper.getBBox().width / text.length;
|
||||
let removedLineBreaks = text.split('\n');
|
||||
let actualRowLength = 0, formattedText = [];
|
||||
const letterWidth = textPaper.getBBox().width / text.length;
|
||||
const removedLineBreaks = text.split('\n');
|
||||
let actualRowLength = 0;
|
||||
const formattedText = [];
|
||||
removedLineBreaks.forEach((sentence) => {
|
||||
let words = sentence.split(' ');
|
||||
const words = sentence.split(' ');
|
||||
words.forEach((word) => {
|
||||
let length = word.length;
|
||||
const length = word.length;
|
||||
if (actualRowLength + (length * letterWidth) > elementWidth) {
|
||||
formattedText.push('\n');
|
||||
actualRowLength = 0;
|
||||
|
Reference in New Issue
Block a user