cytoscape-node-html-label
Advanced tools
Comparing version 1.1.0 to 1.1.1
var sampleDataset = [{ | ||
"group": "nodes", | ||
"data": {"id": "16150999", "name": "xps plrmr altdarwkjpyzdi dinpmbmjtsy", "type": 0, "code": "7704322293"}, | ||
"classes": "class1" | ||
"group": "nodes", | ||
"data": {"id": "16150999", "name": "xps plrmr altdarwkjpyzdi dinpmbmjtsy", "type": 0, "code": "7704322293"}, | ||
"classes": "class1" | ||
}, { | ||
"group": "nodes", | ||
"data": {"id": "1", "name": "Parent"} | ||
},{ | ||
"group": "nodes", | ||
"data": {"id": "2", "name": "Children", "parent": '1', "type": 2} | ||
},{ | ||
"group": "nodes", | ||
"data": {"id": "3", "name": "Children", "parent": '1', "type": 2} | ||
}, { | ||
"group": "nodes", | ||
@@ -506,2 +515,11 @@ "data": {"id": "12948827", "name": "orcbqfetex ljww csesfiujzv", "type": 2}, | ||
"data": {"id": "e78_1521909741119", "source": "5379", "target": "3820259", "type": 2} | ||
}, {"group": "edges", "data": {"id": "e79_1521909741119", "source": "5379", "target": "3855775", "type": 2}}]; | ||
}, { | ||
"group": "edges", | ||
"data": {"id": "e79_1521909741119", "source": "5379", "target": "3855775", "type": 2} | ||
}, { | ||
"group": "edges", | ||
"data": {"id": "e5379_1", "source": "5379", "target": "1"} | ||
}, { | ||
"group": "edges", | ||
"data": {"id": "e2_3", "source": "2", "target": "3"} | ||
}]; |
@@ -150,3 +150,3 @@ (function () { | ||
_cy.on("pan zoom", wrapCyHandler); | ||
_cy.on("drag", moveCyHandler); | ||
_cy.on("drag bounds", moveCyHandler); | ||
return _cy; | ||
@@ -153,0 +153,0 @@ function createLabelContainer() { |
@@ -1,1 +0,1 @@ | ||
!function(){"use strict";function t(t,n){function i(t){var e=t.cy;s.forEach(function(t){e.elements(t.query).forEach(function(e){e.isNode()&&d.addOrUpdateElem(e.id(),t,{position:r(e),data:e.data()})})})}function a(t){var e=t.cy;d.updatePanZoom({pan:e.pan(),zoom:e.zoom()})}function r(t){return{w:t.width(),h:t.height(),x:t.position("x"),y:t.position("y")}}var s=n&&"object"==typeof n?n:[],d=function(){var e=t.container(),n=document.createElement("div"),i=e.querySelector("canvas"),a=e.querySelector("[class^='cy-node-html']");a&&i.parentNode.removeChild(a);var r=n.style;return r.position="absolute",r["z-index"]=10,r.width="500px",r["pointer-events"]="none",r.margin="0px",r.padding="0px",r.border="0px",r.outline="0px",r.outline="0px",i.parentNode.appendChild(n),new o(n)}();return t.one("render",function(t){i(t),a(t)}),t.on("add",function(t){var n=t.target,o=e(s.slice().reverse(),function(t){return n.is(t.query)});o&&d.addOrUpdateElem(n.id(),o,{position:r(n),data:n.data()})}),t.on("layoutstop",function(t){var e=t.cy;s.forEach(function(t){e.elements(t.query).forEach(function(t){t.isNode()&&d.updateElemPosition(t.id(),r(t))})})}),t.on("remove",function(t){d.removeElemById(t.target.id())}),t.on("data",function(t){setTimeout(function(){var n=t.target,o=e(s.slice().reverse(),function(t){return n.is(t.query)});o?d.addOrUpdateElem(n.id(),o,{position:r(n),data:n.data()}):d.removeElemById(n.id())},0)}),t.on("pan zoom",a),t.on("drag",function(t){d.updateElemPosition(t.target.id(),r(t.target))}),t}var e=function(t,e){if("function"!=typeof e)throw new TypeError("predicate must be a function");for(var n,o=t.length>>>0,i=arguments[1],a=0;a<o;a++)if(n=t[a],e.call(i,n,a,t))return n},n=function(){function t(t,e){var n=t.node,o=t.baseClassName,i=t.position,a=void 0===i?null:i,r=t.data,s=void 0===r?null:r;this.updateParams(e),this._node=n,this._baseElementClassName=o,this.initStyles(),s&&this.updateData(s),a&&this.updatePosition(a)}return t.prototype.updateParams=function(t){var e=t.tpl,n=void 0===e?function(){return""}:e,o=t.cssClass,i=void 0===o?null:o,a=t.halign,r=void 0===a?"center":a,s=t.valign,d=void 0===s?"center":s,p=t.halignBox,u=void 0===p?"center":p,l=t.valignBox,c=void 0===l?"center":l,f={top:-.5,left:-.5,center:0,right:.5,bottom:.5};this._align=[f[r],f[d],100*(f[u]-.5),100*(f[c]-.5)],this.cssClass=i,this.tpl=n},t.prototype.updateData=function(t){try{this._node.innerHTML=this.tpl(t)}catch(t){console.error(t)}},t.prototype.getNode=function(){return this._node},t.prototype.updatePosition=function(t){this._renderPosition(t)},t.prototype.initStyles=function(){this._node.style.position="absolute"},t.prototype._renderPosition=function(t){var e=this._position,n=t.x+this._align[0]*t.w,o=t.y+this._align[1]*t.h;if(!e||e[0]!==n||e[1]!==o){this._position=[n,o];var i="translate("+this._align[2]+"%,"+this._align[3]+"%) "+("translate("+n.toFixed(2)+"px,"+o.toFixed(2)+"px) "),a=this._node.style;a.webkitTransform=i,a.msTransform=i,a.transform=i}},t}(),o=function(){function t(t){this._node=t,this._cssWrap="cy-node-html-"+ +new Date,this._cssElem=this._cssWrap+"__e",this._node.className=this._cssWrap,this._elements={}}return t.prototype.addOrUpdateElem=function(t,e,o){void 0===o&&(o={});var i=this._elements[t];if(i)i.updateParams(e),i.updateData(o.data),i.updatePosition(o.position);else{var a=document.createElement("div");this._node.appendChild(a),this._elements[t]=new n({node:a,baseClassName:this._cssElem,data:o.data,position:o.position},e)}},t.prototype.removeElemById=function(t){this._elements[t]&&(this._node.removeChild(this._elements[t].getNode()),delete this._elements[t])},t.prototype.updateElemPosition=function(t,e){var n=this._elements[t];n&&n.updatePosition(e)},t.prototype.updatePanZoom=function(t){var e=t.pan,n=t.zoom,o="translate("+e.x+"px,"+e.y+"px) scale("+n+")",i=this._node.style;i.webkitTransform=o,i.msTransform=o,i.transform=o,i.webkitTransformOrigin="top left",i.msTransformOrigin="top left",i.transformOrigin="top left"},t}(),i=function(e){e&&e("core","nodeHtmlLabel",function(e){return t(this,e)})};"undefined"!=typeof module&&module.exports?module.exports=function(t){i(t)}:"undefined"!=typeof define&&define.amd&&define("cytoscape-nodeHtmlLabel",function(){return i}),"undefined"!=typeof cytoscape&&i(cytoscape)}(); | ||
!function(){"use strict";function t(t,n){function i(t){var e=t.cy;r.forEach(function(t){e.elements(t.query).forEach(function(e){e.isNode()&&d.addOrUpdateElem(e.id(),t,{position:s(e),data:e.data()})})})}function a(t){var e=t.cy;d.updatePanZoom({pan:e.pan(),zoom:e.zoom()})}function s(t){return{w:t.width(),h:t.height(),x:t.position("x"),y:t.position("y")}}var r=n&&"object"==typeof n?n:[],d=function(){var e=t.container(),n=document.createElement("div"),i=e.querySelector("canvas"),a=e.querySelector("[class^='cy-node-html']");a&&i.parentNode.removeChild(a);var s=n.style;return s.position="absolute",s["z-index"]=10,s.width="500px",s["pointer-events"]="none",s.margin="0px",s.padding="0px",s.border="0px",s.outline="0px",s.outline="0px",i.parentNode.appendChild(n),new o(n)}();return t.one("render",function(t){i(t),a(t)}),t.on("add",function(t){var n=t.target,o=e(r.slice().reverse(),function(t){return n.is(t.query)});o&&d.addOrUpdateElem(n.id(),o,{position:s(n),data:n.data()})}),t.on("layoutstop",function(t){var e=t.cy;r.forEach(function(t){e.elements(t.query).forEach(function(t){t.isNode()&&d.updateElemPosition(t.id(),s(t))})})}),t.on("remove",function(t){d.removeElemById(t.target.id())}),t.on("data",function(t){setTimeout(function(){var n=t.target,o=e(r.slice().reverse(),function(t){return n.is(t.query)});o?d.addOrUpdateElem(n.id(),o,{position:s(n),data:n.data()}):d.removeElemById(n.id())},0)}),t.on("pan zoom",a),t.on("drag bounds",function(t){d.updateElemPosition(t.target.id(),s(t.target))}),t}var e=function(t,e){if("function"!=typeof e)throw new TypeError("predicate must be a function");for(var n,o=t.length>>>0,i=arguments[1],a=0;a<o;a++)if(n=t[a],e.call(i,n,a,t))return n},n=function(){function t(t,e){var n=t.node,o=t.baseClassName,i=t.position,a=void 0===i?null:i,s=t.data,r=void 0===s?null:s;this.updateParams(e),this._node=n,this._baseElementClassName=o,this.initStyles(),r&&this.updateData(r),a&&this.updatePosition(a)}return t.prototype.updateParams=function(t){var e=t.tpl,n=void 0===e?function(){return""}:e,o=t.cssClass,i=void 0===o?null:o,a=t.halign,s=void 0===a?"center":a,r=t.valign,d=void 0===r?"center":r,p=t.halignBox,u=void 0===p?"center":p,l=t.valignBox,c=void 0===l?"center":l,f={top:-.5,left:-.5,center:0,right:.5,bottom:.5};this._align=[f[s],f[d],100*(f[u]-.5),100*(f[c]-.5)],this.cssClass=i,this.tpl=n},t.prototype.updateData=function(t){try{this._node.innerHTML=this.tpl(t)}catch(t){console.error(t)}},t.prototype.getNode=function(){return this._node},t.prototype.updatePosition=function(t){this._renderPosition(t)},t.prototype.initStyles=function(){this._node.style.position="absolute"},t.prototype._renderPosition=function(t){var e=this._position,n=t.x+this._align[0]*t.w,o=t.y+this._align[1]*t.h;if(!e||e[0]!==n||e[1]!==o){this._position=[n,o];var i="translate("+this._align[2]+"%,"+this._align[3]+"%) "+("translate("+n.toFixed(2)+"px,"+o.toFixed(2)+"px) "),a=this._node.style;a.webkitTransform=i,a.msTransform=i,a.transform=i}},t}(),o=function(){function t(t){this._node=t,this._cssWrap="cy-node-html-"+ +new Date,this._cssElem=this._cssWrap+"__e",this._node.className=this._cssWrap,this._elements={}}return t.prototype.addOrUpdateElem=function(t,e,o){void 0===o&&(o={});var i=this._elements[t];if(i)i.updateParams(e),i.updateData(o.data),i.updatePosition(o.position);else{var a=document.createElement("div");this._node.appendChild(a),this._elements[t]=new n({node:a,baseClassName:this._cssElem,data:o.data,position:o.position},e)}},t.prototype.removeElemById=function(t){this._elements[t]&&(this._node.removeChild(this._elements[t].getNode()),delete this._elements[t])},t.prototype.updateElemPosition=function(t,e){var n=this._elements[t];n&&n.updatePosition(e)},t.prototype.updatePanZoom=function(t){var e=t.pan,n=t.zoom,o="translate("+e.x+"px,"+e.y+"px) scale("+n+")",i=this._node.style;i.webkitTransform=o,i.msTransform=o,i.transform=o,i.webkitTransformOrigin="top left",i.msTransformOrigin="top left",i.transformOrigin="top left"},t}(),i=function(e){e&&e("core","nodeHtmlLabel",function(e){return t(this,e)})};"undefined"!=typeof module&&module.exports?module.exports=function(t){i(t)}:"undefined"!=typeof define&&define.amd&&define("cytoscape-nodeHtmlLabel",function(){return i}),"undefined"!=typeof cytoscape&&i(cytoscape)}(); |
{ | ||
"name": "cytoscape-node-html-label", | ||
"version": "1.1.0", | ||
"version": "1.1.1", | ||
"description": "labels for cytoscape nodes", | ||
@@ -5,0 +5,0 @@ "author": "Kalugin Sergey <kalugin.perm@gmail.com> (https://github.com/kaluginserg)", |
@@ -120,2 +120,4 @@ cytoscape-node-html-label | ||
2) `git commit` | ||
2) Create new npm version: `gulp patch`, `gulp feature` or `gulp release` | ||
Then, for version update and publish: | ||
2) Create new npm version: `gulp patch`, `gulp feature` or `gulp release` | ||
2) `npm publish` |
@@ -233,3 +233,3 @@ type IHAlign = "left" | "center" | "right"; | ||
_cy.on("pan zoom", wrapCyHandler); | ||
_cy.on("drag", moveCyHandler); | ||
_cy.on("drag bounds", moveCyHandler); | ||
@@ -236,0 +236,0 @@ return _cy; |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
2835
122
467556