highmark-cli 0.0.140 → 0.0.142
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/client.js +635 -619
- package/lib/client.js +5 -1
- package/lib/constants.js +5 -5
- package/lib/createMethods.js +35 -17
- package/lib/localStorage.js +6 -5
- package/lib/mixins/fullsrean.js +3 -5
- package/lib/state.js +62 -44
- package/lib/view/div/buttons.js +4 -6
- package/lib/view/div/checkbox/{restoreNativeGestures.js → fullScreen.js} +23 -16
- package/lib/view/div/checkbox/invertColours.js +9 -6
- package/lib/view/div/checkbox/nativeGestures.js +154 -0
- package/lib/view/div/checkboxes.js +5 -3
- package/lib/view/div/menu.js +11 -43
- package/lib/view/div/overlay.js +92 -123
- package/lib/view/div.js +11 -3
- package/lib/view.js +21 -3
- package/package.json +2 -1
- package/src/client.js +5 -0
- package/src/constants.js +1 -1
- package/src/createMethods.js +52 -16
- package/src/localStorage.js +9 -6
- package/src/mixins/fullsrean.js +3 -4
- package/src/state.js +66 -48
- package/src/view/div/buttons.js +4 -6
- package/src/view/div/checkbox/fullScreen.js +38 -0
- package/src/view/div/checkbox/invertColours.js +7 -3
- package/src/view/div/checkbox/nativeGestures.js +38 -0
- package/src/view/div/checkboxes.js +4 -2
- package/src/view/div/menu.js +13 -45
- package/src/view/div/overlay.js +101 -124
- package/src/view/div.js +12 -4
- package/src/view.js +16 -2
- package/lib/view/button/fullScreen.js +0 -121
- package/lib/view/svg/fullScreen.js +0 -138
- package/src/view/button/fullScreen.js +0 -16
- package/src/view/div/checkbox/restoreNativeGestures.js +0 -29
- package/src/view/svg/fullScreen.js +0 -19
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "highmark-cli",
|
|
3
3
|
"author": "James Smith",
|
|
4
|
-
"version": "0.0.
|
|
4
|
+
"version": "0.0.142",
|
|
5
5
|
"license": "MIT, Anti-996",
|
|
6
6
|
"homepage": "https://github.com/djalbat/highmark-cli",
|
|
7
7
|
"description": "Extensible, styleable Markdown.",
|
|
@@ -24,6 +24,7 @@
|
|
|
24
24
|
"easy-layout": "^6.0.145",
|
|
25
25
|
"easy-with-style": "^3.0.349",
|
|
26
26
|
"esbuild": "^0.9.2",
|
|
27
|
+
"fragmented": "^2.1.3",
|
|
27
28
|
"juxtapose": "^4.0.81",
|
|
28
29
|
"sufficient": "^2.0.55",
|
|
29
30
|
"watchful-cli": "^1.7.44"
|
package/src/client.js
CHANGED
|
@@ -6,6 +6,7 @@ import withStyle from "easy-with-style"; ///
|
|
|
6
6
|
|
|
7
7
|
import { controller } from "sufficient";
|
|
8
8
|
import { Body, Element } from "easy";
|
|
9
|
+
import { onFragmentChange } from "fragmented";
|
|
9
10
|
|
|
10
11
|
import View from "./view";
|
|
11
12
|
import createMethods from "./createMethods";
|
|
@@ -43,6 +44,10 @@ onOrientationChange((orientation) => {
|
|
|
43
44
|
view.updateZoom();
|
|
44
45
|
});
|
|
45
46
|
|
|
47
|
+
onFragmentChange(() => {
|
|
48
|
+
debugger
|
|
49
|
+
});
|
|
50
|
+
|
|
46
51
|
getOrientation((orientation) => {
|
|
47
52
|
setOrientation(orientation);
|
|
48
53
|
|
package/src/constants.js
CHANGED
|
@@ -5,13 +5,13 @@ export const { PI } = Math;
|
|
|
5
5
|
export const GRID = "grid";
|
|
6
6
|
export const STATE_KEY = "state";
|
|
7
7
|
export const TAP_DELAY = 250;
|
|
8
|
-
export const ZOOM_RATIO = 1.1;
|
|
9
8
|
export const PI_OVER_TWO = PI / 2;
|
|
10
9
|
export const SCROLL_DELAY = 10;
|
|
11
10
|
export const DECELERATION = 0.0333333;
|
|
12
11
|
export const UP_DIRECTION = +1;
|
|
13
12
|
export const DOWN_DIRECTION = -1;
|
|
14
13
|
export const MAXIMUM_SPREAD = PI / 4;
|
|
14
|
+
export const MENU_ZOOM_RATIO = 1.1;
|
|
15
15
|
export const MAXIMUM_TAP_TIME = 125;
|
|
16
16
|
export const BACKGROUND_COLOUR = "background-color"; ///
|
|
17
17
|
export const MINIMUM_SWIPE_SPEED = 1;
|
package/src/createMethods.js
CHANGED
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
+
import { MENU_ZOOM_RATIO } from "./constants";
|
|
4
|
+
import { getMenuZoom, setMenuZoom, setOverlayZoom, setColoursInverted, setNativeGesturesRestored } from "./state";
|
|
5
|
+
|
|
3
6
|
export default function createMethods(scheduler, model, view) {
|
|
4
7
|
function openMenu() {
|
|
5
8
|
view.openMenu();
|
|
@@ -10,43 +13,77 @@ export default function createMethods(scheduler, model, view) {
|
|
|
10
13
|
}
|
|
11
14
|
|
|
12
15
|
function zoomMenuIn() {
|
|
13
|
-
|
|
16
|
+
let menuZoom = getMenuZoom();
|
|
17
|
+
|
|
18
|
+
menuZoom *= MENU_ZOOM_RATIO;
|
|
19
|
+
|
|
20
|
+
setMenuZoom(menuZoom);
|
|
21
|
+
|
|
22
|
+
view.updateMenuZoom();
|
|
14
23
|
}
|
|
15
24
|
|
|
16
25
|
function zoomMenuOut() {
|
|
17
|
-
|
|
26
|
+
let menuZoom = getMenuZoom();
|
|
27
|
+
|
|
28
|
+
menuZoom /= MENU_ZOOM_RATIO;
|
|
29
|
+
|
|
30
|
+
setMenuZoom(menuZoom);
|
|
31
|
+
|
|
32
|
+
view.updateMenuZoom();
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
function zoomOverlay(overlayZoom) {
|
|
36
|
+
setOverlayZoom(overlayZoom);
|
|
37
|
+
|
|
38
|
+
view.updateOverlayZoom();
|
|
18
39
|
}
|
|
19
40
|
|
|
20
41
|
function invertColours() {
|
|
21
|
-
|
|
42
|
+
const coloursInverted = true;
|
|
43
|
+
|
|
44
|
+
setColoursInverted(coloursInverted);
|
|
45
|
+
|
|
46
|
+
view.updateOverlayColours();
|
|
22
47
|
}
|
|
23
48
|
|
|
24
49
|
function revertColours() {
|
|
25
|
-
|
|
50
|
+
const coloursInverted = false;
|
|
51
|
+
|
|
52
|
+
setColoursInverted(coloursInverted);
|
|
53
|
+
|
|
54
|
+
view.updateOverlayColours();
|
|
26
55
|
}
|
|
27
56
|
|
|
28
57
|
function exitFullScreen() {
|
|
29
58
|
view.exitFullScreen();
|
|
59
|
+
|
|
60
|
+
view.updateFullScreenCheckboxDiv();
|
|
30
61
|
}
|
|
31
62
|
|
|
32
63
|
function enterFullScreen() {
|
|
33
|
-
view.enterFullScreen()
|
|
64
|
+
view.enterFullScreen(() => {
|
|
65
|
+
view.updateFullScreenCheckboxDiv();
|
|
66
|
+
});
|
|
34
67
|
}
|
|
35
68
|
|
|
36
69
|
function restoreNativeGestures() {
|
|
37
|
-
|
|
70
|
+
const nativeGesturesRestored = true;
|
|
71
|
+
|
|
72
|
+
setNativeGesturesRestored(nativeGesturesRestored);
|
|
73
|
+
|
|
74
|
+
view.updateNativeGestures();
|
|
75
|
+
|
|
76
|
+
view.updateNativeGesturesCheckboxDiv();
|
|
38
77
|
}
|
|
39
78
|
|
|
40
79
|
function suppressNativeGestures() {
|
|
41
|
-
|
|
42
|
-
}
|
|
80
|
+
const nativeGesturesRestored = false;
|
|
43
81
|
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
82
|
+
setNativeGesturesRestored(nativeGesturesRestored);
|
|
83
|
+
|
|
84
|
+
view.updateNativeGestures();
|
|
47
85
|
|
|
48
|
-
|
|
49
|
-
view.uncheckRestoreNativeGesturesCheckbox(checked);
|
|
86
|
+
view.updateNativeGesturesCheckboxDiv();
|
|
50
87
|
}
|
|
51
88
|
|
|
52
89
|
return ({
|
|
@@ -54,13 +91,12 @@ export default function createMethods(scheduler, model, view) {
|
|
|
54
91
|
closeMenu,
|
|
55
92
|
zoomMenuIn,
|
|
56
93
|
zoomMenuOut,
|
|
94
|
+
zoomOverlay,
|
|
57
95
|
invertColours,
|
|
58
96
|
revertColours,
|
|
59
97
|
exitFullScreen,
|
|
60
98
|
enterFullScreen,
|
|
61
99
|
restoreNativeGestures,
|
|
62
|
-
suppressNativeGestures
|
|
63
|
-
checkRestoreNativeGesturesCheckbox,
|
|
64
|
-
uncheckRestoreNativeGesturesCheckbox
|
|
100
|
+
suppressNativeGestures
|
|
65
101
|
});
|
|
66
102
|
}
|
package/src/localStorage.js
CHANGED
|
@@ -2,23 +2,25 @@
|
|
|
2
2
|
|
|
3
3
|
import { STATE_KEY, LANDSCAPE_ORIENTATION, PORTRAIT_ORIENTATION } from "./constants";
|
|
4
4
|
|
|
5
|
-
const
|
|
5
|
+
const menuZoom = {
|
|
6
6
|
[PORTRAIT_ORIENTATION]: 1,
|
|
7
7
|
[LANDSCAPE_ORIENTATION]: 1
|
|
8
8
|
},
|
|
9
|
-
|
|
9
|
+
overlayZoom = {
|
|
10
10
|
[PORTRAIT_ORIENTATION]: 1,
|
|
11
11
|
[LANDSCAPE_ORIENTATION]: 1
|
|
12
12
|
},
|
|
13
|
-
|
|
13
|
+
fullScreenOverlayZoom = {
|
|
14
14
|
[PORTRAIT_ORIENTATION]: 1,
|
|
15
15
|
[LANDSCAPE_ORIENTATION]: 1
|
|
16
16
|
},
|
|
17
17
|
coloursInverted = false,
|
|
18
|
+
nativeGesturesRestored = false,
|
|
18
19
|
defaultPersistentState = {
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
20
|
+
menuZoom,
|
|
21
|
+
overlayZoom,
|
|
22
|
+
fullScreenOverlayZoom,
|
|
23
|
+
nativeGesturesRestored,
|
|
22
24
|
coloursInverted
|
|
23
25
|
};
|
|
24
26
|
|
|
@@ -46,3 +48,4 @@ export function setPersistentState(persistentState) {
|
|
|
46
48
|
|
|
47
49
|
localStorage.setItem(key, value);
|
|
48
50
|
}
|
|
51
|
+
|
package/src/mixins/fullsrean.js
CHANGED
|
@@ -16,13 +16,12 @@ function exitFullScreen() {
|
|
|
16
16
|
document.exitFullscreen();
|
|
17
17
|
}
|
|
18
18
|
|
|
19
|
-
function requestFullScreen() {
|
|
19
|
+
function requestFullScreen(callback) {
|
|
20
20
|
const domElement = this.getDOMElement();
|
|
21
21
|
|
|
22
22
|
domElement.requestFullscreen()
|
|
23
|
-
.
|
|
24
|
-
|
|
25
|
-
});
|
|
23
|
+
.then(callback)
|
|
24
|
+
.catch(alert);
|
|
26
25
|
}
|
|
27
26
|
|
|
28
27
|
function onFullscreenchange(fullscreenchangeHandler) {
|
package/src/state.js
CHANGED
|
@@ -2,95 +2,112 @@
|
|
|
2
2
|
|
|
3
3
|
import { isFullScreen } from "./utilities/fullScreen";
|
|
4
4
|
import { getPersistentState, setPersistentState } from "./localStorage";
|
|
5
|
-
import {PORTRAIT_ORIENTATION} from "./constants";
|
|
6
5
|
|
|
7
6
|
const orientation = null,
|
|
8
7
|
state = {
|
|
9
8
|
orientation
|
|
10
9
|
};
|
|
11
10
|
|
|
12
|
-
export function
|
|
13
|
-
|
|
11
|
+
export function getOrientation() {
|
|
12
|
+
const { orientation } = state;
|
|
14
13
|
|
|
15
|
-
|
|
16
|
-
|
|
14
|
+
return orientation;
|
|
15
|
+
}
|
|
17
16
|
|
|
18
|
-
|
|
17
|
+
export function setOrientation(orientation) {
|
|
18
|
+
Object.assign(state, {
|
|
19
|
+
orientation
|
|
20
|
+
});
|
|
21
|
+
}
|
|
19
22
|
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
} else {
|
|
23
|
-
({ viewZoom } = state);
|
|
24
|
-
}
|
|
23
|
+
export function getMenuZoom() {
|
|
24
|
+
stateFromPersistentState();
|
|
25
25
|
|
|
26
|
-
|
|
26
|
+
let menuZoom;
|
|
27
27
|
|
|
28
|
-
|
|
28
|
+
({ menuZoom } = state);
|
|
29
29
|
|
|
30
|
-
|
|
30
|
+
const { orientation } = state,
|
|
31
|
+
orientedMenuZoom = menuZoom[orientation]; ///
|
|
32
|
+
|
|
33
|
+
menuZoom = orientedMenuZoom; ///
|
|
34
|
+
|
|
35
|
+
return menuZoom;
|
|
31
36
|
}
|
|
32
37
|
|
|
33
|
-
export function
|
|
38
|
+
export function setMenuZoom(menuZoom) {
|
|
34
39
|
stateFromPersistentState();
|
|
35
40
|
|
|
36
|
-
const
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
const orientedViewZoom = viewZoom; ///
|
|
41
|
+
const { orientation } = state,
|
|
42
|
+
orientedMenuZoom = menuZoom; ///
|
|
40
43
|
|
|
41
|
-
|
|
42
|
-
({ fullScreenViewZoom: viewZoom } = state);
|
|
43
|
-
} else {
|
|
44
|
-
({ viewZoom } = state);
|
|
45
|
-
}
|
|
44
|
+
({ menuZoom } = state);
|
|
46
45
|
|
|
47
|
-
Object.assign(
|
|
48
|
-
[orientation]:
|
|
46
|
+
Object.assign(menuZoom, {
|
|
47
|
+
[orientation]: orientedMenuZoom
|
|
49
48
|
});
|
|
50
49
|
|
|
51
50
|
stateToPersistentState();
|
|
52
51
|
}
|
|
53
52
|
|
|
54
|
-
export function
|
|
53
|
+
export function getOverlayZoom() {
|
|
55
54
|
stateFromPersistentState();
|
|
56
55
|
|
|
57
|
-
|
|
56
|
+
const fullScreen = isFullScreen(),
|
|
57
|
+
orientation = getOrientation();
|
|
58
58
|
|
|
59
|
-
|
|
59
|
+
let overlayZoom;
|
|
60
60
|
|
|
61
|
-
|
|
62
|
-
|
|
61
|
+
if (fullScreen) {
|
|
62
|
+
({ fullScreenOverlayZoom: overlayZoom } = state);
|
|
63
|
+
} else {
|
|
64
|
+
({ overlayZoom } = state);
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
const orientedOverlayZoom = overlayZoom[orientation]; ///
|
|
63
68
|
|
|
64
|
-
|
|
69
|
+
overlayZoom = orientedOverlayZoom; ///
|
|
65
70
|
|
|
66
|
-
return
|
|
71
|
+
return overlayZoom;
|
|
67
72
|
}
|
|
68
73
|
|
|
69
|
-
export function
|
|
74
|
+
export function setOverlayZoom(overlayZoom) {
|
|
70
75
|
stateFromPersistentState();
|
|
71
76
|
|
|
72
|
-
const
|
|
73
|
-
|
|
77
|
+
const fullScreen = isFullScreen(),
|
|
78
|
+
orientation = getOrientation();
|
|
74
79
|
|
|
75
|
-
|
|
80
|
+
const orientedOverlayZoom = overlayZoom; ///
|
|
76
81
|
|
|
77
|
-
|
|
78
|
-
|
|
82
|
+
if (fullScreen) {
|
|
83
|
+
({ fullScreenOverlayZoom: overlayZoom } = state);
|
|
84
|
+
} else {
|
|
85
|
+
({ overlayZoom } = state);
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
Object.assign(overlayZoom, {
|
|
89
|
+
[orientation]: orientedOverlayZoom
|
|
79
90
|
});
|
|
80
91
|
|
|
81
92
|
stateToPersistentState();
|
|
82
93
|
}
|
|
83
94
|
|
|
84
|
-
export function
|
|
85
|
-
|
|
95
|
+
export function areNativeGesturesRestored() {
|
|
96
|
+
stateFromPersistentState();
|
|
86
97
|
|
|
87
|
-
|
|
98
|
+
const { nativeGesturesRestored } = state;
|
|
99
|
+
|
|
100
|
+
return nativeGesturesRestored;
|
|
88
101
|
}
|
|
89
102
|
|
|
90
|
-
export function
|
|
103
|
+
export function setNativeGesturesRestored(nativeGesturesRestored) {
|
|
104
|
+
stateFromPersistentState();
|
|
105
|
+
|
|
91
106
|
Object.assign(state, {
|
|
92
|
-
|
|
107
|
+
nativeGesturesRestored
|
|
93
108
|
});
|
|
109
|
+
|
|
110
|
+
stateToPersistentState();
|
|
94
111
|
}
|
|
95
112
|
|
|
96
113
|
export function areColoursInverted() {
|
|
@@ -112,11 +129,12 @@ export function setColoursInverted(coloursInverted) {
|
|
|
112
129
|
}
|
|
113
130
|
|
|
114
131
|
function stateToPersistentState() {
|
|
115
|
-
const {
|
|
132
|
+
const { menuZoom, overlayZoom, fullScreenOverlayZoom, nativeGesturesRestored, coloursInverted } = state,
|
|
116
133
|
persistentState = {
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
134
|
+
menuZoom,
|
|
135
|
+
overlayZoom,
|
|
136
|
+
fullScreenOverlayZoom,
|
|
137
|
+
nativeGesturesRestored,
|
|
120
138
|
coloursInverted
|
|
121
139
|
};
|
|
122
140
|
|
package/src/view/div/buttons.js
CHANGED
|
@@ -4,7 +4,6 @@ import withStyle from "easy-with-style"; ///
|
|
|
4
4
|
|
|
5
5
|
import Element from "../element";
|
|
6
6
|
import CloseMenuButton from "../button/closeMenu";
|
|
7
|
-
import FullScreenButton from "../button/fullScreen";
|
|
8
7
|
import ZoomMenuInButton from "../button/zoomMenuIn";
|
|
9
8
|
import ZoomMenuOutButton from "../button/zoomMenuOut";
|
|
10
9
|
|
|
@@ -14,10 +13,9 @@ class ButtonsDiv extends Element {
|
|
|
14
13
|
childElements() {
|
|
15
14
|
return ([
|
|
16
15
|
|
|
17
|
-
<ZoomMenuInButton/>,
|
|
18
|
-
<CloseMenuButton/>,
|
|
19
16
|
<ZoomMenuOutButton/>,
|
|
20
|
-
<
|
|
17
|
+
<ZoomMenuInButton/>,
|
|
18
|
+
<CloseMenuButton/>
|
|
21
19
|
|
|
22
20
|
]);
|
|
23
21
|
}
|
|
@@ -33,7 +31,7 @@ export default withStyle(ButtonsDiv)`
|
|
|
33
31
|
|
|
34
32
|
gap: ${buttonsDivGap};
|
|
35
33
|
display: grid;
|
|
36
|
-
grid-template-rows: min-content
|
|
37
|
-
grid-template-columns: min-content min-content;
|
|
34
|
+
grid-template-rows: min-content;
|
|
35
|
+
grid-template-columns: min-content min-content min-content;
|
|
38
36
|
|
|
39
37
|
`;
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
import CheckboxDiv from "../../div/checkbox";
|
|
4
|
+
|
|
5
|
+
import { isFullScreen } from "../../../utilities/fullScreen";
|
|
6
|
+
|
|
7
|
+
export default class FullScreenCheckboxDiv extends CheckboxDiv {
|
|
8
|
+
changeHandler = (event, element) => {
|
|
9
|
+
const checkboxChecked = this.isCheckboxChecked();
|
|
10
|
+
|
|
11
|
+
checkboxChecked ?
|
|
12
|
+
controller.enterFullScreen() :
|
|
13
|
+
controller.exitFullScreen();
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
update() {
|
|
17
|
+
const fullScreen = isFullScreen();
|
|
18
|
+
|
|
19
|
+
fullScreen ?
|
|
20
|
+
this.checkCheckbox() :
|
|
21
|
+
this.uncheckCheckbox();
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
parentContext() {
|
|
25
|
+
const updateFullScreenCheckboxDiv = this.update.bind(this); ///
|
|
26
|
+
|
|
27
|
+
return ({
|
|
28
|
+
updateFullScreenCheckboxDiv
|
|
29
|
+
});
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
static message = `Full screen
|
|
33
|
+
(double tap to toggle)`;
|
|
34
|
+
|
|
35
|
+
static defaultProperties = {
|
|
36
|
+
className: "full-screen"
|
|
37
|
+
};
|
|
38
|
+
}
|
|
@@ -13,7 +13,7 @@ export default class InvertColoursCheckboxDiv extends CheckboxDiv {
|
|
|
13
13
|
controller.revertColours();
|
|
14
14
|
}
|
|
15
15
|
|
|
16
|
-
|
|
16
|
+
update() {
|
|
17
17
|
const coloursInverted = areColoursInverted();
|
|
18
18
|
|
|
19
19
|
coloursInverted ?
|
|
@@ -21,8 +21,12 @@ export default class InvertColoursCheckboxDiv extends CheckboxDiv {
|
|
|
21
21
|
this.uncheckCheckbox();
|
|
22
22
|
}
|
|
23
23
|
|
|
24
|
-
|
|
25
|
-
|
|
24
|
+
parentContext() {
|
|
25
|
+
const updateInvertColoursCheckboxDiv = this.update.bind(this);
|
|
26
|
+
|
|
27
|
+
return ({
|
|
28
|
+
updateInvertColoursCheckboxDiv
|
|
29
|
+
});
|
|
26
30
|
}
|
|
27
31
|
|
|
28
32
|
static message = "Invert colours";
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
import CheckboxDiv from "../../div/checkbox";
|
|
4
|
+
|
|
5
|
+
import { areNativeGesturesRestored } from "../../../state";
|
|
6
|
+
|
|
7
|
+
export default class NativeGesturesCheckboxDiv extends CheckboxDiv {
|
|
8
|
+
changeHandler = (event, element) => {
|
|
9
|
+
const checkboxChecked = this.isCheckboxChecked();
|
|
10
|
+
|
|
11
|
+
checkboxChecked ?
|
|
12
|
+
controller.restoreNativeGestures() :
|
|
13
|
+
controller.suppressNativeGestures();
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
update() {
|
|
17
|
+
const nativeGesturesRestored = areNativeGesturesRestored();
|
|
18
|
+
|
|
19
|
+
nativeGesturesRestored ?
|
|
20
|
+
this.checkCheckbox() :
|
|
21
|
+
this.uncheckCheckbox();
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
parentContext() {
|
|
25
|
+
const updateNativeGesturesCheckboxDiv = this.update.bind(this); ///
|
|
26
|
+
|
|
27
|
+
return ({
|
|
28
|
+
updateNativeGesturesCheckboxDiv
|
|
29
|
+
});
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
static message = `Native gestures
|
|
33
|
+
(tap to toggle)`;
|
|
34
|
+
|
|
35
|
+
static defaultProperties = {
|
|
36
|
+
className: "native-gestures"
|
|
37
|
+
};
|
|
38
|
+
}
|
|
@@ -3,8 +3,9 @@
|
|
|
3
3
|
import withStyle from "easy-with-style"; ///
|
|
4
4
|
|
|
5
5
|
import Element from "../element";
|
|
6
|
+
import FullScreenCheckboxDiv from "./checkbox/fullScreen";
|
|
6
7
|
import InvertColoursCheckboxDiv from "./checkbox/invertColours";
|
|
7
|
-
import
|
|
8
|
+
import NativeGesturesCheckboxDiv from "./checkbox/nativeGestures";
|
|
8
9
|
|
|
9
10
|
import { checkboxesDivGap } from "../../styles";
|
|
10
11
|
|
|
@@ -13,7 +14,8 @@ class CheckboxesDiv extends Element {
|
|
|
13
14
|
return ([
|
|
14
15
|
|
|
15
16
|
<InvertColoursCheckboxDiv/>,
|
|
16
|
-
<
|
|
17
|
+
<NativeGesturesCheckboxDiv/>,
|
|
18
|
+
<FullScreenCheckboxDiv/>
|
|
17
19
|
|
|
18
20
|
]);
|
|
19
21
|
}
|
package/src/view/div/menu.js
CHANGED
|
@@ -6,43 +6,11 @@ import Element from "../element";
|
|
|
6
6
|
import ButtonsDiv from "../div/buttons";
|
|
7
7
|
import CheckboxesDiv from "../div/checkboxes";
|
|
8
8
|
|
|
9
|
-
import { GRID
|
|
9
|
+
import { GRID } from "../../constants";
|
|
10
|
+
import { getMenuZoom as getZoom } from "../../state";
|
|
10
11
|
import { borderColour, menuDivPadding, backgroundColour } from "../../styles";
|
|
11
|
-
import { getMenuDivZoom as getZoom, setMenuDivZoom as setZoom } from "../../state";
|
|
12
12
|
|
|
13
13
|
class MenuDiv extends Element {
|
|
14
|
-
zoomMenuOut() {
|
|
15
|
-
let zoom = getZoom();
|
|
16
|
-
|
|
17
|
-
zoom /= ZOOM_RATIO;
|
|
18
|
-
|
|
19
|
-
setZoom(zoom);
|
|
20
|
-
|
|
21
|
-
this.updateZoom();
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
zoomMenuIn() {
|
|
25
|
-
let zoom = getZoom();
|
|
26
|
-
|
|
27
|
-
zoom *= ZOOM_RATIO;
|
|
28
|
-
|
|
29
|
-
setZoom(zoom);
|
|
30
|
-
|
|
31
|
-
this.updateZoom();
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
updateZoom() {
|
|
35
|
-
const zoom = getZoom(),
|
|
36
|
-
width = `${100/zoom}%`,
|
|
37
|
-
transform = `scale(${zoom})`,
|
|
38
|
-
css = {
|
|
39
|
-
width,
|
|
40
|
-
transform
|
|
41
|
-
};
|
|
42
|
-
|
|
43
|
-
this.css(css);
|
|
44
|
-
}
|
|
45
|
-
|
|
46
14
|
show() {
|
|
47
15
|
const display = GRID;
|
|
48
16
|
|
|
@@ -57,12 +25,16 @@ class MenuDiv extends Element {
|
|
|
57
25
|
this.hide();
|
|
58
26
|
}
|
|
59
27
|
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
28
|
+
updateMenuZoom() {
|
|
29
|
+
const zoom = getZoom(),
|
|
30
|
+
width = `${100/zoom}%`,
|
|
31
|
+
transform = `scale(${zoom})`,
|
|
32
|
+
css = {
|
|
33
|
+
width,
|
|
34
|
+
transform
|
|
35
|
+
};
|
|
63
36
|
|
|
64
|
-
|
|
65
|
-
///
|
|
37
|
+
this.css(css);
|
|
66
38
|
}
|
|
67
39
|
|
|
68
40
|
childElements() {
|
|
@@ -78,17 +50,13 @@ class MenuDiv extends Element {
|
|
|
78
50
|
const context = this.getContext(),
|
|
79
51
|
openMenu = this.openMenu.bind(this),
|
|
80
52
|
closeMenu = this.closeMenu.bind(this),
|
|
81
|
-
|
|
82
|
-
zoomMenuOut = this.zoomMenuOut.bind(this),
|
|
83
|
-
updateMenuDivZoom = this.updateZoom.bind(this); ///
|
|
53
|
+
updateMenuZoom = this.updateMenuZoom.bind(this);
|
|
84
54
|
|
|
85
55
|
return ({
|
|
86
56
|
...context,
|
|
87
57
|
openMenu,
|
|
88
58
|
closeMenu,
|
|
89
|
-
|
|
90
|
-
zoomMenuOut,
|
|
91
|
-
updateMenuDivZoom
|
|
59
|
+
updateMenuZoom
|
|
92
60
|
});
|
|
93
61
|
}
|
|
94
62
|
|