Skip to content

Commit

Permalink
Fixed polygon label bug (#14 github).
Browse files Browse the repository at this point in the history
Label has been created before setting polygone id.
  • Loading branch information
alfredwassermann committed Oct 1, 2012
1 parent bb42f02 commit 3c4f4c5
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
1 change: 0 additions & 1 deletion examples/construct.html
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,6 @@ <h1 id="x1">Playground</h1>
JXG.Options.point.label = {};
*/


var brd = JXG.JSXGraph.initBoard('jxgbox',{boundingbox: [-1,5,5,-1], axis:true});
var p1 = brd.create('point', [1,1]);
var p2 = brd.create('point', [3,0]);
Expand Down
7 changes: 4 additions & 3 deletions src/Polygon.js
Original file line number Diff line number Diff line change
Expand Up @@ -82,18 +82,19 @@ JXG.Polygon = function (board, vertices, attributes) {
vertex.addChild(this);
}

// create label
this.createLabel();

/* Register polygon at board */
this.id = this.board.setId(this, 'Py');
this.board.renderer.drawPolygon(this);
this.board.finalizeAdding(this);
this.elType = 'polygon';

// create label
this.createLabel();

this.methodMap.borders = 'borders';
this.methodMap.vertices = 'vertices';

this.elType = 'polygon';
};
JXG.Polygon.prototype = new JXG.GeometryElement;

Expand Down

0 comments on commit 3c4f4c5

Please sign in to comment.