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

        <bdo id='tIvVJ'></bdo><ul id='tIvVJ'></ul>
      <tfoot id='tIvVJ'></tfoot>

      1. KineticJS 拖动一个连接线的框

        时间:2023-08-02

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

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

          <bdo id='MmVq0'></bdo><ul id='MmVq0'></ul>
          • <legend id='MmVq0'><style id='MmVq0'><dir id='MmVq0'><q id='MmVq0'></q></dir></style></legend>

                  <tbody id='MmVq0'></tbody>

                1. 本文介绍了KineticJS 拖动一个连接线的框的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  我以前在网上看到过这样的例子,但我再也找不到链接了.

                  I've seen an example of this done on the web before, but I cannot find the link anymore.

                  基本上它是一个可拖动框的 KineticJS 示例,并带有线连接到它.当您围绕线移动框时,将保持连接并重新绘制到框的位置.

                  Basically it is a KineticJS example of a draggable box, with lines connected to it. When you move the box around the line will stay connected and redraw to the box's position.

                  我真的很想知道是否有其他人看过这个例子,或者如何做到这一点.我用谷歌搜索了这个例子,但我在任何地方都找不到答案.

                  I would really just like to know if anyone else has seen the example, or how this could be accomplished. I have googled the example, but I cannot find the answer anywhere.

                  谢谢.

                  推荐答案

                  做起来并不难...

                  创建你的盒子:

                   var box = new Kinetic.Rect({x:10,y:10, other stuff });
                  

                  创建你的线路:

                   var line = new Kinetic.Line({ x: box.getX(), y: box.getY(), other stuff });
                   var originalPoint = {x: box.getX(), y: box.getY()}; // save original box coordinates
                  

                  然后添加拖动事件重新定义线

                  then add a drag event redefine the line

                   box.on('dragstart dragmove', function(){
                       line.setPoints([originalPoint.x, originalPoint.y, box.getX(), box.getY() ]);
                       layer.draw();  //redraw current layer
                   });
                  

                  像这样:http://jsfiddle.net/KS9Bf/3/

                  这正是您要问的:http://jsfiddle.net/KS9Bf/6/

                  它是对上一个的更新.

                  这篇关于KineticJS 拖动一个连接线的框的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  上一篇:webkit css resize 不适用于儿童画布? 下一篇:来自跨启用站点的跨域图像加载被拒绝

                  相关文章

                    • <bdo id='RZTSN'></bdo><ul id='RZTSN'></ul>
                    <tfoot id='RZTSN'></tfoot>

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

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

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