Adds boolean props for lock, hide, aspect lock

This commit is contained in:
Steve Ruiz 2021-05-29 11:12:28 +01:00
parent b369aef7fc
commit 3329c16e57
29 changed files with 601 additions and 366 deletions

View file

@ -1,7 +1,7 @@
import CodeShape from "./index"
import { v4 as uuid } from "uuid"
import { CircleShape, ShapeType } from "types"
import { vectorToPoint } from "utils/utils"
import CodeShape from './index'
import { v4 as uuid } from 'uuid'
import { CircleShape, ShapeType } from 'types'
import { vectorToPoint } from 'utils/utils'
export default class Circle extends CodeShape<CircleShape> {
constructor(props = {} as Partial<CircleShape>) {
@ -11,15 +11,18 @@ export default class Circle extends CodeShape<CircleShape> {
id: uuid(),
type: ShapeType.Circle,
isGenerated: true,
name: "Circle",
parentId: "page0",
name: 'Circle',
parentId: 'page0',
childIndex: 0,
point: [0, 0],
rotation: 0,
radius: 20,
isAspectRatioLocked: false,
isLocked: false,
isHidden: false,
style: {
fill: "#c6cacb",
stroke: "#000",
fill: '#c6cacb',
stroke: '#000',
strokeWidth: 1,
},
...props,

View file

@ -1,7 +1,7 @@
import CodeShape from "./index"
import { v4 as uuid } from "uuid"
import { DotShape, ShapeType } from "types"
import { vectorToPoint } from "utils/utils"
import CodeShape from './index'
import { v4 as uuid } from 'uuid'
import { DotShape, ShapeType } from 'types'
import { vectorToPoint } from 'utils/utils'
export default class Dot extends CodeShape<DotShape> {
constructor(props = {} as Partial<DotShape>) {
@ -11,14 +11,17 @@ export default class Dot extends CodeShape<DotShape> {
id: uuid(),
type: ShapeType.Dot,
isGenerated: true,
name: "Dot",
parentId: "page0",
name: 'Dot',
parentId: 'page0',
childIndex: 0,
point: [0, 0],
rotation: 0,
isAspectRatioLocked: false,
isLocked: false,
isHidden: false,
style: {
fill: "#c6cacb",
stroke: "#000",
fill: '#c6cacb',
stroke: '#000',
strokeWidth: 1,
},
...props,

View file

@ -1,7 +1,7 @@
import CodeShape from "./index"
import { v4 as uuid } from "uuid"
import { EllipseShape, ShapeType } from "types"
import { vectorToPoint } from "utils/utils"
import CodeShape from './index'
import { v4 as uuid } from 'uuid'
import { EllipseShape, ShapeType } from 'types'
import { vectorToPoint } from 'utils/utils'
export default class Ellipse extends CodeShape<EllipseShape> {
constructor(props = {} as Partial<EllipseShape>) {
@ -11,16 +11,19 @@ export default class Ellipse extends CodeShape<EllipseShape> {
id: uuid(),
type: ShapeType.Ellipse,
isGenerated: true,
name: "Ellipse",
parentId: "page0",
name: 'Ellipse',
parentId: 'page0',
childIndex: 0,
point: [0, 0],
radiusX: 20,
radiusY: 20,
rotation: 0,
isAspectRatioLocked: false,
isLocked: false,
isHidden: false,
style: {
fill: "#c6cacb",
stroke: "#000",
fill: '#c6cacb',
stroke: '#000',
strokeWidth: 1,
},
...props,

View file

@ -1,7 +1,7 @@
import CodeShape from "./index"
import { v4 as uuid } from "uuid"
import { LineShape, ShapeType } from "types"
import { vectorToPoint } from "utils/utils"
import CodeShape from './index'
import { v4 as uuid } from 'uuid'
import { LineShape, ShapeType } from 'types'
import { vectorToPoint } from 'utils/utils'
export default class Line extends CodeShape<LineShape> {
constructor(props = {} as Partial<LineShape>) {
@ -12,15 +12,18 @@ export default class Line extends CodeShape<LineShape> {
id: uuid(),
type: ShapeType.Line,
isGenerated: true,
name: "Line",
parentId: "page0",
name: 'Line',
parentId: 'page0',
childIndex: 0,
point: [0, 0],
direction: [-0.5, 0.5],
rotation: 0,
isAspectRatioLocked: false,
isLocked: false,
isHidden: false,
style: {
fill: "#c6cacb",
stroke: "#000",
fill: '#c6cacb',
stroke: '#000',
strokeWidth: 1,
},
...props,

View file

@ -1,7 +1,7 @@
import CodeShape from "./index"
import { v4 as uuid } from "uuid"
import { PolylineShape, ShapeType } from "types"
import { vectorToPoint } from "utils/utils"
import CodeShape from './index'
import { v4 as uuid } from 'uuid'
import { PolylineShape, ShapeType } from 'types'
import { vectorToPoint } from 'utils/utils'
export default class Polyline extends CodeShape<PolylineShape> {
constructor(props = {} as Partial<PolylineShape>) {
@ -12,15 +12,18 @@ export default class Polyline extends CodeShape<PolylineShape> {
id: uuid(),
type: ShapeType.Polyline,
isGenerated: true,
name: "Polyline",
parentId: "page0",
name: 'Polyline',
parentId: 'page0',
childIndex: 0,
point: [0, 0],
points: [[0, 0]],
rotation: 0,
isAspectRatioLocked: false,
isLocked: false,
isHidden: false,
style: {
fill: "none",
stroke: "#000",
fill: 'none',
stroke: '#000',
strokeWidth: 1,
},
...props,

View file

@ -1,7 +1,7 @@
import CodeShape from "./index"
import { v4 as uuid } from "uuid"
import { RayShape, ShapeType } from "types"
import { vectorToPoint } from "utils/utils"
import CodeShape from './index'
import { v4 as uuid } from 'uuid'
import { RayShape, ShapeType } from 'types'
import { vectorToPoint } from 'utils/utils'
export default class Ray extends CodeShape<RayShape> {
constructor(props = {} as Partial<RayShape>) {
@ -12,15 +12,18 @@ export default class Ray extends CodeShape<RayShape> {
id: uuid(),
type: ShapeType.Ray,
isGenerated: true,
name: "Ray",
parentId: "page0",
name: 'Ray',
parentId: 'page0',
childIndex: 0,
point: [0, 0],
direction: [0, 1],
rotation: 0,
isAspectRatioLocked: false,
isLocked: false,
isHidden: false,
style: {
fill: "#c6cacb",
stroke: "#000",
fill: '#c6cacb',
stroke: '#000',
strokeWidth: 1,
},
...props,

View file

@ -1,7 +1,7 @@
import CodeShape from "./index"
import { v4 as uuid } from "uuid"
import { RectangleShape, ShapeType } from "types"
import { vectorToPoint } from "utils/utils"
import CodeShape from './index'
import { v4 as uuid } from 'uuid'
import { RectangleShape, ShapeType } from 'types'
import { vectorToPoint } from 'utils/utils'
export default class Rectangle extends CodeShape<RectangleShape> {
constructor(props = {} as Partial<RectangleShape>) {
@ -12,16 +12,19 @@ export default class Rectangle extends CodeShape<RectangleShape> {
id: uuid(),
type: ShapeType.Rectangle,
isGenerated: true,
name: "Rectangle",
parentId: "page0",
name: 'Rectangle',
parentId: 'page0',
childIndex: 0,
point: [0, 0],
size: [100, 100],
rotation: 0,
radius: 2,
isAspectRatioLocked: false,
isLocked: false,
isHidden: false,
style: {
fill: "#c6cacb",
stroke: "#000",
fill: '#c6cacb',
stroke: '#000',
strokeWidth: 1,
},
...props,