@nativescript/canvas 0.9.22-v6 → 1.0.0-alpha.10
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.
- package/Canvas/common.d.ts +17 -24
- package/Canvas/common.js +207 -182
- package/Canvas/common.js.map +1 -1
- package/Canvas/index.android.d.ts +8 -6
- package/Canvas/index.android.js +155 -156
- package/Canvas/index.android.js.map +1 -1
- package/Canvas/index.ios.d.ts +10 -7
- package/Canvas/index.ios.js +141 -153
- package/Canvas/index.ios.js.map +1 -1
- package/Canvas2D/CanvasGradient/CanvasGradient.android.d.ts +2 -2
- package/Canvas2D/CanvasGradient/CanvasGradient.android.js +13 -23
- package/Canvas2D/CanvasGradient/CanvasGradient.android.js.map +1 -1
- package/Canvas2D/CanvasGradient/CanvasGradient.d.ts +1 -1
- package/Canvas2D/CanvasGradient/CanvasGradient.ios.d.ts +1 -1
- package/Canvas2D/CanvasGradient/CanvasGradient.ios.js +13 -23
- package/Canvas2D/CanvasGradient/CanvasGradient.ios.js.map +1 -1
- package/Canvas2D/CanvasGradient/common.d.ts +1 -1
- package/Canvas2D/CanvasGradient/common.js +2 -8
- package/Canvas2D/CanvasGradient/common.js.map +1 -1
- package/Canvas2D/CanvasGradient/index.js +2 -7
- package/Canvas2D/CanvasGradient/index.js.map +1 -1
- package/Canvas2D/CanvasPattern/CanvasPattern.android.js +8 -14
- package/Canvas2D/CanvasPattern/CanvasPattern.android.js.map +1 -1
- package/Canvas2D/CanvasPattern/CanvasPattern.ios.js +7 -12
- package/Canvas2D/CanvasPattern/CanvasPattern.ios.js.map +1 -1
- package/Canvas2D/CanvasPattern/common.d.ts +1 -1
- package/Canvas2D/CanvasPattern/common.js +6 -14
- package/Canvas2D/CanvasPattern/common.js.map +1 -1
- package/Canvas2D/CanvasPattern/index.js +2 -7
- package/Canvas2D/CanvasPattern/index.js.map +1 -1
- package/Canvas2D/CanvasRenderingContext2D/common.d.ts +21 -21
- package/Canvas2D/CanvasRenderingContext2D/common.js +9 -21
- package/Canvas2D/CanvasRenderingContext2D/common.js.map +1 -1
- package/Canvas2D/CanvasRenderingContext2D/index.android.d.ts +40 -21
- package/Canvas2D/CanvasRenderingContext2D/index.android.js +602 -638
- package/Canvas2D/CanvasRenderingContext2D/index.android.js.map +1 -1
- package/Canvas2D/CanvasRenderingContext2D/index.ios.d.ts +40 -21
- package/Canvas2D/CanvasRenderingContext2D/index.ios.js +621 -737
- package/Canvas2D/CanvasRenderingContext2D/index.ios.js.map +1 -1
- package/Canvas2D/DOMMatrix/DOMMatrix.android.d.ts +44 -22
- package/Canvas2D/DOMMatrix/DOMMatrix.android.js +141 -231
- package/Canvas2D/DOMMatrix/DOMMatrix.android.js.map +1 -1
- package/Canvas2D/DOMMatrix/DOMMatrix.d.ts +1 -1
- package/Canvas2D/DOMMatrix/DOMMatrix.ios.d.ts +44 -22
- package/Canvas2D/DOMMatrix/DOMMatrix.ios.js +141 -225
- package/Canvas2D/DOMMatrix/DOMMatrix.ios.js.map +1 -1
- package/Canvas2D/DOMMatrix/common.d.ts +23 -7
- package/Canvas2D/DOMMatrix/common.js +6 -14
- package/Canvas2D/DOMMatrix/common.js.map +1 -1
- package/Canvas2D/DOMMatrix/index.js +2 -7
- package/Canvas2D/DOMMatrix/index.js.map +1 -1
- package/Canvas2D/ImageData/ImageData.android.d.ts +4 -0
- package/Canvas2D/ImageData/ImageData.android.js +41 -16
- package/Canvas2D/ImageData/ImageData.android.js.map +1 -1
- package/Canvas2D/ImageData/ImageData.ios.d.ts +4 -0
- package/Canvas2D/ImageData/ImageData.ios.js +41 -16
- package/Canvas2D/ImageData/ImageData.ios.js.map +1 -1
- package/Canvas2D/ImageData/common.d.ts +5 -5
- package/Canvas2D/ImageData/common.js +6 -17
- package/Canvas2D/ImageData/common.js.map +1 -1
- package/Canvas2D/ImageData/index.js +2 -7
- package/Canvas2D/ImageData/index.js.map +1 -1
- package/Canvas2D/Path2D/Path2D.android.js +26 -35
- package/Canvas2D/Path2D/Path2D.android.js.map +1 -1
- package/Canvas2D/Path2D/Path2D.ios.js +26 -35
- package/Canvas2D/Path2D/Path2D.ios.js.map +1 -1
- package/Canvas2D/Path2D/common.d.ts +1 -1
- package/Canvas2D/Path2D/common.js +6 -14
- package/Canvas2D/Path2D/common.js.map +1 -1
- package/Canvas2D/Path2D/index.js +2 -7
- package/Canvas2D/Path2D/index.js.map +1 -1
- package/Canvas2D/TextMetrics/TextMetrics.android.d.ts +13 -14
- package/Canvas2D/TextMetrics/TextMetrics.android.js +41 -94
- package/Canvas2D/TextMetrics/TextMetrics.android.js.map +1 -1
- package/Canvas2D/TextMetrics/TextMetrics.d.ts +1 -12
- package/Canvas2D/TextMetrics/TextMetrics.ios.d.ts +12 -12
- package/Canvas2D/TextMetrics/TextMetrics.ios.js +41 -94
- package/Canvas2D/TextMetrics/TextMetrics.ios.js.map +1 -1
- package/Canvas2D/TextMetrics/common.d.ts +14 -2
- package/Canvas2D/TextMetrics/common.js +6 -14
- package/Canvas2D/TextMetrics/common.js.map +1 -1
- package/Canvas2D/TextMetrics/index.js +2 -7
- package/Canvas2D/TextMetrics/index.js.map +1 -1
- package/Canvas2D/index.js +6 -11
- package/Canvas2D/index.js.map +1 -1
- package/ImageAsset/ImageAsset.android.d.ts +4 -4
- package/ImageAsset/ImageAsset.android.js +79 -101
- package/ImageAsset/ImageAsset.android.js.map +1 -1
- package/ImageAsset/ImageAsset.d.ts +1 -1
- package/ImageAsset/ImageAsset.ios.d.ts +5 -4
- package/ImageAsset/ImageAsset.ios.js +82 -107
- package/ImageAsset/ImageAsset.ios.js.map +1 -1
- package/ImageAsset/common.d.ts +1 -1
- package/ImageAsset/common.js +8 -16
- package/ImageAsset/common.js.map +1 -1
- package/ImageAsset/index.js +2 -7
- package/ImageAsset/index.js.map +1 -1
- package/ImageBitmap/common.d.ts +8 -0
- package/ImageBitmap/common.js +9 -0
- package/ImageBitmap/common.js.map +1 -0
- package/ImageBitmap/index.android.d.ts +12 -0
- package/ImageBitmap/index.android.js +332 -0
- package/ImageBitmap/index.android.js.map +1 -0
- package/ImageBitmap/index.ios.d.ts +12 -0
- package/ImageBitmap/index.ios.js +283 -0
- package/ImageBitmap/index.ios.js.map +1 -0
- package/README.md +26 -27
- package/SVG/Circle.d.ts +3 -3
- package/SVG/Circle.js +16 -89
- package/SVG/Circle.js.map +1 -1
- package/SVG/ClipPath.d.ts +1 -0
- package/SVG/ClipPath.js +7 -10
- package/SVG/ClipPath.js.map +1 -1
- package/SVG/Defs.d.ts +1 -4
- package/SVG/Defs.js +7 -18
- package/SVG/Defs.js.map +1 -1
- package/SVG/Ellipse.d.ts +1 -2
- package/SVG/Ellipse.js +16 -43
- package/SVG/Ellipse.js.map +1 -1
- package/SVG/G.d.ts +1 -7
- package/SVG/G.js +7 -64
- package/SVG/G.js.map +1 -1
- package/SVG/Image.d.ts +5 -4
- package/SVG/Image.js +28 -74
- package/SVG/Image.js.map +1 -1
- package/SVG/Line.d.ts +1 -1
- package/SVG/Line.js +16 -39
- package/SVG/Line.js.map +1 -1
- package/SVG/LinearGradient.d.ts +1 -4
- package/SVG/LinearGradient.js +11 -54
- package/SVG/LinearGradient.js.map +1 -1
- package/SVG/Path.d.ts +2 -2
- package/SVG/Path.js +10 -81
- package/SVG/Path.js.map +1 -1
- package/SVG/Pattern.d.ts +1 -9
- package/SVG/Pattern.js +7 -89
- package/SVG/Pattern.js.map +1 -1
- package/SVG/Polygon.d.ts +2 -2
- package/SVG/Polygon.js +10 -63
- package/SVG/Polygon.js.map +1 -1
- package/SVG/Polyline.d.ts +1 -1
- package/SVG/Polyline.js +10 -64
- package/SVG/Polyline.js.map +1 -1
- package/SVG/Rect.d.ts +1 -1
- package/SVG/Rect.js +11 -74
- package/SVG/Rect.js.map +1 -1
- package/SVG/SVG.d.ts +23 -9
- package/SVG/SVG.js +162 -55
- package/SVG/SVG.js.map +1 -1
- package/SVG/SVGItem.d.ts +2 -19
- package/SVG/SVGItem.js +6 -191
- package/SVG/SVGItem.js.map +1 -1
- package/SVG/Stop.d.ts +1 -2
- package/SVG/Stop.js +7 -32
- package/SVG/Stop.js.map +1 -1
- package/SVG/Symbol.d.ts +1 -4
- package/SVG/Symbol.js +7 -18
- package/SVG/Symbol.js.map +1 -1
- package/SVG/Text.d.ts +6 -5
- package/SVG/Text.js +18 -19
- package/SVG/Text.js.map +1 -1
- package/SVG/Use.d.ts +1 -10
- package/SVG/Use.js +7 -96
- package/SVG/Use.js.map +1 -1
- package/SVG/index.js +18 -40
- package/SVG/index.js.map +1 -1
- package/TextDecoder/TextDecoder.android.d.ts +2 -1
- package/TextDecoder/TextDecoder.android.js +39 -40
- package/TextDecoder/TextDecoder.android.js.map +1 -1
- package/TextDecoder/TextDecoder.ios.d.ts +1 -1
- package/TextDecoder/TextDecoder.ios.js +23 -36
- package/TextDecoder/TextDecoder.ios.js.map +1 -1
- package/TextDecoder/common.d.ts +4 -4
- package/TextDecoder/common.js +6 -17
- package/TextDecoder/common.js.map +1 -1
- package/TextDecoder/index.js +2 -7
- package/TextDecoder/index.js.map +1 -1
- package/TextEncoder/TextEncoder.android.d.ts +1 -1
- package/TextEncoder/TextEncoder.android.js +11 -21
- package/TextEncoder/TextEncoder.android.js.map +1 -1
- package/TextEncoder/TextEncoder.ios.d.ts +1 -1
- package/TextEncoder/TextEncoder.ios.js +11 -21
- package/TextEncoder/TextEncoder.ios.js.map +1 -1
- package/TextEncoder/common.d.ts +4 -4
- package/TextEncoder/common.js +6 -17
- package/TextEncoder/common.js.map +1 -1
- package/TextEncoder/index.js +2 -7
- package/TextEncoder/index.js.map +1 -1
- package/WebGL/WebGLActiveInfo.js +8 -10
- package/WebGL/WebGLActiveInfo.js.map +1 -1
- package/WebGL/WebGLBuffer.d.ts +1 -1
- package/WebGL/WebGLBuffer.js +11 -17
- package/WebGL/WebGLBuffer.js.map +1 -1
- package/WebGL/WebGLExtensions/index.android.js +137 -190
- package/WebGL/WebGLExtensions/index.android.js.map +1 -1
- package/WebGL/WebGLExtensions/index.ios.js +110 -163
- package/WebGL/WebGLExtensions/index.ios.js.map +1 -1
- package/WebGL/WebGLFramebuffer.d.ts +1 -1
- package/WebGL/WebGLFramebuffer.js +11 -17
- package/WebGL/WebGLFramebuffer.js.map +1 -1
- package/WebGL/WebGLProgram.d.ts +1 -1
- package/WebGL/WebGLProgram.js +11 -17
- package/WebGL/WebGLProgram.js.map +1 -1
- package/WebGL/WebGLRenderbuffer.d.ts +1 -1
- package/WebGL/WebGLRenderbuffer.js +11 -17
- package/WebGL/WebGLRenderbuffer.js.map +1 -1
- package/WebGL/WebGLRenderingContext/common.d.ts +301 -301
- package/WebGL/WebGLRenderingContext/common.js +940 -2140
- package/WebGL/WebGLRenderingContext/common.js.map +1 -1
- package/WebGL/WebGLRenderingContext/index.android.d.ts +10 -5
- package/WebGL/WebGLRenderingContext/index.android.js +1014 -587
- package/WebGL/WebGLRenderingContext/index.android.js.map +1 -1
- package/WebGL/WebGLRenderingContext/index.d.ts +2 -0
- package/WebGL/WebGLRenderingContext/index.ios.d.ts +3 -3
- package/WebGL/WebGLRenderingContext/index.ios.js +502 -573
- package/WebGL/WebGLRenderingContext/index.ios.js.map +1 -1
- package/WebGL/WebGLShader.d.ts +1 -1
- package/WebGL/WebGLShader.js +11 -17
- package/WebGL/WebGLShader.js.map +1 -1
- package/WebGL/WebGLShaderPrecisionFormat.js +8 -10
- package/WebGL/WebGLShaderPrecisionFormat.js.map +1 -1
- package/WebGL/WebGLTexture.d.ts +1 -1
- package/WebGL/WebGLTexture.js +11 -17
- package/WebGL/WebGLTexture.js.map +1 -1
- package/WebGL/WebGLUniformLocation.d.ts +1 -1
- package/WebGL/WebGLUniformLocation.js +11 -17
- package/WebGL/WebGLUniformLocation.js.map +1 -1
- package/WebGL/index.js +9 -14
- package/WebGL/index.js.map +1 -1
- package/WebGL2/WebGL2RenderingContext/common.d.ts +265 -265
- package/WebGL2/WebGL2RenderingContext/common.js +817 -1885
- package/WebGL2/WebGL2RenderingContext/common.js.map +1 -1
- package/WebGL2/WebGL2RenderingContext/index.android.d.ts +4 -1
- package/WebGL2/WebGL2RenderingContext/index.android.js +359 -293
- package/WebGL2/WebGL2RenderingContext/index.android.js.map +1 -1
- package/WebGL2/WebGL2RenderingContext/index.ios.d.ts +3 -1
- package/WebGL2/WebGL2RenderingContext/index.ios.js +289 -260
- package/WebGL2/WebGL2RenderingContext/index.ios.js.map +1 -1
- package/WebGL2/WebGLQuery.d.ts +1 -1
- package/WebGL2/WebGLQuery.js +11 -17
- package/WebGL2/WebGLQuery.js.map +1 -1
- package/WebGL2/WebGLSampler.d.ts +1 -1
- package/WebGL2/WebGLSampler.js +11 -17
- package/WebGL2/WebGLSampler.js.map +1 -1
- package/WebGL2/WebGLSync.d.ts +1 -1
- package/WebGL2/WebGLSync.js +11 -17
- package/WebGL2/WebGLSync.js.map +1 -1
- package/WebGL2/WebGLTransformFeedback.d.ts +1 -1
- package/WebGL2/WebGLTransformFeedback.js +11 -17
- package/WebGL2/WebGLTransformFeedback.js.map +1 -1
- package/WebGL2/WebGLVertexArrayObject.d.ts +1 -1
- package/WebGL2/WebGLVertexArrayObject.js +11 -17
- package/WebGL2/WebGLVertexArrayObject.js.map +1 -1
- package/WebGL2/index.js +5 -10
- package/WebGL2/index.js.map +1 -1
- package/angular/bundles/nativescript-canvas-angular.umd.js +29 -0
- package/angular/bundles/nativescript-canvas-angular.umd.js.map +1 -0
- package/angular/esm2015/index.js +12 -0
- package/angular/esm2015/nativescript-canvas-angular.js +5 -0
- package/angular/fesm2015/nativescript-canvas-angular.js +19 -0
- package/angular/fesm2015/nativescript-canvas-angular.js.map +1 -0
- package/angular/nativescript-canvas-angular.d.ts +4 -0
- package/angular/nativescript-canvas-angular.metadata.json +1 -0
- package/angular/package.json +14 -0
- package/common.js +4 -12
- package/common.js.map +1 -1
- package/index.d.ts +2 -2
- package/index.js +56 -28
- package/index.js.map +1 -1
- package/package.json +10 -6
- package/platforms/android/include.gradle +22 -1
- package/platforms/ios/Podfile +2 -4
- package/react/index.js +2 -4
- package/react/index.js.map +1 -1
- package/svelte/index.js +2 -4
- package/svelte/index.js.map +1 -1
- package/utils.d.ts +4 -0
- package/utils.js +46 -22
- package/utils.js.map +1 -1
- package/vue/index.d.ts +4 -0
- package/vue/index.js +6 -0
- package/vue/index.js.map +1 -0
- package/Canvas/common.metadata.json +0 -1
- package/Canvas/index.android.metadata.json +0 -1
- package/Canvas/index.ios.metadata.json +0 -1
- package/Canvas2D/CanvasGradient/CanvasGradient.android.metadata.json +0 -1
- package/Canvas2D/CanvasGradient/CanvasGradient.ios.metadata.json +0 -1
- package/Canvas2D/CanvasGradient/common.metadata.json +0 -1
- package/Canvas2D/CanvasGradient/index.metadata.json +0 -1
- package/Canvas2D/CanvasPattern/CanvasPattern.android.metadata.json +0 -1
- package/Canvas2D/CanvasPattern/CanvasPattern.ios.metadata.json +0 -1
- package/Canvas2D/CanvasPattern/common.metadata.json +0 -1
- package/Canvas2D/CanvasPattern/index.metadata.json +0 -1
- package/Canvas2D/CanvasRenderingContext2D/common.metadata.json +0 -1
- package/Canvas2D/CanvasRenderingContext2D/index.android.metadata.json +0 -1
- package/Canvas2D/CanvasRenderingContext2D/index.ios.metadata.json +0 -1
- package/Canvas2D/DOMMatrix/DOMMatrix.android.metadata.json +0 -1
- package/Canvas2D/DOMMatrix/DOMMatrix.ios.metadata.json +0 -1
- package/Canvas2D/DOMMatrix/common.metadata.json +0 -1
- package/Canvas2D/DOMMatrix/index.metadata.json +0 -1
- package/Canvas2D/ImageData/ImageData.android.metadata.json +0 -1
- package/Canvas2D/ImageData/ImageData.ios.metadata.json +0 -1
- package/Canvas2D/ImageData/common.metadata.json +0 -1
- package/Canvas2D/ImageData/index.metadata.json +0 -1
- package/Canvas2D/Path2D/Path2D.android.metadata.json +0 -1
- package/Canvas2D/Path2D/Path2D.ios.metadata.json +0 -1
- package/Canvas2D/Path2D/common.metadata.json +0 -1
- package/Canvas2D/Path2D/index.metadata.json +0 -1
- package/Canvas2D/TextMetrics/TextMetrics.android.metadata.json +0 -1
- package/Canvas2D/TextMetrics/TextMetrics.ios.metadata.json +0 -1
- package/Canvas2D/TextMetrics/common.metadata.json +0 -1
- package/Canvas2D/TextMetrics/index.metadata.json +0 -1
- package/Canvas2D/index.metadata.json +0 -1
- package/ImageAsset/ImageAsset.android.metadata.json +0 -1
- package/ImageAsset/ImageAsset.ios.metadata.json +0 -1
- package/ImageAsset/common.metadata.json +0 -1
- package/ImageAsset/index.metadata.json +0 -1
- package/SVG/Circle.metadata.json +0 -1
- package/SVG/ClipPath.metadata.json +0 -1
- package/SVG/Defs.metadata.json +0 -1
- package/SVG/Ellipse.metadata.json +0 -1
- package/SVG/G.metadata.json +0 -1
- package/SVG/Image.metadata.json +0 -1
- package/SVG/Line.metadata.json +0 -1
- package/SVG/LinearGradient.metadata.json +0 -1
- package/SVG/Path.metadata.json +0 -1
- package/SVG/Pattern.metadata.json +0 -1
- package/SVG/Polygon.metadata.json +0 -1
- package/SVG/Polyline.metadata.json +0 -1
- package/SVG/Rect.metadata.json +0 -1
- package/SVG/SVG.metadata.json +0 -1
- package/SVG/SVGItem.metadata.json +0 -1
- package/SVG/Stop.metadata.json +0 -1
- package/SVG/Symbol.metadata.json +0 -1
- package/SVG/Text.metadata.json +0 -1
- package/SVG/Use.metadata.json +0 -1
- package/SVG/index.metadata.json +0 -1
- package/TextDecoder/TextDecoder.android.metadata.json +0 -1
- package/TextDecoder/TextDecoder.ios.metadata.json +0 -1
- package/TextDecoder/common.metadata.json +0 -1
- package/TextDecoder/index.metadata.json +0 -1
- package/TextEncoder/TextEncoder.android.metadata.json +0 -1
- package/TextEncoder/TextEncoder.ios.metadata.json +0 -1
- package/TextEncoder/common.metadata.json +0 -1
- package/TextEncoder/index.metadata.json +0 -1
- package/WebGL/WebGLActiveInfo.metadata.json +0 -1
- package/WebGL/WebGLBuffer.metadata.json +0 -1
- package/WebGL/WebGLExtensions/index.android.metadata.json +0 -1
- package/WebGL/WebGLExtensions/index.ios.metadata.json +0 -1
- package/WebGL/WebGLFramebuffer.metadata.json +0 -1
- package/WebGL/WebGLProgram.metadata.json +0 -1
- package/WebGL/WebGLRenderbuffer.metadata.json +0 -1
- package/WebGL/WebGLRenderingContext/common.metadata.json +0 -1
- package/WebGL/WebGLRenderingContext/index.android.metadata.json +0 -1
- package/WebGL/WebGLRenderingContext/index.ios.metadata.json +0 -1
- package/WebGL/WebGLShader.metadata.json +0 -1
- package/WebGL/WebGLShaderPrecisionFormat.metadata.json +0 -1
- package/WebGL/WebGLTexture.metadata.json +0 -1
- package/WebGL/WebGLUniformLocation.metadata.json +0 -1
- package/WebGL/index.metadata.json +0 -1
- package/WebGL2/WebGL2RenderingContext/common.metadata.json +0 -1
- package/WebGL2/WebGL2RenderingContext/index.android.metadata.json +0 -1
- package/WebGL2/WebGL2RenderingContext/index.ios.metadata.json +0 -1
- package/WebGL2/WebGLQuery.metadata.json +0 -1
- package/WebGL2/WebGLSampler.metadata.json +0 -1
- package/WebGL2/WebGLSync.metadata.json +0 -1
- package/WebGL2/WebGLTransformFeedback.metadata.json +0 -1
- package/WebGL2/WebGLVertexArrayObject.metadata.json +0 -1
- package/WebGL2/index.metadata.json +0 -1
- package/angular/index.js +0 -19
- package/angular/index.js.map +0 -1
- package/angular/index.metadata.json +0 -1
- package/common.metadata.json +0 -1
- package/index.metadata.json +0 -1
- package/react/index.metadata.json +0 -1
- package/utils.metadata.json +0 -1
package/SVG/Rect.js
CHANGED
|
@@ -1,76 +1,13 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
_this.rx = 0;
|
|
12
|
-
_this.ry = 0;
|
|
13
|
-
return _this;
|
|
1
|
+
import { SVGItem } from "./SVGItem";
|
|
2
|
+
import { DOMParser } from 'xmldom';
|
|
3
|
+
export class Rect extends SVGItem {
|
|
4
|
+
constructor() {
|
|
5
|
+
super();
|
|
6
|
+
this.x = 0;
|
|
7
|
+
this.y = 0;
|
|
8
|
+
this.rx = 0;
|
|
9
|
+
this.ry = 0;
|
|
10
|
+
this._dom = new DOMParser().parseFromString('<rect></rect>');
|
|
14
11
|
}
|
|
15
|
-
|
|
16
|
-
var ctx;
|
|
17
|
-
if (canvas) {
|
|
18
|
-
ctx = canvas.getContext('2d');
|
|
19
|
-
}
|
|
20
|
-
else {
|
|
21
|
-
ctx = this._canvas.getContext('2d');
|
|
22
|
-
}
|
|
23
|
-
ctx.save();
|
|
24
|
-
ctx.globalAlpha = this._realOpacity;
|
|
25
|
-
var lastOpacity;
|
|
26
|
-
if (this._doFillOpacity()) {
|
|
27
|
-
lastOpacity = ctx.globalAlpha;
|
|
28
|
-
ctx.globalAlpha = this._realFillOpacity;
|
|
29
|
-
}
|
|
30
|
-
if (this._doFill()) {
|
|
31
|
-
if (this.fill !== undefined && this.fill !== 'none') {
|
|
32
|
-
if (this.fill && this.fill.indexOf('url') > -1) {
|
|
33
|
-
var fill = this._getViewById(this.fill);
|
|
34
|
-
if (fill) {
|
|
35
|
-
var style = fill._getFillOrStrokeStyle();
|
|
36
|
-
if (style instanceof Canvas2D_1.CanvasGradient) {
|
|
37
|
-
ctx.fillStyle = style;
|
|
38
|
-
}
|
|
39
|
-
else {
|
|
40
|
-
ctx.fillStyle = ctx.createPattern(style, 'repeat');
|
|
41
|
-
}
|
|
42
|
-
}
|
|
43
|
-
}
|
|
44
|
-
else {
|
|
45
|
-
ctx.fillStyle = this.fill;
|
|
46
|
-
}
|
|
47
|
-
}
|
|
48
|
-
ctx.fillRect(this.x, this.y, this._getRealSize(this.width, null, 'width'), this._getRealSize(this.height, null, 'height'));
|
|
49
|
-
}
|
|
50
|
-
if (lastOpacity !== undefined) {
|
|
51
|
-
ctx.globalAlpha = lastOpacity;
|
|
52
|
-
}
|
|
53
|
-
if (this._doStroke()) {
|
|
54
|
-
if (this.stroke !== undefined && this.stroke !== 'none') {
|
|
55
|
-
if (this.stroke && this.stroke.indexOf('url') > -1) {
|
|
56
|
-
var stroke = this._getViewById(this.stroke);
|
|
57
|
-
var style = stroke._getFillOrStrokeStyle();
|
|
58
|
-
if (style instanceof Canvas2D_1.CanvasGradient) {
|
|
59
|
-
ctx.strokeStyle = style;
|
|
60
|
-
}
|
|
61
|
-
else if (stroke) {
|
|
62
|
-
ctx.strokeStyle = ctx.createPattern(style, 'repeat');
|
|
63
|
-
}
|
|
64
|
-
}
|
|
65
|
-
else {
|
|
66
|
-
ctx.strokeStyle = this.stroke;
|
|
67
|
-
}
|
|
68
|
-
}
|
|
69
|
-
ctx.strokeRect(this.x, this.y, this._getRealSize(this.width, null, 'width'), this._getRealSize(this.height, null, 'height'));
|
|
70
|
-
}
|
|
71
|
-
ctx.restore();
|
|
72
|
-
};
|
|
73
|
-
return Rect;
|
|
74
|
-
}(SVGItem_1.SVGItem));
|
|
75
|
-
exports.Rect = Rect;
|
|
12
|
+
}
|
|
76
13
|
//# sourceMappingURL=Rect.js.map
|
package/SVG/Rect.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Rect.js","sourceRoot":"","sources":["
|
|
1
|
+
{"version":3,"file":"Rect.js","sourceRoot":"","sources":["../../../../packages/canvas/SVG/Rect.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAEpC,OAAO,EAAE,SAAS,EAAE,MAAM,QAAQ,CAAC;AACnC,MAAM,OAAO,IAAK,SAAQ,OAAO;IAMhC;QACC,KAAK,EAAE,CAAC;QANT,MAAC,GAAQ,CAAC,CAAC;QACX,MAAC,GAAQ,CAAC,CAAC;QACX,OAAE,GAAQ,CAAC,CAAC;QACZ,OAAE,GAAQ,CAAC,CAAC;QAIX,IAAI,CAAC,IAAI,GAAG,IAAI,SAAS,EAAE,CAAC,eAAe,CAAC,eAAe,CAAC,CAAC;IAC9D,CAAC;CACD"}
|
package/SVG/SVG.d.ts
CHANGED
|
@@ -1,17 +1,31 @@
|
|
|
1
|
-
import { View, Style } from '@nativescript/core';
|
|
2
|
-
import { CssProperty } from '@nativescript/core/ui/core/properties';
|
|
3
|
-
import { AddChildFromBuilder } from '@nativescript/core/ui/core/view';
|
|
1
|
+
import { View, Style, CssProperty } from '@nativescript/core';
|
|
4
2
|
export declare const strokeProperty: CssProperty<Style, any>;
|
|
5
3
|
export declare const strokeWidthProperty: CssProperty<Style, number>;
|
|
6
4
|
export declare const fillProperty: CssProperty<Style, any>;
|
|
5
|
+
export declare const fillRuleProperty: CssProperty<Style, any>;
|
|
7
6
|
export declare const fillOpacityProperty: CssProperty<Style, any>;
|
|
8
7
|
export declare const stopColorProperty: CssProperty<Style, any>;
|
|
9
|
-
export declare
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
8
|
+
export declare const strokeLinecapProperty: CssProperty<Style, any>;
|
|
9
|
+
export declare const strokeLinejoinProperty: CssProperty<Style, any>;
|
|
10
|
+
export declare const strokeMiterlimitProperty: CssProperty<Style, any>;
|
|
11
|
+
export declare const srcProperty: any;
|
|
12
|
+
import { SVGItem } from './SVGItem';
|
|
13
|
+
export declare class Svg extends View {
|
|
14
|
+
static readyEvent: string;
|
|
15
|
+
_dom: any;
|
|
16
|
+
_serializer: any;
|
|
17
|
+
_svg: any;
|
|
18
|
+
src: string;
|
|
19
|
+
__children: any[];
|
|
20
|
+
__attachedToDom: boolean;
|
|
13
21
|
constructor();
|
|
22
|
+
onLayout(left: number, top: number, right: number, bottom: number): void;
|
|
23
|
+
onMeasure(widthMeasureSpec: number, heightMeasureSpec: number): void;
|
|
24
|
+
__redraw(): void;
|
|
25
|
+
onLoaded(): void;
|
|
26
|
+
onUnloaded(): void;
|
|
14
27
|
createNativeView(): Object;
|
|
15
|
-
|
|
16
|
-
|
|
28
|
+
initNativeView(): void;
|
|
29
|
+
addChild(view: SVGItem): void;
|
|
30
|
+
removeChild(view: SVGItem): void;
|
|
17
31
|
}
|
package/SVG/SVG.js
CHANGED
|
@@ -1,83 +1,190 @@
|
|
|
1
|
-
|
|
2
|
-
Object.
|
|
3
|
-
|
|
4
|
-
var
|
|
5
|
-
|
|
6
|
-
|
|
1
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
2
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
3
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
4
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
5
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
|
+
};
|
|
7
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
8
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
9
|
+
};
|
|
10
|
+
import { Http, View, Style, CssProperty, Property, path, knownFolders, CSSType, Application, Utils } from '@nativescript/core';
|
|
11
|
+
export const strokeProperty = new CssProperty({
|
|
7
12
|
name: 'stroke',
|
|
8
13
|
cssName: 'stroke',
|
|
9
14
|
defaultValue: undefined,
|
|
10
15
|
});
|
|
11
|
-
|
|
16
|
+
export const strokeWidthProperty = new CssProperty({
|
|
12
17
|
name: 'strokeWidth',
|
|
13
18
|
cssName: 'stroke-width',
|
|
14
19
|
defaultValue: 1,
|
|
15
20
|
});
|
|
16
|
-
|
|
21
|
+
export const fillProperty = new CssProperty({
|
|
17
22
|
name: 'fill',
|
|
18
23
|
cssName: 'fill',
|
|
19
24
|
defaultValue: undefined,
|
|
20
25
|
});
|
|
21
|
-
|
|
26
|
+
export const fillRuleProperty = new CssProperty({
|
|
27
|
+
name: 'fillRule',
|
|
28
|
+
cssName: 'fill-rule',
|
|
29
|
+
defaultValue: undefined,
|
|
30
|
+
});
|
|
31
|
+
export const fillOpacityProperty = new CssProperty({
|
|
22
32
|
name: 'fillOpacity',
|
|
23
33
|
cssName: 'fill-opacity',
|
|
24
34
|
defaultValue: undefined,
|
|
25
35
|
});
|
|
26
|
-
|
|
36
|
+
export const stopColorProperty = new CssProperty({
|
|
27
37
|
name: 'stopColor',
|
|
28
38
|
cssName: 'stop-color',
|
|
29
39
|
defaultValue: undefined,
|
|
30
40
|
});
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
41
|
+
export const strokeLinecapProperty = new CssProperty({
|
|
42
|
+
name: 'strokeLinecap',
|
|
43
|
+
cssName: 'stroke-linecap',
|
|
44
|
+
});
|
|
45
|
+
export const strokeLinejoinProperty = new CssProperty({
|
|
46
|
+
name: 'strokeLinejoin',
|
|
47
|
+
cssName: 'stroke-linejoin',
|
|
48
|
+
});
|
|
49
|
+
export const strokeMiterlimitProperty = new CssProperty({
|
|
50
|
+
name: 'strokeMiterlimit',
|
|
51
|
+
cssName: 'stroke-miterlimit',
|
|
52
|
+
});
|
|
53
|
+
export const srcProperty = new Property({
|
|
54
|
+
name: 'src',
|
|
55
|
+
});
|
|
56
|
+
import { DOMParser, XMLSerializer } from 'xmldom';
|
|
57
|
+
const initialSVG = '<svg width="auto" height="auto" xmlns="http://www.w3.org/2000/svg"></svg>';
|
|
58
|
+
let Svg = class Svg extends View {
|
|
59
|
+
constructor() {
|
|
60
|
+
super();
|
|
61
|
+
this.__children = [];
|
|
62
|
+
this.__attachedToDom = false;
|
|
63
|
+
if (global.isAndroid) {
|
|
64
|
+
const activity = Application.android.foregroundActivity || Application.android.startActivity;
|
|
65
|
+
this._svg = new org.nativescript.canvas.TNSSVG(activity);
|
|
66
|
+
}
|
|
67
|
+
else if (global.isIOS) {
|
|
68
|
+
this._svg = TNSSVG.alloc().initWithFrame(CGRectZero);
|
|
69
|
+
this._svg.backgroundColor = UIColor.clearColor;
|
|
70
|
+
}
|
|
71
|
+
this._dom = new DOMParser().parseFromString(initialSVG);
|
|
72
|
+
this._serializer = new XMLSerializer();
|
|
39
73
|
}
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
74
|
+
[srcProperty.setNative](value) {
|
|
75
|
+
if (typeof value === 'string') {
|
|
76
|
+
if (value.indexOf('<svg') > -1) {
|
|
77
|
+
if (global.isAndroid) {
|
|
78
|
+
this._svg.setSrc(value);
|
|
79
|
+
}
|
|
80
|
+
else if (global.isIOS) {
|
|
81
|
+
this._svg.src = value;
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
else {
|
|
85
|
+
if (value.startsWith('~')) {
|
|
86
|
+
if (global.isAndroid) {
|
|
87
|
+
this._svg.setSrcPath(path.join(knownFolders.currentApp().path, value.replace('~', '')));
|
|
88
|
+
}
|
|
89
|
+
else if (global.isIOS) {
|
|
90
|
+
this._svg.srcPath = path.join(knownFolders.currentApp().path, value.replace('~', ''));
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
else if (value.startsWith('/')) {
|
|
94
|
+
if (global.isAndroid) {
|
|
95
|
+
this._svg.setSrcPath(value);
|
|
96
|
+
}
|
|
97
|
+
else if (global.isIOS) {
|
|
98
|
+
this._svg.srcPath = value;
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
else if (value.startsWith('http')) {
|
|
102
|
+
Http.getString(value)
|
|
103
|
+
.then((res) => {
|
|
104
|
+
if (global.isAndroid) {
|
|
105
|
+
this._svg.setSrc(res);
|
|
106
|
+
}
|
|
107
|
+
else if (global.isIOS) {
|
|
108
|
+
this._svg.src = res;
|
|
109
|
+
}
|
|
110
|
+
})
|
|
111
|
+
.catch((e) => {
|
|
112
|
+
console.log(e);
|
|
113
|
+
});
|
|
46
114
|
}
|
|
47
|
-
}
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
onLayout(left, top, right, bottom) {
|
|
119
|
+
super.onLayout(left, top, right, bottom);
|
|
120
|
+
this.__redraw();
|
|
121
|
+
}
|
|
122
|
+
onMeasure(widthMeasureSpec, heightMeasureSpec) {
|
|
123
|
+
const nativeView = this.nativeView;
|
|
124
|
+
if (nativeView) {
|
|
125
|
+
const width = Utils.layout.getMeasureSpecSize(widthMeasureSpec);
|
|
126
|
+
const height = Utils.layout.getMeasureSpecSize(heightMeasureSpec);
|
|
127
|
+
this.setMeasuredDimension(width, height);
|
|
51
128
|
}
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
if (typeof name === 'string') {
|
|
62
|
-
if (name.indexOf('url') > -1) {
|
|
63
|
-
name = name.replace('url', '').replace('(', '').replace(')', '');
|
|
129
|
+
}
|
|
130
|
+
__redraw() {
|
|
131
|
+
if (this.__attachedToDom) {
|
|
132
|
+
const domCopy = this._dom.valueOf();
|
|
133
|
+
const serialized = this._serializer.serializeToString(domCopy);
|
|
134
|
+
const width = domCopy.documentElement.getAttribute('width');
|
|
135
|
+
const height = domCopy.documentElement.getAttribute('height');
|
|
136
|
+
if (width === 'auto') {
|
|
137
|
+
domCopy.documentElement.setAttribute('width', `${this.getMeasuredWidth()}px`);
|
|
64
138
|
}
|
|
65
|
-
if (
|
|
66
|
-
|
|
139
|
+
if (height === 'auto') {
|
|
140
|
+
domCopy.documentElement.setAttribute('height', `${this.getMeasuredHeight()}px`);
|
|
67
141
|
}
|
|
68
|
-
if (
|
|
69
|
-
|
|
142
|
+
if (serialized !== initialSVG) {
|
|
143
|
+
this.src = serialized;
|
|
70
144
|
}
|
|
71
|
-
return this._children.get(name);
|
|
72
145
|
}
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
146
|
+
}
|
|
147
|
+
onLoaded() {
|
|
148
|
+
super.onLoaded();
|
|
149
|
+
this.__attachedToDom = true;
|
|
150
|
+
}
|
|
151
|
+
onUnloaded() {
|
|
152
|
+
this.__attachedToDom = false;
|
|
153
|
+
super.onUnloaded();
|
|
154
|
+
}
|
|
155
|
+
createNativeView() {
|
|
156
|
+
return this._svg;
|
|
157
|
+
}
|
|
158
|
+
initNativeView() {
|
|
159
|
+
super.initNativeView();
|
|
160
|
+
}
|
|
161
|
+
addChild(view) {
|
|
162
|
+
this._addView(view);
|
|
163
|
+
view.__attached = true;
|
|
164
|
+
this.__children.push(view);
|
|
165
|
+
}
|
|
166
|
+
removeChild(view) {
|
|
167
|
+
if (view.__attached) {
|
|
168
|
+
this._removeView(view);
|
|
169
|
+
view.__attached = false;
|
|
170
|
+
this.__children = this.__children.filter((item) => item !== view);
|
|
171
|
+
}
|
|
172
|
+
}
|
|
173
|
+
};
|
|
174
|
+
Svg.readyEvent = 'ready';
|
|
175
|
+
Svg = __decorate([
|
|
176
|
+
CSSType('Svg'),
|
|
177
|
+
__metadata("design:paramtypes", [])
|
|
178
|
+
], Svg);
|
|
179
|
+
export { Svg };
|
|
180
|
+
srcProperty.register(Svg);
|
|
181
|
+
stopColorProperty.register(Style);
|
|
182
|
+
strokeWidthProperty.register(Style);
|
|
183
|
+
strokeProperty.register(Style);
|
|
184
|
+
fillProperty.register(Style);
|
|
185
|
+
fillOpacityProperty.register(Style);
|
|
186
|
+
fillRuleProperty.register(Style);
|
|
187
|
+
strokeLinecapProperty.register(Style);
|
|
188
|
+
strokeLinejoinProperty.register(Style);
|
|
189
|
+
strokeMiterlimitProperty.register(Style);
|
|
83
190
|
//# sourceMappingURL=SVG.js.map
|
package/SVG/SVG.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SVG.js","sourceRoot":"","sources":["
|
|
1
|
+
{"version":3,"file":"SVG.js","sourceRoot":"","sources":["../../../../packages/canvas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CAAC;CACD,CAAA;AAzHc,cAAU,GAAG,OAAO,CAAC;AADvB,GAAG;IADf,OAAO,CAAC,KAAK,CAAC;;GACF,GAAG,CA0Hf;SA1HY,GAAG;AA4HhB,WAAW,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC;AAC1B,iBAAiB,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC;AAClC,mBAAmB,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC;AACpC,cAAc,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC;AAC/B,YAAY,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC;AAC7B,mBAAmB,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC;AACpC,gBAAgB,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC;AACjC,qBAAqB,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC;AACtC,sBAAsB,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC;AACvC,wBAAwB,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC"}
|
package/SVG/SVGItem.d.ts
CHANGED
|
@@ -1,22 +1,5 @@
|
|
|
1
1
|
import { View } from '@nativescript/core';
|
|
2
|
-
import { Canvas } from "../Canvas";
|
|
3
2
|
export declare class SVGItem extends View {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
fill: any;
|
|
7
|
-
_parseOpacity(value: any): any;
|
|
8
|
-
fillOpacity: any;
|
|
9
|
-
opacity: any;
|
|
10
|
-
_canvas: Canvas;
|
|
11
|
-
_doStroke(): boolean;
|
|
12
|
-
_doFill(): boolean;
|
|
13
|
-
_doFillOpacity(): boolean;
|
|
14
|
-
readonly _realFillOpacity: any;
|
|
15
|
-
readonly _realStroke: any;
|
|
16
|
-
readonly _realFill: any;
|
|
17
|
-
readonly _realOpacity: any;
|
|
18
|
-
_getRealSize(value: any, parent?: any, type?: string): any;
|
|
19
|
-
_appendChild(id: any, child: any): void;
|
|
20
|
-
_removeChild(id: any): void;
|
|
21
|
-
_getViewById(name: string): any;
|
|
3
|
+
_dom: any;
|
|
4
|
+
__attached: boolean;
|
|
22
5
|
}
|
package/SVG/SVGItem.js
CHANGED
|
@@ -1,193 +1,8 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
var SVGItem = /** @class */ (function (_super) {
|
|
7
|
-
__extends(SVGItem, _super);
|
|
8
|
-
function SVGItem() {
|
|
9
|
-
return _super !== null && _super.apply(this, arguments) || this;
|
|
1
|
+
import { View } from '@nativescript/core';
|
|
2
|
+
export class SVGItem extends View {
|
|
3
|
+
constructor() {
|
|
4
|
+
super(...arguments);
|
|
5
|
+
this.__attached = false;
|
|
10
6
|
}
|
|
11
|
-
|
|
12
|
-
get: function () {
|
|
13
|
-
return this.style.stroke;
|
|
14
|
-
},
|
|
15
|
-
set: function (value) {
|
|
16
|
-
this.style.stroke = value;
|
|
17
|
-
},
|
|
18
|
-
enumerable: true,
|
|
19
|
-
configurable: true
|
|
20
|
-
});
|
|
21
|
-
Object.defineProperty(SVGItem.prototype, "strokeWidth", {
|
|
22
|
-
get: function () {
|
|
23
|
-
return this.style.strokeWidth;
|
|
24
|
-
},
|
|
25
|
-
set: function (value) {
|
|
26
|
-
this.style.strokeWidth = value;
|
|
27
|
-
},
|
|
28
|
-
enumerable: true,
|
|
29
|
-
configurable: true
|
|
30
|
-
});
|
|
31
|
-
Object.defineProperty(SVGItem.prototype, "fill", {
|
|
32
|
-
get: function () {
|
|
33
|
-
return this.style.fill;
|
|
34
|
-
},
|
|
35
|
-
set: function (value) {
|
|
36
|
-
this.style.fill = value;
|
|
37
|
-
},
|
|
38
|
-
enumerable: true,
|
|
39
|
-
configurable: true
|
|
40
|
-
});
|
|
41
|
-
SVGItem.prototype._parseOpacity = function (value) {
|
|
42
|
-
if (typeof value === 'string') {
|
|
43
|
-
if (value.indexOf('%') > -1) {
|
|
44
|
-
var percent = parseInt(value.replace('%', ''), 10);
|
|
45
|
-
value = isNaN(percent) ? 1 : percent / 100;
|
|
46
|
-
}
|
|
47
|
-
else {
|
|
48
|
-
var percent = parseFloat(value);
|
|
49
|
-
value = isNaN(percent) ? 1 : percent;
|
|
50
|
-
}
|
|
51
|
-
}
|
|
52
|
-
return value;
|
|
53
|
-
};
|
|
54
|
-
Object.defineProperty(SVGItem.prototype, "fillOpacity", {
|
|
55
|
-
get: function () {
|
|
56
|
-
return this.style.fillOpacity;
|
|
57
|
-
},
|
|
58
|
-
set: function (value) {
|
|
59
|
-
value = this._parseOpacity(value);
|
|
60
|
-
this.style.fillOpacity = value;
|
|
61
|
-
},
|
|
62
|
-
enumerable: true,
|
|
63
|
-
configurable: true
|
|
64
|
-
});
|
|
65
|
-
SVGItem.prototype._doStroke = function () {
|
|
66
|
-
return this._realStroke !== undefined && this._realStroke !== 'none';
|
|
67
|
-
};
|
|
68
|
-
SVGItem.prototype._doFill = function () {
|
|
69
|
-
return this._realFill !== 'none';
|
|
70
|
-
};
|
|
71
|
-
SVGItem.prototype._doFillOpacity = function () {
|
|
72
|
-
return this._realFillOpacity !== undefined;
|
|
73
|
-
};
|
|
74
|
-
Object.defineProperty(SVGItem.prototype, "_realFillOpacity", {
|
|
75
|
-
get: function () {
|
|
76
|
-
// @ts-ignore
|
|
77
|
-
if ((this.parent && this.parent.fillOpacity) !== undefined && this.fillOpacity !== undefined) {
|
|
78
|
-
return this._parseOpacity(this.fillOpacity);
|
|
79
|
-
}
|
|
80
|
-
// @ts-ignore
|
|
81
|
-
return this._parseOpacity((this.parent && this.parent.fillOpacity)) || this._parseOpacity(this.fillOpacity);
|
|
82
|
-
},
|
|
83
|
-
enumerable: true,
|
|
84
|
-
configurable: true
|
|
85
|
-
});
|
|
86
|
-
Object.defineProperty(SVGItem.prototype, "_realStroke", {
|
|
87
|
-
get: function () {
|
|
88
|
-
// @ts-ignore
|
|
89
|
-
if ((this.parent && this.parent.stroke) !== undefined && this.stroke !== undefined) {
|
|
90
|
-
return this.stroke;
|
|
91
|
-
}
|
|
92
|
-
// @ts-ignore
|
|
93
|
-
return (this.parent && this.parent.stroke) || this.stroke;
|
|
94
|
-
},
|
|
95
|
-
enumerable: true,
|
|
96
|
-
configurable: true
|
|
97
|
-
});
|
|
98
|
-
Object.defineProperty(SVGItem.prototype, "_realFill", {
|
|
99
|
-
get: function () {
|
|
100
|
-
// @ts-ignore
|
|
101
|
-
if ((this.parent && this.parent.fill) !== undefined && this.fill !== undefined) {
|
|
102
|
-
return this.fill;
|
|
103
|
-
}
|
|
104
|
-
// @ts-ignore
|
|
105
|
-
return (this.parent && this.parent.fill) || this.fill;
|
|
106
|
-
},
|
|
107
|
-
enumerable: true,
|
|
108
|
-
configurable: true
|
|
109
|
-
});
|
|
110
|
-
Object.defineProperty(SVGItem.prototype, "_realOpacity", {
|
|
111
|
-
get: function () {
|
|
112
|
-
// @ts-ignore
|
|
113
|
-
if ((this.parent && this.parent.opacity) !== undefined && this.opacity !== undefined) {
|
|
114
|
-
return this.opacity;
|
|
115
|
-
}
|
|
116
|
-
// @ts-ignore
|
|
117
|
-
return (this.parent && this.parent.opacity) || this.opacity || 1;
|
|
118
|
-
},
|
|
119
|
-
enumerable: true,
|
|
120
|
-
configurable: true
|
|
121
|
-
});
|
|
122
|
-
SVGItem.prototype._getRealSize = function (value, parent, type) {
|
|
123
|
-
if (!parent) {
|
|
124
|
-
parent = this.parent;
|
|
125
|
-
while (!(parent instanceof SVG_1.SVG)) {
|
|
126
|
-
parent = parent.parent;
|
|
127
|
-
if (parent === undefined || parent === null) {
|
|
128
|
-
break;
|
|
129
|
-
}
|
|
130
|
-
}
|
|
131
|
-
if (parent instanceof SVG_1.SVG && (type === 'width' || type === 'height')) {
|
|
132
|
-
if (type === 'width') {
|
|
133
|
-
parent = parent.getMeasuredWidth();
|
|
134
|
-
}
|
|
135
|
-
if (type === 'height') {
|
|
136
|
-
parent = parent.getMeasuredHeight();
|
|
137
|
-
}
|
|
138
|
-
}
|
|
139
|
-
}
|
|
140
|
-
var base = parent || 0;
|
|
141
|
-
var size;
|
|
142
|
-
if (value && value.unit === '%') {
|
|
143
|
-
size = style_properties_1.PercentLength.convertToString(value);
|
|
144
|
-
}
|
|
145
|
-
if (typeof value === 'string' || typeof value === 'number') {
|
|
146
|
-
size = value;
|
|
147
|
-
}
|
|
148
|
-
if (typeof size === 'string' && (size.indexOf('%') > -1)) {
|
|
149
|
-
size = (base * (parseInt(size.replace('%', '')) / 100));
|
|
150
|
-
}
|
|
151
|
-
return size;
|
|
152
|
-
};
|
|
153
|
-
SVGItem.prototype._appendChild = function (id, child) {
|
|
154
|
-
var parent = this.parent;
|
|
155
|
-
while (!(parent instanceof SVG_1.SVG)) {
|
|
156
|
-
parent = parent.parent;
|
|
157
|
-
if (parent === undefined || parent === null) {
|
|
158
|
-
break;
|
|
159
|
-
}
|
|
160
|
-
}
|
|
161
|
-
if (parent instanceof SVG_1.SVG) {
|
|
162
|
-
parent._children.set(id, child);
|
|
163
|
-
}
|
|
164
|
-
};
|
|
165
|
-
SVGItem.prototype._removeChild = function (id) {
|
|
166
|
-
var parent = this.parent;
|
|
167
|
-
while (!(parent instanceof SVG_1.SVG)) {
|
|
168
|
-
parent = parent.parent;
|
|
169
|
-
if (parent === undefined || parent === null) {
|
|
170
|
-
break;
|
|
171
|
-
}
|
|
172
|
-
}
|
|
173
|
-
if (parent instanceof SVG_1.SVG) {
|
|
174
|
-
parent._children.delete(id);
|
|
175
|
-
}
|
|
176
|
-
};
|
|
177
|
-
SVGItem.prototype._getViewById = function (name) {
|
|
178
|
-
var parent = this.parent;
|
|
179
|
-
while (!(parent instanceof SVG_1.SVG)) {
|
|
180
|
-
parent = parent.parent;
|
|
181
|
-
if (parent === undefined || parent == null) {
|
|
182
|
-
break;
|
|
183
|
-
}
|
|
184
|
-
}
|
|
185
|
-
if (!parent) {
|
|
186
|
-
return null;
|
|
187
|
-
}
|
|
188
|
-
return parent._getViewById(name);
|
|
189
|
-
};
|
|
190
|
-
return SVGItem;
|
|
191
|
-
}(core_1.View));
|
|
192
|
-
exports.SVGItem = SVGItem;
|
|
7
|
+
}
|
|
193
8
|
//# sourceMappingURL=SVGItem.js.map
|
package/SVG/SVGItem.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SVGItem.js","sourceRoot":"","sources":["
|
|
1
|
+
{"version":3,"file":"SVGItem.js","sourceRoot":"","sources":["../../../../packages/canvas/SVG/SVGItem.ts"],"names":[],"mappings":"AAAA,OAAO,EAAgB,IAAI,EAAS,MAAM,oBAAoB,CAAC;AAI/D,MAAM,OAAO,OAAQ,SAAQ,IAAI;IAAjC;;QAEI,eAAU,GAAY,KAAK,CAAC;IAChC,CAAC;CAAA"}
|