2015-06-21 57 views

回答

1

這裏有一個fabricjs中的標尺演示:https://jsfiddle.net/grqorhqw/1/。它的主要部分是在循環中添加線條和文本標記:

window.canvas.add(new fabric.Line([measurementThickness - tickSize, location1, measurementThickness, location1], { stroke: '#888', selectable: false })); 
    window.canvas.add(new fabric.Text(count + "\"", { 
     left: measurementThickness - (tickSize * 2) - 7, 
     top: location1, 
     fontSize: 12, 
     fontFamily: 'san-serif' 
    }));