Skip to content

Commit

Permalink
refactor(coordinate): set default options before constructor(#28)
Browse files Browse the repository at this point in the history
  • Loading branch information
pearmini committed Jun 3, 2021
1 parent 7cc03e8 commit 6de6dba
Showing 1 changed file with 9 additions and 10 deletions.
19 changes: 9 additions & 10 deletions src/coordinate.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,15 +25,21 @@ import {
} from './transforms';

export class Coordinate {
// 当前的选项
private options: Options;

// 所有变换合成后的函数
private output: Transform;

// 所有变换合成后的逆函数
private input: Transform;

// 当前的选项
private options: Options = {
x: 0,
y: 0,
width: 300,
height: 150,
transformations: [],
};

// 当前可以使用的变换
private transformers = {
cartesian,
Expand Down Expand Up @@ -62,13 +68,6 @@ export class Coordinate {
* @param options Custom options
*/
constructor(options?: Partial<Options>) {
this.options = {
x: 0,
y: 0,
width: 300,
height: 150,
transformations: [],
};
this.update(options);
}

Expand Down

0 comments on commit 6de6dba

Please sign in to comment.