Skip to content

Commit 75961ae

Browse files
Hannes KruseHannes Kruse
authored andcommitted
Merge branch 'release/v1.0.3'
2 parents 9b192b1 + 0519921 commit 75961ae

17 files changed

+779
-989
lines changed

README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,8 @@ window.onload = () => {
111111
};
112112

113113
menu.init();
114-
menu.setStructure(tasty.parser.parse(struct));
114+
const parser = new tasty.parser();
115+
menu.setStructure(parser.parse(structure));
115116

116117
menu.selection$.subscribe(s => {
117118
if (s.type === 'itemSelection') {

package-lock.json

Lines changed: 438 additions & 495 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "tasty.js",
3-
"version": "1.0.2",
3+
"version": "1.0.3",
44
"description": "A Pie- and Marking-Menu Framework written in TypeScript.",
55
"scripts": {
66
"type-check": "tsc --noEmit",
@@ -18,27 +18,27 @@
1818
"types": "dist/types/index.d.ts",
1919
"license": "MIT",
2020
"devDependencies": {
21-
"@babel/core": "^7.7.5",
21+
"@babel/core": "^7.7.7",
2222
"@babel/plugin-proposal-class-properties": "^7.7.4",
23-
"@babel/plugin-proposal-object-rest-spread": "^7.7.4",
24-
"@babel/preset-env": "^7.7.6",
25-
"@babel/preset-typescript": "^7.7.4",
26-
"@fortawesome/free-solid-svg-icons": "^5.11.2",
23+
"@babel/plugin-proposal-object-rest-spread": "^7.7.7",
24+
"@babel/preset-env": "^7.7.7",
25+
"@babel/preset-typescript": "^7.7.7",
26+
"@fortawesome/free-solid-svg-icons": "^5.12.0",
2727
"@types/lodash": "^4.14.149",
28-
"@typescript-eslint/eslint-plugin": "^2.11.0",
29-
"@typescript-eslint/parser": "^2.11.0",
28+
"@typescript-eslint/eslint-plugin": "^2.15.0",
29+
"@typescript-eslint/parser": "^2.15.0",
3030
"babel-loader": "^8.0.6",
31-
"eslint": "^6.7.2",
31+
"eslint": "^6.8.0",
3232
"fork-ts-checker-webpack-plugin": "^3.1.1",
3333
"html-loader": "^0.5.5",
3434
"html-webpack-plugin": "^3.2.0",
3535
"lodash": "^4.17.15",
36-
"paper": "^0.12.3",
37-
"rxjs": "^6.5.3",
38-
"typescript": "^3.7.3",
39-
"webpack": "^4.41.2",
36+
"paper": "^0.12.4",
37+
"rxjs": "^6.5.4",
38+
"typescript": "^3.7.4",
39+
"webpack": "^4.41.5",
4040
"webpack-cli": "^3.3.10",
41-
"webpack-dev-server": "^3.9.0"
41+
"webpack-dev-server": "^3.10.1"
4242
},
4343
"resolutions": {
4444
"terser": "3.14.1"

src/lib/interfaces.ts

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import {Observable, Subject} from "rxjs";
2-
import {Color, Item, Point} from "paper";
32
import {ClickState, DragState, MenuItemEventType, SettingsGroup} from "./enums";
43
import Trace from "../utlis/trace";
54

@@ -9,8 +8,8 @@ import Trace from "../utlis/trace";
98
* @see {Menu}
109
*/
1110
export interface MenuData {
12-
inputPosition$: Subject<Point>;
13-
inputPosition: Point;
11+
inputPosition$: Subject<paper.Point>;
12+
inputPosition: paper.Point;
1413
inputActivation$: Subject<Input>;
1514
inputDeactivation$: Subject<Input>;
1615

@@ -39,7 +38,7 @@ export interface Input {
3938
* DragDefinition state data
4039
*/
4140
export interface DragDefinition {
42-
readonly position: Point;
41+
readonly position: paper.Point;
4342
readonly state: DragState;
4443
}
4544

@@ -84,7 +83,7 @@ export interface MenuEventDefinition {
8483
* to - To state
8584
*/
8685
export interface AnimationDefinition {
87-
target: Item;
86+
target: paper.Item;
8887
from?: AnimatableData;
8988
to?: AnimatableData;
9089
options?: AnimationOptions;
@@ -102,12 +101,12 @@ export interface AnimationOptions {
102101
* Animatable Data
103102
*/
104103
export interface AnimatableData {
105-
[key: string]: Point | Color | number | string | null | undefined | Record<string, string | number | Point>;
104+
[key: string]: paper.Point | paper.Color | number | string | null | undefined | Record<string, string | number | paper.Point>;
106105

107-
position?: Point | number;
108-
scaling?: Point | number;
106+
position?: paper.Point | number;
107+
scaling?: paper.Point | number;
109108
opacity?: number;
110-
fillColor?: string | Color | null;
109+
fillColor?: string | paper.Color | null;
111110
}
112111

113112
/**

src/lib/menu/base.ts

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,15 @@
1-
import {Group} from 'paper';
2-
31
/**
42
* This class removes the automatic hitTest calls from paper.js as they are not needed
53
*/
6-
export default class Base extends Group {
4+
export default class Base extends paper.Group {
75
//@ts-ignore
86
public hitTestAll(point: paper.Point, options?: object): paper.HitResult[] {
97
return [];
108
}
119

1210
//@ts-ignore
1311
public hitTest(point: paper.Point, options?: object): paper.HitResult {
14-
return undefined;
12+
return new paper.HitResult();
1513
}
1614

1715
// @ts-ignore

src/lib/menu/checkbox.ts

Lines changed: 22 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,14 @@
11
import MenuItem from "./menu-item";
22
import {MenuItemEventType, SettingsGroup} from "../enums";
33
import ColorFactory from "../../utlis/color-factory";
4-
import {Path, Rectangle, Size} from "paper";
54
import {ZERO_POINT as CENTER} from "../constants";
65

6+
/**
7+
* A Checkbox is either selected or not
8+
*/
79
export default class Checkbox extends MenuItem {
10+
public readonly TYPE = 'checkbox';
11+
812
/**
913
* Selection Flag
1014
*/
@@ -21,14 +25,27 @@ export default class Checkbox extends MenuItem {
2125
}
2226
}
2327

28+
/**
29+
* Set the checkbox state to deselected
30+
*/
2431
public deselect(): void {
2532
this.itemSelected = false;
2633
}
2734

35+
/**
36+
* Set the checkbox state to selected
37+
*/
2838
public select(): void {
2939
this.itemSelected = true;
3040
}
3141

42+
/**
43+
* True if checkbox is selected
44+
*/
45+
public isSelected(): boolean {
46+
return this.itemSelected;
47+
}
48+
3249
/**
3350
* @see setGeometryColorSelected
3451
*/
@@ -85,16 +102,16 @@ export default class Checkbox extends MenuItem {
85102
protected setupGeometry(): void {
86103
let rectangleSize = this.settings[SettingsGroup.GEOMETRY].size * 1.75;
87104

88-
let rectangle = new Rectangle(
105+
let rectangle = new paper.Rectangle(
89106
CENTER,
90-
new Size(rectangleSize, rectangleSize)
107+
new paper.Size(rectangleSize, rectangleSize)
91108
);
92109
rectangle.center = CENTER;
93110

94111
let cornerRadius = this.settings[SettingsGroup.CHECKBOX].cornerRadius;
95-
let cornerSize = new Size(cornerRadius, cornerRadius);
112+
let cornerSize = new paper.Size(cornerRadius, cornerRadius);
96113

97-
this._geometry = new Path.Rectangle(rectangle, cornerSize);
114+
this._geometry = new paper.Path.Rectangle(rectangle, cornerSize);
98115

99116
this.setGeometryColorDefault();
100117
this.geometry.strokeScaling = false;

src/lib/menu/crankslider.ts

Lines changed: 0 additions & 195 deletions
This file was deleted.

0 commit comments

Comments
 (0)