How can I disable scaling points of canvas elements using fabric.js?

前端 未结 5 1682
臣服心动
臣服心动 2021-02-12 11:17

By default fabric.js elements come with 8 points to scale any objects. But the app I\'m working specifically requires that stretching should not be allowed on a single axis (hor

5条回答
  •  我寻月下人不归
    2021-02-12 12:08

       imgInstance.setControlsVisibility({
             mt: false, 
             mb: false, 
             ml: false, 
             mr: false, 
             bl: false,
             br: false, 
             tl: false, 
             tr: false,
             mtr: false, 
        });
    

    change "imgInstance" to be your object.

    @http://fabricjs.com/docs/fabric.Image.html

提交回复
热议问题