From 9e508fa1ea879ddecce0dc529ec82668b697b0da Mon Sep 17 00:00:00 2001 From: mrsfy Date: Mon, 1 Aug 2016 11:21:38 +0300 Subject: [PATCH] README update. --- README.md | 78 +++++++++++++++++++++------------------- cytoscape-node-resize.js | 2 +- 2 files changed, 43 insertions(+), 37 deletions(-) diff --git a/README.md b/README.md index 7763849..0bdf56a 100644 --- a/README.md +++ b/README.md @@ -8,41 +8,6 @@ Provides grapples to resize nodes. ![Image of extension](img.png) - -## Dependencies - - * Cytoscape.js ^2.7.0 - * oCanvas ^2.8.0 - - -## Usage instructions - -Download the library: - * via npm: `npm install cytoscape-node-resize`, - * via bower: `bower install cytoscape-node-resize`, or - * via direct download in the repository (probably from a tag). - -`require()` the library as appropriate for your project: - -CommonJS: -```js -var cytoscape = require('cytoscape'); -var nodeResize = require('cytoscape-node-resize'); -var oCanvas = require('oCanvas'); - -nodeResize( cytoscape, jQuery, oCanvas ); // register extension -``` - -AMD: -```js -require(['cytoscape', 'cytoscape-node-resize', "jquery", "oCanvas], function( cytoscape, nodeResize, jQuery, oCanvas ){ - nodeResize( cytoscape, jQuery, oCanvas ); // register extension -}); -``` - -Plain HTML/JS has the extension registered for you automatically, because no `require()` is needed. - - ## API Only consists of initilization & default options. @@ -57,7 +22,14 @@ Only consists of initilization & default options. boundingRectangle: true, // enable/disable bounding rectangle boundingRectangleStroke: "1.5px red", // style bounding rectangle - minNodeSize: 15, // minimum width/height of node to be set + minWidth: function (node) { + var data = node.data("resizeMinWidth"); + return data ? data : 15; + }, // a function returns min width of node + minHeight: function (node) { + var data = node.data("resizeMinHeight"); + return data ? data : 15; + }, // a function returns min height of node fixedAspectRatioResizeModeSelector: ".fixedAspectRatioResizeMode",// with only 4 active grapples (at corners) noResizeModeSelector: ".noResizeMode", // no active grapples @@ -79,6 +51,40 @@ Only consists of initilization & default options. ``` +## Dependencies + + * Cytoscape.js ^2.7.0 + * oCanvas ^2.8.0 + + +## Usage instructions + +Download the library: + * via npm: `npm install cytoscape-node-resize`, + * via bower: `bower install cytoscape-node-resize`, or + * via direct download in the repository (probably from a tag). + +`require()` the library as appropriate for your project: + +CommonJS: +```js +var cytoscape = require('cytoscape'); +var nodeResize = require('cytoscape-node-resize'); +var oCanvas = require('oCanvas'); + +nodeResize( cytoscape, jQuery, oCanvas ); // register extension +``` + +AMD: +```js +require(['cytoscape', 'cytoscape-node-resize', "jquery", "oCanvas"], function( cytoscape, nodeResize, jQuery, oCanvas ){ + nodeResize( cytoscape, jQuery, oCanvas ); // register extension +}); +``` + +Plain HTML/JS has the extension registered for you automatically, because no `require()` is needed. + + ## Emitted Events `cy.on("resizestart", function(e, type){ })` diff --git a/cytoscape-node-resize.js b/cytoscape-node-resize.js index bd36d58..026190a 100644 --- a/cytoscape-node-resize.js +++ b/cytoscape-node-resize.js @@ -17,7 +17,7 @@ minWidth: function (node) { var data = node.data("resizeMinWidth"); return data ? data : 15; - }, // a function returns min with of node + }, // a function returns min width of node minHeight: function (node) { var data = node.data("resizeMinHeight"); return data ? data : 15;