feat:add Pullable and view's setRotation function
This commit is contained in:
@@ -66,6 +66,10 @@ export interface IPullable {
|
||||
setProgressRotation(rotation: number): void
|
||||
}
|
||||
|
||||
export class PullableView extends Image {
|
||||
|
||||
export function pullable(context: BridgeContext, v: View, config: IPullable) {
|
||||
Reflect.set(v, 'startAnimation', config.startAnimation)
|
||||
Reflect.set(v, 'stopAnimation', config.stopAnimation)
|
||||
Reflect.set(v, 'setProgressRotation', config.setProgressRotation)
|
||||
return v
|
||||
}
|
@@ -18,6 +18,7 @@ import { Modeling, Model, obj2Model } from "../util/types";
|
||||
import { uniqueId } from "../util/uniqueId";
|
||||
import { Gravity } from "../util/gravity";
|
||||
import { loge } from "../util/log";
|
||||
import { BridgeContext } from "../runtime/global";
|
||||
|
||||
export enum LayoutSpec {
|
||||
EXACTLY = 0,
|
||||
@@ -281,6 +282,29 @@ export abstract class View implements Modeling, IView {
|
||||
return Reflect.apply(func, undefined, [params]) as Promise<any>
|
||||
}
|
||||
}
|
||||
|
||||
getWidth(context: BridgeContext) {
|
||||
return this.nativeChannel(context, 'getWidth')() as Promise<number>
|
||||
}
|
||||
|
||||
getHeight(context: BridgeContext) {
|
||||
return this.nativeChannel(context, 'getHeight')() as Promise<number>
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param rotation [0..1]
|
||||
*/
|
||||
setRotation(context: BridgeContext, rotation: number) {
|
||||
return this.nativeChannel(context, 'setRotation')(rotation)
|
||||
}
|
||||
/**
|
||||
*
|
||||
* @return rotation [0..1]
|
||||
*/
|
||||
getRotation(context: BridgeContext) {
|
||||
return this.nativeChannel(context, 'getRotation')() as Promise<number>
|
||||
}
|
||||
}
|
||||
|
||||
export abstract class Superview extends View {
|
||||
|
Reference in New Issue
Block a user