<tfoot id='9KGPS'></tfoot>

    <bdo id='9KGPS'></bdo><ul id='9KGPS'></ul>

      <i id='9KGPS'><tr id='9KGPS'><dt id='9KGPS'><q id='9KGPS'><span id='9KGPS'><b id='9KGPS'><form id='9KGPS'><ins id='9KGPS'></ins><ul id='9KGPS'></ul><sub id='9KGPS'></sub></form><legend id='9KGPS'></legend><bdo id='9KGPS'><pre id='9KGPS'><center id='9KGPS'></center></pre></bdo></b><th id='9KGPS'></th></span></q></dt></tr></i><div id='9KGPS'><tfoot id='9KGPS'></tfoot><dl id='9KGPS'><fieldset id='9KGPS'></fieldset></dl></div>
    1. <small id='9KGPS'></small><noframes id='9KGPS'>

      <legend id='9KGPS'><style id='9KGPS'><dir id='9KGPS'><q id='9KGPS'></q></dir></style></legend>
      1. 使用 Fabric.js 选择画布上的所有对象

        时间:2023-08-02
      2. <tfoot id='N5e7z'></tfoot>
          <tbody id='N5e7z'></tbody>

            <small id='N5e7z'></small><noframes id='N5e7z'>

          • <i id='N5e7z'><tr id='N5e7z'><dt id='N5e7z'><q id='N5e7z'><span id='N5e7z'><b id='N5e7z'><form id='N5e7z'><ins id='N5e7z'></ins><ul id='N5e7z'></ul><sub id='N5e7z'></sub></form><legend id='N5e7z'></legend><bdo id='N5e7z'><pre id='N5e7z'><center id='N5e7z'></center></pre></bdo></b><th id='N5e7z'></th></span></q></dt></tr></i><div id='N5e7z'><tfoot id='N5e7z'></tfoot><dl id='N5e7z'><fieldset id='N5e7z'></fieldset></dl></div>

                <bdo id='N5e7z'></bdo><ul id='N5e7z'></ul>

                1. <legend id='N5e7z'><style id='N5e7z'><dir id='N5e7z'><q id='N5e7z'></q></dir></style></legend>

                  本文介绍了使用 Fabric.js 选择画布上的所有对象的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  有没有办法显式选择在特定时间实例中存在的所有对象.这可以很容易地使用鼠标选择所有.是否有一个代码解决方案,例如一个名为 Select All 的按钮,以便单击它会使所有织物类型对象都被选中,然后我可以使用 canvas 将更改应用于整个 ActiveGroup.getActiveGroup(); 并迭代.

                  Is there a way to explicitly select all the objects present at a particular instance of time. This can be easily done using mouse to select all. Is there a code-solution like a button named Select All so that clicking it would make all the fabric type objects being selected and then I could apply the changes to whole of that ActiveGroup using canvas.getActiveGroup(); and iterate over.

                  推荐答案

                  好问题.

                  对此没有内置方法,但您需要按照以下方式进行操作:

                  There's no built-in method for this, but you would need to do something along these lines:

                  var objs = canvas.getObjects().map(function(o) {
                    return o.set('active', true);
                  });
                  
                  var group = new fabric.Group(objs, {
                    originX: 'center', 
                    originY: 'center'
                  });
                  
                  canvas._activeObject = null;
                  
                  canvas.setActiveGroup(group.setCoords()).renderAll();
                  

                  代码应该是不言自明的,当您使用鼠标、shift+click 等时,它几乎就是幕后发生的事情.

                  The code should be self-explanatory, and it's pretty much what's happening under the hood when you use mouse, shift+click, etc.

                  这篇关于使用 Fabric.js 选择画布上的所有对象的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  上一篇:使用 JavaScript 裁剪图像 下一篇:为什么 ARM 芯片的指令名称中带有 Javascript(FJCVTZS)?

                  相关文章

                      • <bdo id='8dvd6'></bdo><ul id='8dvd6'></ul>
                    1. <i id='8dvd6'><tr id='8dvd6'><dt id='8dvd6'><q id='8dvd6'><span id='8dvd6'><b id='8dvd6'><form id='8dvd6'><ins id='8dvd6'></ins><ul id='8dvd6'></ul><sub id='8dvd6'></sub></form><legend id='8dvd6'></legend><bdo id='8dvd6'><pre id='8dvd6'><center id='8dvd6'></center></pre></bdo></b><th id='8dvd6'></th></span></q></dt></tr></i><div id='8dvd6'><tfoot id='8dvd6'></tfoot><dl id='8dvd6'><fieldset id='8dvd6'></fieldset></dl></div>
                    2. <tfoot id='8dvd6'></tfoot>
                    3. <small id='8dvd6'></small><noframes id='8dvd6'>

                      <legend id='8dvd6'><style id='8dvd6'><dir id='8dvd6'><q id='8dvd6'></q></dir></style></legend>