UNPKG

scriptable-testlab

Version:

A lightweight, efficient tool designed to manage and update scripts for Scriptable.

54 lines (42 loc) 1.03 kB
import {AbsLinearGradient} from 'scriptable-abstract'; interface LinearGradientMockState { colors: Color[]; locations: number[]; startPoint: Point; endPoint: Point; } const DEFAULT_STATE: LinearGradientMockState = { colors: [], locations: [], startPoint: {x: 0, y: 0}, endPoint: {x: 1, y: 1}, }; export class MockLinearGradient extends AbsLinearGradient<LinearGradientMockState> { constructor() { super(DEFAULT_STATE); } get colors(): Color[] { return [...this.state.colors]; } set colors(value: Color[]) { this.setState({colors: value}); } get locations(): number[] { return [...this.state.locations]; } set locations(value: number[]) { this.setState({locations: value}); } get startPoint(): Point { return {...this.state.startPoint}; } set startPoint(value: Point) { this.setState({startPoint: value}); } get endPoint(): Point { return {...this.state.endPoint}; } set endPoint(value: Point) { this.setState({endPoint: value}); } }