From 79d4eafa5a9332250abe83a8d0fb3627c34f6c98 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=8E=8B=E5=8A=B2=E9=B9=8F?= Date: Thu, 16 Apr 2020 17:14:56 +0800 Subject: [PATCH] js: add stretchInset in image --- doric-js/bundle/doric-lib.es5.js | 4 ++++ doric-js/bundle/doric-lib.js | 4 ++++ doric-js/bundle/doric-vm.js | 4 ++++ doric-js/index.d.ts | 12 ++++++++++++ doric-js/lib/src/widget/image.d.ts | 12 ++++++++++++ doric-js/lib/src/widget/image.js | 4 ++++ doric-js/src/widget/image.ts | 8 ++++++++ 7 files changed, 48 insertions(+) diff --git a/doric-js/bundle/doric-lib.es5.js b/doric-js/bundle/doric-lib.es5.js index 4247f932..a2fd4664 100644 --- a/doric-js/bundle/doric-lib.es5.js +++ b/doric-js/bundle/doric-lib.es5.js @@ -1786,6 +1786,10 @@ var Image = /** @class */ (function (_super) { Property, __metadata$4("design:type", Function) ], Image.prototype, "loadCallback", void 0); + __decorate$4([ + Property, + __metadata$4("design:type", Object) + ], Image.prototype, "stretchInset", void 0); return Image; }(View)); function image(config) { diff --git a/doric-js/bundle/doric-lib.js b/doric-js/bundle/doric-lib.js index 61485f5d..cf0f1cbc 100644 --- a/doric-js/bundle/doric-lib.js +++ b/doric-js/bundle/doric-lib.js @@ -1336,6 +1336,10 @@ __decorate$4([ Property, __metadata$4("design:type", Function) ], Image.prototype, "loadCallback", void 0); +__decorate$4([ + Property, + __metadata$4("design:type", Object) +], Image.prototype, "stretchInset", void 0); function image(config) { const ret = new Image; ret.layoutConfig = layoutConfig().fit(); diff --git a/doric-js/bundle/doric-vm.js b/doric-js/bundle/doric-vm.js index 136460ed..4cbfe911 100644 --- a/doric-js/bundle/doric-vm.js +++ b/doric-js/bundle/doric-vm.js @@ -2795,6 +2795,10 @@ __decorate$4([ Property, __metadata$4("design:type", Function) ], Image.prototype, "loadCallback", void 0); +__decorate$4([ + Property, + __metadata$4("design:type", Object) +], Image.prototype, "stretchInset", void 0); function image(config) { const ret = new Image; ret.layoutConfig = layoutConfig().fit(); diff --git a/doric-js/index.d.ts b/doric-js/index.d.ts index e811e19d..30efa43e 100644 --- a/doric-js/index.d.ts +++ b/doric-js/index.d.ts @@ -486,6 +486,18 @@ declare module 'doric/lib/src/widget/image' { width: number; height: number; } | undefined) => void; + /** + * Stretch a image according to pointed rect + * Rect contains left, top, right & bottom + * For Android, it is based on nine patch + * For iOS, it is based on cap insets & stretch mode + */ + stretchInset?: { + left: number; + top: number; + right: number; + bottom: number; + }; } export function image(config: Partial): Image; } diff --git a/doric-js/lib/src/widget/image.d.ts b/doric-js/lib/src/widget/image.d.ts index 0f2723cb..a63b9755 100644 --- a/doric-js/lib/src/widget/image.d.ts +++ b/doric-js/lib/src/widget/image.d.ts @@ -48,5 +48,17 @@ export declare class Image extends View { width: number; height: number; } | undefined) => void; + /** + * Stretch a image according to pointed rect + * Rect contains left, top, right & bottom + * For Android, it is based on nine patch + * For iOS, it is based on cap insets & stretch mode + */ + stretchInset?: { + left: number; + top: number; + right: number; + bottom: number; + }; } export declare function image(config: Partial): Image; diff --git a/doric-js/lib/src/widget/image.js b/doric-js/lib/src/widget/image.js index 0ac8d74c..381fbee7 100644 --- a/doric-js/lib/src/widget/image.js +++ b/doric-js/lib/src/widget/image.js @@ -82,6 +82,10 @@ __decorate([ Property, __metadata("design:type", Function) ], Image.prototype, "loadCallback", void 0); +__decorate([ + Property, + __metadata("design:type", Object) +], Image.prototype, "stretchInset", void 0); export function image(config) { const ret = new Image; ret.layoutConfig = layoutConfig().fit(); diff --git a/doric-js/src/widget/image.ts b/doric-js/src/widget/image.ts index 14f913a3..5a514b69 100644 --- a/doric-js/src/widget/image.ts +++ b/doric-js/src/widget/image.ts @@ -80,6 +80,14 @@ export class Image extends View { @Property loadCallback?: (image: { width: number; height: number } | undefined) => void + + @Property + stretchInset?: { + left: number, + top: number, + right: number, + bottom: number + } } export function image(config: Partial) {