如何使矩形的特定边可以调整大小?

时间:2012-08-23 07:01:37

标签: javascript raphael graphiti-js

我想在Graphiti中制作几个或单面的矩形可调整大小。 如果有人有任何想法,请帮助我。

提前致谢。

1 个答案:

答案 0 :(得分:1)

在版本1.0.0中,您可以覆盖 Figure.showResizeHandles 方法。有关示例

,请参见Horizo​​ntalBus图
/**
 * @method
 * Callback to update the visibility of the resize handles
 * 
 * @param {graphiti.Canvas} canvas
 * @param {graphiti.ResizeHandle} resizeHandle1 topLeft resize handle
 * @param {graphiti.ResizeHandle} resizeHandle2 topCenter resize handle
 * @param {graphiti.ResizeHandle} resizeHandle3 topRight resize handle
 * @param {graphiti.ResizeHandle} resizeHandle4 rightMiddle resize handle
 * @param {graphiti.ResizeHandle} resizeHandle5 bottomRight resize handle
 * @param {graphiti.ResizeHandle} resizeHandle6 bottomCenter resize handle
 * @param {graphiti.ResizeHandle} resizeHandle7 bottomLeft resize handle
 * @param {graphiti.ResizeHandle} resizeHandle8 leftMiddle resize handle
 * @template
 */
 showResizeHandles: function(canvas, resizeHandle1, resizeHandle2, resizeHandle3, resizeHandle4, resizeHandle5, resizeHandle6, resizeHandle7, resizeHandle8)
 {
    resizeHandle4.setDimension(resizeHandle4.getWidth(), this.getHeight());
    resizeHandle8.setDimension(resizeHandle4.getWidth(), this.getHeight());

    this._super(canvas, resizeHandle1, resizeHandle2, resizeHandle3, resizeHandle4, resizeHandle5, resizeHandle6, resizeHandle7, resizeHandle8);

    resizeHandle1.hide();
    resizeHandle2.hide();
    resizeHandle3.hide();
    resizeHandle5.hide();
    resizeHandle6.hide();
    resizeHandle7.hide();
 },

这会在右侧和左侧创建两个调整大小手柄,其中包含父级的完整高度 图。

1.0.0版将于9月17日发布