@deck.gl/widgets 9.0.0-beta.1 → 9.0.0-beta.11
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/dist/compass-widget.d.ts +46 -0
- package/dist/compass-widget.d.ts.map +1 -0
- package/dist/compass-widget.js +75 -0
- package/dist/components.d.ts +4 -0
- package/dist/components.d.ts.map +1 -0
- package/dist/components.js +13 -0
- package/dist/dist.dev.js +430 -204
- package/{typed → dist}/fullscreen-widget.d.ts +8 -2
- package/dist/fullscreen-widget.d.ts.map +1 -0
- package/dist/fullscreen-widget.js +108 -0
- package/dist/index.cjs +343 -0
- package/dist/index.cjs.map +7 -0
- package/dist/index.d.ts +5 -0
- package/{typed → dist}/index.d.ts.map +1 -1
- package/dist/index.js +4 -0
- package/dist/{es5/stylesheet.css → stylesheet.css} +81 -11
- package/{typed → dist}/themes.d.ts +8 -0
- package/dist/themes.d.ts.map +1 -0
- package/dist/themes.js +44 -0
- package/dist/zoom-widget.d.ts +55 -0
- package/dist/zoom-widget.d.ts.map +1 -0
- package/dist/zoom-widget.js +68 -0
- package/dist.min.js +1 -2
- package/package.json +15 -8
- package/src/compass-widget.tsx +133 -0
- package/src/components.tsx +21 -2
- package/src/fullscreen-widget.tsx +8 -2
- package/src/index.ts +2 -0
- package/src/stylesheet.css +81 -11
- package/src/themes.ts +12 -4
- package/src/zoom-widget.tsx +128 -0
- package/dist/es5/components.js +0 -25
- package/dist/es5/components.js.map +0 -1
- package/dist/es5/fullscreen-widget.js +0 -272
- package/dist/es5/fullscreen-widget.js.map +0 -1
- package/dist/es5/index.js +0 -31
- package/dist/es5/index.js.map +0 -1
- package/dist/es5/themes.js +0 -47
- package/dist/es5/themes.js.map +0 -1
- package/dist/esm/components.js +0 -18
- package/dist/esm/components.js.map +0 -1
- package/dist/esm/fullscreen-widget.js +0 -145
- package/dist/esm/fullscreen-widget.js.map +0 -1
- package/dist/esm/index.js +0 -3
- package/dist/esm/index.js.map +0 -1
- package/dist/esm/stylesheet.css +0 -79
- package/dist/esm/themes.js +0 -37
- package/dist/esm/themes.js.map +0 -1
- package/typed/components.d.ts +0 -3
- package/typed/components.d.ts.map +0 -1
- package/typed/fullscreen-widget.d.ts.map +0 -1
- package/typed/index.d.ts +0 -3
- package/typed/themes.d.ts.map +0 -1
package/src/components.tsx
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
export const IconButton = props => {
|
|
2
2
|
const {className, label, onClick} = props;
|
|
3
3
|
return (
|
|
4
|
-
<div className="deck-widget-button
|
|
4
|
+
<div className="deck-widget-button">
|
|
5
5
|
<button
|
|
6
|
-
className={`deck-widget-button ${className}`}
|
|
6
|
+
className={`deck-widget-icon-button ${className}`}
|
|
7
7
|
type="button"
|
|
8
8
|
onClick={onClick}
|
|
9
9
|
title={label}
|
|
@@ -13,3 +13,22 @@ export const IconButton = props => {
|
|
|
13
13
|
</div>
|
|
14
14
|
);
|
|
15
15
|
};
|
|
16
|
+
|
|
17
|
+
export const ButtonGroup = props => {
|
|
18
|
+
const {children, orientation} = props;
|
|
19
|
+
return <div className={`deck-widget-button-group ${orientation}`}>{children}</div>;
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
export const GroupedIconButton = props => {
|
|
23
|
+
const {className, label, onClick} = props;
|
|
24
|
+
return (
|
|
25
|
+
<button
|
|
26
|
+
className={`deck-widget-icon-button ${className}`}
|
|
27
|
+
type="button"
|
|
28
|
+
onClick={onClick}
|
|
29
|
+
title={label}
|
|
30
|
+
>
|
|
31
|
+
<div className="deck-widget-icon" />
|
|
32
|
+
</button>
|
|
33
|
+
);
|
|
34
|
+
};
|
|
@@ -21,7 +21,13 @@ interface FullscreenWidgetProps {
|
|
|
21
21
|
* Tooltip message when fullscreen.
|
|
22
22
|
*/
|
|
23
23
|
exitLabel?: string;
|
|
24
|
+
/**
|
|
25
|
+
* CSS inline style overrides.
|
|
26
|
+
*/
|
|
24
27
|
style?: Partial<CSSStyleDeclaration>;
|
|
28
|
+
/**
|
|
29
|
+
* Additional CSS class.
|
|
30
|
+
*/
|
|
25
31
|
className?: string;
|
|
26
32
|
}
|
|
27
33
|
|
|
@@ -30,7 +36,7 @@ export class FullscreenWidget implements Widget<FullscreenWidgetProps> {
|
|
|
30
36
|
props: FullscreenWidgetProps;
|
|
31
37
|
placement: WidgetPlacement = 'top-left';
|
|
32
38
|
|
|
33
|
-
deck?: Deck
|
|
39
|
+
deck?: Deck<any>;
|
|
34
40
|
element?: HTMLDivElement;
|
|
35
41
|
|
|
36
42
|
fullscreen: boolean = false;
|
|
@@ -44,7 +50,7 @@ export class FullscreenWidget implements Widget<FullscreenWidgetProps> {
|
|
|
44
50
|
this.props = props;
|
|
45
51
|
}
|
|
46
52
|
|
|
47
|
-
onAdd({deck}: {deck: Deck}): HTMLDivElement {
|
|
53
|
+
onAdd({deck}: {deck: Deck<any>}): HTMLDivElement {
|
|
48
54
|
const {style, className} = this.props;
|
|
49
55
|
const el = document.createElement('div');
|
|
50
56
|
el.classList.add('deck-widget', 'deck-widget-fullscreen');
|
package/src/index.ts
CHANGED
package/src/stylesheet.css
CHANGED
|
@@ -2,12 +2,9 @@
|
|
|
2
2
|
margin: var(--widget-margin, 12px);
|
|
3
3
|
}
|
|
4
4
|
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
box-sizing: border-box;
|
|
9
|
-
flex-shrink: 0;
|
|
10
|
-
|
|
5
|
+
/* Common button container styles */
|
|
6
|
+
.deck-widget-button,
|
|
7
|
+
.deck-widget-button-group {
|
|
11
8
|
background: var(--button-stroke, rgba(255, 255, 255, 0.3));
|
|
12
9
|
border-radius: var(--button-corner-radius, 8px);
|
|
13
10
|
box-shadow: var(--button-shadow, 0px 0px 8px 0px rgba(0, 0, 0, 0.25));
|
|
@@ -17,12 +14,34 @@
|
|
|
17
14
|
justify-content: center;
|
|
18
15
|
}
|
|
19
16
|
|
|
20
|
-
|
|
17
|
+
/* Single button */
|
|
18
|
+
.deck-widget-button {
|
|
19
|
+
width: var(--button-size, 28px);
|
|
20
|
+
height: var(--button-size, 28px);
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
/* Button group */
|
|
24
|
+
.deck-widget-button-group {
|
|
25
|
+
width: calc(var(--button-size, 28px) - 2);
|
|
26
|
+
height: calc((var(--button-size, 28px) * 2) - 1);
|
|
27
|
+
|
|
28
|
+
flex-direction: row;
|
|
29
|
+
padding: 1px;
|
|
30
|
+
gap: 1px;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
.deck-widget-button-group.vertical {
|
|
34
|
+
display: inline-flex;
|
|
35
|
+
flex-direction: column;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
/* Common button styles */
|
|
39
|
+
.deck-widget-button-group button,
|
|
40
|
+
.deck-widget-button button {
|
|
21
41
|
width: calc(var(--button-size, 28px) - 2px);
|
|
22
42
|
height: calc(var(--button-size, 28px) - 2px);
|
|
23
|
-
box-sizing: border-box;
|
|
24
|
-
flex-shrink: 0;
|
|
25
43
|
|
|
44
|
+
box-sizing: border-box;
|
|
26
45
|
background: var(--button-background, #fff);
|
|
27
46
|
backdrop-filter: var(--button-backdrop-filter, unset);
|
|
28
47
|
border: var(--button-inner-stroke, unset);
|
|
@@ -34,8 +53,35 @@
|
|
|
34
53
|
padding: 0;
|
|
35
54
|
}
|
|
36
55
|
|
|
56
|
+
/* Border radius adjustments for grouped buttons */
|
|
57
|
+
.deck-widget-button-group.vertical > *:not(:last-child),
|
|
58
|
+
.deck-widget-button-group.vertical > *:not(:last-child) > button {
|
|
59
|
+
border-bottom-left-radius: 0;
|
|
60
|
+
border-bottom-right-radius: 0;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
.deck-widget-button-group.vertical > *:not(:first-child),
|
|
64
|
+
.deck-widget-button-group.vertical > *:not(:first-child) > button {
|
|
65
|
+
border-top-left-radius: 0;
|
|
66
|
+
border-top-right-radius: 0;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
|
|
70
|
+
.deck-widget-button-group.horizontal > *:not(:last-child),
|
|
71
|
+
.deck-widget-button-group.horizontal > *:not(:last-child) > button {
|
|
72
|
+
border-top-right-radius: 0;
|
|
73
|
+
border-bottom-right-radius: 0;
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
.deck-widget-button-group.horizontal > *:not(:first-child),
|
|
77
|
+
.deck-widget-button-group.horizontal > *:not(:first-child) > button {
|
|
78
|
+
border-top-left-radius: 0;
|
|
79
|
+
border-bottom-left-radius: 0;
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
/* Icon button styles */
|
|
37
83
|
.deck-widget button .deck-widget-icon {
|
|
38
|
-
background-color: var(--button-icon-idle,
|
|
84
|
+
background-color: var(--button-icon-idle, #616166);
|
|
39
85
|
background-position: 50%;
|
|
40
86
|
background-repeat: no-repeat;
|
|
41
87
|
display: block;
|
|
@@ -44,9 +90,10 @@
|
|
|
44
90
|
}
|
|
45
91
|
|
|
46
92
|
.deck-widget button .deck-widget-icon:hover {
|
|
47
|
-
background-color: var(--button-icon-hover,
|
|
93
|
+
background-color: var(--button-icon-hover, rgb(24, 24, 26));
|
|
48
94
|
}
|
|
49
95
|
|
|
96
|
+
/* Fullscreen styles */
|
|
50
97
|
.deck-widget.deck-widget-fullscreen button.deck-widget-fullscreen-enter .deck-widget-icon {
|
|
51
98
|
mask-image: var(
|
|
52
99
|
--icon-fullscreen-enter,
|
|
@@ -77,3 +124,26 @@
|
|
|
77
124
|
width: 100% !important;
|
|
78
125
|
z-index: 99999;
|
|
79
126
|
}
|
|
127
|
+
|
|
128
|
+
/* Zoom styles */
|
|
129
|
+
.deck-widget.deck-widget-zoom button.deck-widget-zoom-in .deck-widget-icon {
|
|
130
|
+
mask-image: var(
|
|
131
|
+
--icon-zoom-in,
|
|
132
|
+
url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" width="100%" height="100%" viewBox="0 0 26 26" fill="black"><path d="M12.1029 13.8971H7.89332C7.64334 13.8971 7.43196 13.8105 7.25918 13.6373C7.08639 13.4641 7 13.2521 7 13.0014C7 12.7508 7.08639 12.5396 7.25918 12.368C7.43196 12.1963 7.64334 12.1105 7.89332 12.1105H12.1029V7.90097C12.1029 7.65161 12.1895 7.43912 12.3627 7.26348C12.5359 7.08783 12.7479 7 12.9986 7C13.2492 7 13.4604 7.08783 13.632 7.26348C13.8037 7.43912 13.8895 7.65161 13.8895 7.90097V12.1105H18.099C18.3484 12.1105 18.5609 12.1971 18.7365 12.3703C18.9122 12.5436 19 12.7555 19 13.0062C19 13.2569 18.9122 13.468 18.7365 13.6397C18.5609 13.8113 18.3484 13.8971 18.099 13.8971H13.8895V18.1067C13.8895 18.3567 13.8029 18.568 13.6297 18.7408C13.4564 18.9136 13.2445 19 12.9938 19C12.7431 19 12.532 18.9136 12.3603 18.7408C12.1887 18.568 12.1029 18.3567 12.1029 18.1067V13.8971Z"/></svg>')
|
|
133
|
+
);
|
|
134
|
+
-webkit-mask-image: var(
|
|
135
|
+
--icon-zoom-in,
|
|
136
|
+
url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" width="100%" height="100%" viewBox="0 0 26 26" fill="black"><path d="M12.1029 13.8971H7.89332C7.64334 13.8971 7.43196 13.8105 7.25918 13.6373C7.08639 13.4641 7 13.2521 7 13.0014C7 12.7508 7.08639 12.5396 7.25918 12.368C7.43196 12.1963 7.64334 12.1105 7.89332 12.1105H12.1029V7.90097C12.1029 7.65161 12.1895 7.43912 12.3627 7.26348C12.5359 7.08783 12.7479 7 12.9986 7C13.2492 7 13.4604 7.08783 13.632 7.26348C13.8037 7.43912 13.8895 7.65161 13.8895 7.90097V12.1105H18.099C18.3484 12.1105 18.5609 12.1971 18.7365 12.3703C18.9122 12.5436 19 12.7555 19 13.0062C19 13.2569 18.9122 13.468 18.7365 13.6397C18.5609 13.8113 18.3484 13.8971 18.099 13.8971H13.8895V18.1067C13.8895 18.3567 13.8029 18.568 13.6297 18.7408C13.4564 18.9136 13.2445 19 12.9938 19C12.7431 19 12.532 18.9136 12.3603 18.7408C12.1887 18.568 12.1029 18.3567 12.1029 18.1067V13.8971Z"/></svg>')
|
|
137
|
+
);
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
.deck-widget.deck-widget-zoom button.deck-widget-zoom-out .deck-widget-icon {
|
|
141
|
+
mask-image: var(
|
|
142
|
+
--icon-zoom-out,
|
|
143
|
+
url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" width="100%" height="100%" viewBox="0 0 26 26" fill="black"> wBox="0 0 26 26" fill="none"><path d="M7.89332 13.8866C7.64334 13.8866 7.43196 13.8 7.25918 13.6268C7.08639 13.4535 7 13.2416 7 12.9909C7 12.7403 7.08639 12.5291 7.25918 12.3575C7.43196 12.1858 7.64334 12.1 7.89332 12.1H18.099C18.349 12.1 18.5617 12.1866 18.737 12.3598C18.9123 12.5331 19 12.745 19 12.9957C19 13.2463 18.9123 13.4575 18.737 13.6291C18.5617 13.8008 18.349 13.8866 18.099 13.8866H7.89332Z"/></svg>')
|
|
144
|
+
);
|
|
145
|
+
-webkit-mask-image: var(
|
|
146
|
+
--icon-zoom-out,
|
|
147
|
+
url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" width="100%" height="100%" viewBox="0 0 26 26" fill="black"> wBox="0 0 26 26" fill="none"><path d="M7.89332 13.8866C7.64334 13.8866 7.43196 13.8 7.25918 13.6268C7.08639 13.4535 7 13.2416 7 12.9909C7 12.7403 7.08639 12.5291 7.25918 12.3575C7.43196 12.1858 7.64334 12.1 7.89332 12.1H18.099C18.349 12.1 18.5617 12.1866 18.737 12.3598C18.9123 12.5331 19 12.745 19 12.9957C19 13.2463 18.9123 13.4575 18.737 13.6291C18.5617 13.8008 18.349 13.8866 18.099 13.8866H7.89332Z"/></svg>')
|
|
148
|
+
);
|
|
149
|
+
}
|
package/src/themes.ts
CHANGED
|
@@ -5,7 +5,9 @@ export const LightTheme = {
|
|
|
5
5
|
'--button-shadow': '0px 0px 8px 0px rgba(0, 0, 0, 0.25)',
|
|
6
6
|
'--button-backdrop-filter': 'unset',
|
|
7
7
|
'--button-icon-idle': 'rgba(97, 97, 102, 1)',
|
|
8
|
-
'--button-icon-hover': 'rgba(24, 24, 26, 1)'
|
|
8
|
+
'--button-icon-hover': 'rgba(24, 24, 26, 1)',
|
|
9
|
+
'--icon-compass-north-color': '#F05C44',
|
|
10
|
+
'--icon-compass-south-color': '#C2C2CC'
|
|
9
11
|
};
|
|
10
12
|
|
|
11
13
|
export const DarkTheme = {
|
|
@@ -15,7 +17,9 @@ export const DarkTheme = {
|
|
|
15
17
|
'--button-shadow': '0px 0px 8px 0px rgba(0, 0, 0, 0.25)',
|
|
16
18
|
'--button-backdrop-filter': 'unset',
|
|
17
19
|
'--button-icon-idle': 'rgba(158, 157, 168, 1)',
|
|
18
|
-
'--button-icon-hover': 'rgba(215, 214, 229, 1)'
|
|
20
|
+
'--button-icon-hover': 'rgba(215, 214, 229, 1)',
|
|
21
|
+
'--icon-compass-north-color': '#F05C44',
|
|
22
|
+
'--icon-compass-south-color': '#C2C2CC'
|
|
19
23
|
};
|
|
20
24
|
|
|
21
25
|
export const LightGlassTheme = {
|
|
@@ -26,7 +30,9 @@ export const LightGlassTheme = {
|
|
|
26
30
|
'0px 0px 8px 0px rgba(0, 0, 0, 0.25), 0px 0px 8px 0px rgba(0, 0, 0, 0.1) inset',
|
|
27
31
|
'--button-backdrop-filter': 'blur(4px)',
|
|
28
32
|
'--button-icon-idle': 'rgba(97, 97, 102, 1)',
|
|
29
|
-
'--button-icon-hover': 'rgba(24, 24, 26, 1)'
|
|
33
|
+
'--button-icon-hover': 'rgba(24, 24, 26, 1)',
|
|
34
|
+
'--icon-compass-north-color': '#F05C44',
|
|
35
|
+
'--icon-compass-south-color': '#C2C2CC'
|
|
30
36
|
};
|
|
31
37
|
|
|
32
38
|
export const DarkGlassTheme = {
|
|
@@ -37,5 +43,7 @@ export const DarkGlassTheme = {
|
|
|
37
43
|
'0px 0px 8px 0px rgba(0, 0, 0, 0.25), 0px 0px 8px 0px rgba(0, 0, 0, 0.1) inset',
|
|
38
44
|
'--button-backdrop-filter': 'blur(4px)',
|
|
39
45
|
'--button-icon-idle': 'rgba(158, 157, 168, 1)',
|
|
40
|
-
'--button-icon-hover': 'rgba(215, 214, 229, 1)'
|
|
46
|
+
'--button-icon-hover': 'rgba(215, 214, 229, 1)',
|
|
47
|
+
'--icon-compass-north-color': '#F05C44',
|
|
48
|
+
'--icon-compass-south-color': '#C2C2CC'
|
|
41
49
|
};
|
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
/* global document */
|
|
2
|
+
import {FlyToInterpolator} from '@deck.gl/core';
|
|
3
|
+
import type {Deck, Viewport, Widget, WidgetPlacement} from '@deck.gl/core';
|
|
4
|
+
import {render} from 'preact';
|
|
5
|
+
import {ButtonGroup, GroupedIconButton} from './components';
|
|
6
|
+
|
|
7
|
+
interface ZoomWidgetProps {
|
|
8
|
+
id: string;
|
|
9
|
+
placement?: WidgetPlacement;
|
|
10
|
+
/**
|
|
11
|
+
* View to attach to and interact with. Required when using multiple views.
|
|
12
|
+
*/
|
|
13
|
+
viewId?: string | null;
|
|
14
|
+
/**
|
|
15
|
+
* Button orientation.
|
|
16
|
+
*/
|
|
17
|
+
orientation?: 'vertical' | 'horizontal';
|
|
18
|
+
/**
|
|
19
|
+
* Tooltip message on zoom in button.
|
|
20
|
+
*/
|
|
21
|
+
zoomInLabel?: string;
|
|
22
|
+
/**
|
|
23
|
+
* Tooltip message on zoom out button.
|
|
24
|
+
*/
|
|
25
|
+
zoomOutLabel?: string;
|
|
26
|
+
/**
|
|
27
|
+
* Zoom transition duration in ms.
|
|
28
|
+
*/
|
|
29
|
+
transitionDuration?: number;
|
|
30
|
+
/**
|
|
31
|
+
* CSS inline style overrides.
|
|
32
|
+
*/
|
|
33
|
+
style?: Partial<CSSStyleDeclaration>;
|
|
34
|
+
/**
|
|
35
|
+
* Additional CSS class.
|
|
36
|
+
*/
|
|
37
|
+
className?: string;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
export class ZoomWidget implements Widget<ZoomWidgetProps> {
|
|
41
|
+
id = 'zoom';
|
|
42
|
+
props: ZoomWidgetProps;
|
|
43
|
+
placement: WidgetPlacement = 'top-left';
|
|
44
|
+
orientation: 'vertical' | 'horizontal' = 'vertical';
|
|
45
|
+
viewId?: string | null = null;
|
|
46
|
+
viewport?: Viewport;
|
|
47
|
+
deck?: Deck<any>;
|
|
48
|
+
element?: HTMLDivElement;
|
|
49
|
+
|
|
50
|
+
constructor(props: ZoomWidgetProps) {
|
|
51
|
+
this.id = props.id || 'zoom';
|
|
52
|
+
this.viewId = props.viewId || null;
|
|
53
|
+
this.placement = props.placement || 'top-left';
|
|
54
|
+
this.orientation = props.orientation || 'vertical';
|
|
55
|
+
props.transitionDuration = props.transitionDuration || 200;
|
|
56
|
+
props.zoomInLabel = props.zoomInLabel || 'Zoom In';
|
|
57
|
+
props.zoomOutLabel = props.zoomOutLabel || 'Zoom Out';
|
|
58
|
+
props.style = props.style || {};
|
|
59
|
+
this.props = props;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
onAdd({deck}: {deck: Deck<any>}): HTMLDivElement {
|
|
63
|
+
const {style, className} = this.props;
|
|
64
|
+
const element = document.createElement('div');
|
|
65
|
+
element.classList.add('deck-widget', 'deck-widget-zoom');
|
|
66
|
+
if (className) element.classList.add(className);
|
|
67
|
+
if (style) {
|
|
68
|
+
Object.entries(style).map(([key, value]) => element.style.setProperty(key, value as string));
|
|
69
|
+
}
|
|
70
|
+
const ui = (
|
|
71
|
+
<ButtonGroup orientation={this.orientation}>
|
|
72
|
+
<GroupedIconButton
|
|
73
|
+
onClick={() => this.handleZoomIn()}
|
|
74
|
+
label={this.props.zoomInLabel}
|
|
75
|
+
className="deck-widget-zoom-in"
|
|
76
|
+
/>
|
|
77
|
+
<GroupedIconButton
|
|
78
|
+
onClick={() => this.handleZoomOut()}
|
|
79
|
+
label={this.props.zoomOutLabel}
|
|
80
|
+
className="deck-widget-zoom-out"
|
|
81
|
+
/>
|
|
82
|
+
</ButtonGroup>
|
|
83
|
+
);
|
|
84
|
+
render(ui, element);
|
|
85
|
+
|
|
86
|
+
this.deck = deck;
|
|
87
|
+
this.element = element;
|
|
88
|
+
|
|
89
|
+
return element;
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
onRemove() {
|
|
93
|
+
this.deck = undefined;
|
|
94
|
+
this.element = undefined;
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
setProps(props: Partial<ZoomWidgetProps>) {
|
|
98
|
+
Object.assign(this.props, props);
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
onViewportChange(viewport) {
|
|
102
|
+
this.viewport = viewport;
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
handleZoom(nextZoom: number) {
|
|
106
|
+
const viewId = this.viewId || 'default-view';
|
|
107
|
+
const nextViewState = {
|
|
108
|
+
...this.viewport,
|
|
109
|
+
zoom: nextZoom,
|
|
110
|
+
transitionDuration: this.props.transitionDuration,
|
|
111
|
+
transitionInterpolator: new FlyToInterpolator()
|
|
112
|
+
};
|
|
113
|
+
// @ts-ignore Using private method temporary until there's a public one
|
|
114
|
+
this.deck._onViewStateChange({viewId, viewState: nextViewState, interactionState: {}});
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
handleZoomIn() {
|
|
118
|
+
if (this.viewport) {
|
|
119
|
+
this.handleZoom(this.viewport.zoom + 1);
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
handleZoomOut() {
|
|
124
|
+
if (this.viewport) {
|
|
125
|
+
this.handleZoom(this.viewport.zoom - 1);
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
}
|
package/dist/es5/components.js
DELETED
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.IconButton = void 0;
|
|
7
|
-
|
|
8
|
-
var IconButton = function IconButton(props) {
|
|
9
|
-
var className = props.className,
|
|
10
|
-
label = props.label,
|
|
11
|
-
onClick = props.onClick;
|
|
12
|
-
return h("div", {
|
|
13
|
-
className: "deck-widget-button-border"
|
|
14
|
-
}, h("button", {
|
|
15
|
-
className: "deck-widget-button ".concat(className),
|
|
16
|
-
type: "button",
|
|
17
|
-
onClick: onClick,
|
|
18
|
-
title: label
|
|
19
|
-
}, h("div", {
|
|
20
|
-
className: "deck-widget-icon"
|
|
21
|
-
})));
|
|
22
|
-
};
|
|
23
|
-
|
|
24
|
-
exports.IconButton = IconButton;
|
|
25
|
-
//# sourceMappingURL=components.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/components.tsx"],"names":["IconButton","props","className","label","onClick"],"mappings":";;;;;;;AAAO,IAAMA,UAAU,GAAG,SAAbA,UAAa,CAAAC,KAAK,EAAI;AACjC,MAAOC,SAAP,GAAoCD,KAApC,CAAOC,SAAP;AAAA,MAAkBC,KAAlB,GAAoCF,KAApC,CAAkBE,KAAlB;AAAA,MAAyBC,OAAzB,GAAoCH,KAApC,CAAyBG,OAAzB;AACA,SACE;AAAK,IAAA,SAAS,EAAC;AAAf,KACE;AACE,IAAA,SAAS,+BAAwBF,SAAxB,CADX;AAEE,IAAA,IAAI,EAAC,QAFP;AAGE,IAAA,OAAO,EAAEE,OAHX;AAIE,IAAA,KAAK,EAAED;AAJT,KAME;AAAK,IAAA,SAAS,EAAC;AAAf,IANF,CADF,CADF;AAYD,CAdM","sourcesContent":["export const IconButton = props => {\n const {className, label, onClick} = props;\n return (\n <div className=\"deck-widget-button-border\">\n <button\n className={`deck-widget-button ${className}`}\n type=\"button\"\n onClick={onClick}\n title={label}\n >\n <div className=\"deck-widget-icon\" />\n </button>\n </div>\n );\n};\n"],"file":"components.js"}
|
|
@@ -1,272 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
-
|
|
5
|
-
Object.defineProperty(exports, "__esModule", {
|
|
6
|
-
value: true
|
|
7
|
-
});
|
|
8
|
-
exports.FullscreenWidget = void 0;
|
|
9
|
-
|
|
10
|
-
var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
|
|
11
|
-
|
|
12
|
-
var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
|
|
13
|
-
|
|
14
|
-
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
|
15
|
-
|
|
16
|
-
var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
|
|
17
|
-
|
|
18
|
-
var _core = require("@deck.gl/core");
|
|
19
|
-
|
|
20
|
-
var _preact = require("preact");
|
|
21
|
-
|
|
22
|
-
var _components = require("./components");
|
|
23
|
-
|
|
24
|
-
var FullscreenWidget = function () {
|
|
25
|
-
function FullscreenWidget(props) {
|
|
26
|
-
(0, _classCallCheck2.default)(this, FullscreenWidget);
|
|
27
|
-
this.id = 'fullscreen';
|
|
28
|
-
this.props = void 0;
|
|
29
|
-
this.placement = 'top-left';
|
|
30
|
-
this.deck = void 0;
|
|
31
|
-
this.element = void 0;
|
|
32
|
-
this.fullscreen = false;
|
|
33
|
-
this.id = props.id || 'fullscreen';
|
|
34
|
-
this.placement = props.placement || 'top-left';
|
|
35
|
-
props.enterLabel = props.enterLabel || 'Enter Fullscreen';
|
|
36
|
-
props.exitLabel = props.exitLabel || 'Exit Fullscreen';
|
|
37
|
-
props.style = props.style || {};
|
|
38
|
-
this.props = props;
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
var _proto = FullscreenWidget.prototype;
|
|
42
|
-
|
|
43
|
-
_proto.onAdd = function onAdd(_ref) {
|
|
44
|
-
var deck = _ref.deck;
|
|
45
|
-
var _this$props = this.props,
|
|
46
|
-
style = _this$props.style,
|
|
47
|
-
className = _this$props.className;
|
|
48
|
-
var el = document.createElement('div');
|
|
49
|
-
el.classList.add('deck-widget', 'deck-widget-fullscreen');
|
|
50
|
-
if (className) el.classList.add(className);
|
|
51
|
-
|
|
52
|
-
if (style) {
|
|
53
|
-
Object.entries(style).map(function (_ref2) {
|
|
54
|
-
var _ref3 = (0, _slicedToArray2.default)(_ref2, 2),
|
|
55
|
-
key = _ref3[0],
|
|
56
|
-
value = _ref3[1];
|
|
57
|
-
|
|
58
|
-
return el.style.setProperty(key, value);
|
|
59
|
-
});
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
this.deck = deck;
|
|
63
|
-
this.element = el;
|
|
64
|
-
this.update();
|
|
65
|
-
document.addEventListener('fullscreenchange', this.onFullscreenChange.bind(this));
|
|
66
|
-
return el;
|
|
67
|
-
};
|
|
68
|
-
|
|
69
|
-
_proto.onRemove = function onRemove() {
|
|
70
|
-
this.deck = undefined;
|
|
71
|
-
this.element = undefined;
|
|
72
|
-
document.removeEventListener('fullscreenchange', this.onFullscreenChange.bind(this));
|
|
73
|
-
};
|
|
74
|
-
|
|
75
|
-
_proto.update = function update() {
|
|
76
|
-
var _this$props2 = this.props,
|
|
77
|
-
enterLabel = _this$props2.enterLabel,
|
|
78
|
-
exitLabel = _this$props2.exitLabel;
|
|
79
|
-
var el = this.element;
|
|
80
|
-
|
|
81
|
-
if (!el) {
|
|
82
|
-
return;
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
var ui = h(_components.IconButton, {
|
|
86
|
-
onClick: this.handleClick.bind(this),
|
|
87
|
-
label: this.fullscreen ? exitLabel : enterLabel,
|
|
88
|
-
className: this.fullscreen ? 'deck-widget-fullscreen-exit' : 'deck-widget-fullscreen-enter'
|
|
89
|
-
});
|
|
90
|
-
(0, _preact.render)(ui, el);
|
|
91
|
-
};
|
|
92
|
-
|
|
93
|
-
_proto.setProps = function setProps(props) {
|
|
94
|
-
var oldProps = this.props;
|
|
95
|
-
var el = this.element;
|
|
96
|
-
|
|
97
|
-
if (el) {
|
|
98
|
-
if (oldProps.className !== props.className) {
|
|
99
|
-
if (oldProps.className) el.classList.remove(oldProps.className);
|
|
100
|
-
if (props.className) el.classList.add(props.className);
|
|
101
|
-
}
|
|
102
|
-
|
|
103
|
-
if (!(0, _core._deepEqual)(oldProps.style, props.style, 1)) {
|
|
104
|
-
if (oldProps.style) {
|
|
105
|
-
Object.entries(oldProps.style).map(function (_ref4) {
|
|
106
|
-
var _ref5 = (0, _slicedToArray2.default)(_ref4, 1),
|
|
107
|
-
key = _ref5[0];
|
|
108
|
-
|
|
109
|
-
return el.style.removeProperty(key);
|
|
110
|
-
});
|
|
111
|
-
}
|
|
112
|
-
|
|
113
|
-
if (props.style) {
|
|
114
|
-
Object.entries(props.style).map(function (_ref6) {
|
|
115
|
-
var _ref7 = (0, _slicedToArray2.default)(_ref6, 2),
|
|
116
|
-
key = _ref7[0],
|
|
117
|
-
value = _ref7[1];
|
|
118
|
-
|
|
119
|
-
return el.style.setProperty(key, value);
|
|
120
|
-
});
|
|
121
|
-
}
|
|
122
|
-
}
|
|
123
|
-
}
|
|
124
|
-
|
|
125
|
-
Object.assign(this.props, props);
|
|
126
|
-
};
|
|
127
|
-
|
|
128
|
-
_proto.getContainer = function getContainer() {
|
|
129
|
-
var _this$deck, _this$deck$getCanvas;
|
|
130
|
-
|
|
131
|
-
return this.props.container || ((_this$deck = this.deck) === null || _this$deck === void 0 ? void 0 : (_this$deck$getCanvas = _this$deck.getCanvas()) === null || _this$deck$getCanvas === void 0 ? void 0 : _this$deck$getCanvas.parentElement);
|
|
132
|
-
};
|
|
133
|
-
|
|
134
|
-
_proto.onFullscreenChange = function onFullscreenChange() {
|
|
135
|
-
var prevFullscreen = this.fullscreen;
|
|
136
|
-
var fullscreen = document.fullscreenElement === this.getContainer();
|
|
137
|
-
|
|
138
|
-
if (prevFullscreen !== fullscreen) {
|
|
139
|
-
this.fullscreen = !this.fullscreen;
|
|
140
|
-
}
|
|
141
|
-
|
|
142
|
-
this.update();
|
|
143
|
-
};
|
|
144
|
-
|
|
145
|
-
_proto.handleClick = function () {
|
|
146
|
-
var _handleClick = (0, _asyncToGenerator2.default)(_regenerator.default.mark(function _callee() {
|
|
147
|
-
return _regenerator.default.wrap(function _callee$(_context) {
|
|
148
|
-
while (1) {
|
|
149
|
-
switch (_context.prev = _context.next) {
|
|
150
|
-
case 0:
|
|
151
|
-
if (!this.fullscreen) {
|
|
152
|
-
_context.next = 5;
|
|
153
|
-
break;
|
|
154
|
-
}
|
|
155
|
-
|
|
156
|
-
_context.next = 3;
|
|
157
|
-
return this.exitFullscreen();
|
|
158
|
-
|
|
159
|
-
case 3:
|
|
160
|
-
_context.next = 7;
|
|
161
|
-
break;
|
|
162
|
-
|
|
163
|
-
case 5:
|
|
164
|
-
_context.next = 7;
|
|
165
|
-
return this.requestFullscreen();
|
|
166
|
-
|
|
167
|
-
case 7:
|
|
168
|
-
this.update();
|
|
169
|
-
|
|
170
|
-
case 8:
|
|
171
|
-
case "end":
|
|
172
|
-
return _context.stop();
|
|
173
|
-
}
|
|
174
|
-
}
|
|
175
|
-
}, _callee, this);
|
|
176
|
-
}));
|
|
177
|
-
|
|
178
|
-
function handleClick() {
|
|
179
|
-
return _handleClick.apply(this, arguments);
|
|
180
|
-
}
|
|
181
|
-
|
|
182
|
-
return handleClick;
|
|
183
|
-
}();
|
|
184
|
-
|
|
185
|
-
_proto.requestFullscreen = function () {
|
|
186
|
-
var _requestFullscreen = (0, _asyncToGenerator2.default)(_regenerator.default.mark(function _callee2() {
|
|
187
|
-
var container;
|
|
188
|
-
return _regenerator.default.wrap(function _callee2$(_context2) {
|
|
189
|
-
while (1) {
|
|
190
|
-
switch (_context2.prev = _context2.next) {
|
|
191
|
-
case 0:
|
|
192
|
-
container = this.getContainer();
|
|
193
|
-
|
|
194
|
-
if (!(container !== null && container !== void 0 && container.requestFullscreen)) {
|
|
195
|
-
_context2.next = 6;
|
|
196
|
-
break;
|
|
197
|
-
}
|
|
198
|
-
|
|
199
|
-
_context2.next = 4;
|
|
200
|
-
return container.requestFullscreen({
|
|
201
|
-
navigationUI: 'hide'
|
|
202
|
-
});
|
|
203
|
-
|
|
204
|
-
case 4:
|
|
205
|
-
_context2.next = 7;
|
|
206
|
-
break;
|
|
207
|
-
|
|
208
|
-
case 6:
|
|
209
|
-
this.togglePseudoFullscreen();
|
|
210
|
-
|
|
211
|
-
case 7:
|
|
212
|
-
case "end":
|
|
213
|
-
return _context2.stop();
|
|
214
|
-
}
|
|
215
|
-
}
|
|
216
|
-
}, _callee2, this);
|
|
217
|
-
}));
|
|
218
|
-
|
|
219
|
-
function requestFullscreen() {
|
|
220
|
-
return _requestFullscreen.apply(this, arguments);
|
|
221
|
-
}
|
|
222
|
-
|
|
223
|
-
return requestFullscreen;
|
|
224
|
-
}();
|
|
225
|
-
|
|
226
|
-
_proto.exitFullscreen = function () {
|
|
227
|
-
var _exitFullscreen = (0, _asyncToGenerator2.default)(_regenerator.default.mark(function _callee3() {
|
|
228
|
-
return _regenerator.default.wrap(function _callee3$(_context3) {
|
|
229
|
-
while (1) {
|
|
230
|
-
switch (_context3.prev = _context3.next) {
|
|
231
|
-
case 0:
|
|
232
|
-
if (!document.exitFullscreen) {
|
|
233
|
-
_context3.next = 5;
|
|
234
|
-
break;
|
|
235
|
-
}
|
|
236
|
-
|
|
237
|
-
_context3.next = 3;
|
|
238
|
-
return document.exitFullscreen();
|
|
239
|
-
|
|
240
|
-
case 3:
|
|
241
|
-
_context3.next = 6;
|
|
242
|
-
break;
|
|
243
|
-
|
|
244
|
-
case 5:
|
|
245
|
-
this.togglePseudoFullscreen();
|
|
246
|
-
|
|
247
|
-
case 6:
|
|
248
|
-
case "end":
|
|
249
|
-
return _context3.stop();
|
|
250
|
-
}
|
|
251
|
-
}
|
|
252
|
-
}, _callee3, this);
|
|
253
|
-
}));
|
|
254
|
-
|
|
255
|
-
function exitFullscreen() {
|
|
256
|
-
return _exitFullscreen.apply(this, arguments);
|
|
257
|
-
}
|
|
258
|
-
|
|
259
|
-
return exitFullscreen;
|
|
260
|
-
}();
|
|
261
|
-
|
|
262
|
-
_proto.togglePseudoFullscreen = function togglePseudoFullscreen() {
|
|
263
|
-
var _this$getContainer;
|
|
264
|
-
|
|
265
|
-
(_this$getContainer = this.getContainer()) === null || _this$getContainer === void 0 ? void 0 : _this$getContainer.classList.toggle('deck-pseudo-fullscreen');
|
|
266
|
-
};
|
|
267
|
-
|
|
268
|
-
return FullscreenWidget;
|
|
269
|
-
}();
|
|
270
|
-
|
|
271
|
-
exports.FullscreenWidget = FullscreenWidget;
|
|
272
|
-
//# sourceMappingURL=fullscreen-widget.js.map
|