zds-pickers 4.1.0 → 4.1.3

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.
Files changed (68) hide show
  1. package/dist/index.cjs.js +9 -9
  2. package/dist/index.cjs.js.map +1 -1
  3. package/dist/index.es.js +56 -57
  4. package/dist/index.es.js.map +1 -1
  5. package/dist/other/SoundFontProvider.js +5 -4
  6. package/dist/pickers/KeyPicker.js +1 -2
  7. package/dist/types/other/SoundFontProvider.d.ts +1 -1
  8. package/dist/types/pickers/KeyPicker.d.ts +1 -4
  9. package/lib/soundfonts/acoustic_grand_piano-mp3.js +107 -0
  10. package/package.json +5 -1
  11. package/.editorconfig +0 -19
  12. package/.github/workflows/codeql-analysis.yml +0 -67
  13. package/.nvmrc +0 -1
  14. package/.prettierignore +0 -0
  15. package/.prettierrc +0 -13
  16. package/.storybook/main.ts +0 -42
  17. package/.storybook/manager.ts +0 -12
  18. package/.storybook/preview.tsx +0 -26
  19. package/.vscode/extensions.json +0 -32
  20. package/.vscode/javascript.code-snippets +0 -229
  21. package/.vscode/settings.json +0 -358
  22. package/biome.jsonc +0 -158
  23. package/lib/@types/nebiru-react-rotary-knob.d.ts +0 -20
  24. package/lib/@types/react-svgmt.d.ts +0 -74
  25. package/lib/@types/zds-mappings.d.ts +0 -55
  26. package/lib/@types/zds-react-piano.d.ts +0 -17
  27. package/lib/hooks/useComponentSize.ts +0 -52
  28. package/lib/hooks/useStateWithDynamicDefault.ts +0 -13
  29. package/lib/index.ts +0 -52
  30. package/lib/midi/ccValues.ts +0 -139
  31. package/lib/midi/export.ts +0 -88
  32. package/lib/other/DefaultTooltip.ts +0 -14
  33. package/lib/other/OctavePlayer.tsx +0 -139
  34. package/lib/other/SoundFontProvider.tsx +0 -213
  35. package/lib/other/SvgText.tsx +0 -221
  36. package/lib/pickers/CCPicker.tsx +0 -28
  37. package/lib/pickers/ChannelMappingPicker.tsx +0 -150
  38. package/lib/pickers/ChannelPicker.tsx +0 -84
  39. package/lib/pickers/KeyPicker.tsx +0 -56
  40. package/lib/pickers/Knob.tsx +0 -93
  41. package/lib/pickers/KnobPicker.tsx +0 -93
  42. package/lib/pickers/LatchPicker.tsx +0 -33
  43. package/lib/pickers/MappingPicker.tsx +0 -68
  44. package/lib/pickers/NotePicker.tsx +0 -95
  45. package/lib/pickers/PianoPicker.tsx +0 -81
  46. package/lib/pickers/PolarityPicker.tsx +0 -39
  47. package/lib/pickers/ResponseCurve.tsx +0 -251
  48. package/lib/pickers/ResponseCurvePicker.tsx +0 -75
  49. package/lib/pickers/Select.tsx +0 -268
  50. package/lib/pickers/StatusPicker.tsx +0 -30
  51. package/lib/pickers/ValuePicker.tsx +0 -67
  52. package/lib/pickers/knobSkin10.tsx +0 -112
  53. package/lib/rotaryKnob/InternalInput.tsx +0 -43
  54. package/lib/rotaryKnob/Types.ts +0 -6
  55. package/lib/rotaryKnob/helpers/DrawCircle.tsx +0 -41
  56. package/lib/rotaryKnob/helpers/DrawLine.tsx +0 -32
  57. package/lib/rotaryKnob/helpers/HelpersOverlay.tsx +0 -43
  58. package/lib/rotaryKnob/helpers/KnobVisualHelpers.tsx +0 -138
  59. package/lib/rotaryKnob/index.tsx +0 -417
  60. package/lib/rotaryKnob/knobdefaultskin.ts +0 -69
  61. package/lib/rotaryKnob/utils.ts +0 -112
  62. package/lib/utils.ts +0 -41
  63. package/stories/assets/sampleStyles.css +0 -365
  64. package/stories/assets/utils.js +0 -7
  65. package/stories/picker.stories.tsx +0 -432
  66. package/tsconfig.json +0 -35
  67. package/vite.config.ts +0 -41
  68. /package/{lib/temp → dist/soundfonts}/acoustic_grand_piano-mp3.js +0 -0
@@ -1,112 +0,0 @@
1
- const knobSkin10 = {
2
- knobX: 71.44,
3
- knobY: 71.44,
4
- svg: `
5
- <svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="207px" height="207px" viewBox="0 0 207 207" version="1.1">
6
- <!-- Generator: Sketch 47.1 (45422) - http://www.bohemiancoding.com/sketch -->
7
- <desc>Created with Sketch.</desc>
8
- <defs>
9
- <linearGradient x1="50%" y1="50%" x2="50%" y2="100%" id="27c61b0f-392f-962d-de12-cb9da898274b">
10
- <stop stop-color="#444040" stop-opacity="0.51098279" offset="0%"/>
11
- <stop stop-color="#131111" stop-opacity="0.893200861" offset="100%"/>
12
- </linearGradient>
13
- <circle id="e966567b-3869-4bcd-76b6-2cf084e45390" cx="100.497487" cy="100.497487" r="99.4974874"/>
14
- <filter x="-3.3%" y="-3.3%" width="106.5%" height="106.5%" filterUnits="objectBoundingBox" id="e2e6829f-0086-96b2-e92a-6f3809b8ac61">
15
- <feMorphology radius="0.5" operator="dilate" in="SourceAlpha" result="shadowSpreadOuter1"/>
16
- <feOffset dx="0" dy="0" in="shadowSpreadOuter1" result="shadowOffsetOuter1"/>
17
- <feGaussianBlur stdDeviation="2" in="shadowOffsetOuter1" result="shadowBlurOuter1"/>
18
- <feComposite in="shadowBlurOuter1" in2="SourceAlpha" operator="out" result="shadowBlurOuter1"/>
19
- <feColorMatrix values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.5 0" type="matrix" in="shadowBlurOuter1"/>
20
- </filter>
21
- <linearGradient x1="50%" y1="0%" x2="50%" y2="100%" id="0facd5c9-8e04-e83f-4842-8ba16f949942">
22
- <stop stop-color="#FFFFFF" stop-opacity="0.5" offset="0%"/>
23
- <stop stop-color="#000000" stop-opacity="0.5" offset="100%"/>
24
- </linearGradient>
25
- <circle id="c54189ed-7ea3-956c-f040-f0207548b268" cx="100.432161" cy="100.432161" r="86.4321608"/>
26
- <filter x="-4.0%" y="-3.5%" width="108.1%" height="108.1%" filterUnits="objectBoundingBox" id="dedf2e7e-f008-c315-f682-e424d670f210">
27
- <feMorphology radius="0.5" operator="dilate" in="SourceAlpha" result="shadowSpreadOuter1"/>
28
- <feOffset dx="0" dy="1" in="shadowSpreadOuter1" result="shadowOffsetOuter1"/>
29
- <feGaussianBlur stdDeviation="2" in="shadowOffsetOuter1" result="shadowBlurOuter1"/>
30
- <feComposite in="shadowBlurOuter1" in2="SourceAlpha" operator="out" result="shadowBlurOuter1"/>
31
- <feColorMatrix values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.5 0" type="matrix" in="shadowBlurOuter1"/>
32
- </filter>
33
-
34
- <filter x="-5.3%" y="-11.3%" width="110.7%" height="122.6%" filterUnits="objectBoundingBox" id="12f618f7-e258-b597-3ed6-242484ddad8f">
35
- <feOffset dx="0" dy="0" in="SourceAlpha" result="shadowOffsetOuter1"/>
36
- <feGaussianBlur stdDeviation="2" in="shadowOffsetOuter1" result="shadowBlurOuter1"/>
37
- <feColorMatrix values="0 0 0 0 0.915577168 0 0 0 0 0.797591325 0 0 0 0 0.601479722 0 0 0 1 0" type="matrix" in="shadowBlurOuter1"/>
38
- </filter>
39
- <pattern id="3cc0e5b8-1f0a-886b-f635-8fcb19212870" width="8.04411765" height="8.04411765" x="21.9558824" y="21.9558824" patternUnits="userSpaceOnUse">
40
- <use xlink:href="#2b8719c1-286b-ebf8-a488-ac66a6598fc5" transform="scale(0.167585784,0.167585784)"/>
41
- </pattern>
42
- <image id="2b8719c1-286b-ebf8-a488-ac66a6598fc5" width="48" height="48" xlink:href="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAYAAABXAvmHAAAEGWlDQ1BrQ0dDb2xvclNwYWNlR2VuZXJpY1JHQgAAOI2NVV1oHFUUPrtzZyMkzlNsNIV0qD8NJQ2TVjShtLp/3d02bpZJNtoi6GT27s6Yyc44M7v9oU9FUHwx6psUxL+3gCAo9Q/bPrQvlQol2tQgKD60+INQ6Ium65k7M5lpurHeZe58853vnnvuuWfvBei5qliWkRQBFpquLRcy4nOHj4g9K5CEh6AXBqFXUR0rXalMAjZPC3e1W99Dwntf2dXd/p+tt0YdFSBxH2Kz5qgLiI8B8KdVy3YBevqRHz/qWh72Yui3MUDEL3q44WPXw3M+fo1pZuQs4tOIBVVTaoiXEI/MxfhGDPsxsNZfoE1q66ro5aJim3XdoLFw72H+n23BaIXzbcOnz5mfPoTvYVz7KzUl5+FRxEuqkp9G/Ajia219thzg25abkRE/BpDc3pqvphHvRFys2weqvp+krbWKIX7nhDbzLOItiM8358pTwdirqpPFnMF2xLc1WvLyOwTAibpbmvHHcvttU57y5+XqNZrLe3lE/Pq8eUj2fXKfOe3pfOjzhJYtB/yll5SDFcSDiH+hRkH25+L+sdxKEAMZahrlSX8ukqMOWy/jXW2m6M9LDBc31B9LFuv6gVKg/0Szi3KAr1kGq1GMjU/aLbnq6/lRxc4XfJ98hTargX++DbMJBSiYMIe9Ck1YAxFkKEAG3xbYaKmDDgYyFK0UGYpfoWYXG+fAPPI6tJnNwb7ClP7IyF+D+bjOtCpkhz6CFrIa/I6sFtNl8auFXGMTP34sNwI/JhkgEtmDz14ySfaRcTIBInmKPE32kxyyE2Tv+thKbEVePDfW/byMM1Kmm0XdObS7oGD/MypMXFPXrCwOtoYjyyn7BV29/MZfsVzpLDdRtuIZnbpXzvlf+ev8MvYr/Gqk4H/kV/G3csdazLuyTMPsbFhzd1UabQbjFvDRmcWJxR3zcfHkVw9GfpbJmeev9F08WW8uDkaslwX6avlWGU6NRKz0g/SHtCy9J30o/ca9zX3Kfc19zn3BXQKRO8ud477hLnAfc1/G9mrzGlrfexZ5GLdn6ZZrrEohI2wVHhZywjbhUWEy8icMCGNCUdiBlq3r+xafL549HQ5jH+an+1y+LlYBifuxAvRN/lVVVOlwlCkdVm9NOL5BE4wkQ2SMlDZU97hX86EilU/lUmkQUztTE6mx1EEPh7OmdqBtAvv8HdWpbrJS6tJj3n0CWdM6busNzRV3S9KTYhqvNiqWmuroiKgYhshMjmhTh9ptWhsF7970j/SbMrsPE1suR5z7DMC+P/Hs+y7ijrQAlhyAgccjbhjPygfeBTjzhNqy28EdkUh8C+DU9+z2v/oyeH791OncxHOs5y2AtTc7nb/f73TWPkD/qwBnjX8BoJ98VQNcC+8AAAFFSURBVGgF7djbDYMwDAXQBjEMYqyqY1WMxTppLiJIQIA8ariWkp8IPuweO60am67r7MstY8wwjuPH7dMz3uUua63p+/7r9rePIRW/9QmQzCV9ub0YgSIgzhxvQkjFb1EZBAdEKolkfJTqtnb7bv/zOJm58moRE0AzYgFoRawAGhE7gDZEEKAJcQjQgjgFaEBcAtgRUQBmRDSAFZEEYEQkA9gQWQAmRDaABVEEYEAUAx5H4EaGOyw+SMl66mbXzNOD4k6gCPNUY/CFwF1YOn5zRxJJRINqaUbUuZA/79sd3wm3xIdbdS60rXzo2XVCbO60/HxKJgFKKv4CkEziuyKBWAE0InYAbYggQBPiEKAFcQrQgLgEsCOiAMyIaAArIgnAiEgGsCGyAEyIbAALogjAgCgGPI7AX9w6F3JtqHMhnMWLFSrSD9jOnakVHpZYAAAAAElFTkSuQmCC"/>
43
- </defs>
44
- <g id="Page-1" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
45
- <g id="s10" transform="translate(3.000000, 3.000000)">
46
- <g id="container">
47
- <g id="Oval-2">
48
- <use fill="black" fill-opacity="1" filter="url(#e2e6829f-0086-96b2-e92a-6f3809b8ac61)" xlink:href="#e966567b-3869-4bcd-76b6-2cf084e45390"/>
49
- <use stroke="#979797" stroke-width="1" fill="url(#27c61b0f-392f-962d-de12-cb9da898274b)" fill-rule="evenodd" xlink:href="#e966567b-3869-4bcd-76b6-2cf084e45390"/>
50
- </g>
51
- <g id="Oval-2">
52
- <use fill="black" fill-opacity="1" filter="url(#dedf2e7e-f008-c315-f682-e424d670f210)" xlink:href="#c54189ed-7ea3-956c-f040-f0207548b268"/>
53
- <use fill="" fill-rule="evenodd" xlink:href="#c54189ed-7ea3-956c-f040-f0207548b268"/>
54
- <use stroke="#4A4A4A" stroke-width="1" fill="url(#0facd5c9-8e04-e83f-4842-8ba16f949942)" fill-rule="evenodd" xlink:href="#c54189ed-7ea3-956c-f040-f0207548b268"/>
55
- </g>
56
- <g id="knob" transform="translate(28.574244, 28.574244)">
57
- <circle id="Oval-5" fill="#322E2E" cx="71.4356094" cy="71.4356094" r="71.4356094"/>
58
-
59
- <!-- Rotating indicator (existing) -->
60
- <path d="M72.4209282,3.63066376 L88.6786876,16.869789 C81.585496,18.1548295 76.1662428,18.7973498 72.4209282,18.7973498 C68.6756135,18.7973498 63.2563604,18.1548295 56.1631688,16.869789 L72.4209282,3.63066376 Z" id="Rectangle" fill="#E6D7D7" transform="translate(72.420928, 11.214007) scale(1, -1) translate(-72.420928, -11.214007) "/>
61
- </g>
62
-
63
- <!-- Fixed position marks (outside the rotating knob group) -->
64
- <!-- 12:00 position mark (more prominent) -->
65
- <line x1="100.0098534" y1="15" x2="100.0098534" y2="35" stroke="#CCCCCC" stroke-width="4" opacity="0.9"/>
66
-
67
- <!-- Arc fill between end position marks -->
68
- <!-- <path d="M 35 165 A 65 65 0 0 1 165 165" stroke="#666666" stroke-width="8" fill="none" opacity="0.3"/> -->
69
-
70
- <!-- End position marks (0 and 127) -->
71
- <!-- 0 position mark (40 degrees from top, clockwise) - at outer radius beyond knob edge -->
72
- <!-- This should be at the bottom-left where the value indicator points when at 0 -->
73
- <line x1="36" y1="164" x2="44" y2="156" stroke="#DDDDDD" stroke-width="4"/>
74
-
75
- <!-- 127 position mark (320 degrees from top, clockwise) - at outer radius beyond knob edge -->
76
- <!-- This should be at the bottom-right where the value indicator points when at 127 -->
77
- <line x1="164" y1="164" x2="156" y2="156" stroke="#DDDDDD" stroke-width="4"/>
78
- <g id="label">
79
- <g id="labeltext" fill-opacity="1" fill="#E6D7D7">
80
- <text id="534f4e02-5541-3607-0966-af0b025d80e0" font-family="Helvetica" font-size="44" font-weight="normal" fill="#E6D7D7" class="text-7" filter="url(#12f618f7-e258-b597-3ed6-242484ddad8f)">
81
- <tspan x="45.3246625" y="117.884225">10.10</tspan>
82
- </text>
83
- <text id="92ebe866-c281-70c7-7b0e-a373cee013a9" font-family="Helvetica" font-size="44" font-weight="normal" fill="#E6D7D7" class="text-7">
84
- <tspan x="45.3246625" y="117.884225">10.10</tspan>
85
- </text>
86
- </g>
87
- <circle id="Oval-6" stroke="#979797" fill-opacity="0.730000019" fill="url(#3cc0e5b8-1f0a-886b-f635-8fcb19212870)" transform="translate(100.351759, 100.351759) rotate(-45.000000) translate(-100.351759, -100.351759) " cx="100.351759" cy="100.351759" r="70.3517588"/>
88
- </g>
89
- </g>
90
- </g>
91
- </g>
92
- </svg>
93
- `,
94
- updateAttributes: [
95
- {
96
- element: '#labeltext text tspan',
97
- content: (_props: React.CSSProperties, value: number) => value.toFixed(0),
98
- attrs: [
99
- {
100
- name: 'text-anchor',
101
- value: (/* props, value */) => 'middle',
102
- },
103
- {
104
- name: 'x',
105
- value: (/* props, value */) => '100',
106
- },
107
- ],
108
- },
109
- ],
110
- }
111
-
112
- export { knobSkin10 }
@@ -1,43 +0,0 @@
1
- import React from 'react'
2
-
3
- type InternalInputProps = {
4
- disabled?: boolean
5
- min: number
6
- max: number
7
- value: number
8
- step?: number
9
- inputRef: React.RefObject<HTMLInputElement>
10
- onChange: (val: number) => void
11
- style?: React.CSSProperties
12
- }
13
-
14
- class InternalInput extends React.Component<InternalInputProps> {
15
- static defaultProps = {
16
- step: 1,
17
- }
18
- render() {
19
- const props = this.props
20
- const hideStyle = {}
21
-
22
- function onValChange(event: React.ChangeEvent<HTMLInputElement>) {
23
- props.onChange(Number(event.target.value))
24
- }
25
-
26
- const { value, min, max, step, onChange, inputRef, ...rest } = props
27
- return (
28
- <input
29
- ref={inputRef}
30
- value={value}
31
- step={step}
32
- onChange={onValChange}
33
- style={hideStyle}
34
- type="range"
35
- min={min}
36
- max={max}
37
- {...rest}
38
- />
39
- )
40
- }
41
- }
42
-
43
- export { InternalInput }
@@ -1,6 +0,0 @@
1
- type Point = {
2
- x: number
3
- y: number
4
- }
5
-
6
- export type { Point }
@@ -1,41 +0,0 @@
1
- import React from 'react'
2
-
3
- /**
4
- * Draws a circle with radius = r
5
- * position must be handled by parent
6
- */
7
-
8
- type DrawCircleProps = React.SVGProps<SVGCircleElement> & {
9
- r: number
10
- borderColor?: string
11
- fillColor?: string
12
- borderWidth?: number
13
- fillOpacity: number
14
- cx: number
15
- cy: number
16
- }
17
-
18
- class DrawCircle extends React.Component<DrawCircleProps> {
19
- render() {
20
- const {
21
- r,
22
- borderColor = 'black',
23
- fillColor = 'transparent',
24
- borderWidth = 2,
25
- fillOpacity = 1,
26
- ...rest
27
- } = this.props
28
-
29
- return (
30
- <circle
31
- stroke={borderColor}
32
- fill={fillColor}
33
- fillOpacity={fillOpacity}
34
- r={r}
35
- {...rest}
36
- />
37
- )
38
- }
39
- }
40
-
41
- export { DrawCircle }
@@ -1,32 +0,0 @@
1
- import React from 'react'
2
- import type { Point } from '../Types'
3
-
4
- /**
5
- * Draws a line from p1 to p2
6
- */
7
-
8
- type DrawLineProps = React.SVGProps<SVGLineElement> & {
9
- width?: number
10
- color?: string
11
- p1: Point
12
- p2: Point
13
- }
14
-
15
- class DrawLine extends React.Component<DrawLineProps> {
16
- render() {
17
- const { width = 2, color = 'black', p1, p2, ...rest } = this.props
18
- return (
19
- <line
20
- {...rest}
21
- stroke={color}
22
- strokeWidth={width}
23
- x1={p1.x}
24
- y1={p1.y}
25
- x2={p2.x}
26
- y2={p2.y}
27
- />
28
- )
29
- }
30
- }
31
-
32
- export { DrawLine }
@@ -1,43 +0,0 @@
1
- import React from 'react'
2
- import ReactDOM from 'react-dom'
3
-
4
- type HelpersOverlayProps = React.PropsWithChildren & {
5
- overlayStyle?: React.CSSProperties
6
- }
7
-
8
- /**
9
- * Draws the overlay and the children
10
- */
11
- class HelpersOverlay extends React.Component<HelpersOverlayProps> {
12
- render() {
13
- const { children, ...rest } = this.props
14
-
15
- const styles = {
16
- overlay: Object.assign(
17
- {
18
- width: '100%',
19
- height: '100vh',
20
- top: 0,
21
- left: 0,
22
- zIndex: 2147483647,
23
- margin: '0',
24
- padding: '0',
25
- boxSizing: 'border-box',
26
- position: 'fixed',
27
- },
28
- this.props.overlayStyle,
29
- ),
30
- }
31
-
32
- return ReactDOM.createPortal(
33
- <div
34
- style={styles.overlay}
35
- {...rest}>
36
- {children}
37
- </div>,
38
- document.body,
39
- )
40
- }
41
- }
42
-
43
- export { HelpersOverlay }
@@ -1,138 +0,0 @@
1
- import React from 'react'
2
- import type { Point } from '../Types'
3
- import { toRadians } from '../utils'
4
- import { DrawCircle } from './DrawCircle'
5
- import { DrawLine } from './DrawLine'
6
- import { HelpersOverlay } from './HelpersOverlay'
7
-
8
- /** Precision visual helpers */
9
-
10
- /**
11
- * Precision mode visual helpers
12
- */
13
- type KnobVisualHelpersProps = {
14
- svgRef?: SVGSVGElement
15
- radius: number
16
- minimumDragDistance: number
17
- valueAngle: number
18
- mousePos: Point
19
- }
20
-
21
- type KnobVisualHelpersState = {
22
- centerX: number
23
- centerY: number
24
- valueMarkerX: number
25
- valueMarkerY: number
26
- }
27
-
28
- class KnobVisualHelpers extends React.Component<
29
- KnobVisualHelpersProps,
30
- KnobVisualHelpersState
31
- > {
32
- state = {
33
- centerX: 0,
34
- centerY: 0,
35
- valueMarkerX: 0,
36
- valueMarkerY: 0,
37
- }
38
-
39
- static getDerivedStateFromProps(
40
- props: KnobVisualHelpersProps,
41
- state: KnobVisualHelpersState,
42
- ) {
43
- //Calculate position
44
- if (!props.svgRef) return state
45
-
46
- const vbox = props.svgRef.getBoundingClientRect()
47
- const halfWidth = vbox.width / 2
48
-
49
- //Calculate current angle segment end point
50
- //Note: Not sure why we need to subtract 90 here
51
- const valueMarkerX =
52
- props.radius * Math.cos(toRadians(props.valueAngle - 90))
53
- const valueMarkerY =
54
- props.radius * Math.sin(toRadians(props.valueAngle - 90))
55
-
56
- return {
57
- ...state,
58
- centerX: vbox.left + halfWidth,
59
- centerY: vbox.top + halfWidth,
60
- valueMarkerX,
61
- valueMarkerY,
62
- }
63
- }
64
-
65
- render() {
66
- const markCircleColor =
67
- this.props.minimumDragDistance <= this.props.radius ? 'green' : 'grey'
68
- const fillColor =
69
- this.props.minimumDragDistance <= this.props.radius
70
- ? '#88E22D'
71
- : '#D8D8D8'
72
- const minDistanceCueVisible =
73
- this.props.minimumDragDistance >= this.props.radius
74
-
75
- return (
76
- <HelpersOverlay>
77
- <svg
78
- style={{ position: 'absolute', top: '0', left: '0' }}
79
- width="100%"
80
- height="100%">
81
- <defs>
82
- <marker
83
- id="Triangle"
84
- viewBox="0 0 10 10"
85
- refX="1"
86
- refY="5"
87
- markerWidth="6"
88
- markerHeight="6"
89
- orient="auto">
90
- <path d="M 0 0 L 10 5 L 0 10 z" />
91
- </marker>
92
- </defs>
93
-
94
- {/* Current drag distance */}
95
- <DrawCircle
96
- borderColor={markCircleColor}
97
- fillColor={fillColor}
98
- fillOpacity={0.02}
99
- r={this.props.radius}
100
- cx={this.state.centerX}
101
- cy={this.state.centerY}
102
- />
103
- {/* Minimum drag distance marker */}
104
- {minDistanceCueVisible && (
105
- <DrawCircle
106
- borderColor={markCircleColor}
107
- fillColor={fillColor}
108
- fillOpacity={0}
109
- r={this.props.minimumDragDistance}
110
- cx={this.state.centerX}
111
- cy={this.state.centerY}
112
- //strokeDasharray="5, 5"
113
- />
114
- )}
115
-
116
- {/* Line to mouse position */}
117
- {/* <DrawLine
118
- p1={{ x: this.state.centerX, y: this.state.centerY }}
119
- p2={{ x: this.props.mousePos.x, y: this.props.mousePos.y }}
120
- opacity={0.4}
121
- strokeDasharray="5, 5"
122
- /> */}
123
- {/* Line to current value */}
124
- <DrawLine
125
- p1={{ x: this.state.centerX, y: this.state.centerY }}
126
- p2={{
127
- x: this.state.valueMarkerX + this.state.centerX,
128
- y: this.state.valueMarkerY + this.state.centerY,
129
- }}
130
- markerEnd="url(#Triangle)"
131
- />
132
- </svg>
133
- </HelpersOverlay>
134
- )
135
- }
136
- }
137
-
138
- export { KnobVisualHelpers }