【发布时间】:2016-08-26 03:44:17
【问题描述】:
我有这个圆形对象:
function makeCircle(left, top, line1, line2, lineId, stationIndex, stationID) {
var c = new fabric.Circle({
left: left,
top: top,
strokeWidth: 0.2,
radius: 1.5,
fill: '#ffffff',
stroke: '#666',
// isMoving: false,
selectable: true,
});
c.hasControls = c.hasBorders = true;
c.stationID = stationID;
c.stationIndex = stationIndex;
c.line1 = line1;
c.line2 = line2;
return c;
}
我在一个循环中运行,并通过一行的 id 将一些圆圈插入到一个组中。 (每一行都有 id ):
circleGroup[lineId] = new fabric.Group([],{selectable: false,});
var circle = makeCircle(x, y, null, line, lineId, 0, circle1Id);
circleGroup[lineId].add(circle);
我希望当点击 edit() 函数时,circleGroup[lineId] 中的圆圈(例如 lineId = 10120)可以选择。
function edit(lineId) {
circleGroup[lineId].selectable = true;
canvas.renderAll();
}
但不是什么都没发生。当我点击它们并尝试移动时,圆圈没有移动。
什么问题?
【问题讨论】:
标签: javascript jquery frontend fabricjs web-frontend