@rnacanvas/draw.svg 2.3.0 → 2.5.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -34,6 +34,25 @@ export declare class CoordinateSystem {
|
|
|
34
34
|
* The maximum Y coordinate of the view box of the target SVG document.
|
|
35
35
|
*/
|
|
36
36
|
get maxY(): number;
|
|
37
|
+
/**
|
|
38
|
+
* The horizontal scaling factor of the target SVG document
|
|
39
|
+
* (as defined by the width of its view box and its `width` attribute).
|
|
40
|
+
*/
|
|
41
|
+
get horizontalScaling(): number;
|
|
42
|
+
/**
|
|
43
|
+
* The vertical scaling factor of the target SVG document
|
|
44
|
+
* (as defined by the height of its view box and its `height` attribute).
|
|
45
|
+
*/
|
|
46
|
+
get verticalScaling(): number;
|
|
47
|
+
/**
|
|
48
|
+
* Sets both the horizontal and vertical scalings of the target SVG document
|
|
49
|
+
* to the provided scaling factor at once.
|
|
50
|
+
*
|
|
51
|
+
* Does so by modifying the `width` and `height` attributes of the target SVG document.
|
|
52
|
+
*
|
|
53
|
+
* Does not modify the view box of the target SVG document.
|
|
54
|
+
*/
|
|
55
|
+
setScaling(scaling: number): void;
|
|
37
56
|
/**
|
|
38
57
|
* The width of the bounding client rect for the target SVG document.
|
|
39
58
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CoordinateSystem.d.ts","sourceRoot":"","sources":["../src/CoordinateSystem.ts"],"names":[],"mappings":"AAAA,KAAK,KAAK,GAAG;IACX,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;CACX,CAAC;AAEF;;GAEG;AACH,qBAAa,gBAAgB;IACf,OAAO,CAAC,YAAY;gBAAZ,YAAY,EAAE,aAAa;IAE/C;;;OAGG;IACH,IAAI,KAAK,IAAI,MAAM,CAElB;IAED;;;OAGG;IACH,IAAI,MAAM,IAAI,MAAM,CAEnB;IAED;;OAEG;IACH,IAAI,IAAI,IAAI,MAAM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,MAAM,GAAG,MAAM;IAI5B;;;;;OAKG;IACH,SAAS,CAAC,CAAC,EAAE,MAAM,GAAG,MAAM;IAI5B;;;;;;;OAOG;IACH,mBAAmB,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC;IAO3D;;;;;OAKG;IACH,aAAa,CAAC,KAAK,EAAE,KAAK,GAAG,KAAK;CAMnC"}
|
package/dist/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define([],e):"object"==typeof exports?exports["draw.svg"]=e():t["draw.svg"]=e()}(this,(()=>(()=>{"use strict";var t={d:(e,n)=>{for(var
|
|
1
|
+
!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define([],e):"object"==typeof exports?exports["draw.svg"]=e():t["draw.svg"]=e()}(this,(()=>(()=>{"use strict";var t={d:(e,n)=>{for(var i in n)t.o(n,i)&&!t.o(e,i)&&Object.defineProperty(e,i,{enumerable:!0,get:n[i]})},o:(t,e)=>Object.prototype.hasOwnProperty.call(t,e),r:t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})}},e={};t.r(e),t.d(e,{CoordinateSystem:()=>l,HorizontalClientScaling:()=>g,Scaling:()=>h,VerticalClientScaling:()=>p,assignUUID:()=>a,bringToFront:()=>s,sendToBack:()=>f});const n={randomUUID:"undefined"!=typeof crypto&&crypto.randomUUID&&crypto.randomUUID.bind(crypto)};let i;const o=new Uint8Array(16);function r(){if(!i&&(i="undefined"!=typeof crypto&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto),!i))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return i(o)}const c=[];for(let t=0;t<256;++t)c.push((t+256).toString(16).slice(1));const u=function(t,e,i){if(n.randomUUID&&!e&&!t)return n.randomUUID();const o=(t=t||{}).random||(t.rng||r)();if(o[6]=15&o[6]|64,o[8]=63&o[8]|128,e){i=i||0;for(let t=0;t<16;++t)e[i+t]=o[t];return e}return function(t,e=0){return c[t[e+0]]+c[t[e+1]]+c[t[e+2]]+c[t[e+3]]+"-"+c[t[e+4]]+c[t[e+5]]+"-"+c[t[e+6]]+c[t[e+7]]+"-"+c[t[e+8]]+c[t[e+9]]+"-"+c[t[e+10]]+c[t[e+11]]+c[t[e+12]]+c[t[e+13]]+c[t[e+14]]+c[t[e+15]]}(o)};function a(t){t.id="uuid-"+u()}var l=function(){function t(t){this.targetSVGDoc=t}return Object.defineProperty(t.prototype,"width",{get:function(){return this.targetSVGDoc.viewBox.baseVal.width},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"height",{get:function(){return this.targetSVGDoc.viewBox.baseVal.height},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"minX",{get:function(){return this.targetSVGDoc.viewBox.baseVal.x},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"maxX",{get:function(){return this.minX+this.width},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"minY",{get:function(){return this.targetSVGDoc.viewBox.baseVal.y},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"maxY",{get:function(){return this.minY+this.height},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"horizontalScaling",{get:function(){return this.targetSVGDoc.width.baseVal.value/this.width},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"verticalScaling",{get:function(){return this.targetSVGDoc.height.baseVal.value/this.height},enumerable:!1,configurable:!0}),t.prototype.setScaling=function(t){this.targetSVGDoc.setAttribute("width","".concat(t*this.width)),this.targetSVGDoc.setAttribute("height","".concat(t*this.height))},Object.defineProperty(t.prototype,"clientWidth",{get:function(){return this.targetSVGDoc.getBoundingClientRect().width},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"clientHeight",{get:function(){return this.targetSVGDoc.getBoundingClientRect().height},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"horizontalClientScaling",{get:function(){return this.clientWidth/this.width},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"verticalClientScaling",{get:function(){return this.clientHeight/this.height},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"minClientX",{get:function(){return this.targetSVGDoc.getBoundingClientRect().x},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"minClientY",{get:function(){return this.targetSVGDoc.getBoundingClientRect().y},enumerable:!1,configurable:!0}),t.prototype.fromClientX=function(t){return this.minX+(t-this.minClientX)/this.horizontalClientScaling},t.prototype.fromClientY=function(t){return this.minY+(t-this.minClientY)/this.verticalClientScaling},t.prototype.fromClientCoordinates=function(t,e){return[this.fromClientX(t),this.fromClientY(e)]},t.prototype.fromClientPoint=function(t){return{x:this.fromClientX(t.x),y:this.fromClientY(t.y)}},t.prototype.toClientX=function(t){return this.minClientX+this.horizontalClientScaling*(t-this.minX)},t.prototype.toClientY=function(t){return this.minClientY+this.verticalClientScaling*(t-this.minY)},t.prototype.toClientCoordinates=function(t,e){return[this.toClientX(t),this.toClientY(e)]},t.prototype.toClientPoint=function(t){return{x:this.toClientX(t.x),y:this.toClientY(t.y)}},t}(),h=function(){function t(t){this.targetSVGDoc=t}return t.prototype.set=function(t){var e=this.targetSVGDoc.viewBox.baseVal;this.targetSVGDoc.setAttribute("width",t*e.width+"px"),this.targetSVGDoc.setAttribute("height",t*e.height+"px")},t}(),g=function(){function t(t){this.targetSVGDoc=t}return t.prototype.get=function(){var t=this.targetSVGDoc.getBoundingClientRect(),e=this.targetSVGDoc.viewBox.baseVal;return t.width/e.width},t}(),p=function(){function t(t){this.targetSVGDoc=t}return t.prototype.get=function(){var t=this.targetSVGDoc.getBoundingClientRect(),e=this.targetSVGDoc.viewBox.baseVal;return t.height/e.height},t}();function s(t){var e=t.parentNode;e&&e.appendChild(t)}function f(t){var e=t.parentNode;e&&e.prepend(t)}return e})()));
|