Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

cytoscape-compound-resize

Package Overview
Dependencies
Maintainers
1
Versions
9
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

cytoscape-compound-resize - npm Package Compare versions

Comparing version 1.0.1 to 1.0.3

35

cytoscape-compound-resize.js

@@ -42,2 +42,5 @@ (function(f){if(typeof exports==="object"&&typeof module!=="undefined"){module.exports=f()}else if(typeof define==="function"&&define.amd){define([],f)}else{var g;if(typeof window!=="undefined"){g=window}else if(typeof global!=="undefined"){g=global}else if(typeof self!=="undefined"){g=self}else{g=this}g.cytoscapeCompoundResize = f()}})(function(){var define,module,exports;return (function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(_dereq_,module,exports){

},
getMode: function() {
return mode;
},
setPaddings: function (nodes, paddings) {

@@ -74,3 +77,3 @@

},
setExtremePaddings: function (nodes, paddings, minOrMax) {
setExtremePaddings: function (nodes, _paddings, minOrMax) {
if (mode !== 'min') {

@@ -88,7 +91,31 @@ return;

// Get the minimum paddings to set them
var extremePaddings = minOrMax === 'min' ? self.getMinimumPaddings(ele) : self.getMaximumPaddings(ele);
var minPaddings = self.getMinimumPaddings(ele);
var maxPaddings = self.getMaximumPaddings(ele);
// Get the extreme paddings to set them
var extremePaddings = minOrMax === 'min' ? minPaddings : maxPaddings;
var sign = minOrMax === 'min' ? 1 : -1;
// Clone _paddings into paddings object
var paddings = {
};
// Filter paddings from _paddings note that the rule of 'maxPaddings >= minPaddings' should be satisfied
if (minOrMax === 'min') {
for (var prop in _paddings) {
if (!maxPaddings[prop] || _paddings[prop] <= maxPaddings[prop]) {
paddings[prop] = _paddings[prop];
}
}
}
else if (minOrMax === 'max') {
for (var prop in _paddings) {
if (!minPaddings[prop] || _paddings[prop] >= minPaddings[prop]) {
paddings[prop] = _paddings[prop];
}
}
}
// Set the extreme paddings where applicable
if (paddings.left) {

@@ -439,2 +466,2 @@ if (paddingLeft * sign < paddings.left * sign) {

});
//# sourceMappingURL=data:application/json;charset:utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIm5vZGVfbW9kdWxlcy9icm93c2VyaWZ5L25vZGVfbW9kdWxlcy9icm93c2VyLXBhY2svX3ByZWx1ZGUuanMiLCJzcmMvY29tcG91bmRSZXNpemVVdGlsaXRpZXMuanMiLCJzcmMvZWxlbWVudFV0aWxpdGllcy5qcyIsInNyYy9pbmRleC5qcyIsInNyYy9zY3JhdGNoVXRpbGl0aWVzLmpzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBO0FDQUE7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E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gICAgICAgICAgICB9XG5cbiAgICAgICAgICAgIHZhciBib3R0b21EaWZmID0gY3VycmVudENvcm5lcnMuYm90dG9tIC0gb2xkQ29ybmVycy5ib3R0b207XG5cbiAgICAgICAgICAgIGlmIChib3R0b21EaWZmICE9IDApIHtcbiAgICAgICAgICAgICAgdmFyIGN1cnJlbnRQYWRkaW5nID0gcGFyc2VJbnQoYW5jZXN0b3IuY3NzKCdwYWRkaW5nLWJvdHRvbScpKTtcbiAgICAgICAgICAgICAgcGFkZGluZ0JvdHRvbSA9IGN1cnJlbnRQYWRkaW5nIC0gYm90dG9tRGlmZjtcbiAgICAgICAgICAgIH1cblxuICAgICAgICAgICAgdmFyIGxlZnREaWZmID0gY3VycmVudENvcm5lcnMubGVmdCAtIG9sZENvcm5lcnMubGVmdDtcblxuICAgICAgICAgICAgaWYgKGxlZnREaWZmICE9IDApIHtcbiAgICAgICAgICAgICAgdmFyIGN1cnJlbnRQYWRkaW5nID0gcGFyc2VJbnQoYW5jZXN0b3IuY3NzKCdwYWRkaW5nLWxlZnQnKSk7XG4gICAgICAgICAgICAgIHBhZGRpbmdMZWZ0ID0gY3VycmVudFBhZGRpbmcgKyBsZWZ0RGlmZjtcbiAgICAgICAgICAgIH1cblxuICAgICAgICAgICAgdmFyIHJpZ2h0RGlmZiA9IGN1cnJlbnRDb3JuZXJzLnJpZ2h0IC0gb2xkQ29ybmVycy5yaWdodDtcblxuICAgICAgICAgICAgaWYgKHJpZ2h0RGlmZiAhPSAwKSB7XG4gICAgICAgICAgICAgIHZhciBjdXJyZW50UGFkZGluZyA9IHBhcnNlSW50KGFuY2VzdG9yLmNzcygncGFkZGluZy1yaWdodCcpKTtcbiAgICAgICAgICAgICAgcGFkZGluZ1JpZ2h0ID0gY3VycmVudFBhZGRpbmcgLSByaWdodERpZmY7XG4gICAgICAgICAgICB9XG5cbiAgICAgICAgICAgIGlmICghcGFkZGluZ1RvcCAmJiAhcGFkZGluZ0JvdHRvbSAmJiAhcGFkZGluZ0xlZnQgJiYgIXBhZGRpbmdSaWdodCkge1xuICAgICAgICAgICAgICBjb250aW51ZTtcbiAgICAgICAgICAgIH1cblxuICAgICAgICAgICAgdmFyIHBhZGRpbmdzID0ge307XG5cbiAgICAgICAgICAgIGlmIChwYWRkaW5nVG9wKSB7XG4gICAgICAgICAgICAgIHBhZGRpbmdzLnRvcCA9IHBhZGRpbmdUb3A7XG4gICAgICAgICAgICB9XG5cbiAgICAgICAgICAgIGlmIChwYWRkaW5nQm90dG9tKSB7XG4gICAgICAgICAgICAgIHBhZGRpbmdzLmJvdHRvbSA9IHBhZGRpbmdCb3R0b207XG4gICAgICAgICAgICB9XG5cbiAgICAgICAgICAgIGlmIChwYWRkaW5nTGVmdCkge1xuICAgICAgICAgICAgICBwYWRkaW5ncy5sZWZ0ID0gcGFkZGluZ0xlZnQ7XG4gICAgICAgICAgICB9XG5cbiAgICAgICAgICAgIGlmIChwYWRkaW5nUmlnaHQpIHtcbiAgICAgICAgICAgICAgcGFkZGluZ3MucmlnaHQgPSBwYWRkaW5nUmlnaHQ7XG4gICAgICAgICAgICB9XG5cbiAgICAgICAgICAgIGNvbXBvdW5kUmVzaXplVXRpbGl0aWVzLnNldFBhZGRpbmdzKGFuY2VzdG9yLCBwYWRkaW5ncyk7XG4gICAgICAgICAgfVxuICAgICAgICB9KTtcbiAgICAgIH07XG5cbiAgICAgIGN5Lm9uKCd0YXBzdGFydCcsICdub2RlJywgdGFwU3RhcnRGY24gPSBmdW5jdGlvbiAoKSB7XG4gICAgICAgIGlmKCBtb2RlICE9PSAnbWluJyApIHtcbiAgICAgICAgICByZXR1cm47XG4gICAgICAgIH1cbiAgICAgICAgXG4gICAgICAgIHZhciBub2RlID0gdGhpcztcblxuICAgICAgICBpZiAobm9kZS5zZWxlY3RlZCgpKSB7XG4gICAgICAgICAgZWZmZWN0ZWROb2RlcyA9IGN5LmNvbGxlY3Rpb24oKS5hZGQobm9kZSk7XG4gICAgICAgIH1cbiAgICAgICAgZWxzZSB7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50b3AgJiYgY3VycmVudENvcm5lcnMuYm90dG9tID09PSBvbGRDb3JuZXJzLmJvdHRvbVxuICAgICAgICAgICAgICAgICAgICAmJiBjdXJyZW50Q29ybmVycy5sZWZ0ID09PSBvbGRDb3JuZXJzLmxlZnQgJiYgY3VycmVudENvcm5lcnMucmlnaHQgPT09IG9sZENvcm5lcnMucmlnaHQpIHtcbiAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICB9XG5cbiAgICAgICAgICAgIHZhciBwYWRkaW5nVG9wLCBwYWRkaW5nQm90dG9tLCBwYWRkaW5nTGVmdCwgcGFkZGluZ1JpZ2h0O1xuXG4gICAgICAgICAgICB2YXIgdG9wRGlmZiA9IGN1cnJlbnRDb3JuZXJzLnRvcCAtIG9sZENvcm5lcnMudG9wO1xuXG4gICAgICAgICAgICBpZiAodG9wRGlmZiAhPSAwKSB7XG4gICAgICAgICAgICAgIHZhciBjdXJyZW50UGFkZGluZyA9IHBhcnNlSW50KGFuY2VzdG9yLmNzcygncGFkZGluZy10b3AnKSk7XG4gICAgICAgICAgICAgIHBhZGRpbmdUb3AgPSBjdXJyZW50UGFkZGluZyArIHRvcERpZmY7XG4gICAgICAgICAgICB9XG5cbiAgICAgICAgICAgIHZhciBib3R0b21EaWZmID0gY3VycmVudENvcm5lcnMuYm90dG9tIC0gb2xkQ29ybmVycy5ib3R0b207XG5cbiAgICAgICAgICAgIGlmIChib3R0b21EaWZmICE9IDApIHtcbiAgICAgICAgICAgICAgdmFyIGN1cnJlbnRQYWRkaW5nID0gcGFyc2VJbnQoYW5jZXN0b3IuY3NzKCdwYWRkaW5nLWJvdHRvbScpKTtcbiAgICAgICAgICAgICAgcGFkZGluZ0JvdHRvbSA9IGN1cnJlbnRQYWRkaW5nIC0gYm90dG9tRGlmZjtcbiAgICAgICAgICAgIH1cblxuICAgICAgICAgICAgdmFyIGxlZnREaWZmID0gY3VycmVudENvcm5lcnMubGVmdCAtIG9sZENvcm5lcnMubGVmdDtcblxuICAgICAgICAgICAgaWYgKGxlZnREaWZmICE9IDApIHtcbiAgICAgICAgICAgICAgdmFyIGN1cnJlbnRQYWRkaW5nID0gcGFyc2VJbnQoYW5jZXN0b3IuY3NzKCdwYWRkaW5nLWxlZnQnKSk7XG4gICAgICAgICAgICAgIHBhZGRpbmdMZWZ0ID0gY3VycmVudFBhZGRpbmcgKyBsZWZ0RGlmZjtcbiAgICAgICAgICAgIH1cblxuICAgICAgICAgICAgdmFyIHJpZ2h0RGlmZiA9IGN1cnJlbnRDb3JuZXJzLnJpZ2h0IC0gb2xkQ29ybmVycy5yaWdodDtcblxuICAgICAgICAgICAgaWYgKHJpZ2h0RGlmZiAhPSAwKSB7XG4gICAgICAgICAgICAgIHZhciBjdXJyZW50UGFkZGluZyA9IHBhcnNlSW50KGFuY2VzdG9yLmNzcygncGFkZGluZy1yaWdodCcpKTtcbiAgICAgICAgICAgICAgcGFkZGluZ1JpZ2h0ID0gY3VycmVudFBhZGRpbmcgLSByaWdodERpZmY7XG4gICAgICAgICAgICB9XG5cbiAgICAgICAgICAgIGlmICghcGFkZGluZ1RvcCAmJiAhcGFkZGluZ0JvdHRvbSAmJiAhcGFkZGluZ0xlZnQgJiYgIXBhZGRpbmdSaWdodCkge1xuICAgICAgICAgICAgICBjb250aW51ZTtcbiAgICAgICAgICAgIH1cblxuICAgICAgICAgICAgdmFyIHBhZGRpbmdzID0ge307XG5cbiAgICAgICAgICAgIGlmIChwYWRkaW5nVG9wKSB7XG4gICAgICAgICAgICAgIHBhZGRpbmdzLnRvcCA9IHBhZGRpbmdUb3A7XG4gICAgICAgICAgICB9XG5cbiAgICAgICAgICAgIGlmIChwYWRkaW5nQm90dG9tKSB7XG4gICAgICAgICAgICAgIHBhZGRpbmdzLmJvdHRvbSA9IHBhZGRpbmdCb3R0b207XG4gICAgICAgICAgICB9XG5cbiAgICAgICAgICAgIGlmIChwYWRkaW5nTGVmdCkge1xuICAgICAgICAgICAgICBwYWRkaW5ncy5sZWZ0ID0gcGF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CB7fSk7XG4gICAgICB9XG4gICAgICByZXR1cm4gY3lPckVsZS5zY3JhdGNoKCdfY29tcG91bmRSZXNpemUnKTtcbiAgICB9XG4gIH07XG59O1xuXG5tb2R1bGUuZXhwb3J0cyA9IHNjcmF0Y2hVdGlsaXRpZXM7Il19

2

package.json
{
"name": "cytoscape-compound-resize",
"version": "1.0.1",
"version": "1.0.3",
"description": "A Cytoscape.js extension to resize compound nodes through setting their paddings",

@@ -5,0 +5,0 @@ "main": "cytoscape-compound-resize.js",

@@ -84,4 +84,2 @@ cytoscape-compound-resize

Please briefly describe your API here:
```js

@@ -106,2 +104,3 @@ var api = cy.compoundResize( mode ); // valid modes are 'free' or 'min'

```js
var paddings = {

@@ -117,2 +116,4 @@ top: 5,

api.setMode(newmode);
// Get the current mode
api.getMode();
// This function returns directly if the mode is not 'min'. It sets the paddings of the nodes conditionally.

@@ -122,3 +123,5 @@ // The paddings which are not between min and max paddings are not set.

// This function returns directly if the mode is not 'min'. Sets the extreme (min or max) paddings for the given nodes.
// You can give 'min' or 'max' to the 'minOrMax' parameter
// You can give 'min' or 'max' to the 'minOrMax' parameter. Also note that this operation checks if the rule of 'maxPaddings >= minPaddings'
// is broken and does not set extreme paddings if it will be broken. If the min paddings will be higher then or the maximum paddings will be
// lower then the original paddings then it sets the original paddings to the extreme paddings.
api.setExtremePaddings(nodes, paddings, minOrMax);

@@ -125,0 +128,0 @@ // Get the minimum paddings of a given node. Returns null if the mode is not 'min'

@@ -41,2 +41,5 @@ var compoundResizeUtilities = function (cy, mode) {

},
getMode: function() {
return mode;
},
setPaddings: function (nodes, paddings) {

@@ -73,3 +76,3 @@

},
setExtremePaddings: function (nodes, paddings, minOrMax) {
setExtremePaddings: function (nodes, _paddings, minOrMax) {
if (mode !== 'min') {

@@ -87,7 +90,31 @@ return;

// Get the minimum paddings to set them
var extremePaddings = minOrMax === 'min' ? self.getMinimumPaddings(ele) : self.getMaximumPaddings(ele);
var minPaddings = self.getMinimumPaddings(ele);
var maxPaddings = self.getMaximumPaddings(ele);
// Get the extreme paddings to set them
var extremePaddings = minOrMax === 'min' ? minPaddings : maxPaddings;
var sign = minOrMax === 'min' ? 1 : -1;
// Clone _paddings into paddings object
var paddings = {
};
// Filter paddings from _paddings note that the rule of 'maxPaddings >= minPaddings' should be satisfied
if (minOrMax === 'min') {
for (var prop in _paddings) {
if (!maxPaddings[prop] || _paddings[prop] <= maxPaddings[prop]) {
paddings[prop] = _paddings[prop];
}
}
}
else if (minOrMax === 'max') {
for (var prop in _paddings) {
if (!minPaddings[prop] || _paddings[prop] >= minPaddings[prop]) {
paddings[prop] = _paddings[prop];
}
}
}
// Set the extreme paddings where applicable
if (paddings.left) {

@@ -94,0 +121,0 @@ if (paddingLeft * sign < paddings.left * sign) {

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc