How to manipulate Canvas elements: Difference between revisions

Jump to navigation Jump to search
Line 257: Line 257:
We have our new canvas, ready to play with.<br />
We have our new canvas, ready to play with.<br />
At the ''>>>'' prompt type:<syntaxhighlight>
At the ''>>>'' prompt type:<syntaxhighlight>
var arrow = canvas.plot2D.polyline(myGroup,[90,120,10],[20,30,30],'#0',"y").setStrokeLineWidth(3);</syntaxhighlight>
var arrow = canvas.plot2D.polyline(myGroup,[90,120,10],[20,30,30],'#0',"y");</syntaxhighlight>
Do not forget the {{key press|Enter}}.<br />
Do not forget the {{key press|Enter}}.<br />
You should have something like this:[[File:My_Arrow.png|thumb]]<br />
You should have something like this:[[File:My_Arrow.png|thumb]]<br />
Line 265: Line 265:
<syntaxhighlight>
<syntaxhighlight>
arrow.getBoundingBox();
arrow.getBoundingBox();
</syntaxhighlight> you get [8.5,18.5, 121.5,41.5]
</syntaxhighlight> you get ''[9.5,19.5, 120.5,40.5]'' which are the values for [Xmin,Ymin, Xmax,Ymax].<br />
The virtual points (the red flashing ones) are usually named as (from 1 to 9):<br />
'left-top'  'center-top'  'right-top'<br />
'left-center'  'center-center'  'right-center'<br />
'left-bottom'  'center-bottom'  'right-bottom'<br />
229

edits

Navigation menu