jsmind 0.6.3 → 0.6.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -16,7 +16,7 @@ jsMind is mind map library built by javascript, it base on html5 canvas and svg.
16
16
 
17
17
  ES6 版本现已发布,详情请查阅 [es6/README.md](es6/README.md)
18
18
 
19
- The ES6 version of jsMind has been launched. see details from [es6/README.md](es6/README.md)
19
+ The ES6 version of jsMind has been launched. see details from [es6/README-en.md](es6/README-en.md)
20
20
 
21
21
  ## Get Started
22
22
 
@@ -26,15 +26,15 @@ The ES6 version of jsMind has been launched. see details from [es6/README.md](es
26
26
  <link
27
27
  type="text/css"
28
28
  rel="stylesheet"
29
- href="//cdn.jsdelivr.net/npm/jsmind@0.6/style/jsmind.css"
29
+ href="//cdn.jsdelivr.net/npm/jsmind@0.6.4/style/jsmind.css"
30
30
  />
31
31
  <script
32
32
  type="text/javascript"
33
- src="//cdn.jsdelivr.net/npm/jsmind@0.6/es6/jsmind.js"
33
+ src="//cdn.jsdelivr.net/npm/jsmind@0.6.4/es6/jsmind.js"
34
34
  ></script>
35
35
  <!--
36
36
  enable draggable node feature
37
- <script type="text/javascript" src="//cdn.jsdelivr.net/npm/jsmind@0.6/es6/jsmind.draggable-node.js"></script>
37
+ <script type="text/javascript" src="//cdn.jsdelivr.net/npm/jsmind@0.6.4/es6/jsmind.draggable-node.js"></script>
38
38
  -->
39
39
  </head>
40
40
  <body>
@@ -57,11 +57,13 @@ The ES6 version of jsMind has been launched. see details from [es6/README.md](es
57
57
  </html>
58
58
  ```
59
59
 
60
+ > 查阅[文档](docs/zh/1.usage.md)以获取更多关于 CDN 以及版本的知识。 Read the [doc](docs/en/1.usage.md) to learn more knowledge about CDN and version.
61
+
60
62
  ## Links
61
63
 
62
64
  - Resources:
63
65
  - [NPM - jsmind](https://www.npmjs.com/package/jsmind)
64
- - CDN - [UNPKG](https://unpkg.com/browse/jsmind/), [jsDelivr](https://www.jsdelivr.com/package/npm/jsmind)
66
+ - CDN - [UNPKG](https://unpkg.com/browse/jsmind/), [jsDelivr](https://www.jsdelivr.com/package/npm/jsmind/), [jsDelivr 的国内镜像](https://jsd.onmicrosoft.cn/npm/jsmind/)
65
67
  - [文档 - Documents](https://hizzgdev.github.io/jsmind/docs)
66
68
  - Apps :
67
69
  - <https://jsmind.online>
@@ -12,15 +12,22 @@
12
12
  At first, 2 files (jsmind.css and jsmind.js) are required. Here we link to the resources on the CDN. It is recommended to use the latest version.
13
13
 
14
14
  ```html
15
- <link type="text/css" rel="stylesheet" href="https://unpkg.com/jsmind@0.5/style/jsmind.css" />
15
+ <link type="text/css" rel="stylesheet" href="https://unpkg.com/jsmind@0.6.4/style/jsmind.css" />
16
+
17
+ <script type="text/javascript" src="https://unpkg.com/jsmind@0.6.4/es6/jsmind.js"></script>
16
18
 
17
- <script type="text/javascript" src="https://unpkg.com/jsmind@0.5/es6/jsmind.js"></script>
18
19
  ```
20
+ > CDN: other available CDNs are [jsDelivr](https://www.jsdelivr.com/package/npm/jsmind/), and [the mirror of jsDelivr in China](https://jsd.onmicrosoft.cn/npm/jsmind/). the resource urls would look like:
21
+ > - https://unpkg.com/jsmind@0.6.4/es6/jsmind.js
22
+ > - https://cdn.jsdelivr.net/npm/jsmind@0.6.4/es6/jsmind.js
23
+ > - https://jsd.onmicrosoft.cn/npm/jsmind@0.6.4/es6/jsmind.js
24
+
25
+ > Version: the version number appear in the url of CDN. It's strongly recommended that you also specify the version number in your project to avoid the risks that caused by version upgrades. Access the [Release page](https://github.com/hizzgdev/jsmind/releases) to get the latest version number of jsMind.
19
26
 
20
27
  Add script jsmind.draggable-node.js for enabling draggable node feature.
21
28
 
22
29
  ```html
23
- <script type="text/javascript" src="https://unpkg.com/jsmind@0.5/es6/jsmind.draggable-node.js"></script>
30
+ <script type="text/javascript" src="https://unpkg.com/jsmind@0.6.4/es6/jsmind.draggable-node.js"></script>
24
31
  ```
25
32
 
26
33
  The second, a div element should be in your HTML as container
@@ -36,6 +36,7 @@ options = {
36
36
  vmargin:50, // Minimum vertical distance of the mindmap from the outer frame of the container
37
37
  line_width:2, // thickness of the mindmap line
38
38
  line_color:'#555', // Thought mindmap line color
39
+ line_style:'curved', // line style, straight or curved
39
40
  draggable: false, // Drag the mind map with your mouse, when it's larger that the container
40
41
  hide_scrollbars_when_draggable: false, // Hide container scrollbars, when mind map is larger than container and draggable option is true.
41
42
  node_overflow: 'hidden' // Text overflow style in node
@@ -126,6 +127,10 @@ These options are described in more detail below.
126
127
  **view.line_width** : (number) Thickness of the mindmap line (pixels)
127
128
  **view.line_color** : (string) color of the mindmap line (color representation in HTML). [for ES6 version] If `data.leading-line-color` is set on `node`, this option will be overridden.
128
129
 
130
+ **view.line_style** : (string) style of the mindmap line. [for ES6 version], the available options are:
131
+ > * `curved` [default]
132
+ > * `straight`
133
+
129
134
  > These two parameters determine the style of the lines in the mindmap. By default, the lines are 2px in thickness and dark gray in color (#555).
130
135
 
131
136
  **view.draggable** : (bool) Do you want whole mind map draggable inside container?
@@ -11,16 +11,24 @@
11
11
 
12
12
  首先,需要在页面上引用 jsmind.js 和 jsmind.css 两个文件,这里我们引用的是 CDN 上的资源,请注意使用最新的版本。
13
13
 
14
+
14
15
  ```html
15
- <link type="text/css" rel="stylesheet" href="https://unpkg.com/jsmind@0.5/style/jsmind.css" />
16
+ <link type="text/css" rel="stylesheet" href="https://unpkg.com/jsmind@0.6.3/style/jsmind.css" />
16
17
 
17
- <script type="text/javascript" src="https://unpkg.com/jsmind@0.5/es6/jsmind.js"></script>
18
+ <script type="text/javascript" src="https://unpkg.com/jsmind@0.6.3/es6/jsmind.js"></script>
18
19
  ```
19
20
 
21
+ > CDN:其它可用的 CDN 还有 [jsDelivr](https://www.jsdelivr.com/package/npm/jsmind/),以及 jsDelivr 的[国内镜像](https://jsd.onmicrosoft.cn/npm/jsmind/)。文件路径大概像这样:
22
+ > - https://unpkg.com/jsmind@0.6.3/es6/jsmind.js
23
+ > - https://cdn.jsdelivr.net/npm/jsmind@0.6.3/es6/jsmind.js
24
+ > - https://jsd.onmicrosoft.cn/npm/jsmind@0.6.3/es6/jsmind.js
25
+
26
+ > 版本:上面的示例url中都有版本号,强烈建议你在项目里也指明版本号,以避免版本升级给你的项目带来风险。访问 [Release 页面](https://github.com/hizzgdev/jsmind/releases) 可以获取 jsmind 的最新版本号。
27
+
20
28
  如果希望能够通过鼠标拖拽的方式移动节点,需要额外引用 jsmind.draggable-node.js 文件
21
29
 
22
30
  ```html
23
- <script type="text/javascript" src="https://unpkg.com/jsmind@0.5/es6/jsmind.draggable-node.js"></script>
31
+ <script type="text/javascript" src="https://unpkg.com/jsmind@0.6.3/es6/jsmind.draggable-node.js"></script>
24
32
  ```
25
33
 
26
34
  其次,要为 jsMind 准备一个容器,jsMind 将在这个容器里显示思维导图。可自行定义容器的id、大小及样式。
@@ -36,6 +36,7 @@ options = {
36
36
  vmargin:50, // 思维导图距容器外框的最小垂直距离
37
37
  line_width:2, // 思维导图线条的粗细
38
38
  line_color:'#555', // 思维导图线条的颜色
39
+ line_style:'curved',// 思维导图线条的样式,直线(straight)或者曲线(curved)
39
40
  draggable: false, // 当容器不能完全容纳思维导图时,是否允许拖动画布代替鼠标滚动
40
41
  hide_scrollbars_when_draggable: false, // 当设置 draggable = true 时,是否隐藏滚动条
41
42
  node_overflow: 'hidden' // 节点文本过长时的样式
@@ -122,7 +123,12 @@ options = {
122
123
  > 这两个参数决定了思维导图与容器的边框能距离多近。把思维导图本身作为一个对象的话,这两个参数就类似该对象的 margin(css) 属性。这两个参数的默认值为 container 的宽和高。
123
124
 
124
125
  **view.line_width** : (number) 思维导图线条的粗细(像素)
125
- **view.line_color** : (string) 思维导图线条的颜色(html的颜色表示方法)。[在 ES6 版本里] 如果一个 `node` 设置了 `data.leading-line-color`,此选项将会被覆盖.
126
+ **view.line_color** : (string) 思维导图线条的颜色(html的颜色表示方法)。[仅在 ES6 版本里支持] 如果一个 `node` 设置了 `data.leading-line-color`,此选项将会被覆盖
127
+
128
+ **view.line_style** : (string) 思维导图线条的样式. [仅在 ES6 版本里支持], 可用的选项有:
129
+
130
+ > * `curved` 表示曲线 [默认值]
131
+ > * `straight` 表示直线
126
132
 
127
133
  > 这两个参数决定了思维导图中的线条的样式。默认情况下,线条的粗细是2px,颜色是深灰色(#555)。
128
134
 
@@ -0,0 +1,37 @@
1
+ # jsMind ES6 Version
2
+
3
+ [[中文](README.md) | English]
4
+
5
+ jsMind is now written in ES6 code, the source code is in `/src`, and the dist directory is `/es6`.
6
+
7
+
8
+ ### Compatibility
9
+
10
+ All features in the JS version are fully compatible in the ES6 version.
11
+
12
+ ### Migration
13
+
14
+ If you use `jsMind` via `NPM`, no migration is required, we just changed the `main` file to `es6/jsmind.js`
15
+
16
+ If you reference `jsMind` from CDN, the only thing you need to do is change the url from `js/*.js` to `es6/*.js`.
17
+
18
+ E.g.
19
+
20
+ ```html
21
+ <!-- before -->
22
+ <script type="text/javascript" src="//cdn.jsdelivr.net/npm/jsmind/js/jsmind.js"></script>
23
+
24
+ <!-- after -->
25
+ <script type="text/javascript" src="//cdn.jsdelivr.net/npm/jsmind/es6/jsmind.js"></script>
26
+ ```
27
+
28
+ ### Deprecation
29
+
30
+ The legacy version `/js` will be kept in repo for several months, and then will be removed in a version with a break change alert.
31
+
32
+ ### Local build
33
+
34
+ You probably notice that there is no `js` files or `es6` files in the directory `/es6`. Yes, we publish the dist file to `NPM` but don't store them in the repo.
35
+
36
+ You can download the resources from CDN, or build them locally by running `npm run build` in the root dir of the project. Read [development doc](../docs/en/5.development.md) to get the detail about code building.
37
+
package/es6/README.md CHANGED
@@ -1,35 +1,34 @@
1
1
  # jsMind ES6 Version
2
2
 
3
- jsMind is now written in ES6 code, the source code is in `/src`, and the dist directory is `/es6`.
3
+ [中文 | [English](README-en.md)]
4
4
 
5
+ jsMind 现在已经用 ES6 编写了,源代码位于 `/src`,构建目录为 `/es6`。
5
6
 
6
- ### Compatible
7
7
 
8
- All features in the JS version are fully compatible in the ES6 version.
8
+ ### 兼容性
9
9
 
10
- ### Migration
10
+ 之前 JS 版本里的所有功能,在 ES6 的版本中都是兼容的。
11
11
 
12
- If you use `jsMind` via `NPM`, no migration is required, we just changed the `main` file to `es6/jsmind.js`
12
+ ### 迁移到新版
13
13
 
14
- If you reference `jsMind` from CDN, the only thing you need to do is change the url from `js/*.js` to `es6/*.js`.
14
+ 如果你是通过 `NPM` 引用的 `jsMind`,则无须手动迁移,我们只是在 `project.json` 里将 `main` 修改成了 `es6/jsmind.js` 。
15
15
 
16
- E.g.
16
+ 如果你是通过 CDN 引用 `jsMind` 的话,你仅仅需要把 url 从 `js/*.js` 改成 `es6/*.js` 。 如:
17
17
 
18
18
  ```html
19
- <!-- before -->
19
+ <!-- 修改前 -->
20
20
  <script type="text/javascript" src="//cdn.jsdelivr.net/npm/jsmind/js/jsmind.js"></script>
21
21
 
22
- <!-- after -->
22
+ <!-- 修改后 -->
23
23
  <script type="text/javascript" src="//cdn.jsdelivr.net/npm/jsmind/es6/jsmind.js"></script>
24
24
  ```
25
25
 
26
- ### Deprecation
26
+ ### 老版本下线
27
27
 
28
- The legacy version `/js` will be kept in repo for serval months, and then will be removed in a version with a break change alert.
28
+ 在未来的几个月,原先的版本仍将会保留在 `/js` 目录里,然后将会在某个带有不兼容警告的版本里移除。
29
29
 
30
- ### Local build
30
+ ### 本地构建
31
31
 
32
- You probably notice that there is no `js` files or `es6` files in the directory `/es6`. Yes, we publish the dist file to `NPM` but don't store them in the repo.
33
-
34
- If you can not refer the resource from CDN, the dist files can be built by running `npm run build` in the root dir of the project. see details for [development](../docs/en/5.development.md)
32
+ 你可以注意到了,在 `es6` 这个目录里没有任何 `js` 或 `es` 文件。是的,构建的文件仅会被包含在 `NPM` 里,但并不会保留在代码库中。
35
33
 
34
+ 你可以从 CDN 上下载这些文件,也可以在你本地构建,只需在项目根目录里运行 `npm run build` 即可。更详细的介绍可参考[贡献代码指南](../docs/en/5.development.md)里的相关内容。
@@ -5,5 +5,5 @@
5
5
  * Project Home:
6
6
  * https://github.com/hizzgdev/jsmind/
7
7
  */
8
- !function(){"use strict";if(!jsMind)throw new Error("jsMind is not defined");const t=jsMind.$,i="getSelection"in t.w?function(){t.w.getSelection().removeAllRanges()}:function(){t.d.selection.empty()},e={line_width:5,line_color:"rgba(0,0,0,0.3)",lookup_delay:500,lookup_interval:80,scrolling_trigger_width:20,scrolling_step_length:10};class s{constructor(t,i){var s={};jsMind.util.json.merge(s,e),jsMind.util.json.merge(s,i),this.jm=t,this.options=s,this.e_canvas=null,this.canvas_ctx=null,this.shadow=null,this.shadow_w=0,this.shadow_h=0,this.active_node=null,this.target_node=null,this.target_direct=null,this.client_w=0,this.client_h=0,this.offset_x=0,this.offset_y=0,this.hlookup_delay=0,this.hlookup_timer=0,this.capture=!1,this.moved=!1,this.canvas_draggable=t.get_view_draggable(),this.view_panel=t.view.e_panel,this.view_panel_rect=null}init(){this._create_canvas(),this._create_shadow(),this._event_bind()}resize(){this.jm.view.e_nodes.appendChild(this.shadow),this.e_canvas.width=this.jm.view.size.w,this.e_canvas.height=this.jm.view.size.h}_create_canvas(){var i=t.c("canvas");this.jm.view.e_panel.appendChild(i);var e=i.getContext("2d");this.e_canvas=i,this.canvas_ctx=e}_create_shadow(){var i=t.c("jmnode");i.style.visibility="hidden",i.style.zIndex="3",i.style.cursor="move",i.style.opacity="0.7",this.shadow=i}reset_shadow(t){var i=this.shadow.style;this.shadow.innerHTML=t.innerHTML,i.left=t.style.left,i.top=t.style.top,i.width=t.style.width,i.height=t.style.height,i.backgroundImage=t.style.backgroundImage,i.backgroundSize=t.style.backgroundSize,i.transform=t.style.transform,this.shadow_w=this.shadow.clientWidth,this.shadow_h=this.shadow.clientHeight}show_shadow(){this.moved||(this.shadow.style.visibility="visible")}hide_shadow(){this.shadow.style.visibility="hidden"}_magnet_shadow(t){t&&(this.canvas_ctx.lineWidth=this.options.line_width,this.canvas_ctx.strokeStyle=this.options.line_color,this.canvas_ctx.lineCap="round",this._clear_lines(),this._canvas_lineto(t.sp.x,t.sp.y,t.np.x,t.np.y))}_clear_lines(){this.canvas_ctx.clearRect(0,0,this.jm.view.size.w,this.jm.view.size.h)}_canvas_lineto(t,i,e,s){this.canvas_ctx.beginPath(),this.canvas_ctx.moveTo(t,i),this.canvas_ctx.lineTo(e,s),this.canvas_ctx.stroke()}_lookup_close_node(){var t,i,e=this.jm.get_root(),s=e.get_location(),o=e.get_size(),n=s.x+o.w/2,l=this.shadow_w,h=this.shadow_h,a=this.shadow.offsetLeft,_=this.shadow.offsetTop,r=a+l/2>=n?jsMind.direction.right:jsMind.direction.left,c=this.jm.mind.nodes,d=null,v=this.jm.layout,g=Number.MAX_VALUE,p=0,w=null,u=null,f=null;for(var m in c){var y,j;if((d=c[m]).isroot||d.direction==r){if(d.id==this.active_node.id)continue;if(!v.is_visible(d))continue;if(t=d.get_size(),i=d.get_location(),r==jsMind.direction.right){if(a-i.x-t.w<=0)continue;p=Math.abs(a-i.x-t.w)+Math.abs(_+h/2-i.y-t.h/2),y={x:i.x+t.w-this.options.line_width,y:i.y+t.h/2},j={x:a+this.options.line_width,y:_+h/2}}else{if(i.x-a-l<=0)continue;p=Math.abs(a+l-i.x)+Math.abs(_+h/2-i.y-t.h/2),y={x:i.x+this.options.line_width,y:i.y+t.h/2},j={x:a+l-this.options.line_width,y:_+h/2}}p<g&&(w=d,u=y,f=j,g=p)}}var b=null;return w&&(b={node:w,direction:r,sp:f,np:u}),b}lookup_close_node(){var t=this._lookup_close_node();t&&(this._magnet_shadow(t),this.target_node=t.node,this.target_direct=t.direction)}_event_bind(){var i=this,e=this.jm.view.container;t.on(e,"mousedown",(function(t){var e=t||event;i.dragstart.call(i,e)})),t.on(e,"mousemove",(function(t){var e=t||event;i.drag.call(i,e)})),t.on(e,"mouseup",(function(t){var e=t||event;i.dragend.call(i,e)})),t.on(e,"touchstart",(function(t){var e=t||event;i.dragstart.call(i,e)})),t.on(e,"touchmove",(function(t){var e=t||event;i.drag.call(i,e)})),t.on(e,"touchend",(function(t){var e=t||event;i.dragend.call(i,e)}))}dragstart(i){if(this.jm.get_editable()&&!this.capture){this.active_node=null,this.view_draggable=this.jm.get_view_draggable();var e=this.jm.view,s=i.target||event.srcElement;if("jmnode"==s.tagName.toLowerCase()){this.view_draggable&&this.jm.disable_view_draggable();var o=e.get_binded_nodeid(s);if(o){var n=this.jm.get_node(o);if(!n.isroot){this.reset_shadow(s),this.view_panel_rect=this.view_panel.getBoundingClientRect(),this.active_node=n,this.offset_x=(i.clientX||i.touches[0].clientX)/e.zoom_current-s.offsetLeft,this.offset_y=(i.clientY||i.touches[0].clientY)/e.zoom_current-s.offsetTop,this.client_hw=Math.floor(s.clientWidth/2),this.client_hh=Math.floor(s.clientHeight/2),0!=this.hlookup_delay&&t.w.clearTimeout(this.hlookup_delay),0!=this.hlookup_timer&&t.w.clearInterval(this.hlookup_timer);var l=this;this.hlookup_delay=t.w.setTimeout((function(){l.hlookup_delay=0,l.hlookup_timer=t.w.setInterval((function(){l.lookup_close_node.call(l)}),l.options.lookup_interval)}),this.options.lookup_delay),this.capture=!0}}}}}drag(t){if(this.jm.get_editable()&&this.capture){t.preventDefault(),this.show_shadow(),this.moved=!0,i();var e=this.jm.view,s=(t.clientX||t.touches[0].clientX)/e.zoom_current-this.offset_x,o=(t.clientY||t.touches[0].clientY)/e.zoom_current-this.offset_y;t.clientY-this.view_panel_rect.top<this.options.scrolling_trigger_width&&this.view_panel.scrollTop>this.options.scrolling_step_length?(this.view_panel.scrollBy(0,-this.options.scrolling_step_length),this.offset_y+=this.options.scrolling_step_length/e.zoom_current):this.view_panel_rect.bottom-t.clientY<this.options.scrolling_trigger_width&&this.view_panel.scrollTop<this.view_panel.scrollHeight-this.view_panel_rect.height-this.options.scrolling_step_length&&(this.view_panel.scrollBy(0,this.options.scrolling_step_length),this.offset_y-=this.options.scrolling_step_length/e.zoom_current),t.clientX-this.view_panel_rect.left<this.options.scrolling_trigger_width&&this.view_panel.scrollLeft>this.options.scrolling_step_length?(this.view_panel.scrollBy(-this.options.scrolling_step_length,0),this.offset_x+=this.options.scrolling_step_length/e.zoom_current):this.view_panel_rect.right-t.clientX<this.options.scrolling_trigger_width&&this.view_panel.scrollLeft<this.view_panel.scrollWidth-this.view_panel_rect.width-this.options.scrolling_step_length&&(this.view_panel.scrollBy(this.options.scrolling_step_length,0),this.offset_x-=this.options.scrolling_step_length/e.zoom_current),this.shadow.style.left=s+"px",this.shadow.style.top=o+"px",i()}}dragend(i){if(this.jm.get_editable()){if(this.view_draggable&&this.jm.enable_view_draggable(),this.capture){if(0!=this.hlookup_delay&&(t.w.clearTimeout(this.hlookup_delay),this.hlookup_delay=0,this._clear_lines()),0!=this.hlookup_timer&&(t.w.clearInterval(this.hlookup_timer),this.hlookup_timer=0,this._clear_lines()),this.moved){var e=this.active_node,s=this.target_node,o=this.target_direct;this.move_node(e,s,o)}this.hide_shadow()}this.view_panel_rect=null,this.moved=!1,this.capture=!1}}move_node(t,i,e){var s=this.shadow.offsetTop;if(i&&t&&!jsMind.node.inherited(t,i)){for(var o=i.children,n=o.length,l=null,h=Number.MAX_VALUE,a=null,_="_last_";n--;)if((l=o[n]).direction==e&&l.id!=t.id){var r=l.get_location().y-s;r>0&&r<h&&(h=r,a=l,_="_first_")}a&&(_=a.id),this.jm.move_node(t.id,_,i.id,e)}this.active_node=null,this.target_node=null,this.target_direct=null}jm_event_handle(t,i){t===jsMind.event_type.resize&&this.resize()}}var o=new jsMind.plugin("draggable_node",(function(t,i){var e=new s(t,i);e.init(),t.add_event_listener((function(t,i){e.jm_event_handle.call(e,t,i)}))}));jsMind.register_plugin(o)}();
8
+ !function(){"use strict";if(!jsMind)throw new Error("jsMind is not defined");const t=jsMind.$,i="getSelection"in t.w?function(){t.w.getSelection().removeAllRanges()}:function(){t.d.selection.empty()},e={line_width:5,line_color:"rgba(0,0,0,0.3)",lookup_delay:500,lookup_interval:80,scrolling_trigger_width:20,scrolling_step_length:10};class s{constructor(t,i){var s={};jsMind.util.json.merge(s,e),jsMind.util.json.merge(s,i),this.version="0.3.0",this.jm=t,this.options=s,this.e_canvas=null,this.canvas_ctx=null,this.shadow=null,this.shadow_w=0,this.shadow_h=0,this.active_node=null,this.target_node=null,this.target_direct=null,this.client_w=0,this.client_h=0,this.offset_x=0,this.offset_y=0,this.hlookup_delay=0,this.hlookup_timer=0,this.capture=!1,this.moved=!1,this.canvas_draggable=t.get_view_draggable(),this.view_panel=t.view.e_panel,this.view_panel_rect=null}init(){this._create_canvas(),this._create_shadow(),this._event_bind()}resize(){this.jm.view.e_nodes.appendChild(this.shadow),this.e_canvas.width=this.jm.view.size.w,this.e_canvas.height=this.jm.view.size.h}_create_canvas(){var i=t.c("canvas");this.jm.view.e_panel.appendChild(i);var e=i.getContext("2d");this.e_canvas=i,this.canvas_ctx=e}_create_shadow(){var i=t.c("jmnode");i.style.visibility="hidden",i.style.zIndex="3",i.style.cursor="move",i.style.opacity="0.7",this.shadow=i}reset_shadow(t){var i=this.shadow.style;this.shadow.innerHTML=t.innerHTML,i.left=t.style.left,i.top=t.style.top,i.width=t.style.width,i.height=t.style.height,i.backgroundImage=t.style.backgroundImage,i.backgroundSize=t.style.backgroundSize,i.transform=t.style.transform,this.shadow_w=this.shadow.clientWidth,this.shadow_h=this.shadow.clientHeight}show_shadow(){this.moved||(this.shadow.style.visibility="visible")}hide_shadow(){this.shadow.style.visibility="hidden"}_magnet_shadow(t){t&&(this.canvas_ctx.lineWidth=this.options.line_width,this.canvas_ctx.strokeStyle=this.options.line_color,this.canvas_ctx.lineCap="round",this._clear_lines(),this._canvas_lineto(t.sp.x,t.sp.y,t.np.x,t.np.y))}_clear_lines(){this.canvas_ctx.clearRect(0,0,this.jm.view.size.w,this.jm.view.size.h)}_canvas_lineto(t,i,e,s){this.canvas_ctx.beginPath(),this.canvas_ctx.moveTo(t,i),this.canvas_ctx.lineTo(e,s),this.canvas_ctx.stroke()}_lookup_close_node(){var t,i,e=this.jm.get_root(),s=e.get_location(),o=e.get_size(),n=s.x+o.w/2,h=this.shadow_w,l=this.shadow_h,a=this.shadow.offsetLeft,_=this.shadow.offsetTop,r=a+h/2>=n?jsMind.direction.right:jsMind.direction.left,c=this.jm.mind.nodes,d=null,v=this.jm.layout,g=Number.MAX_VALUE,p=0,w=null,u=null,f=null;for(var m in c){var y,j;if((d=c[m]).isroot||d.direction==r){if(d.id==this.active_node.id)continue;if(!v.is_visible(d))continue;if(t=d.get_size(),i=d.get_location(),r==jsMind.direction.right){if(a-i.x-t.w<=0)continue;p=Math.abs(a-i.x-t.w)+Math.abs(_+l/2-i.y-t.h/2),y={x:i.x+t.w-this.options.line_width,y:i.y+t.h/2},j={x:a+this.options.line_width,y:_+l/2}}else{if(i.x-a-h<=0)continue;p=Math.abs(a+h-i.x)+Math.abs(_+l/2-i.y-t.h/2),y={x:i.x+this.options.line_width,y:i.y+t.h/2},j={x:a+h-this.options.line_width,y:_+l/2}}p<g&&(w=d,u=y,f=j,g=p)}}var b=null;return w&&(b={node:w,direction:r,sp:f,np:u}),b}lookup_close_node(){var t=this._lookup_close_node();t&&(this._magnet_shadow(t),this.target_node=t.node,this.target_direct=t.direction)}_event_bind(){var i=this,e=this.jm.view.container;t.on(e,"mousedown",(function(t){var e=t||event;i.dragstart.call(i,e)})),t.on(e,"mousemove",(function(t){var e=t||event;i.drag.call(i,e)})),t.on(e,"mouseup",(function(t){var e=t||event;i.dragend.call(i,e)})),t.on(e,"touchstart",(function(t){var e=t||event;i.dragstart.call(i,e)})),t.on(e,"touchmove",(function(t){var e=t||event;i.drag.call(i,e)})),t.on(e,"touchend",(function(t){var e=t||event;i.dragend.call(i,e)}))}dragstart(i){if(this.jm.get_editable()&&!this.capture){this.active_node=null,this.view_draggable=this.jm.get_view_draggable();var e=this.jm.view,s=i.target||event.srcElement;if("jmnode"==s.tagName.toLowerCase()){this.view_draggable&&this.jm.disable_view_draggable();var o=e.get_binded_nodeid(s);if(o){var n=this.jm.get_node(o);if(!n.isroot){this.reset_shadow(s),this.view_panel_rect=this.view_panel.getBoundingClientRect(),this.active_node=n,this.offset_x=(i.clientX||i.touches[0].clientX)/e.zoom_current-s.offsetLeft,this.offset_y=(i.clientY||i.touches[0].clientY)/e.zoom_current-s.offsetTop,this.client_hw=Math.floor(s.clientWidth/2),this.client_hh=Math.floor(s.clientHeight/2),0!=this.hlookup_delay&&t.w.clearTimeout(this.hlookup_delay),0!=this.hlookup_timer&&t.w.clearInterval(this.hlookup_timer);var h=this;this.hlookup_delay=t.w.setTimeout((function(){h.hlookup_delay=0,h.hlookup_timer=t.w.setInterval((function(){h.lookup_close_node.call(h)}),h.options.lookup_interval)}),this.options.lookup_delay),this.capture=!0}}}}}drag(t){if(this.jm.get_editable()&&this.capture){t.preventDefault(),this.show_shadow(),this.moved=!0,i();var e=this.jm.view,s=(t.clientX||t.touches[0].clientX)/e.zoom_current-this.offset_x,o=(t.clientY||t.touches[0].clientY)/e.zoom_current-this.offset_y;t.clientY-this.view_panel_rect.top<this.options.scrolling_trigger_width&&this.view_panel.scrollTop>this.options.scrolling_step_length?(this.view_panel.scrollBy(0,-this.options.scrolling_step_length),this.offset_y+=this.options.scrolling_step_length/e.zoom_current):this.view_panel_rect.bottom-t.clientY<this.options.scrolling_trigger_width&&this.view_panel.scrollTop<this.view_panel.scrollHeight-this.view_panel_rect.height-this.options.scrolling_step_length&&(this.view_panel.scrollBy(0,this.options.scrolling_step_length),this.offset_y-=this.options.scrolling_step_length/e.zoom_current),t.clientX-this.view_panel_rect.left<this.options.scrolling_trigger_width&&this.view_panel.scrollLeft>this.options.scrolling_step_length?(this.view_panel.scrollBy(-this.options.scrolling_step_length,0),this.offset_x+=this.options.scrolling_step_length/e.zoom_current):this.view_panel_rect.right-t.clientX<this.options.scrolling_trigger_width&&this.view_panel.scrollLeft<this.view_panel.scrollWidth-this.view_panel_rect.width-this.options.scrolling_step_length&&(this.view_panel.scrollBy(this.options.scrolling_step_length,0),this.offset_x-=this.options.scrolling_step_length/e.zoom_current),this.shadow.style.left=s+"px",this.shadow.style.top=o+"px",i()}}dragend(i){if(this.jm.get_editable()){if(this.view_draggable&&this.jm.enable_view_draggable(),this.capture){if(0!=this.hlookup_delay&&(t.w.clearTimeout(this.hlookup_delay),this.hlookup_delay=0,this._clear_lines()),0!=this.hlookup_timer&&(t.w.clearInterval(this.hlookup_timer),this.hlookup_timer=0,this._clear_lines()),this.moved){var e=this.active_node,s=this.target_node,o=this.target_direct;this.move_node(e,s,o)}this.hide_shadow()}this.view_panel_rect=null,this.moved=!1,this.capture=!1}}move_node(t,i,e){var s=this.shadow.offsetTop;if(i&&t&&!jsMind.node.inherited(t,i)){for(var o=i.children,n=o.length,h=null,l=Number.MAX_VALUE,a=null,_="_last_";n--;)if((h=o[n]).direction==e&&h.id!=t.id){var r=h.get_location().y-s;r>0&&r<l&&(l=r,a=h,_="_first_")}a&&(_=a.id),this.jm.move_node(t.id,_,i.id,e)}this.active_node=null,this.target_node=null,this.target_direct=null}jm_event_handle(t,i){t===jsMind.event_type.resize&&this.resize()}}var o=new jsMind.plugin("draggable_node",(function(t,i){var e=new s(t,i);e.init(),t.add_event_listener((function(t,i){e.jm_event_handle.call(e,t,i)}))}));jsMind.register_plugin(o)}();
9
9
  //# sourceMappingURL=jsmind.draggable-node.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"jsmind.draggable-node.js","sources":["../src/plugins/jsmind.draggable-node.js"],"sourcesContent":["/**\n * @license BSD\n * @copyright 2014-2023 hizzgdev@163.com\n *\n * Project Home:\n * https://github.com/hizzgdev/jsmind/\n */\n\nif (!jsMind) {\n throw new Error('jsMind is not defined');\n}\n\nconst $ = jsMind.$;\n\nconst clear_selection =\n 'getSelection' in $.w\n ? function () {\n $.w.getSelection().removeAllRanges();\n }\n : function () {\n $.d.selection.empty();\n };\n\nconst DEFAULT_OPTIONS = {\n line_width: 5,\n line_color: 'rgba(0,0,0,0.3)',\n lookup_delay: 500,\n lookup_interval: 80,\n scrolling_trigger_width: 20,\n scrolling_step_length: 10,\n};\n\nclass DraggableNode {\n constructor(jm, options) {\n var opts = {};\n jsMind.util.json.merge(opts, DEFAULT_OPTIONS);\n jsMind.util.json.merge(opts, options);\n\n this.jm = jm;\n this.options = opts;\n this.e_canvas = null;\n this.canvas_ctx = null;\n this.shadow = null;\n this.shadow_w = 0;\n this.shadow_h = 0;\n this.active_node = null;\n this.target_node = null;\n this.target_direct = null;\n this.client_w = 0;\n this.client_h = 0;\n this.offset_x = 0;\n this.offset_y = 0;\n this.hlookup_delay = 0;\n this.hlookup_timer = 0;\n this.capture = false;\n this.moved = false;\n this.canvas_draggable = jm.get_view_draggable();\n this.view_panel = jm.view.e_panel;\n this.view_panel_rect = null;\n }\n init() {\n this._create_canvas();\n this._create_shadow();\n this._event_bind();\n }\n resize() {\n this.jm.view.e_nodes.appendChild(this.shadow);\n this.e_canvas.width = this.jm.view.size.w;\n this.e_canvas.height = this.jm.view.size.h;\n }\n _create_canvas() {\n var c = $.c('canvas');\n this.jm.view.e_panel.appendChild(c);\n var ctx = c.getContext('2d');\n this.e_canvas = c;\n this.canvas_ctx = ctx;\n }\n _create_shadow() {\n var s = $.c('jmnode');\n s.style.visibility = 'hidden';\n s.style.zIndex = '3';\n s.style.cursor = 'move';\n s.style.opacity = '0.7';\n this.shadow = s;\n }\n reset_shadow(el) {\n var s = this.shadow.style;\n this.shadow.innerHTML = el.innerHTML;\n s.left = el.style.left;\n s.top = el.style.top;\n s.width = el.style.width;\n s.height = el.style.height;\n s.backgroundImage = el.style.backgroundImage;\n s.backgroundSize = el.style.backgroundSize;\n s.transform = el.style.transform;\n this.shadow_w = this.shadow.clientWidth;\n this.shadow_h = this.shadow.clientHeight;\n }\n show_shadow() {\n if (!this.moved) {\n this.shadow.style.visibility = 'visible';\n }\n }\n hide_shadow() {\n this.shadow.style.visibility = 'hidden';\n }\n _magnet_shadow(node) {\n if (!!node) {\n this.canvas_ctx.lineWidth = this.options.line_width;\n this.canvas_ctx.strokeStyle = this.options.line_color;\n this.canvas_ctx.lineCap = 'round';\n this._clear_lines();\n this._canvas_lineto(node.sp.x, node.sp.y, node.np.x, node.np.y);\n }\n }\n _clear_lines() {\n this.canvas_ctx.clearRect(0, 0, this.jm.view.size.w, this.jm.view.size.h);\n }\n _canvas_lineto(x1, y1, x2, y2) {\n this.canvas_ctx.beginPath();\n this.canvas_ctx.moveTo(x1, y1);\n this.canvas_ctx.lineTo(x2, y2);\n this.canvas_ctx.stroke();\n }\n _lookup_close_node() {\n var root = this.jm.get_root();\n var root_location = root.get_location();\n var root_size = root.get_size();\n var root_x = root_location.x + root_size.w / 2;\n\n var sw = this.shadow_w;\n var sh = this.shadow_h;\n var sx = this.shadow.offsetLeft;\n var sy = this.shadow.offsetTop;\n\n var ns, nl;\n\n var direct = sx + sw / 2 >= root_x ? jsMind.direction.right : jsMind.direction.left;\n var nodes = this.jm.mind.nodes;\n var node = null;\n var layout = this.jm.layout;\n var min_distance = Number.MAX_VALUE;\n var distance = 0;\n var closest_node = null;\n var closest_p = null;\n var shadow_p = null;\n for (var nodeid in nodes) {\n var np, sp;\n node = nodes[nodeid];\n if (node.isroot || node.direction == direct) {\n if (node.id == this.active_node.id) {\n continue;\n }\n if (!layout.is_visible(node)) {\n continue;\n }\n ns = node.get_size();\n nl = node.get_location();\n if (direct == jsMind.direction.right) {\n if (sx - nl.x - ns.w <= 0) {\n continue;\n }\n distance = Math.abs(sx - nl.x - ns.w) + Math.abs(sy + sh / 2 - nl.y - ns.h / 2);\n np = { x: nl.x + ns.w - this.options.line_width, y: nl.y + ns.h / 2 };\n sp = { x: sx + this.options.line_width, y: sy + sh / 2 };\n } else {\n if (nl.x - sx - sw <= 0) {\n continue;\n }\n distance = Math.abs(sx + sw - nl.x) + Math.abs(sy + sh / 2 - nl.y - ns.h / 2);\n np = { x: nl.x + this.options.line_width, y: nl.y + ns.h / 2 };\n sp = { x: sx + sw - this.options.line_width, y: sy + sh / 2 };\n }\n if (distance < min_distance) {\n closest_node = node;\n closest_p = np;\n shadow_p = sp;\n min_distance = distance;\n }\n }\n }\n var result_node = null;\n if (!!closest_node) {\n result_node = {\n node: closest_node,\n direction: direct,\n sp: shadow_p,\n np: closest_p,\n };\n }\n return result_node;\n }\n lookup_close_node() {\n var node_data = this._lookup_close_node();\n if (!!node_data) {\n this._magnet_shadow(node_data);\n this.target_node = node_data.node;\n this.target_direct = node_data.direction;\n }\n }\n _event_bind() {\n var jd = this;\n var container = this.jm.view.container;\n $.on(container, 'mousedown', function (e) {\n var evt = e || event;\n jd.dragstart.call(jd, evt);\n });\n $.on(container, 'mousemove', function (e) {\n var evt = e || event;\n jd.drag.call(jd, evt);\n });\n $.on(container, 'mouseup', function (e) {\n var evt = e || event;\n jd.dragend.call(jd, evt);\n });\n $.on(container, 'touchstart', function (e) {\n var evt = e || event;\n jd.dragstart.call(jd, evt);\n });\n $.on(container, 'touchmove', function (e) {\n var evt = e || event;\n jd.drag.call(jd, evt);\n });\n $.on(container, 'touchend', function (e) {\n var evt = e || event;\n jd.dragend.call(jd, evt);\n });\n }\n dragstart(e) {\n if (!this.jm.get_editable()) {\n return;\n }\n if (this.capture) {\n return;\n }\n this.active_node = null;\n this.view_draggable = this.jm.get_view_draggable();\n\n var jview = this.jm.view;\n var el = e.target || event.srcElement;\n if (el.tagName.toLowerCase() != 'jmnode') {\n return;\n }\n if (this.view_draggable) {\n this.jm.disable_view_draggable();\n }\n var nodeid = jview.get_binded_nodeid(el);\n if (!!nodeid) {\n var node = this.jm.get_node(nodeid);\n if (!node.isroot) {\n this.reset_shadow(el);\n this.view_panel_rect = this.view_panel.getBoundingClientRect();\n this.active_node = node;\n this.offset_x =\n (e.clientX || e.touches[0].clientX) / jview.zoom_current - el.offsetLeft;\n this.offset_y =\n (e.clientY || e.touches[0].clientY) / jview.zoom_current - el.offsetTop;\n this.client_hw = Math.floor(el.clientWidth / 2);\n this.client_hh = Math.floor(el.clientHeight / 2);\n if (this.hlookup_delay != 0) {\n $.w.clearTimeout(this.hlookup_delay);\n }\n if (this.hlookup_timer != 0) {\n $.w.clearInterval(this.hlookup_timer);\n }\n var jd = this;\n this.hlookup_delay = $.w.setTimeout(function () {\n jd.hlookup_delay = 0;\n jd.hlookup_timer = $.w.setInterval(function () {\n jd.lookup_close_node.call(jd);\n }, jd.options.lookup_interval);\n }, this.options.lookup_delay);\n this.capture = true;\n }\n }\n }\n drag(e) {\n if (!this.jm.get_editable()) {\n return;\n }\n if (this.capture) {\n e.preventDefault();\n this.show_shadow();\n this.moved = true;\n clear_selection();\n var jview = this.jm.view;\n var px = (e.clientX || e.touches[0].clientX) / jview.zoom_current - this.offset_x;\n var py = (e.clientY || e.touches[0].clientY) / jview.zoom_current - this.offset_y;\n // scrolling container axisY if drag nodes exceeding container\n if (\n e.clientY - this.view_panel_rect.top < this.options.scrolling_trigger_width &&\n this.view_panel.scrollTop > this.options.scrolling_step_length\n ) {\n this.view_panel.scrollBy(0, -this.options.scrolling_step_length);\n this.offset_y += this.options.scrolling_step_length / jview.zoom_current;\n } else if (\n this.view_panel_rect.bottom - e.clientY < this.options.scrolling_trigger_width &&\n this.view_panel.scrollTop <\n this.view_panel.scrollHeight -\n this.view_panel_rect.height -\n this.options.scrolling_step_length\n ) {\n this.view_panel.scrollBy(0, this.options.scrolling_step_length);\n this.offset_y -= this.options.scrolling_step_length / jview.zoom_current;\n }\n // scrolling container axisX if drag nodes exceeding container\n if (\n e.clientX - this.view_panel_rect.left < this.options.scrolling_trigger_width &&\n this.view_panel.scrollLeft > this.options.scrolling_step_length\n ) {\n this.view_panel.scrollBy(-this.options.scrolling_step_length, 0);\n this.offset_x += this.options.scrolling_step_length / jview.zoom_current;\n } else if (\n this.view_panel_rect.right - e.clientX < this.options.scrolling_trigger_width &&\n this.view_panel.scrollLeft <\n this.view_panel.scrollWidth -\n this.view_panel_rect.width -\n this.options.scrolling_step_length\n ) {\n this.view_panel.scrollBy(this.options.scrolling_step_length, 0);\n this.offset_x -= this.options.scrolling_step_length / jview.zoom_current;\n }\n this.shadow.style.left = px + 'px';\n this.shadow.style.top = py + 'px';\n clear_selection();\n }\n }\n dragend(e) {\n if (!this.jm.get_editable()) {\n return;\n }\n if (this.view_draggable) {\n this.jm.enable_view_draggable();\n }\n if (this.capture) {\n if (this.hlookup_delay != 0) {\n $.w.clearTimeout(this.hlookup_delay);\n this.hlookup_delay = 0;\n this._clear_lines();\n }\n if (this.hlookup_timer != 0) {\n $.w.clearInterval(this.hlookup_timer);\n this.hlookup_timer = 0;\n this._clear_lines();\n }\n if (this.moved) {\n var src_node = this.active_node;\n var target_node = this.target_node;\n var target_direct = this.target_direct;\n this.move_node(src_node, target_node, target_direct);\n }\n this.hide_shadow();\n }\n this.view_panel_rect = null;\n this.moved = false;\n this.capture = false;\n }\n move_node(src_node, target_node, target_direct) {\n var shadow_h = this.shadow.offsetTop;\n if (!!target_node && !!src_node && !jsMind.node.inherited(src_node, target_node)) {\n // lookup before_node\n var sibling_nodes = target_node.children;\n var sc = sibling_nodes.length;\n var node = null;\n var delta_y = Number.MAX_VALUE;\n var node_before = null;\n var beforeid = '_last_';\n while (sc--) {\n node = sibling_nodes[sc];\n if (node.direction == target_direct && node.id != src_node.id) {\n var dy = node.get_location().y - shadow_h;\n if (dy > 0 && dy < delta_y) {\n delta_y = dy;\n node_before = node;\n beforeid = '_first_';\n }\n }\n }\n if (!!node_before) {\n beforeid = node_before.id;\n }\n this.jm.move_node(src_node.id, beforeid, target_node.id, target_direct);\n }\n this.active_node = null;\n this.target_node = null;\n this.target_direct = null;\n }\n jm_event_handle(type, data) {\n if (type === jsMind.event_type.resize) {\n this.resize();\n }\n }\n}\n\nvar draggable_plugin = new jsMind.plugin('draggable_node', function (jm, options) {\n var jd = new DraggableNode(jm, options);\n jd.init();\n jm.add_event_listener(function (type, data) {\n jd.jm_event_handle.call(jd, type, data);\n });\n});\n\njsMind.register_plugin(draggable_plugin);\n"],"names":["jsMind","Error","$","clear_selection","w","getSelection","removeAllRanges","d","selection","empty","DEFAULT_OPTIONS","line_width","line_color","lookup_delay","lookup_interval","scrolling_trigger_width","scrolling_step_length","DraggableNode","constructor","jm","options","opts","util","json","merge","this","e_canvas","canvas_ctx","shadow","shadow_w","shadow_h","active_node","target_node","target_direct","client_w","client_h","offset_x","offset_y","hlookup_delay","hlookup_timer","capture","moved","canvas_draggable","get_view_draggable","view_panel","view","e_panel","view_panel_rect","init","_create_canvas","_create_shadow","_event_bind","resize","e_nodes","appendChild","width","size","height","h","c","ctx","getContext","s","style","visibility","zIndex","cursor","opacity","reset_shadow","el","innerHTML","left","top","backgroundImage","backgroundSize","transform","clientWidth","clientHeight","show_shadow","hide_shadow","_magnet_shadow","node","lineWidth","strokeStyle","lineCap","_clear_lines","_canvas_lineto","sp","x","y","np","clearRect","x1","y1","x2","y2","beginPath","moveTo","lineTo","stroke","_lookup_close_node","ns","nl","root","get_root","root_location","get_location","root_size","get_size","root_x","sw","sh","sx","offsetLeft","sy","offsetTop","direct","direction","right","nodes","mind","layout","min_distance","Number","MAX_VALUE","distance","closest_node","closest_p","shadow_p","nodeid","isroot","id","is_visible","Math","abs","result_node","lookup_close_node","node_data","jd","container","on","e","evt","event","dragstart","call","drag","dragend","get_editable","view_draggable","jview","target","srcElement","tagName","toLowerCase","disable_view_draggable","get_binded_nodeid","get_node","getBoundingClientRect","clientX","touches","zoom_current","clientY","client_hw","floor","client_hh","clearTimeout","clearInterval","setTimeout","setInterval","preventDefault","px","py","scrollTop","scrollBy","bottom","scrollHeight","scrollLeft","scrollWidth","enable_view_draggable","src_node","move_node","inherited","sibling_nodes","children","sc","length","delta_y","node_before","beforeid","dy","jm_event_handle","type","data","event_type","draggable_plugin","plugin","add_event_listener","register_plugin"],"mappings":";;;;;;;yBAQA,IAAKA,OACD,MAAM,IAAIC,MAAM,yBAGpB,MAAMC,EAAIF,OAAOE,EAEXC,EACF,iBAAkBD,EAAEE,EACd,WACIF,EAAEE,EAAEC,eAAeC,iBACtB,EACD,WACIJ,EAAEK,EAAEC,UAAUC,OAC5B,EAEMC,EAAkB,CACpBC,WAAY,EACZ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AAO,KACP0G,EAAUhE,OAAOC,UACjBgE,EAAc,KACdC,EAAW,SACRJ,KAEH,IADAxG,EAAOsG,EAAcE,IACZpE,WAAapF,GAAiBgD,EAAKkD,IAAMiD,EAASjD,GAAI,CAC3D,IAAI2D,EAAK7G,EAAKyB,eAAejB,EAAI3D,EAC7BgK,EAAK,GAAKA,EAAKH,IACfA,EAAUG,EACVF,EAAc3G,EACd4G,EAAW,UAElB,CAECD,IACFC,EAAWD,EAAYzD,IAE3B1G,KAAKN,GAAGkK,UAAUD,EAASjD,GAAI0D,EAAU7J,EAAYmG,GAAIlG,EAC5D,CACDR,KAAKM,YAAc,KACnBN,KAAKO,YAAc,KACnBP,KAAKQ,cAAgB,IACxB,CACD8J,gBAAgBC,EAAMC,GACdD,IAAShM,OAAOkM,WAAW9I,QAC3B3B,KAAK2B,QAEZ,EAGL,IAAI+I,EAAmB,IAAInM,OAAOoM,OAAO,kBAAkB,SAAUjL,EAAIC,GACrE,IAAIsH,EAAK,IAAIzH,EAAcE,EAAIC,GAC/BsH,EAAG1F,OACH7B,EAAGkL,oBAAmB,SAAUL,EAAMC,GAClCvD,EAAGqD,gBAAgB9C,KAAKP,EAAIsD,EAAMC,EAC1C,GACA,IAEAjM,OAAOsM,gBAAgBH"}
1
+ {"version":3,"file":"jsmind.draggable-node.js","sources":["../src/plugins/jsmind.draggable-node.js"],"sourcesContent":["/**\n * @license BSD\n * @copyright 2014-2023 hizzgdev@163.com\n *\n * Project Home:\n * https://github.com/hizzgdev/jsmind/\n */\n\nif (!jsMind) {\n throw new Error('jsMind is not defined');\n}\n\nconst $ = jsMind.$;\n\nconst clear_selection =\n 'getSelection' in $.w\n ? function () {\n $.w.getSelection().removeAllRanges();\n }\n : function () {\n $.d.selection.empty();\n };\n\nconst DEFAULT_OPTIONS = {\n line_width: 5,\n line_color: 'rgba(0,0,0,0.3)',\n lookup_delay: 500,\n lookup_interval: 80,\n scrolling_trigger_width: 20,\n scrolling_step_length: 10,\n};\n\nclass DraggableNode {\n constructor(jm, options) {\n var opts = {};\n jsMind.util.json.merge(opts, DEFAULT_OPTIONS);\n jsMind.util.json.merge(opts, options);\n\n this.version = '0.3.0';\n this.jm = jm;\n this.options = opts;\n this.e_canvas = null;\n this.canvas_ctx = null;\n this.shadow = null;\n this.shadow_w = 0;\n this.shadow_h = 0;\n this.active_node = null;\n this.target_node = null;\n this.target_direct = null;\n this.client_w = 0;\n this.client_h = 0;\n this.offset_x = 0;\n this.offset_y = 0;\n this.hlookup_delay = 0;\n this.hlookup_timer = 0;\n this.capture = false;\n this.moved = false;\n this.canvas_draggable = jm.get_view_draggable();\n this.view_panel = jm.view.e_panel;\n this.view_panel_rect = null;\n }\n init() {\n this._create_canvas();\n this._create_shadow();\n this._event_bind();\n }\n resize() {\n this.jm.view.e_nodes.appendChild(this.shadow);\n this.e_canvas.width = this.jm.view.size.w;\n this.e_canvas.height = this.jm.view.size.h;\n }\n _create_canvas() {\n var c = $.c('canvas');\n this.jm.view.e_panel.appendChild(c);\n var ctx = c.getContext('2d');\n this.e_canvas = c;\n this.canvas_ctx = ctx;\n }\n _create_shadow() {\n var s = $.c('jmnode');\n s.style.visibility = 'hidden';\n s.style.zIndex = '3';\n s.style.cursor = 'move';\n s.style.opacity = '0.7';\n this.shadow = s;\n }\n reset_shadow(el) {\n var s = this.shadow.style;\n this.shadow.innerHTML = el.innerHTML;\n s.left = el.style.left;\n s.top = el.style.top;\n s.width = el.style.width;\n s.height = el.style.height;\n s.backgroundImage = el.style.backgroundImage;\n s.backgroundSize = el.style.backgroundSize;\n s.transform = el.style.transform;\n this.shadow_w = this.shadow.clientWidth;\n this.shadow_h = this.shadow.clientHeight;\n }\n show_shadow() {\n if (!this.moved) {\n this.shadow.style.visibility = 'visible';\n }\n }\n hide_shadow() {\n this.shadow.style.visibility = 'hidden';\n }\n _magnet_shadow(node) {\n if (!!node) {\n this.canvas_ctx.lineWidth = this.options.line_width;\n this.canvas_ctx.strokeStyle = this.options.line_color;\n this.canvas_ctx.lineCap = 'round';\n this._clear_lines();\n this._canvas_lineto(node.sp.x, node.sp.y, node.np.x, node.np.y);\n }\n }\n _clear_lines() {\n this.canvas_ctx.clearRect(0, 0, this.jm.view.size.w, this.jm.view.size.h);\n }\n _canvas_lineto(x1, y1, x2, y2) {\n this.canvas_ctx.beginPath();\n this.canvas_ctx.moveTo(x1, y1);\n this.canvas_ctx.lineTo(x2, y2);\n this.canvas_ctx.stroke();\n }\n _lookup_close_node() {\n var root = this.jm.get_root();\n var root_location = root.get_location();\n var root_size = root.get_size();\n var root_x = root_location.x + root_size.w / 2;\n\n var sw = this.shadow_w;\n var sh = this.shadow_h;\n var sx = this.shadow.offsetLeft;\n var sy = this.shadow.offsetTop;\n\n var ns, nl;\n\n var direct = sx + sw / 2 >= root_x ? jsMind.direction.right : jsMind.direction.left;\n var nodes = this.jm.mind.nodes;\n var node = null;\n var layout = this.jm.layout;\n var min_distance = Number.MAX_VALUE;\n var distance = 0;\n var closest_node = null;\n var closest_p = null;\n var shadow_p = null;\n for (var nodeid in nodes) {\n var np, sp;\n node = nodes[nodeid];\n if (node.isroot || node.direction == direct) {\n if (node.id == this.active_node.id) {\n continue;\n }\n if (!layout.is_visible(node)) {\n continue;\n }\n ns = node.get_size();\n nl = node.get_location();\n if (direct == jsMind.direction.right) {\n if (sx - nl.x - ns.w <= 0) {\n continue;\n }\n distance = Math.abs(sx - nl.x - ns.w) + Math.abs(sy + sh / 2 - nl.y - ns.h / 2);\n np = { x: nl.x + ns.w - this.options.line_width, y: nl.y + ns.h / 2 };\n sp = { x: sx + this.options.line_width, y: sy + sh / 2 };\n } else {\n if (nl.x - sx - sw <= 0) {\n continue;\n }\n distance = Math.abs(sx + sw - nl.x) + Math.abs(sy + sh / 2 - nl.y - ns.h / 2);\n np = { x: nl.x + this.options.line_width, y: nl.y + ns.h / 2 };\n sp = { x: sx + sw - this.options.line_width, y: sy + sh / 2 };\n }\n if (distance < min_distance) {\n closest_node = node;\n closest_p = np;\n shadow_p = sp;\n min_distance = distance;\n }\n }\n }\n var result_node = null;\n if (!!closest_node) {\n result_node = {\n node: closest_node,\n direction: direct,\n sp: shadow_p,\n np: closest_p,\n };\n }\n return result_node;\n }\n lookup_close_node() {\n var node_data = this._lookup_close_node();\n if (!!node_data) {\n this._magnet_shadow(node_data);\n this.target_node = node_data.node;\n this.target_direct = node_data.direction;\n }\n }\n _event_bind() {\n var jd = this;\n var container = this.jm.view.container;\n $.on(container, 'mousedown', function (e) {\n var evt = e || event;\n jd.dragstart.call(jd, evt);\n });\n $.on(container, 'mousemove', function (e) {\n var evt = e || event;\n jd.drag.call(jd, evt);\n });\n $.on(container, 'mouseup', function (e) {\n var evt = e || event;\n jd.dragend.call(jd, evt);\n });\n $.on(container, 'touchstart', function (e) {\n var evt = e || event;\n jd.dragstart.call(jd, evt);\n });\n $.on(container, 'touchmove', function (e) {\n var evt = e || event;\n jd.drag.call(jd, evt);\n });\n $.on(container, 'touchend', function (e) {\n var evt = e || event;\n jd.dragend.call(jd, evt);\n });\n }\n dragstart(e) {\n if (!this.jm.get_editable()) {\n return;\n }\n if (this.capture) {\n return;\n }\n this.active_node = null;\n this.view_draggable = this.jm.get_view_draggable();\n\n var jview = this.jm.view;\n var el = e.target || event.srcElement;\n if (el.tagName.toLowerCase() != 'jmnode') {\n return;\n }\n if (this.view_draggable) {\n this.jm.disable_view_draggable();\n }\n var nodeid = jview.get_binded_nodeid(el);\n if (!!nodeid) {\n var node = this.jm.get_node(nodeid);\n if (!node.isroot) {\n this.reset_shadow(el);\n this.view_panel_rect = this.view_panel.getBoundingClientRect();\n this.active_node = node;\n this.offset_x =\n (e.clientX || e.touches[0].clientX) / jview.zoom_current - el.offsetLeft;\n this.offset_y =\n (e.clientY || e.touches[0].clientY) / jview.zoom_current - el.offsetTop;\n this.client_hw = Math.floor(el.clientWidth / 2);\n this.client_hh = Math.floor(el.clientHeight / 2);\n if (this.hlookup_delay != 0) {\n $.w.clearTimeout(this.hlookup_delay);\n }\n if (this.hlookup_timer != 0) {\n $.w.clearInterval(this.hlookup_timer);\n }\n var jd = this;\n this.hlookup_delay = $.w.setTimeout(function () {\n jd.hlookup_delay = 0;\n jd.hlookup_timer = $.w.setInterval(function () {\n jd.lookup_close_node.call(jd);\n }, jd.options.lookup_interval);\n }, this.options.lookup_delay);\n this.capture = true;\n }\n }\n }\n drag(e) {\n if (!this.jm.get_editable()) {\n return;\n }\n if (this.capture) {\n e.preventDefault();\n this.show_shadow();\n this.moved = true;\n clear_selection();\n var jview = this.jm.view;\n var px = (e.clientX || e.touches[0].clientX) / jview.zoom_current - this.offset_x;\n var py = (e.clientY || e.touches[0].clientY) / jview.zoom_current - this.offset_y;\n // scrolling container axisY if drag nodes exceeding container\n if (\n e.clientY - this.view_panel_rect.top < this.options.scrolling_trigger_width &&\n this.view_panel.scrollTop > this.options.scrolling_step_length\n ) {\n this.view_panel.scrollBy(0, -this.options.scrolling_step_length);\n this.offset_y += this.options.scrolling_step_length / jview.zoom_current;\n } else if (\n this.view_panel_rect.bottom - e.clientY < this.options.scrolling_trigger_width &&\n this.view_panel.scrollTop <\n this.view_panel.scrollHeight -\n this.view_panel_rect.height -\n this.options.scrolling_step_length\n ) {\n this.view_panel.scrollBy(0, this.options.scrolling_step_length);\n this.offset_y -= this.options.scrolling_step_length / jview.zoom_current;\n }\n // scrolling container axisX if drag nodes exceeding container\n if (\n e.clientX - this.view_panel_rect.left < this.options.scrolling_trigger_width &&\n this.view_panel.scrollLeft > this.options.scrolling_step_length\n ) {\n this.view_panel.scrollBy(-this.options.scrolling_step_length, 0);\n this.offset_x += this.options.scrolling_step_length / jview.zoom_current;\n } else if (\n this.view_panel_rect.right - e.clientX < this.options.scrolling_trigger_width &&\n this.view_panel.scrollLeft <\n this.view_panel.scrollWidth -\n this.view_panel_rect.width -\n this.options.scrolling_step_length\n ) {\n this.view_panel.scrollBy(this.options.scrolling_step_length, 0);\n this.offset_x -= this.options.scrolling_step_length / jview.zoom_current;\n }\n this.shadow.style.left = px + 'px';\n this.shadow.style.top = py + 'px';\n clear_selection();\n }\n }\n dragend(e) {\n if (!this.jm.get_editable()) {\n return;\n }\n if (this.view_draggable) {\n this.jm.enable_view_draggable();\n }\n if (this.capture) {\n if (this.hlookup_delay != 0) {\n $.w.clearTimeout(this.hlookup_delay);\n this.hlookup_delay = 0;\n this._clear_lines();\n }\n if (this.hlookup_timer != 0) {\n $.w.clearInterval(this.hlookup_timer);\n this.hlookup_timer = 0;\n this._clear_lines();\n }\n if (this.moved) {\n var src_node = this.active_node;\n var target_node = this.target_node;\n var target_direct = this.target_direct;\n this.move_node(src_node, target_node, target_direct);\n }\n this.hide_shadow();\n }\n this.view_panel_rect = null;\n this.moved = false;\n this.capture = false;\n }\n move_node(src_node, target_node, target_direct) {\n var shadow_h = this.shadow.offsetTop;\n if (!!target_node && !!src_node && !jsMind.node.inherited(src_node, target_node)) {\n // lookup before_node\n var sibling_nodes = target_node.children;\n var sc = sibling_nodes.length;\n var node = null;\n var delta_y = Number.MAX_VALUE;\n var node_before = null;\n var beforeid = '_last_';\n while (sc--) {\n node = sibling_nodes[sc];\n if (node.direction == target_direct && node.id != src_node.id) {\n var dy = node.get_location().y - shadow_h;\n if (dy > 0 && dy < delta_y) {\n delta_y = dy;\n node_before = node;\n beforeid = '_first_';\n }\n }\n }\n if (!!node_before) {\n beforeid = node_before.id;\n }\n this.jm.move_node(src_node.id, beforeid, target_node.id, target_direct);\n }\n this.active_node = null;\n this.target_node = null;\n this.target_direct = null;\n }\n jm_event_handle(type, data) {\n if (type === jsMind.event_type.resize) {\n this.resize();\n }\n }\n}\n\nvar draggable_plugin = new jsMind.plugin('draggable_node', function (jm, options) {\n var jd = new DraggableNode(jm, options);\n jd.init();\n jm.add_event_listener(function (type, data) {\n jd.jm_event_handle.call(jd, type, data);\n });\n});\n\njsMind.register_plugin(draggable_plugin);\n"],"names":["jsMind","Error","$","clear_selection","w","getSelection","removeAllRanges","d","selection","empty","DEFAULT_OPTIONS","line_width","line_color","lookup_delay","lookup_interval","scrolling_trigger_width","scrolling_step_length","DraggableNode","constructor","jm","options","opts","util","json","merge","this","version","e_canvas","canvas_ctx","shadow","shadow_w","shadow_h","active_node","target_node","target_direct","client_w","client_h","offset_x","offset_y","hlookup_delay","hlookup_timer","capture","moved","canvas_draggable","get_view_draggable","view_panel","view","e_panel","view_panel_rect","init","_create_canvas","_create_shadow","_event_bind","resize","e_nodes","appendChild","width","size","height","h","c","ctx","getContext","s","style","visibility","zIndex","cursor","opacity","reset_shadow","el","innerHTML","left","top","backgroundImage","backgroundSize","transform","clientWidth","clientHeight","show_shadow","hide_shadow","_magnet_shadow","node","lineWidth","strokeStyle","lineCap","_clear_lines","_canvas_lineto","sp","x","y","np","clearRect","x1","y1","x2","y2","beginPath","moveTo","lineTo","stroke","_lookup_close_node","ns","nl","root","get_root","root_location","get_location","root_size","get_size","root_x","sw","sh","sx","offsetLeft","sy","offsetTop","direct","direction","right","nodes","mind","layout","min_distance","Number","MAX_VALUE","distance","closest_node","closest_p","shadow_p","nodeid","isroot","id","is_visible","Math","abs","result_node","lookup_close_node","node_data","jd","container","on","e","evt","event","dragstart","call","drag","dragend","get_editable","view_draggable","jview","target","srcElement","tagName","toLowerCase","disable_view_draggable","get_binded_nodeid","get_node","getBoundingClientRect","clientX","touches","zoom_current","clientY","client_hw","floor","client_hh","clearTimeout","clearInterval","setTimeout","setInterval","preventDefault","px","py","scrollTop","scrollBy","bottom","scrollHeight","scrollLeft","scrollWidth","enable_view_draggable","src_node","move_node","inherited","sibling_nodes","children","sc","length","delta_y","node_before","beforeid","dy","jm_event_handle","type","data","event_type","draggable_plugin","plugin","add_event_listener","register_plugin"],"mappings":";;;;;;;yBAQA,IAAKA,OACD,MAAM,IAAIC,MAAM,yBAGpB,MAAMC,EAAIF,OAAOE,EAEXC,EACF,iBAAkBD,EAAEE,EACd,WACIF,EAAEE,EAAEC,eAAeC,iBACtB,EACD,WACIJ,EAAEK,EAAEC,UAAUC,OAC5B,EAEMC,EAAkB,CACpBC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