feat: slider support set max and min scale

This commit is contained in:
pengfei.zhou
2022-07-15 18:36:48 +08:00
committed by osborn
parent fd5994e270
commit c05c169dd7
8 changed files with 37 additions and 13 deletions

View File

@@ -2727,7 +2727,7 @@ var Slider = /** @class */ (function (_super) {
], Slider.prototype, "bounces", void 0);
__decorate$9([
Property,
__metadata$9("design:type", String)
__metadata$9("design:type", Object)
], Slider.prototype, "slideStyle", void 0);
return Slider;
}(Superview));

View File

@@ -2068,7 +2068,7 @@ __decorate$9([
], Slider.prototype, "bounces", void 0);
__decorate$9([
Property,
__metadata$9("design:type", String)
__metadata$9("design:type", Object)
], Slider.prototype, "slideStyle", void 0);
function slider(config) {
const ret = new Slider;

View File

@@ -3596,7 +3596,7 @@ __decorate$9([
], Slider.prototype, "bounces", void 0);
__decorate$9([
Property,
__metadata$9("design:type", String)
__metadata$9("design:type", Object)
], Slider.prototype, "slideStyle", void 0);
function slider(config) {
const ret = new Slider;

10
doric-js/index.d.ts vendored
View File

@@ -810,7 +810,15 @@ declare module 'doric/lib/src/widget/slider' {
* Take effect only on iOS
*/
bounces?: boolean;
slideStyle?: "zoomOut";
/**
* Set the effect when sliding
* ZoomOut is currently supported
*/
slideStyle?: "zoomOut" | {
type: "zoomOut";
minScale: number;
maxScale: number;
};
slidePage(context: BridgeContext, page: number, smooth?: boolean): Promise<any>;
getSlidedPage(context: BridgeContext): Promise<number>;
}

View File

@@ -20,7 +20,15 @@ export declare class Slider extends Superview {
* Take effect only on iOS
*/
bounces?: boolean;
slideStyle?: "zoomOut";
/**
* Set the effect when sliding
* ZoomOut is currently supported
*/
slideStyle?: "zoomOut" | {
type: "zoomOut";
minScale: number;
maxScale: number;
};
private getItem;
private renderBunchedItems;
slidePage(context: BridgeContext, page: number, smooth?: boolean): Promise<any>;

View File

@@ -90,7 +90,7 @@ __decorate([
], Slider.prototype, "bounces", void 0);
__decorate([
Property,
__metadata("design:type", String)
__metadata("design:type", Object)
], Slider.prototype, "slideStyle", void 0);
export function slider(config) {
const ret = new Slider;

View File

@@ -56,9 +56,12 @@ export class Slider extends Superview {
*/
@Property
bounces?: boolean
/**
* Set the effect when sliding
* ZoomOut is currently supported
*/
@Property
slideStyle?: "zoomOut"
slideStyle?: "zoomOut" | { type: "zoomOut", minScale: number, maxScale: number }
private getItem(itemIdx: number) {
let view = this.renderPage(itemIdx)