--- title: CanvasRenderingContext2D.miterLimit slug: Web/API/CanvasRenderingContext2D/miterLimit translation_of: Web/API/CanvasRenderingContext2D/miterLimit ---
Свойство CanvasRenderingContext2D.miterLimit устанавливает/возвращает максимальную длину среза.
Длина среза это расстояние между внутренним и внешнем углом, образованным пересечением двух линий.
For more info about miters, see Applying styles and color in the Canvas tutorial.
ctx.miterLimit = число;
числоbevel свойства lineJoin.miterLimit propertySee the chapter Applying styles and color in the Canvas tutorial for more information.
<canvas id="canvas" width="400" height="200" class="playable-canvas"></canvas> <div class="playable-buttons"> <input id="edit" type="button" value="Edit" /> <input id="reset" type="button" value="Reset" /> </div> <textarea id="code" class="playable-code"> ctx.beginPath(); ctx.moveTo(0,0); ctx.lineWidth = 15; ctx.lineTo(100, 100); ctx.stroke();</textarea>
var canvas = document.getElementById("canvas");
var ctx = canvas.getContext("2d");
var textarea = document.getElementById("code");
var reset = document.getElementById("reset");
var edit = document.getElementById("edit");
var code = textarea.value;
function drawCanvas() {
  ctx.clearRect(0, 0, canvas.width, canvas.height);
  eval(textarea.value);
}
reset.addEventListener("click", function() {
  textarea.value = code;
  drawCanvas();
});
edit.addEventListener("click", function() {
  textarea.focus();
})
textarea.addEventListener("input", drawCanvas);
window.addEventListener("load", drawCanvas);
{{EmbedLiveSample("Демонстрация_свойства_miterLimit", "400", "180", "https://mdn.mozillademos.org/files/240/Canvas_miterlimit.png", "Web/API/Canvas_API/Tutorial/Applying_styles_and_colors")}}
{{Compat}}
ctx.setMiterLimit() is implemented in addition to this property.miterLimit to a negative value no longer throws an exception; instead, it properly ignores non-positive values.