• <small id='WfGlM'></small><noframes id='WfGlM'>

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

        向控件添加自定义删除(后退、前移)按钮

        Adding Custom Delete (Back,toFront) Button to Controls(向控件添加自定义删除(后退、前移)按钮)
            <bdo id='w1jKO'></bdo><ul id='w1jKO'></ul>

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

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

                1. 本文介绍了向控件添加自定义删除(后退、前移)按钮的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  我想知道是否有一种简单的方法可以添加删除、放在前面、放在后面将函数添加到现有的 fabric.js 对象控件中.

                  I would like to know if there is an easy way to add a delete, bring to front, bring to back function into the existing fabric.js object controls.

                  目前我只能点击删除对象、放在前面等按钮.

                  At the moment I can only click on buttons which would delete object, bring to front etc.

                  我正在努力寻找能够在对象上按 X(右上角)并删除该对象的解决方案.

                  我猜这与覆盖、包装或继承现有的控件对象有关.

                  I guess it will have to do with overwriting, wrapping or subclassing the existing control object.

                  也许我已经监督了一些事情并且有一个简单的解决方案?请不要使用 Div Wrapper.

                  Maybe I have overseen something and there is an easy solution? Please no Div Wrapper.

                  推荐答案

                  Fabric.js 不提供向对象添加控件的任何简单方法.如果您想创建自己的控件,则必须覆盖 Object 类,特别是:

                  Fabric.js does not offer any simple mean of adding controls to objects. If you want to create your own controls, you will have to overwrite the Object class, notably:

                  • 覆盖 drawControls,绘制自定义按钮
                  • 您需要存储按钮的坐标,以便检测用户何时单击它们.参考文献_setCornerCoords_findTargetCorner
                  • __onMouseDown
                  • 中的某处合并您的操作
                  • override drawControls, to draw your custom button
                  • you will need to store the button's coordinates, so that you can detect when the user clicks them. C.f. _setCornerCoords and _findTargetCorner
                  • incorporate your action somewhere in __onMouseDown

                  您无需处理取消绘制"控件,因为取消选择对象时会重新渲染整个画布.

                  You don't need to take care of 'undrawing' the controls, as the whole canvas is re-rendered when an object is de-selected.

                  我希望这会有所帮助,祝你好运:)

                  I hope this helps, and good luck :)

                  这篇关于向控件添加自定义删除(后退、前移)按钮的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  本站部分内容来源互联网,如果有图片或者内容侵犯了您的权益,请联系我们,我们会在确认后第一时间进行删除!

                  相关文档推荐

                  How does object-fit work with canvas element?(对象适合如何与画布元素一起使用?)
                  How to make rooftext effect and valley text effect in HTML5 (or Fabric.js)(如何在 HTML5(或 Fabric.js)中制作屋顶文字效果和山谷文字效果)
                  Draw border around nontransparent part of image on canvas(在画布上的图像不透明部分周围绘制边框)
                  dragging and resizing an image on html5 canvas(在 html5 画布上拖动图像并调整其大小)
                  What#39;s the difference between a boolean as primitive and a boolean as property of an object?(作为原始对象的布尔值和作为对象属性的布尔值有什么区别?)
                  I want to do animation of an object along a particular path(我想沿特定路径对对象进行动画处理)
                  <tfoot id='JhO0N'></tfoot>

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

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

                      <tbody id='JhO0N'></tbody>

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