Skip to content

Commit 012905a

Browse files
committed
Enable drag-and-drop in DABC
git-svn-id: https://subversion.gsi.de/dabc/trunk/plugins/root/js@2816 bcbf6573-9a26-0410-9ebc-ce4ab7aade96
1 parent ef4baf6 commit 012905a

File tree

1 file changed

+18
-2
lines changed

1 file changed

+18
-2
lines changed

scripts/JSRootPainter.js

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5726,6 +5726,22 @@
57265726

57275727
var local_bins = this.CreateDrawBins(w, h, 0, 0);
57285728

5729+
var foreignObject = document.createElementNS('http://www.w3.org/2000/svg', 'foreignObject' );
5730+
// var body = document.createElement( 'body' );
5731+
5732+
var canvas = document.createElementNS("http://www.w3.org/1999/xhtml", "canvas");
5733+
5734+
$(canvas).attr('width', w).attr('height',h)
5735+
5736+
// $(body).append(canvas);
5737+
5738+
$(foreignObject).attr("width", w).attr("height", h).append(canvas);
5739+
5740+
$(this.draw_g.node()).append(foreignObject);
5741+
5742+
var ctx = canvas.getContext("2d");
5743+
5744+
/*
57295745
var canvas =
57305746
this.draw_g.append("foreignObject")
57315747
.attr("width", w)
@@ -5734,14 +5750,14 @@
57345750
.attr("width", w)
57355751
.attr("height", h)
57365752
.attr("style", "width: " + w + "px; height: "+ h + "px");
5737-
57385753
var ctx = canvas.node().getContext("2d");
5754+
*/
57395755
for (var i in local_bins) {
57405756
var bin = local_bins[i];
57415757
ctx.fillStyle = bin.fill;
57425758
ctx.fillRect(bin.x,bin.y,bin.width,bin.height);
57435759
}
5744-
5760+
57455761
ctx.stroke();
57465762
}
57475763

0 commit comments

Comments
 (0)