From 1ff591136f5e908a69c0669962526b51f2bfc6c2 Mon Sep 17 00:00:00 2001 From: dabeng Date: Fri, 24 Jun 2016 11:28:23 +0800 Subject: [PATCH] split option panzoom into pan and zoom --- README.md | 5 ++++- bower.json | 2 +- dist/js/jquery.orgchart.js | 8 ++++++-- examples/js/jquery.orgchart.js | 8 ++++++-- examples/pan-zoom/scripts.js | 3 ++- package.json | 2 +- 6 files changed, 20 insertions(+), 8 deletions(-) diff --git a/README.md b/README.md index 96a24d61..0fb472d3 100644 --- a/README.md +++ b/README.md @@ -480,7 +480,10 @@ $('#chartContainerId').orgchart(options); datajson or stringyesdatasource usded to build out structure of orgchart. It could be a json object or a string containing the URL to which the ajax request is sent. - panzoombooleannofalseUsers could pan the orgchart by mouse drag&drop, zoomin/zoomout the orgchart by mouse wheel if they enable this option. + panbooleannofalseUsers could pan the orgchart by mouse drag&drop if they enable this option. + + + zoombooleannofalseUsers could zoomin/zoomout the orgchart by mouse wheel if they enable this option. directionstringno"t2b"The available values are t2b(implies "top to bottom", it's default value), b2t(implies "bottom to top"), l2r(implies "left to right"), r2l(implies "right to left"). diff --git a/bower.json b/bower.json index 55c6ff77..a04b0020 100644 --- a/bower.json +++ b/bower.json @@ -1,6 +1,6 @@ { "name": "orgchart", - "version": "1.0.9.6", + "version": "1.0.9.8", "homepage": "https://github.com/dabeng/OrgChart", "authors": [ "dabeng " diff --git a/dist/js/jquery.orgchart.js b/dist/js/jquery.orgchart.js index fddcb97f..a919e459 100755 --- a/dist/js/jquery.orgchart.js +++ b/dist/js/jquery.orgchart.js @@ -38,7 +38,8 @@ 'parentNodeSymbol': 'fa-users', 'draggable': false, 'direction': 't2b', - 'panzoom': false + 'pan': false, + 'zoom': false }; switch (options) { @@ -124,7 +125,7 @@ $chartContainer.append($exportBtn).append(downloadBtn); } - if (opts.panzoom) { + if (opts.pan) { $chartContainer.css('overflow', 'hidden'); $chart.on('mousedown',function(e){ var $this = $(this); @@ -179,6 +180,9 @@ $(this).off('mousemove'); } }); + } + + if (opts.zoom) { $chartContainer.on('wheel', function(event) { event.preventDefault(); var lastTf = $chart.css('transform'); diff --git a/examples/js/jquery.orgchart.js b/examples/js/jquery.orgchart.js index fddcb97f..a919e459 100755 --- a/examples/js/jquery.orgchart.js +++ b/examples/js/jquery.orgchart.js @@ -38,7 +38,8 @@ 'parentNodeSymbol': 'fa-users', 'draggable': false, 'direction': 't2b', - 'panzoom': false + 'pan': false, + 'zoom': false }; switch (options) { @@ -124,7 +125,7 @@ $chartContainer.append($exportBtn).append(downloadBtn); } - if (opts.panzoom) { + if (opts.pan) { $chartContainer.css('overflow', 'hidden'); $chart.on('mousedown',function(e){ var $this = $(this); @@ -179,6 +180,9 @@ $(this).off('mousemove'); } }); + } + + if (opts.zoom) { $chartContainer.on('wheel', function(event) { event.preventDefault(); var lastTf = $chart.css('transform'); diff --git a/examples/pan-zoom/scripts.js b/examples/pan-zoom/scripts.js index c123a9a2..c85e40e0 100644 --- a/examples/pan-zoom/scripts.js +++ b/examples/pan-zoom/scripts.js @@ -33,7 +33,8 @@ 'data' : datascource, 'depth': 2, 'nodeContent': 'title', - 'panzoom': true + 'pan': true, + 'zoom': true }); }); diff --git a/package.json b/package.json index b21f6e25..c2f36d49 100755 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "orgchart", - "version": "1.0.9.6", + "version": "1.0.9.8", "description": "Simple and direct organization chart(tree-like hierarchy) plugin based on pure DOM and jQuery.", "main": "./dist/js/jquery.orgchart.js", "style": [