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

      <legend id='rgO6h'><style id='rgO6h'><dir id='rgO6h'><q id='rgO6h'></q></dir></style></legend>
      <tfoot id='rgO6h'></tfoot>

      1. HTML5 Canvas 中的取消绑定功能

        时间:2023-08-02
      2. <small id='S1WIs'></small><noframes id='S1WIs'>

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

          <legend id='S1WIs'><style id='S1WIs'><dir id='S1WIs'><q id='S1WIs'></q></dir></style></legend>

                1. 本文介绍了HTML5 Canvas 中的取消绑定功能的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  我想在 HTML5 Canvas 中解绑函数...

                  I want to unbind function in HTML5 Canvas...

                  示例:当我在选择选项矩形后选择画笔时,它也会在我使用画笔时创建矩形.请帮助我解决同样的问题.

                  Example: when I am selecting Brush after selecting option rectangle its creating Rectangle also when I am using brush. Please help me regarding same.

                  谢谢

                  开发

                  推荐答案

                  选择矩形然后橡皮擦后看到另一个矩形的原因如下:

                  The reason you are seeing another rectangle after selecting rectangle and then eraser is because of the following:

                      function addClick(x, y, dragging) {
                          clickX.push(x);
                          clickY.push(y);
                          clickDrag.push(dragging);
                          hitColors.push(bgColor);
                          clickTool.push(tool);
                          toolSize.push(radius);
                      }
                  

                  您正在将每个单击的工具添加到 clickTool 数组.所以一旦你添加了矩形然后橡皮擦,矩形仍然存在.

                  You are adding every tool that is clicked to clickTool array. So once you add the rect then eraser, the rect is still there.

                  然后当你循环时:

                      function redraw() {
                          context.width = canvas.width; // Clears the canvas
                          context.lineJoin = "round";        
                  
                          for (var i = 0; i < clickX.length; i++) {
                             // this will log rect then eraser over and over
                             console.log(clickTool[i]);
                          // ......
                          }
                      }
                  

                  因此,您需要弄清楚为什么要拥有一系列已被选中的工具,也许您一次只需要一个而不是全部持有.

                  So you need to work out why you want to have an array of tools that have been selected, maybe you only need to have one at a time instead of holding on to them all.

                  这篇关于HTML5 Canvas 中的取消绑定功能的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  上一篇:HTML5 Canvas 中的曲线绘制 下一篇:Fabric.js - 自由绘制矩形

                  相关文章

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

                  <tfoot id='UBcxq'></tfoot>
                2. <small id='UBcxq'></small><noframes id='UBcxq'>

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

                      <legend id='UBcxq'><style id='UBcxq'><dir id='UBcxq'><q id='UBcxq'></q></dir></style></legend>