Skip to content

Shape: Default name of shape #34

@kanarelo

Description

@kanarelo

I know we have discussed this is #24. But I feel that we should have default names for each shape created.

In #24 you had suggested that we should pass the name such as:

const rect = editor.shapes.rect.insert({
   name: '<name>',
   // rest config
})

and access that through console.log(rect.node.name()), or change the name through rect.node.name('<new name>')

I feel that this leaves room for bugs, due to missing this in Pikaso's documentation.

I suggest we add a method renameShape() and add

public insert(config: Konva.ArrowConfig): ArrowModel {
    return super.insert({
         name: `${type}`
         ...config
    })
}

and duplicate take the name of the original, and postfix -copy, e.g, triangle to triangle-copy.

Two shapes can have the same name however...

Metadata

Metadata

Assignees

Labels

documentationImprovements or additions to documentationquestionFurther information is requested

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions