-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
1) Different tutorials to explain the functionality of the tool 2) Add options (Rotate, delete, change color) to Labels 3) Export SVG now downloads the file directly
- Loading branch information
Showing
10 changed files
with
987 additions
and
125 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
Label = draw2d.shape.basic.Label.extend({ | ||
NAME: "Label", | ||
|
||
ORIENTATION_PROPERTIES: Object.freeze({ | ||
[OrientationEnum.north]: { | ||
"rotationAngle": 0, | ||
"padding": { left: 10, top: 5, right: 10, bottom: 5 }, | ||
"locator": new draw2d.layout.locator.BottomLocator(), | ||
}, | ||
[OrientationEnum.east]: { | ||
"rotationAngle": -90, | ||
"padding": { left: 10, top: 5, right: 10, bottom: 5 }, | ||
"locator": new draw2d.layout.locator.RightLocator(), | ||
}, | ||
[OrientationEnum.south]: { | ||
"rotationAngle": 0, | ||
"padding": { left: 10, top: 5, right: 10, bottom: 5 }, | ||
"locator": new draw2d.layout.locator.TopLocator(), | ||
}, | ||
[OrientationEnum.west]: { | ||
"rotationAngle": -270, | ||
"padding": { left: 10, top: 5, right: 10, bottom: 5 }, | ||
"locator": new draw2d.layout.locator.LeftLocator(), | ||
}, | ||
}), | ||
|
||
init: function (attr) { | ||
this._super($.extend({ | ||
text: "Label text", | ||
radius: 4, | ||
bgColor: "#5b5b5b", | ||
color: "#5b5b5b", | ||
fontColor: "white", | ||
resizeable: true, | ||
}, attr)); | ||
|
||
|
||
this.setOrientation(attr.orientation, false); | ||
this.installEditPolicy(new SelectionMenuPolicy()); | ||
this.installEditor(new draw2d.ui.LabelInplaceEditor()); | ||
}, | ||
|
||
setLinksToChannel: function (partner) { | ||
this.linksToChannel.push(partner); | ||
}, | ||
|
||
getOrientation: function () { | ||
return this.orientation; | ||
}, | ||
|
||
|
||
setOrientation: function (orientation, repaint = true) { | ||
this.orientation = orientation; | ||
let prop = this.ORIENTATION_PROPERTIES[orientation]; | ||
this.rotationAngle = prop.rotationAngle; | ||
this.height = 0; | ||
this.setPadding(prop.padding); | ||
if (repaint) { | ||
this.repaint(); | ||
} | ||
} | ||
}); | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.