Skip to content

Commit 6c597c6

Browse files
Ability to delete classes from the diagram add
1 parent 4f4b28a commit 6c597c6

File tree

4 files changed

+31
-2
lines changed

4 files changed

+31
-2
lines changed

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "CacheClassExplorer",
3-
"version": "1.17.2",
3+
"version": "1.18.0",
44
"description": "Class Explorer for InterSystems Caché",
55
"directories": { "test": "test" },
66
"dependencies": {},

web/css/classView.css

+9
Original file line numberDiff line numberDiff line change
@@ -124,6 +124,15 @@ text {
124124
outline: 4px solid rgba(255, 0, 0, 0.6);
125125
}
126126

127+
.element.uml.Class .tool-remove {
128+
display: none;
129+
cursor: pointer;
130+
}
131+
132+
.element.uml.Class:hover .tool-remove {
133+
display: block;
134+
}
135+
127136
.marker-source, .marker-target {
128137
vector-effect: none !important;
129138
}

web/js/ClassView.js

+20-1
Original file line numberDiff line numberDiff line change
@@ -824,7 +824,7 @@ ClassView.prototype.confirmRender = function (data) {
824824
connector.on("all", function (e) {
825825
if (e !== "remove") return;
826826
self.cacheClassExplorer.setSubLabel(
827-
"*Some links are removed on this diagram.",
827+
"*Some elements are removed on this diagram.",
828828
"color:red"
829829
);
830830
});
@@ -862,6 +862,25 @@ ClassView.prototype.confirmRender = function (data) {
862862
q.options.height/2 - Math.min(q.options.height/2 - 100, bb.height/2)
863863
);
864864

865+
this.paper.on('cell:pointerclick', function(cellView, evt, x, y) {
866+
var e = evt.target || evt.srcElement;
867+
// https://upload.wikimedia.org/wikipedia/commons/a/ae/Elleboogkruk.jpg
868+
if (!((e && e.getAttribute("event") === "remove") ||
869+
(e.parentNode && e.parentNode.getAttribute("event") === "remove")))
870+
return;
871+
cellView.remove();
872+
for (var p in self.links) {
873+
if (self.paper.getModelById(self.links[p].attributes.source) === cellView.model
874+
|| self.paper.getModelById(self.links[p].attributes.target) === cellView.model) {
875+
self.links[p].remove();
876+
}
877+
}
878+
self.cacheClassExplorer.setSubLabel(
879+
"*Some elements are removed on this diagram.",
880+
"color:red"
881+
);
882+
});
883+
865884
if (data.savedView) this.restoreView(data.savedView);
866885

867886
this.onRendered();

web/jsLib/joint.shapes.uml.js

+1
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ joint.shapes.uml.Class = joint.shapes.basic.Generic.extend({
3333
'<text class="uml-class-methods-text"/>',
3434
'<text class="uml-class-queries-text"/>',
3535
'<text class="uml-class-xdatas-text"/>',
36+
'<g class="tool-remove" event="remove" x="" transform="translate(0,0)"><circle r="11" style="fill: red;"></circle><path transform="scale(.8) translate(-16, -16)" d="M24.778,21.419 19.276,15.917 24.777,10.415 21.949,7.585 16.447,13.087 10.945,7.585 8.117,10.415 13.618,15.917 8.116,21.419 10.946,24.248 16.447,18.746 21.948,24.248z"></path><title>Remove class</title></g>',
3637
'</g>'
3738
].join(''),
3839

0 commit comments

Comments
 (0)