如何将两个点之间的线从一个角点的曲线更改为直线 [英] How to change the lines between two points from curved to straight lines with one angle point

查看:184
本文介绍了如何将两个点之间的线从一个角点的曲线更改为直线的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要什么

当前示例: http://jsfiddle.net/2ecsjomz/5/

注意:

  • 特定的左/右对永远不会改变位置,"left drag"将始终留在左侧或"right drag"
  • 需要在两个点之间形成一个角度点
  • 从左拖动"开始的线必须是水平的
  • 如果可以帮助我不需要拖动点,则可以具有特定的坐标.
  • 它需要在两个html元素之间生成行(与example相同)
  • a specific left/right pair will never change places, "left drag" will always stay on the left or the "right drag"
  • a single angle point needs to be formed between two points
  • the line starting from the "left drag" needs to be horizontal
  • if it helps i do not need the points to be draggable, its ok to have specific coordinates.
  • it needs to generate lines between two html elements ( same as example )

推荐答案

将路径编码更改为以下代码:

Change the path coding to this one below:

        // Build the path decription
        p = "M" + pt1x + "," + pt1y +
            " L" + (pt1x+pt2x)/2 + "," + pt1y +
            " L" + pt2x + "," + pt2y ;

这篇关于如何将两个点之间的线从一个角点的曲线更改为直线的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆