FabricJS:取消选择组后,控制器显示旋转180度

时间:2017-10-19 12:10:10

标签: javascript fabricjs

取消选择一个组后,如果我选择了一个对象,则控制器会颠倒显示(旋转180度)。

重现此问题的步骤:

  1. 选择所有对象
  2. 取消选择所有对象
  3. 选择三角形对象(上面代码示例中的
  4. (function() {
        // Code from FabricJs tutorial - http://fabricjs.com/fabric-intro-part-1/#objects
        var canvas = new fabric.Canvas('canvas');
        
        // create a rectangle object
        var rect = new fabric.Rect({
          left: 100,
          top: 100,
          fill: 'red',
          width: 80,
          height: 40
        });
        
        var triangle = new fabric.Triangle({
          left: 300,
          top: 100,
          width: 40,
          height: 40,
          fill: 'blue',
          flipX: true
        });
        
        canvas.add(rect);
        canvas.add(triangle);
        
        canvas.renderAll(); // this wasn't mentioned in the tutorial, but I'm pretty sure it's needed
    })();
    <head>
    <script src="https://cdnjs.cloudflare.com/ajax/libs/fabric.js/1.7.19/fabric.min.js"></script>
    </head>
    <body></body>
    
    
    
    <h1>Flip issue after grouping objects</h1>
    <h2>None of the objects have rotation. Please select both objects (create a group) and, then, deselect it. After this, select the triangle : triangle will have rotation</h2>
    <canvas id="canvas" width="600" height="300"></canvas>

    我已经在这个问题上在github上打开了ticket

    我想知道的是,如果有任何解决方法可以避免此问题。

    注意:

    fabricJS 1.7.15版本。

0 个答案:

没有答案