Skip to content

Commit 0452d54

Browse files
author
SeungpilPark
committed
#9 Edge Label prevent transparent background
1 parent 3c7282d commit 0452d54

5 files changed

Lines changed: 20 additions & 6 deletions

File tree

src/main/webapp/examples/develope.html

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -219,6 +219,7 @@
219219
});
220220

221221
// Canvas
222+
//canvas = new OG.Canvas('canvas', [1000, 800], 'transparent');
222223
canvas = new OG.Canvas('canvas', [1000, 800], 'transparent');
223224
//canvas = new OG.Canvas('canvas', [1000, 800], 'white', 'url(resources/images/symbol/grid.gif)');
224225
canvas._CONFIG.DEFAULT_STYLE.EDGE["edge-type"] = "plain";
@@ -350,6 +351,11 @@
350351
update.click(function () {
351352
canvas.updateBackDoor(150, 0.7);
352353
});
354+
355+
var aaa = canvas.drawShape([100,100],new OG.Location('aaaa'), [100,100]);
356+
var bbb = canvas.drawShape([200,100],new OG.Location('aaaa'), [100,100]);
357+
var line = canvas.connect(aaa,bbb);
358+
canvas.drawLabel(line,'bbb');
353359
});
354360

355361
function save() {

src/main/webapp/opengraph/OpenGraph-0.1.2-SNAPSHOT-All.js

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/main/webapp/opengraph/OpenGraph-0.1.2-SNAPSHOT-min.js

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/main/webapp/opengraph/OpenGraph-0.1.2-SNAPSHOT.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19456,7 +19456,11 @@ OG.renderer.RaphaelRenderer.prototype._drawLabel = function (position, text, siz
1945619456

1945719457
rect = this._PAPER.rect(bBox.x - LABEL_PADDING / 2, bBox.y - LABEL_PADDING / 2,
1945819458
bBox.width + LABEL_PADDING, bBox.height + LABEL_PADDING);
19459-
rect.attr({stroke: "none", fill: this._CANVAS_COLOR, 'fill-opacity': 1});
19459+
var rectFill = this._CANVAS_COLOR;
19460+
if(rectFill == 'transparent'){
19461+
rectFill = 'white';
19462+
}
19463+
rect.attr({stroke: "none", fill: rectFill, 'fill-opacity': 1});
1946019464
this._add(rect);
1946119465
group.node.appendChild(rect.node);
1946219466
}

src/main/webapp/src/renderer/RaphaelRenderer.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1212,7 +1212,11 @@ OG.renderer.RaphaelRenderer.prototype._drawLabel = function (position, text, siz
12121212

12131213
rect = this._PAPER.rect(bBox.x - LABEL_PADDING / 2, bBox.y - LABEL_PADDING / 2,
12141214
bBox.width + LABEL_PADDING, bBox.height + LABEL_PADDING);
1215-
rect.attr({stroke: "none", fill: this._CANVAS_COLOR, 'fill-opacity': 1});
1215+
var rectFill = this._CANVAS_COLOR;
1216+
if(rectFill == 'transparent'){
1217+
rectFill = 'white';
1218+
}
1219+
rect.attr({stroke: "none", fill: rectFill, 'fill-opacity': 1});
12161220
this._add(rect);
12171221
group.node.appendChild(rect.node);
12181222
}

0 commit comments

Comments
 (0)