Format JS files.

This commit is contained in:
Paulo Gustavo Veiga
2022-07-12 18:58:11 -07:00
parent cf29f4f953
commit 5ee7448d3c
70 changed files with 7930 additions and 1420 deletions

View File

@ -55,9 +55,10 @@ class Grid {
result.style.borderCollapse = 'collapse';
result.style.emptyCells = 'show';
result.style.position = 'absolute';
result.innerHTML = '<table style="table-layout:fixed;border-collapse:collapse;empty-cells:show;"><tbody id="tableBody"></tbody></table>';
result.innerHTML =
'<table style="table-layout:fixed;border-collapse:collapse;empty-cells:show;"><tbody id="tableBody"></tbody></table>';
return result;
}
}
export default Grid ;
export default Grid;

View File

@ -1,7 +1,5 @@
import $ from 'jquery';
import {
Workspace, Arrow, Point,
} from '../../src';
import { Workspace, Arrow, Point } from '../../src';
const workspace = new Workspace({ fillColor: 'green' });
workspace.setSize('200px', '200px');

View File

@ -1,7 +1,5 @@
import $ from 'jquery';
import {
Workspace, CurvedLine, Point,
} from '../../src';
import { Workspace, CurvedLine, Point } from '../../src';
const workspace = new Workspace({ fillColor: 'green' });
workspace.setSize('400px', '400px');

View File

@ -1,8 +1,6 @@
/* eslint-disable no-alert */
import $ from 'jquery';
import {
Workspace, Elipse,
} from '../../src';
import { Workspace, Elipse } from '../../src';
global.$ = $;
@ -55,7 +53,6 @@ MultipleEventHandler.prototype.unRegisterOneListener = function unRegisterOneLis
}
};
// Workspace with CoordOrigin(100,100);
const workspace = new Workspace();
workspace.setSize('150px', '150px');

View File

@ -1,7 +1,5 @@
import $ from 'jquery';
import {
Workspace, Text,
} from '../../src';
import { Workspace, Text } from '../../src';
global.$ = $;
@ -51,5 +49,9 @@ function alignments(text, family, elemId) {
// Multine tests and alingments .. ...
['Arial', 'Tahoma', 'Verdana', 'Times', 'Brush Script MT'].forEach((fontName, i) => {
alignments('This multine text.\nThis is the long line just because :)\nShort line', fontName, `amulti${i}`);
alignments(
'This multine text.\nThis is the long line just because :)\nShort line',
fontName,
`amulti${i}`,
);
});

View File

@ -1,8 +1,6 @@
/* eslint-disable no-alert */
import $ from 'jquery';
import {
Toolkit, Workspace, Line, Group, Elipse,
} from '../../src';
import { Toolkit, Workspace, Line, Group, Elipse } from '../../src';
global.$ = $;
@ -58,7 +56,7 @@ const basicTest = () => {
// Logger.logMsg("Moving group x,y:"+ x + "," + y);
group.setPosition(x, y);
};
// executer.periodical(100);
// executer.periodical(100);
};
basicTest();
@ -68,7 +66,12 @@ const eventTest = () => {
workspace.setCoordSize(100, 100);
const groupAttributes = {
width: 50, height: 50, x: 25, y: 50, coordSize: '200 200', coordOrigin: '0 0',
width: 50,
height: 50,
x: 25,
y: 50,
coordSize: '200 200',
coordOrigin: '0 0',
};
const group = new Group(groupAttributes);
workspace.append(group);
@ -262,7 +265,7 @@ const groupVisibilitySample = () => {
isVisible = !isVisible;
group.setVisibility(isVisible);
};
// executer.periodical(100);
// executer.periodical(100);
workspace.addItAsChildTo($('#visibilityExample'));
};
groupVisibilitySample();
@ -296,7 +299,7 @@ const groupVisibilitySample2 = () => {
height = (height + 10) % 100;
group.setCoordSize(width, height);
};
// executer.periodical(100);
// executer.periodical(100);
workspace.addItAsChildTo($('#scaleStrokeExample'));
};
groupVisibilitySample2();

View File

@ -2,9 +2,7 @@ import $ from 'jquery';
import svgResource from './resources/logo-icon.svg';
import pngResource from './resources/logo-icon.png';
import {
Workspace, Image,
} from '../../src';
import { Workspace, Image } from '../../src';
// URL Based image test ...
const workspace = new Workspace({ fillColor: 'light-gray' });

View File

@ -1,12 +1,13 @@
import $ from 'jquery';
import {
Workspace, Line, Rect,
} from '../../src';
import { Workspace, Line, Rect } from '../../src';
global.$ = $;
const workspaceAttributes = {
width: '700px', height: '100px', coordSize: '350 50', fillColor: '#ffffcc',
width: '700px',
height: '100px',
coordSize: '350 50',
fillColor: '#ffffcc',
};
const strokeWidthWorkspace = new Workspace(workspaceAttributes);
@ -18,8 +19,8 @@ strokeWidthWorkspace.append(rect);
for (let i = 0; i <= 10; i++) {
const line = new Line();
line.setFrom(5 + (i * 25), 5);
line.setTo(5 + (i * 25), 45);
line.setFrom(5 + i * 25, 5);
line.setTo(5 + i * 25, 45);
line.setAttribute('strokeWidth', i + 1);
strokeWidthWorkspace.append(line);
}
@ -30,8 +31,8 @@ strokeWidthWorkspace.addItAsChildTo($('#strokeWidthSample'));
const strokeOpacityWorkspace = new Workspace(workspaceAttributes);
for (let i = 0; i < 10; i++) {
const line = new Line();
line.setFrom(15 + (i * 25), 5);
line.setTo(3 + (i * 25), 45);
line.setFrom(15 + i * 25, 5);
line.setTo(3 + i * 25, 45);
line.setAttribute('strokeWidth', 2);
line.setAttribute('strokeOpacity', 1 / (i + 1));
line.setAttribute('strokeColor', 'red');
@ -43,8 +44,8 @@ const strokeStyleWorkspace = new Workspace(workspaceAttributes);
const styles = ['solid', 'dot', 'dash', 'dashdot', 'longdash'];
for (let i = 0; i < styles.length; i++) {
const line = new Line();
line.setFrom(25 + (i * 30), 5);
line.setTo(13 + (i * 30), 45);
line.setFrom(25 + i * 30, 5);
line.setTo(13 + i * 30, 45);
line.setAttribute('strokeWidth', 2);
line.setAttribute('strokeColor', 'red');
line.setAttribute('strokeStyle', styles[i]);
@ -53,11 +54,20 @@ for (let i = 0; i < styles.length; i++) {
strokeStyleWorkspace.addItAsChildTo($('#strokeStyleSample'));
const strokeArrowWorkspace = new Workspace(workspaceAttributes);
const styles2 = ['none ', 'block ', 'classic', 'diamond ', 'oval', 'open', 'chevron', 'doublechevron'];
const styles2 = [
'none ',
'block ',
'classic',
'diamond ',
'oval',
'open',
'chevron',
'doublechevron',
];
for (let i = 0; i < styles.length; i++) {
const line = new Line();
line.setFrom(25 + (i * 30), 5);
line.setTo(13 + (i * 30), 45);
line.setFrom(25 + i * 30, 5);
line.setTo(13 + i * 30, 45);
line.setAttribute('strokeWidth', 2);
line.setAttribute('strokeColor', 'red');
line.setArrowStyle(styles2[i]);

View File

@ -1,7 +1,5 @@
import $ from 'jquery';
import {
Workspace, PolyLine,
} from '../../src';
import { Workspace, PolyLine } from '../../src';
global.$ = $;

View File

@ -100,10 +100,8 @@ global.createShape = function createShape() {
posx = e.pageX;
posy = e.pageY;
} else if (event.clientX || event.clientY) {
posx = event.clientX + document.body.scrollLeft
+ document.documentElement.scrollLeft;
posy = event.clientY + document.body.scrollTop
+ document.documentElement.scrollTop;
posx = event.clientX + document.body.scrollLeft + document.documentElement.scrollLeft;
posy = event.clientY + document.body.scrollTop + document.documentElement.scrollTop;
}
shadowGroup.setPosition(posx - 50, posy - 150);

View File

@ -1,11 +1,8 @@
import $ from 'jquery';
import {
Workspace, Rect,
} from '../../src';
import { Workspace, Rect } from '../../src';
global.$ = $;
const rectExampleTest = () => {
const workspace = new Workspace();
workspace.setSize('100px', '100px');
@ -24,7 +21,7 @@ const roundrectExampleTest = () => {
function builder(container, x, width, height) {
for (let i = 1; i <= 10; i++) {
const rect = new Rect(i / 10);
rect.setPosition(x, ((i - 1) * (50 + 5)));
rect.setPosition(x, (i - 1) * (50 + 5));
rect.setSize(width, height);
container.append(rect);
}

View File

@ -1,7 +1,5 @@
import $ from 'jquery';
import {
Workspace, Rect,
} from '../../src';
import { Workspace, Rect } from '../../src';
global.$ = $;
@ -96,7 +94,12 @@ const strokeOpacityTest = () => {
workspace.append(rect);
const rectAttributes = {
width: 60, height: 60, fillColor: 'yellow', strokeColor: 'black', strokeStyle: 'solid', strokeWidth: 10,
width: 60,
height: 60,
fillColor: 'yellow',
strokeColor: 'black',
strokeStyle: 'solid',
strokeWidth: 10,
};
rect = new Rect(0, rectAttributes);
rect.setPosition(20, 20);
@ -141,7 +144,12 @@ const fillOpacityTest = () => {
workspace.append(rect);
const rectAttributes = {
width: 60, height: 60, fillColor: 'yellow', strokeColor: 'black', strokeStyle: 'solid', strokeWidth: 10,
width: 60,
height: 60,
fillColor: 'yellow',
strokeColor: 'black',
strokeStyle: 'solid',
strokeWidth: 10,
};
rect = new Rect(0, rectAttributes);
rect.setPosition(20, 20);
@ -186,7 +194,12 @@ const opacityTest = () => {
workspace.append(rect);
const rectAttributes = {
width: 60, height: 60, fillColor: 'yellow', strokeColor: 'black', strokeStyle: 'solid', strokeWidth: 10,
width: 60,
height: 60,
fillColor: 'yellow',
strokeColor: 'black',
strokeStyle: 'solid',
strokeWidth: 10,
};
rect = new Rect(0, rectAttributes);
rect.setPosition(20, 20);
@ -219,7 +232,12 @@ const visibilityTest = () => {
workspace.setCoordOrigin(0, 0);
const rectAttributes = {
width: 60, height: 60, fillColor: 'green', strokeColor: 'black', strokeStyle: 'solid', strokeWidth: 10,
width: 60,
height: 60,
fillColor: 'green',
strokeColor: 'black',
strokeStyle: 'solid',
strokeWidth: 10,
};
const rect = new Rect(0, rectAttributes);
rect.setPosition(120, 20);

View File

@ -1,7 +1,5 @@
import $ from 'jquery';
import {
Workspace, Text,
} from '../../src';
import { Workspace, Text } from '../../src';
import TransformUtils from '../../src/components/peer/utils/TransformUtils';
const workspaces = [];
@ -14,7 +12,17 @@ global.zoomIn = function zoomIn() {
}
};
const textTestHelper = function textTestHelper(coordSize, textval, font, fontSizeval, style, modifier, fontColor, htmlElemId, iesimo) {
const textTestHelper = function textTestHelper(
coordSize,
textval,
font,
fontSizeval,
style,
modifier,
fontColor,
htmlElemId,
iesimo,
) {
const workspace = new Workspace();
workspace.setSize('300px', '100px');
@ -38,7 +46,10 @@ const textTestHelper = function textTestHelper(coordSize, textval, font, fontSiz
const textHtml = document.createTextNode(textsize);
const fontSize = text.getHtmlFontSize(textsize);
span.append(textHtml);
span.setAttribute('style', `font-weight:${modifier};font-style: ${style}; font-size:${fontSize}pt; font-family: ${font};width:30;height:30;`);
span.setAttribute(
'style',
`font-weight:${modifier};font-style: ${style}; font-size:${fontSize}pt; font-family: ${font};width:30;height:30;`,
);
parent.append(span);
workspaces[iesimo] = workspace;

View File

@ -1,7 +1,5 @@
import $ from 'jquery';
import {
Workspace, Elipse,
} from '../../src';
import { Workspace, Elipse } from '../../src';
import Grid from './Grid';
global.$ = $;
@ -16,7 +14,10 @@ overflowWorkspace.addItAsChildTo($('#overflowExample'));
const workspacePosition = () => {
const elipseAttr = {
width: 100, height: 100, x: 100, y: 100,
width: 100,
height: 100,
x: 100,
y: 100,
};
const divElem = $('#positionExample');