Skip to content

Commit

Permalink
added polygon element
Browse files Browse the repository at this point in the history
  • Loading branch information
daign committed Sep 19, 2023
1 parent 1c25e8f commit 75af7e4
Show file tree
Hide file tree
Showing 5 changed files with 34 additions and 1 deletion.
1 change: 1 addition & 0 deletions lib/basic-elements/index.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
export { FixedRadiusCircle } from './fixedRadiusCircle';
export { Group } from './group';
export { Line } from './line';
export { Polygon } from './polygon';
export { Polyline } from './polyline';
export { QuadraticCurve } from './quadraticCurve';
export { ScalableText } from './scalableText';
Expand Down
15 changes: 15 additions & 0 deletions lib/basic-elements/polygon.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import { StyledGraphicNode } from '../styledGraphicNode';

/**
* Class for a polygon element.
*/
export class Polygon extends StyledGraphicNode {
/**
* Constructor.
*/
public constructor() {
super();

this.baseClass = 'polygon';
}
}
1 change: 1 addition & 0 deletions lib/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ export { Viewport } from './application/viewport';
export { FixedRadiusCircle } from './basic-elements/fixedRadiusCircle';
export { Group } from './basic-elements/group';
export { Line } from './basic-elements/line';
export { Polygon } from './basic-elements/polygon';
export { Polyline } from './basic-elements/polyline';
export { QuadraticCurve } from './basic-elements/quadraticCurve';
export { ScalableText } from './basic-elements/scalableText';
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@daign/2d-graphics",
"version": "1.1.7",
"version": "1.1.8",
"description": "Two dimensional graphics library that implements the daign-2d-pipeline.",
"keywords": [
"graphics",
Expand Down
16 changes: 16 additions & 0 deletions test/basic-elements/polygon.spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import { expect } from 'chai';

import { Polygon } from '../../lib';

describe( 'Polygon', (): void => {
describe( 'constructor', (): void => {
it( 'should set the base class polygon', (): void => {
// Act
const polygon = new Polygon();

// Assert
expect( ( polygon as any ).classNames.getByName( 'baseClass' ).value )
.to.equal( 'polygon' );
} );
} );
} );

0 comments on commit 75af7e4

Please sign in to comment.