Fixed the young javascript code.

This commit is contained in:
mdtrooper 2016-02-09 16:18:05 +01:00
parent 1d6b9dfc19
commit 4c894fd04a
2 changed files with 19 additions and 12 deletions

View File

@ -84,7 +84,7 @@ abstract class Map {
?>
<div id="map" data-id="<?php echo $this->id;?>" >
<svg style="border: 2px solid red;" pointer-events="all" width="800" height="800"><g><circle id="node_10" class="node" cx="100" cy="100" style="fill: rgb(128, 186, 39);" r="5">
<svg style="border: 2px solid red;" pointer-events="all" width="800px" height="800px">
</svg>
</div>

View File

@ -25,17 +25,24 @@ MapController.prototype._id = null;
// Methods
MapController.prototype.init_map = function() {
$(this._target + " svg").append(
$("<g>").append(
$("<circle>")
.attr("id", "node_10")
.attr("class", "node")
.attr("cx", "100")
.attr("cy", "100")
.attr("style", "fill: rgb(128, 186, 39);")
.attr("r", "5")
)
);
var svg = d3.select("#map svg");
svg.append("g").append("circle")
.attr("id", "node_10")
.attr("class", "node")
.attr("cx", "100")
.attr("cy", "100")
.attr("style", "fill: rgb(128, 186, 39);")
.attr("r", "5");
svg.append("g").append("circle")
.attr("id", "node_11")
.attr("class", "node")
.attr("cx", "200")
.attr("cy", "200")
.attr("style", "fill: rgb(255, 0, 0);")
.attr("r", "10");
this.init_events();
};