Adding cloud and bang shapes

This commit is contained in:
Knut Sveidqvist
2022-09-02 11:08:26 +02:00
parent 2fbdfdbf6a
commit ccb16e5f5a
8 changed files with 115 additions and 26 deletions

View File

@@ -82,14 +82,19 @@ export const nodeType = {
CIRCLE: 3,
};
export const getTypeFromStart = (str) => {
switch (str) {
export const getType = (startStr, endStr) => {
console.log('In get type', startStr, endStr);
switch (startStr) {
case '[':
return nodeType.RECT;
case '(':
return nodeType.ROUNDED_RECT;
case '((':
return nodeType.CIRCLE;
case ')':
return nodeType.CLOUD;
case '))':
return nodeType.BANG;
default:
return nodeType.DEFAULT;
}
@@ -120,6 +125,10 @@ const type2Str = (type) => {
return 'rounded-rect';
case nodeType.CIRCLE:
return 'circle';
case nodeType.CLOUD:
return 'cloud';
case nodeType.BANG:
return 'bang';
default:
return 'no-border';
}
@@ -130,7 +139,7 @@ export default {
addNode,
clear,
nodeType,
getTypeFromStart,
getType,
decorateNode,
setElementForId,
getElementById: (id) => elements[id],