Paper.js won't resize the canvas correctly

后端 未结 3 631
忘掉有多难
忘掉有多难 2021-02-02 08:29

I\'m trying out Paper.js for fun, but it seems I\'m already stuck at the very start.

Adding resize=\"true\" to the canvas tag is supposed to ma

3条回答
  •  轮回少年
    2021-02-02 09:19

    Another option is - if you are using set proportions (relative to the body) - to override paper's view:

    var pageWidth = document.getElementsByTagName("BODY")[0].clientWidth
    var pageHeight = document.getElementsByTagName("BODY")[0].clientHeight
    view.size.width = pageWidth * myWidthScale
    view.size.height = pageHeight * myHeightScale
    center = new Point(width / 2, pageHeight / 2)
    view.center = center
    

提交回复
热议问题