HTML canvas miterLimit attribute
Definition and Usage
miterLimit
Property setting or return the maximum bevel length.
The bevel length refers to the distance between the inner and outer angles at the intersection of two lines.

Tip:Only when the lineJoin property is "miter
" is valid.
The smaller the angle of the corner, the longer the bevel length will be.
To avoid a too long bevel length, we can use the miterLimit property.
If the bevel length exceeds the value of miterLimit, the corner will be with the lineJoin of "bevel
" type to display (Illustration 3):

Example
With the maximum bevel length 5 draw the line:
JavaScript:
var c=document.getElementById("myCanvas"); var ctx=c.getContext("2d"); ctx.lineWidth=10; ctx.lineJoin="miter"; ctx.miterLimit=5; ctx.moveTo(20,20); ctx.lineTo(50,27); ctx.lineTo(20,34); ctx.stroke();
语法
context.miterLimit=number;
属性值
值 | 描述 |
---|---|
number |
正数。规定最大斜接长度。 如果斜接长度超过 miterLimit 的值,边角会以 lineJoin 的 "bevel" 类型来显示。 |
技术细节
默认值: | 10 |
---|
浏览器支持
表中的数字注明了首个完全支持该属性的浏览器版本。
ਚਰਮ | ਐਜ਼ | ਫਾਇਰਫਾਕਸ | ਸਫਾਰੀ | ਓਪਰਾ |
---|---|---|---|---|
ਚਰਮ | ਐਜ਼ | ਫਾਇਰਫਾਕਸ | ਸਫਾਰੀ | ਓਪਰਾ |
4.0 | 9.0 | 3.6 | 4.0 | 10.1 |
ਟਿੱਪਣੀਆਂ:Internet Explorer 8 ਅਤੇ ਪਹਿਲੇ ਵਰਜਨ ਨਹੀਂ <canvas> ਐਲੀਮੈਂਟ ਸਮਰਥਨ ਕਰਦੇ ਹਨ。