Socket
Socket
Sign inDemoInstall

@jiaminghi/c-render

Package Overview
Dependencies
5
Maintainers
2
Versions
34
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 1.0.0-alpha.2 to 1.0.0-alpha.3

10

CHANGELOG.md

@@ -0,1 +1,7 @@

# 1.0.0-alpha.3 (2020-09-23)
### Life Cycle
- **Optmization:** Add instance parameters.
# 1.0.0-alpha.2 (2020-09-04)

@@ -5,3 +11,3 @@

- **types:** Type optimization
- **types:** Type optimization.

@@ -12,3 +18,3 @@ # 1.0.1-alpha.1 (2020-07-30)

- **types:** Type optimization
- **types:** Type optimization.

@@ -15,0 +21,0 @@ # 1.0.1-alpha (2020-07-24)

2

dist/index.min.js

@@ -15,3 +15,3 @@ !function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports):"function"==typeof define&&define.amd?define(["exports"],e):e((t=t||self).CRender={})}(this,(function(t){"use strict";

PERFORMANCE OF THIS SOFTWARE.
***************************************************************************** */var e=function(t,r){return(e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])})(t,r)};function r(t,r){function n(){this.constructor=t}e(t,r),t.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}var n,o=function(){return(o=Object.assign||function(t){for(var e,r=1,n=arguments.length;n>r;r++)for(var o in e=arguments[r])Object.prototype.hasOwnProperty.call(e,o)&&(t[o]=e[o]);return t}).apply(this,arguments)};function i(t,e,r,n){var o,i=arguments.length,a=3>i?e:null===n?n=Object.getOwnPropertyDescriptor(e,r):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,r,n);else for(var s=t.length-1;s>=0;s--)(o=t[s])&&(a=(3>i?o(a):i>3?o(e,r,a):o(e,r))||a);return i>3&&a&&Object.defineProperty(e,r,a),a}function a(t,e,r,n){return new(r||(r=Promise))((function(o,i){function a(t){try{u(n.next(t))}catch(t){i(t)}}function s(t){try{u(n.throw(t))}catch(t){i(t)}}function u(t){var e;t.done?o(t.value):(e=t.value,e instanceof r?e:new r((function(t){t(e)}))).then(a,s)}u((n=n.apply(t,e||[])).next())}))}function s(t,e){var r,n,o,i,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function s(i){return function(s){return function(i){if(r)throw new TypeError("Generator is already executing.");for(;a;)try{if(r=1,n&&(o=2&i[0]?n.return:i[0]?n.throw||((o=n.return)&&o.call(n),0):n.next)&&!(o=o.call(n,i[1])).done)return o;switch(n=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return a.label++,{value:i[1],done:!1};case 5:a.label++,n=i[1],i=[0];continue;case 7:i=a.ops.pop(),a.trys.pop();continue;default:if(!(o=a.trys,(o=o.length>0&&o[o.length-1])||6!==i[0]&&2!==i[0])){a=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&o[3]>i[1])){a.label=i[1];break}if(6===i[0]&&o[1]>a.label){a.label=o[1],o=i;break}if(o&&o[2]>a.label){a.label=o[2],a.ops.push(i);break}o[2]&&a.ops.pop(),a.trys.pop();continue}i=e.call(t,a)}catch(t){i=[6,t],n=0}finally{r=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,s])}}}function u(){for(var t=0,e=0,r=arguments.length;r>e;e++)t+=arguments[e].length;var n=Array(t),o=0;for(e=0;r>e;e++)for(var i=arguments[e],a=0,s=i.length;s>a;a++,o++)n[o]=i[a];return n}function h(t,e){if(void 0===e&&(e=new Map([])),null===t||"object"!=typeof t)return t;if(e.has(t))return e.get(t);var r=Array.isArray(t)?[]:{};return e.set(t,r),Object.keys(t).forEach((function(n){return r[n]=h(t[n],e)})),r}function f(t,e,r,n,o){var i=t[0],a=t[1];return i>=e&&(a>=r&&(e+n>=i&&a<=r+o))}function c(t,e,r){return{configurable:!0,enumerable:!1,get:function(){return Object.defineProperty(this,e,{enumerable:!1,writable:!0,configurable:!0,value:(r.value||r.initializer.call(this)).bind(this)}),this[e]},set:function(){throw Error("Reassign able not after bound!")}}}!function(t){t.STATIC="STATIC",t.HOVER="HOVER",t.ACTIVE="ACTIVE",t.DRAG="DRAG"}(n||(n={}));var l,p=function(){function t(t,e){if(void 0===e&&(e=!1),this.dpr=1,this.offScreenRendering=!1,this.area=[0,0],this.animationStatus=!1,this.graphs=[],this.drawAllGraphDebounced=function(t,e){var r=this;void 0===e&&(e=0);var n=void 0;return function(){for(var o=[],i=0;arguments.length>i;i++)o[i]=arguments[i];n&&clearTimeout(n),n=window.setTimeout((function(){t.call.apply(t,u([r],o))}),e)}}(this.drawAllGraphImmediately,0),!t)throw Error("CRender: Missing parameters!");var r=devicePixelRatio||1,n=t.getContext("2d"),o=t.clientWidth,i=t.clientHeight,a=o*r,s=i*r,h=[o,i];if(t.setAttribute("width",a+""),t.setAttribute("height",s+""),Object.assign(this,{dpr:r,area:h,canvas:t,ctx:n,actualCtx:n}),t.addEventListener("mousedown",this.mouseDown.bind(this)),t.addEventListener("mousemove",this.mouseMove.bind(this)),t.addEventListener("mouseup",this.mouseUp.bind(this)),e){if(!OffscreenCanvas)return Object.assign(this,{offScreenRendering:!1}),void console.warn("CRender: Your browser does not support off-screen rendering!");var f=new OffscreenCanvas(a,s),c=f.getContext("2d");Object.assign(this,{osCanvas:f,osCtx:c,offScreenRendering:e})}}return t.prototype.clearArea=function(){var t=this.osCanvas,e=this.offScreenRendering,r=this.area[0]*this.dpr;this.canvas.width=r,e&&(t.width=r)},t.prototype.sortGraphsByIndex=function(){this.graphs.sort((function(t,e){return t.index-e.index}))},t.prototype.drawAllGraph=function(t){void 0===t&&(t=!1),t?this.drawAllGraphImmediately():this.drawAllGraphDebounced()},t.prototype.drawAllGraphImmediately=function(){var t=this.offScreenRendering,e=this.actualCtx,r=this.osCtx,n=this.osCanvas;this.clearArea(),this.ctx=t?r:e,this.graphs.filter((function(t){return t.visible})).forEach(this.drawGraphProcessor),t&&e.drawImage(n,0,0)},t.prototype.drawGraphProcessor=function(t){var e,r;t.style.setCtx(this),null===(e=t.beforeDraw)||void 0===e||e.call(t),t.draw(),null===(r=t.drawed)||void 0===r||r.call(t),t.style.restoreCtx(this)},t.prototype.add=function(t,e){void 0===e&&(e=!1),Array.isArray(t)?t.forEach(this.graphAddProcessor):this.graphAddProcessor(t),e||this.drawAllGraph()},t.prototype.graphAddProcessor=function(t){var e,r;null===(e=t.beforeAdd)||void 0===e||e.call(t),t.render=this,t.setGraphCenter(),this.graphs.push(t),this.sortGraphsByIndex(),null===(r=t.added)||void 0===r||r.call(t)},t.prototype.delGraph=function(t,e){void 0===e&&(e=!1),Array.isArray(t)?u(t).forEach(this.graphDelProcessor):this.graphDelProcessor(t),e||this.drawAllGraph()},t.prototype.graphDelProcessor=function(t){var e,r,n=this.graphs,o=n.findIndex((function(e){return e===t}));-1!==o&&(null===(e=t.beforeDelete)||void 0===e||e.call(t),n.splice(o,1),null===(r=t.deleted)||void 0===r||r.call(t))},t.prototype.delAllGraph=function(){this.delGraph(this.graphs),this.clearArea()},t.prototype.launchAnimation=function(){var t=this;if(!this.animationStatus)return this.animationStatus=!0,new Promise((function(e){t.animate((function(){t.animationStatus=!1,e()}),Date.now())}))},t.prototype.animate=function(t,e){var r=this,n=this.graphs;this.animateAble()?(n.forEach((function(t){return r.graphTrunNextAnimationFrame(t,e)})),this.drawAllGraph(),requestAnimationFrame(this.animate.bind(this,t,e))):t()},t.prototype.graphTrunNextAnimationFrame=function(t,e){var r=t.animationDelay,n=t.animationQueue;t.animationPause||Date.now()-e<r||(t.animationQueue=n.reduce((function(e,r){var n=r.key,o=r.frameState;return Object.assign(t[n],o.shift()),o.length?u(e,[{key:n,frameState:o}]):e}),[]))},t.prototype.animateAble=function(){return!!this.graphs.find((function(t){return!t.animationPause&&t.animationQueue.length}))},t.prototype.mouseDown=function(){var t=this.graphs.find((function(t){return t.status===n.HOVER}));t&&(t.status=n.ACTIVE)},t.prototype.mouseMove=function(t){var e,r,o,i,a,s,u=this,h=[t.offsetX,t.offsetY],f=this.graphs,c=f.find((function(t){return t.status===n.ACTIVE||t.status===n.DRAG}));if(c&&c.drag&&c.move)return this.graphMoveProcessor(c,t),void(c.status=n.DRAG);var l=f.find((function(t){return t.status===n.HOVER})),p=f.filter((function(t){return t.hover&&(t.hoverCheck||t.hoverRect)})).find((function(t){return u.graphHoverCheckProcessor(t,h)}));if(document.body.style.cursor=p?p.style.hoverCursor:"default",(p||l)&&p!==l){if(!p&&l)return null===(e=l.onMouseOuter)||void 0===e||e.call(l,t),void(l.status=n.STATIC);if(p&&!l)return null===(r=p.onMouseEnter)||void 0===r||r.call(p,t),void(p.status=n.HOVER);null===(i=(o=l).onMouseOuter)||void 0===i||i.call(o,t),l.status=n.STATIC,null===(s=(a=p).onMouseEnter)||void 0===s||s.call(a,t),p.status=n.HOVER}},t.prototype.graphMoveProcessor=function(t,e){var r,n;t.move&&(null===(r=t.beforeMove)||void 0===r||r.call(t,e),t.move(e),null===(n=t.moved)||void 0===n||n.call(t,e),t.setGraphCenter(e))},t.prototype.graphHoverCheckProcessor=function(t,e){var r=t.hoverRect,n=t.style,o=n.graphCenter,i=n.rotate,a=n.scale,s=n.translate;return!!t.hoverCheck&&(o&&(i&&(e=function(t,e,r){if(void 0===t&&(t=0),void 0===r&&(r=[0,0]),t%360==0)return e;var n=e[0],o=e[1],i=r[0],a=r[1];return[(n-i)*Math.cos(t*=Math.PI/180)-(o-a)*Math.sin(t)+i,(n-i)*Math.sin(t)+(o-a)*Math.cos(t)+a]}(-i,e,o)),a&&(e=function(t,e,r){void 0===t&&(t=[1,1]),void 0===r&&(r=[0,0]);var n=r[0],o=r[1];return[(e[0]-n)*t[0]+n,(e[1]-o)*t[1]+o]}(a.map((function(t){return 1/t})),e,o)),s&&(e=function(t,e){return[e[0]+t[0],e[1]+t[1]]}(s.map((function(t){return-1*t})),e))),r?f.apply(void 0,u([e],r)):t.hoverCheck(e))},t.prototype.mouseUp=function(t){var e,r=this.graphs,o=r.find((function(t){return t.status===n.ACTIVE})),i=r.find((function(t){return t.status===n.DRAG}));null===(e=null==o?void 0:o.onClick)||void 0===e||e.call(o,t),r.forEach((function(t){return t.status=n.STATIC})),o&&(o.status=n.HOVER),i&&(i.status=n.HOVER)},i([c],t.prototype,"drawAllGraphImmediately",null),i([c],t.prototype,"drawGraphProcessor",null),i([c],t.prototype,"graphAddProcessor",null),i([c],t.prototype,"graphDelProcessor",null),i([c],t.prototype,"launchAnimation",null),t}();
***************************************************************************** */var e=function(t,r){return(e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])})(t,r)};function r(t,r){function n(){this.constructor=t}e(t,r),t.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}var n,o=function(){return(o=Object.assign||function(t){for(var e,r=1,n=arguments.length;n>r;r++)for(var o in e=arguments[r])Object.prototype.hasOwnProperty.call(e,o)&&(t[o]=e[o]);return t}).apply(this,arguments)};function i(t,e,r,n){var o,i=arguments.length,a=3>i?e:null===n?n=Object.getOwnPropertyDescriptor(e,r):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,r,n);else for(var s=t.length-1;s>=0;s--)(o=t[s])&&(a=(3>i?o(a):i>3?o(e,r,a):o(e,r))||a);return i>3&&a&&Object.defineProperty(e,r,a),a}function a(t,e,r,n){return new(r||(r=Promise))((function(o,i){function a(t){try{u(n.next(t))}catch(t){i(t)}}function s(t){try{u(n.throw(t))}catch(t){i(t)}}function u(t){var e;t.done?o(t.value):(e=t.value,e instanceof r?e:new r((function(t){t(e)}))).then(a,s)}u((n=n.apply(t,e||[])).next())}))}function s(t,e){var r,n,o,i,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function s(i){return function(s){return function(i){if(r)throw new TypeError("Generator is already executing.");for(;a;)try{if(r=1,n&&(o=2&i[0]?n.return:i[0]?n.throw||((o=n.return)&&o.call(n),0):n.next)&&!(o=o.call(n,i[1])).done)return o;switch(n=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return a.label++,{value:i[1],done:!1};case 5:a.label++,n=i[1],i=[0];continue;case 7:i=a.ops.pop(),a.trys.pop();continue;default:if(!(o=a.trys,(o=o.length>0&&o[o.length-1])||6!==i[0]&&2!==i[0])){a=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&o[3]>i[1])){a.label=i[1];break}if(6===i[0]&&o[1]>a.label){a.label=o[1],o=i;break}if(o&&o[2]>a.label){a.label=o[2],a.ops.push(i);break}o[2]&&a.ops.pop(),a.trys.pop();continue}i=e.call(t,a)}catch(t){i=[6,t],n=0}finally{r=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,s])}}}function u(){for(var t=0,e=0,r=arguments.length;r>e;e++)t+=arguments[e].length;var n=Array(t),o=0;for(e=0;r>e;e++)for(var i=arguments[e],a=0,s=i.length;s>a;a++,o++)n[o]=i[a];return n}function h(t,e){if(void 0===e&&(e=new Map([])),null===t||"object"!=typeof t)return t;if(e.has(t))return e.get(t);var r=Array.isArray(t)?[]:{};return e.set(t,r),Object.keys(t).forEach((function(n){return r[n]=h(t[n],e)})),r}function f(t,e,r,n,o){var i=t[0],a=t[1];return i>=e&&(a>=r&&(e+n>=i&&a<=r+o))}function c(t,e,r){return{configurable:!0,enumerable:!1,get:function(){return Object.defineProperty(this,e,{enumerable:!1,writable:!0,configurable:!0,value:(r.value||r.initializer.call(this)).bind(this)}),this[e]},set:function(){throw Error("Reassign able not after bound!")}}}!function(t){t.STATIC="STATIC",t.HOVER="HOVER",t.ACTIVE="ACTIVE",t.DRAG="DRAG"}(n||(n={}));var l,p=function(){function t(t,e){if(void 0===e&&(e=!1),this.dpr=1,this.offScreenRendering=!1,this.area=[0,0],this.animationStatus=!1,this.graphs=[],this.drawAllGraphDebounced=function(t,e){var r=this;void 0===e&&(e=0);var n=void 0;return function(){for(var o=[],i=0;arguments.length>i;i++)o[i]=arguments[i];n&&clearTimeout(n),n=window.setTimeout((function(){t.call.apply(t,u([r],o))}),e)}}(this.drawAllGraphImmediately,0),!t)throw Error("CRender: Missing parameters!");var r=devicePixelRatio||1,n=t.getContext("2d"),o=t.clientWidth,i=t.clientHeight,a=o*r,s=i*r,h=[o,i];if(t.setAttribute("width",a+""),t.setAttribute("height",s+""),Object.assign(this,{dpr:r,area:h,canvas:t,ctx:n,actualCtx:n}),t.addEventListener("mousedown",this.mouseDown.bind(this)),t.addEventListener("mousemove",this.mouseMove.bind(this)),t.addEventListener("mouseup",this.mouseUp.bind(this)),e){if(!OffscreenCanvas)return Object.assign(this,{offScreenRendering:!1}),void console.warn("CRender: Your browser does not support off-screen rendering!");var f=new OffscreenCanvas(a,s),c=f.getContext("2d");Object.assign(this,{osCanvas:f,osCtx:c,offScreenRendering:e})}}return t.prototype.clearArea=function(){var t=this.osCanvas,e=this.offScreenRendering,r=this.area[0]*this.dpr;this.canvas.width=r,e&&(t.width=r)},t.prototype.sortGraphsByIndex=function(){this.graphs.sort((function(t,e){return t.index-e.index}))},t.prototype.drawAllGraph=function(t){void 0===t&&(t=!1),t?this.drawAllGraphImmediately():this.drawAllGraphDebounced()},t.prototype.drawAllGraphImmediately=function(){var t=this.offScreenRendering,e=this.actualCtx,r=this.osCtx,n=this.osCanvas;this.clearArea(),this.ctx=t?r:e,this.graphs.filter((function(t){return t.visible})).forEach(this.drawGraphProcessor),t&&e.drawImage(n,0,0)},t.prototype.drawGraphProcessor=function(t){var e,r;t.style.setCtx(this),null===(e=t.beforeDraw)||void 0===e||e.call(t,t),t.draw(),null===(r=t.drawed)||void 0===r||r.call(t,t),t.style.restoreCtx(this)},t.prototype.add=function(t,e){void 0===e&&(e=!1),Array.isArray(t)?t.forEach(this.graphAddProcessor):this.graphAddProcessor(t),e||this.drawAllGraph()},t.prototype.graphAddProcessor=function(t){var e,r;null===(e=t.beforeAdd)||void 0===e||e.call(t,t),t.render=this,t.setGraphCenter(),this.graphs.push(t),this.sortGraphsByIndex(),null===(r=t.added)||void 0===r||r.call(t,t)},t.prototype.delGraph=function(t,e){void 0===e&&(e=!1),Array.isArray(t)?u(t).forEach(this.graphDelProcessor):this.graphDelProcessor(t),e||this.drawAllGraph()},t.prototype.graphDelProcessor=function(t){var e,r,n=this.graphs,o=n.findIndex((function(e){return e===t}));-1!==o&&(null===(e=t.beforeDelete)||void 0===e||e.call(t,t),n.splice(o,1),null===(r=t.deleted)||void 0===r||r.call(t,t))},t.prototype.delAllGraph=function(){this.delGraph(this.graphs),this.clearArea()},t.prototype.launchAnimation=function(){var t=this;if(!this.animationStatus)return this.animationStatus=!0,new Promise((function(e){t.animate((function(){t.animationStatus=!1,e()}),Date.now())}))},t.prototype.animate=function(t,e){var r=this,n=this.graphs;this.animateAble()?(n.forEach((function(t){return r.graphTrunNextAnimationFrame(t,e)})),this.drawAllGraph(),requestAnimationFrame(this.animate.bind(this,t,e))):t()},t.prototype.graphTrunNextAnimationFrame=function(t,e){var r=t.animationDelay,n=t.animationQueue;t.animationPause||Date.now()-e<r||(t.animationQueue=n.reduce((function(e,r){var n=r.key,o=r.frameState;return Object.assign(t[n],o.shift()),o.length?u(e,[{key:n,frameState:o}]):e}),[]))},t.prototype.animateAble=function(){return!!this.graphs.find((function(t){return!t.animationPause&&t.animationQueue.length}))},t.prototype.mouseDown=function(){var t=this.graphs.find((function(t){return t.status===n.HOVER}));t&&(t.status=n.ACTIVE)},t.prototype.mouseMove=function(t){var e,r,o,i,a,s,u=this,h=[t.offsetX,t.offsetY],f=this.graphs,c=f.find((function(t){return t.status===n.ACTIVE||t.status===n.DRAG}));if(c&&c.drag&&c.move)return this.graphMoveProcessor(c,t),void(c.status=n.DRAG);var l=f.find((function(t){return t.status===n.HOVER})),p=f.filter((function(t){return t.hover&&(t.hoverCheck||t.hoverRect)})).find((function(t){return u.graphHoverCheckProcessor(t,h)}));if(document.body.style.cursor=p?p.style.hoverCursor:"default",(p||l)&&p!==l){if(!p&&l)return null===(e=l.onMouseOuter)||void 0===e||e.call(l,t),void(l.status=n.STATIC);if(p&&!l)return null===(r=p.onMouseEnter)||void 0===r||r.call(p,t),void(p.status=n.HOVER);null===(i=(o=l).onMouseOuter)||void 0===i||i.call(o,t),l.status=n.STATIC,null===(s=(a=p).onMouseEnter)||void 0===s||s.call(a,t),p.status=n.HOVER}},t.prototype.graphMoveProcessor=function(t,e){var r,n;t.move&&(null===(r=t.beforeMove)||void 0===r||r.call(t,e,t),t.move(e),null===(n=t.moved)||void 0===n||n.call(t,e,t),t.setGraphCenter(e))},t.prototype.graphHoverCheckProcessor=function(t,e){var r=t.hoverRect,n=t.style,o=n.graphCenter,i=n.rotate,a=n.scale,s=n.translate;return!!t.hoverCheck&&(o&&(i&&(e=function(t,e,r){if(void 0===t&&(t=0),void 0===r&&(r=[0,0]),t%360==0)return e;var n=e[0],o=e[1],i=r[0],a=r[1];return[(n-i)*Math.cos(t*=Math.PI/180)-(o-a)*Math.sin(t)+i,(n-i)*Math.sin(t)+(o-a)*Math.cos(t)+a]}(-i,e,o)),a&&(e=function(t,e,r){void 0===t&&(t=[1,1]),void 0===r&&(r=[0,0]);var n=r[0],o=r[1];return[(e[0]-n)*t[0]+n,(e[1]-o)*t[1]+o]}(a.map((function(t){return 1/t})),e,o)),s&&(e=function(t,e){return[e[0]+t[0],e[1]+t[1]]}(s.map((function(t){return-1*t})),e))),r?f.apply(void 0,u([e],r)):t.hoverCheck(e))},t.prototype.mouseUp=function(t){var e,r=this.graphs,o=r.find((function(t){return t.status===n.ACTIVE})),i=r.find((function(t){return t.status===n.DRAG}));null===(e=null==o?void 0:o.onClick)||void 0===e||e.call(o,t),r.forEach((function(t){return t.status=n.STATIC})),o&&(o.status=n.HOVER),i&&(i.status=n.HOVER)},i([c],t.prototype,"drawAllGraphImmediately",null),i([c],t.prototype,"drawGraphProcessor",null),i([c],t.prototype,"graphAddProcessor",null),i([c],t.prototype,"graphDelProcessor",null),i([c],t.prototype,"launchAnimation",null),t}();
/*! *****************************************************************************

@@ -18,0 +18,0 @@ Copyright (c) Microsoft Corporation. All rights reserved.

@@ -176,5 +176,5 @@ import _toConsumableArray from "@babel/runtime/helpers/toConsumableArray";

graph.style.setCtx(this);
(_graph$beforeDraw = graph.beforeDraw) === null || _graph$beforeDraw === void 0 ? void 0 : _graph$beforeDraw.call(graph);
(_graph$beforeDraw = graph.beforeDraw) === null || _graph$beforeDraw === void 0 ? void 0 : _graph$beforeDraw.call(graph, graph);
graph.draw();
(_graph$drawed = graph.drawed) === null || _graph$drawed === void 0 ? void 0 : _graph$drawed.call(graph);
(_graph$drawed = graph.drawed) === null || _graph$drawed === void 0 ? void 0 : _graph$drawed.call(graph, graph);
graph.style.restoreCtx(this);

@@ -200,3 +200,3 @@ }

(_graph$beforeAdd = graph.beforeAdd) === null || _graph$beforeAdd === void 0 ? void 0 : _graph$beforeAdd.call(graph);
(_graph$beforeAdd = graph.beforeAdd) === null || _graph$beforeAdd === void 0 ? void 0 : _graph$beforeAdd.call(graph, graph);
graph.render = this;

@@ -206,3 +206,3 @@ graph.setGraphCenter();

this.sortGraphsByIndex();
(_graph$added = graph.added) === null || _graph$added === void 0 ? void 0 : _graph$added.call(graph);
(_graph$added = graph.added) === null || _graph$added === void 0 ? void 0 : _graph$added.call(graph, graph);
}

@@ -234,5 +234,5 @@ }, {

if (index === -1) return;
(_graph$beforeDelete = graph.beforeDelete) === null || _graph$beforeDelete === void 0 ? void 0 : _graph$beforeDelete.call(graph);
(_graph$beforeDelete = graph.beforeDelete) === null || _graph$beforeDelete === void 0 ? void 0 : _graph$beforeDelete.call(graph, graph);
graphs.splice(index, 1);
(_graph$deleted = graph.deleted) === null || _graph$deleted === void 0 ? void 0 : _graph$deleted.call(graph);
(_graph$deleted = graph.deleted) === null || _graph$deleted === void 0 ? void 0 : _graph$deleted.call(graph, graph);
}

@@ -410,5 +410,5 @@ }, {

if (!graph.move) return;
(_graph$beforeMove = graph.beforeMove) === null || _graph$beforeMove === void 0 ? void 0 : _graph$beforeMove.call(graph, e);
(_graph$beforeMove = graph.beforeMove) === null || _graph$beforeMove === void 0 ? void 0 : _graph$beforeMove.call(graph, e, graph);
graph.move(e);
(_graph$moved = graph.moved) === null || _graph$moved === void 0 ? void 0 : _graph$moved.call(graph, e);
(_graph$moved = graph.moved) === null || _graph$moved === void 0 ? void 0 : _graph$moved.call(graph, e, graph);
graph.setGraphCenter(e);

@@ -415,0 +415,0 @@ }

@@ -103,31 +103,31 @@ import { HoverRect, Status, GraphConfig, Point, AnimationQueueItem } from '../types/core/graph';

*/
beforeAdd?: () => any;
beforeAdd?: (graph: Graph) => any;
/**
* @description Life Cycle when graph added
*/
added?: () => any;
added?: (graph: Graph) => any;
/**
* @description Life Cycle when graph before draw
*/
beforeDraw?: () => any;
beforeDraw?: (graph: Graph) => any;
/**
* @description Life Cycle when graph drawed
*/
drawed?: () => any;
drawed?: (graph: Graph) => any;
/**
* @description Life Cycle when graph before move
*/
beforeMove?: (e: MouseEvent) => any;
beforeMove?: (e: MouseEvent, graph: Graph) => any;
/**
* @description Life Cycle when graph moved
*/
moved?: (e: MouseEvent) => any;
moved?: (e: MouseEvent, graph: Graph) => any;
/**
* @description Life Cycle when graph before delete
*/
beforeDelete?: () => any;
beforeDelete?: (graph: Graph) => any;
/**
* @description Life Cycle when graph deleted
*/
deleted?: () => any;
deleted?: (graph: Graph) => any;
constructor(config: GraphConfig<Shape>);

@@ -134,0 +134,0 @@ static mergeDefaultShape<Shape>(defaultShape: Shape, config: GraphConfig<Partial<Shape>>, checker?: (config: GraphConfig<Shape>) => void): GraphConfig<Shape>;

import { StyleConfig } from './style';
import { EaseCurve } from '@jiaminghi/transition/types/types/core/index';
import { RgbaValue } from '@jiaminghi/color/types/types';
import { Graph } from '../..';
export declare type HoverRect = [number, number, number, number];

@@ -88,23 +89,31 @@ export declare type Point = [number, number];

*/
beforeAdd?: () => any;
beforeAdd?: (graph: Graph) => any;
/**
* @description Life cycle added
*/
added?: () => any;
added?: (graph: Graph) => any;
/**
* Life Cycle when graph before draw
*/
beforeDraw?: () => any;
beforeDraw?: (graph: Graph) => any;
/**
* Life Cycle when graph drawed
*/
drawed?: () => any;
drawed?: (graph: Graph) => any;
/**
* Life Cycle when graph before move
*/
beforeMove?: (e: MouseEvent) => any;
beforeMove?: (e: MouseEvent, graph: Graph) => any;
/**
* @description Life Cycle when graph moved
*/
moved?: (e: MouseEvent) => any;
moved?: (e: MouseEvent, graph: Graph) => any;
/**
* @description Life Cycle when graph before delete
*/
beforeDelete?: (graph: Graph) => any;
/**
* @description Life Cycle when graph deleted
*/
deleted?: (graph: Graph) => any;
};

@@ -111,0 +120,0 @@ export declare enum Status {

{
"name": "@jiaminghi/c-render",
"version": "1.0.0-alpha.2",
"version": "1.0.0-alpha.3",
"author": "JiaMing <743192023@qq.com>",

@@ -5,0 +5,0 @@ "description": "Canvas-based vector graphics rendering plugin",

@@ -148,7 +148,7 @@ import Graph from './graph.class'

graph.beforeDraw?.()
graph.beforeDraw?.(graph)
graph.draw()
graph.drawed?.()
graph.drawed?.(graph)

@@ -170,3 +170,3 @@ graph.style.restoreCtx(this)

private graphAddProcessor(graph: Graph): void {
graph.beforeAdd?.()
graph.beforeAdd?.(graph)

@@ -179,3 +179,3 @@ graph.render = this

graph.added?.()
graph.added?.(graph)
}

@@ -200,7 +200,7 @@

graph.beforeDelete?.()
graph.beforeDelete?.(graph)
graphs.splice(index, 1)
graph.deleted?.()
graph.deleted?.(graph)
}

@@ -365,7 +365,7 @@

graph.beforeMove?.(e)
graph.beforeMove?.(e, graph)
graph.move(e)
graph.moved?.(e)
graph.moved?.(e, graph)

@@ -372,0 +372,0 @@ graph.setGraphCenter(e)

@@ -125,3 +125,3 @@ import {

// eslint-disable-next-line
beforeAdd?: () => any
beforeAdd?: (graph: Graph) => any
/**

@@ -131,3 +131,3 @@ * @description Life Cycle when graph added

// eslint-disable-next-line
added?: () => any
added?: (graph: Graph) => any
/**

@@ -137,3 +137,3 @@ * @description Life Cycle when graph before draw

// eslint-disable-next-line
beforeDraw?: () => any
beforeDraw?: (graph: Graph) => any
/**

@@ -143,3 +143,3 @@ * @description Life Cycle when graph drawed

// eslint-disable-next-line
drawed?: () => any
drawed?: (graph: Graph) => any
/**

@@ -149,3 +149,3 @@ * @description Life Cycle when graph before move

// eslint-disable-next-line
beforeMove?: (e: MouseEvent) => any
beforeMove?: (e: MouseEvent, graph: Graph) => any
/**

@@ -155,3 +155,3 @@ * @description Life Cycle when graph moved

// eslint-disable-next-line
moved?: (e: MouseEvent) => any
moved?: (e: MouseEvent, graph: Graph) => any
/**

@@ -161,3 +161,3 @@ * @description Life Cycle when graph before delete

// eslint-disable-next-line
beforeDelete?: () => any
beforeDelete?: (graph: Graph) => any
/**

@@ -167,3 +167,3 @@ * @description Life Cycle when graph deleted

// eslint-disable-next-line
deleted?: () => any
deleted?: (graph: Graph) => any

@@ -170,0 +170,0 @@ constructor(config: GraphConfig<Shape>) {

import { StyleConfig } from './style'
import { EaseCurve } from '@jiaminghi/transition/types/types/core/index'
import { RgbaValue } from '@jiaminghi/color/types/types'
import { Graph } from '../..'

@@ -95,3 +96,3 @@ export type HoverRect = [number, number, number, number]

// eslint-disable-next-line
beforeAdd?: () => any
beforeAdd?: (graph: Graph) => any
/**

@@ -101,3 +102,3 @@ * @description Life cycle added

// eslint-disable-next-line
added?: () => any
added?: (graph: Graph) => any
/**

@@ -107,3 +108,3 @@ * Life Cycle when graph before draw

// eslint-disable-next-line
beforeDraw?: () => any
beforeDraw?: (graph: Graph) => any
/**

@@ -113,3 +114,3 @@ * Life Cycle when graph drawed

// eslint-disable-next-line
drawed?: () => any
drawed?: (graph: Graph) => any
/**

@@ -119,3 +120,3 @@ * Life Cycle when graph before move

// eslint-disable-next-line
beforeMove?: (e: MouseEvent) => any
beforeMove?: (e: MouseEvent, graph: Graph) => any
/**

@@ -125,3 +126,13 @@ * @description Life Cycle when graph moved

// eslint-disable-next-line
moved?: (e: MouseEvent) => any
moved?: (e: MouseEvent, graph: Graph) => any
/**
* @description Life Cycle when graph before delete
*/
// eslint-disable-next-line
beforeDelete?: (graph: Graph) => any
/**
* @description Life Cycle when graph deleted
*/
// eslint-disable-next-line
deleted?: (graph: Graph) => any
}

@@ -128,0 +139,0 @@

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

SocketSocket SOC 2 Logo

Product

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc