mirror of
https://bitbucket.org/wisemapping/wisemapping-frontend.git
synced 2024-11-29 09:04:55 +01:00
46 lines
1.0 KiB
JavaScript
46 lines
1.0 KiB
JavaScript
|
/* eslint-disable import/prefer-default-export */
|
||
|
// eslint-disable-next-line import/prefer-default-export
|
||
|
import Elipse from '../../../src/components/Elipse';
|
||
|
import Workspace from '../../../src/components/Workspace';
|
||
|
|
||
|
export const createEllipse = ({
|
||
|
backgroundColor,
|
||
|
strokeColor,
|
||
|
strokeWidth,
|
||
|
onClick,
|
||
|
strokeStyle,
|
||
|
size,
|
||
|
arc,
|
||
|
}) => {
|
||
|
const divElem = document.createElement('div');
|
||
|
|
||
|
const workspace = new Workspace();
|
||
|
workspace.setSize('400px', '400px');
|
||
|
workspace.setCoordSize(300, 300);
|
||
|
workspace.setCoordOrigin(-150, -150);
|
||
|
|
||
|
const rect = new Elipse(arc);
|
||
|
rect.setFill(backgroundColor);
|
||
|
|
||
|
const parsedSize = JSON.parse(size);
|
||
|
rect.setSize(parsedSize.width, parsedSize.height);
|
||
|
|
||
|
rect.setPosition(0, 0);
|
||
|
|
||
|
rect.setStroke(strokeWidth, strokeStyle, strokeColor, 1);
|
||
|
|
||
|
rect.addEvent('click', onClick);
|
||
|
|
||
|
// Add referene point ...
|
||
|
const e1 = new Elipse();
|
||
|
e1.setSize(5, 5);
|
||
|
e1.setPosition(0, 0);
|
||
|
e1.setFill('red');
|
||
|
|
||
|
workspace.append(rect);
|
||
|
workspace.append(e1);
|
||
|
workspace.addItAsChildTo(divElem);
|
||
|
|
||
|
return divElem;
|
||
|
};
|