@mint-ui/map 0.4.5-beta → 0.5.0-beta
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/.eslintrc.js +109 -109
- package/LICENSE +21 -21
- package/README.md +73 -73
- package/dist/components/mint-map/MintMap.d.ts +10 -117
- package/dist/components/mint-map/MintMap.js +24 -421
- package/dist/components/mint-map/core/MintMapCanvasRenderer.d.ts +4 -4
- package/dist/components/mint-map/core/MintMapCanvasRenderer.js +3 -1
- package/dist/components/mint-map/core/MintMapController.d.ts +64 -44
- package/dist/components/mint-map/core/MintMapController.js +49 -15
- package/dist/components/mint-map/core/MintMapCore.d.ts +3 -3
- package/dist/components/mint-map/core/MintMapCore.js +22 -10
- package/dist/components/mint-map/core/advanced/MapBuildingProjection.d.ts +15 -15
- package/dist/components/mint-map/core/advanced/MapBuildingProjection.js +11 -7
- package/dist/components/mint-map/core/advanced/MapLoadingComponents.d.ts +17 -0
- package/dist/components/mint-map/core/advanced/MapLoadingComponents.js +257 -0
- package/dist/components/mint-map/core/advanced/index.d.ts +3 -1
- package/dist/components/mint-map/core/advanced/shapes/CircleMarker.d.ts +20 -0
- package/dist/components/mint-map/core/advanced/shapes/CircleMarker.js +137 -0
- package/dist/components/mint-map/core/advanced/shapes/PolygonMarker.d.ts +23 -0
- package/dist/components/mint-map/core/advanced/shapes/PolygonMarker.js +188 -0
- package/dist/components/mint-map/core/advanced/shapes/base/SVGCircle.d.ts +8 -0
- package/dist/components/mint-map/core/advanced/shapes/base/SVGCircle.js +54 -0
- package/dist/components/mint-map/core/advanced/shapes/base/SVGPolygon.d.ts +12 -0
- package/dist/components/mint-map/core/advanced/shapes/base/SVGPolygon.js +152 -0
- package/dist/components/mint-map/core/advanced/shapes/base/SVGRect.d.ts +10 -0
- package/dist/components/mint-map/core/advanced/shapes/base/SVGRect.js +60 -0
- package/dist/components/mint-map/core/advanced/shapes/base/index.d.ts +3 -0
- package/dist/components/mint-map/core/advanced/shapes/index.d.ts +3 -0
- package/dist/components/mint-map/core/hooks/MarkerMovingHook.d.ts +6 -6
- package/dist/components/mint-map/core/hooks/MarkerMovingHook.js +21 -9
- package/dist/components/mint-map/core/hooks/index.d.ts +1 -1
- package/dist/components/mint-map/core/index.d.ts +8 -8
- package/dist/components/mint-map/core/provider/MintMapProvider.d.ts +8 -8
- package/dist/components/mint-map/core/provider/index.d.ts +1 -1
- package/dist/components/mint-map/core/util/animation.d.ts +16 -16
- package/dist/components/mint-map/core/util/animation.js +14 -5
- package/dist/components/mint-map/core/util/calculate.d.ts +66 -34
- package/dist/components/mint-map/core/util/calculate.js +233 -27
- package/dist/components/mint-map/core/util/cluster.d.ts +18 -18
- package/dist/components/mint-map/core/util/cluster.js +14 -9
- package/dist/components/mint-map/core/util/index.d.ts +4 -4
- package/dist/components/mint-map/core/util/waiting.d.ts +1 -1
- package/dist/components/mint-map/core/util/waiting.js +6 -2
- package/dist/components/mint-map/core/wrapper/MapCanvasMarkerWrapper.d.ts +27 -19
- package/dist/components/mint-map/core/wrapper/MapCanvasMarkerWrapper.js +9 -0
- package/dist/components/mint-map/core/wrapper/MapCanvasWrapper.d.ts +11 -4
- package/dist/components/mint-map/core/wrapper/MapCanvasWrapper.js +107 -35
- package/dist/components/mint-map/core/wrapper/MapControlWrapper.d.ts +18 -11
- package/dist/components/mint-map/core/wrapper/MapControlWrapper.js +8 -0
- package/dist/components/mint-map/core/wrapper/MapMarkerWrapper.d.ts +32 -23
- package/dist/components/mint-map/core/wrapper/MapMarkerWrapper.js +76 -28
- package/dist/components/mint-map/core/wrapper/MapPolygonWrapper.d.ts +12 -5
- package/dist/components/mint-map/core/wrapper/MapPolygonWrapper.js +21 -6
- package/dist/components/mint-map/core/wrapper/MapPolylineWrapper.d.ts +12 -5
- package/dist/components/mint-map/core/wrapper/MapPolylineWrapper.js +21 -7
- package/dist/components/mint-map/core/wrapper/index.d.ts +6 -6
- package/dist/components/mint-map/google/GoogleMintMapController.d.ts +51 -39
- package/dist/components/mint-map/google/GoogleMintMapController.js +224 -44
- package/dist/components/mint-map/index.d.ts +5 -4
- package/dist/components/mint-map/kakao/KakaoMintMapController.d.ts +56 -44
- package/dist/components/mint-map/kakao/KakaoMintMapController.js +265 -66
- package/dist/components/mint-map/naver/NaverMintMapController.d.ts +53 -42
- package/dist/components/mint-map/naver/NaverMintMapController.js +237 -50
- package/dist/components/mint-map/types/CommonTypes.d.ts +11 -0
- package/dist/components/mint-map/types/MapDrawables.d.ts +110 -0
- package/dist/components/mint-map/types/MapDrawables.js +92 -0
- package/dist/components/mint-map/types/MapEventTypes.d.ts +41 -0
- package/dist/components/mint-map/types/MapEventTypes.js +57 -0
- package/dist/components/mint-map/types/MapTypes.d.ts +60 -0
- package/dist/components/mint-map/types/MapTypes.js +155 -0
- package/dist/components/mint-map/types/MintMapEvents.d.ts +25 -0
- package/dist/components/mint-map/types/MintMapProps.d.ts +92 -0
- package/dist/components/mint-map/types/index.d.ts +6 -0
- package/dist/index.d.ts +7 -1
- package/dist/index.es.js +2638 -975
- package/dist/index.js +25 -9
- package/dist/index.umd.js +2644 -974
- package/package.json +77 -77
- package/test.ts +0 -7
package/.eslintrc.js
CHANGED
|
@@ -1,110 +1,110 @@
|
|
|
1
|
-
module.exports = {
|
|
2
|
-
env: {
|
|
3
|
-
browser: true,
|
|
4
|
-
node: true
|
|
5
|
-
},
|
|
6
|
-
extends: [ 'airbnb', 'airbnb/hooks', 'eslint:recommended', 'plugin:react/recommended', 'plugin:import/recommended', 'plugin:storybook/recommended' ],
|
|
7
|
-
ignorePatterns: [ '.storybook', '*.d.ts', 'node_modules', 'build', 'dist', '**/env/*.js' ],
|
|
8
|
-
overrides: [
|
|
9
|
-
{
|
|
10
|
-
files: [ '*.ts', '*.tsx' ],
|
|
11
|
-
rules: { 'no-undef': 'off' }
|
|
12
|
-
}
|
|
13
|
-
],
|
|
14
|
-
parser: '@typescript-eslint/parser',
|
|
15
|
-
parserOptions: { warnOnUnsupportedTypeScriptVersion: false },
|
|
16
|
-
plugins: [ '@typescript-eslint', 'sort-keys-fix', 'prettier' ],
|
|
17
|
-
rules: {
|
|
18
|
-
'@typescript-eslint/ban-ts-comment': [
|
|
19
|
-
'error',
|
|
20
|
-
{ 'ts-ignore': 'allow-with-description' }
|
|
21
|
-
],
|
|
22
|
-
'@typescript-eslint/no-explicit-any': 'warn',
|
|
23
|
-
'@typescript-eslint/no-unused-vars': 'error',
|
|
24
|
-
'array-bracket-spacing': [
|
|
25
|
-
'error',
|
|
26
|
-
'always',
|
|
27
|
-
{
|
|
28
|
-
arraysInArrays: false,
|
|
29
|
-
objectsInArrays: false
|
|
30
|
-
}
|
|
31
|
-
],
|
|
32
|
-
'brace-style': [ 'error', 'allman' ],
|
|
33
|
-
'class-methods-use-this': 'off',
|
|
34
|
-
'comma-dangle': [ 'error', 'never' ],
|
|
35
|
-
'eol-last': [ 'error', 'never' ],
|
|
36
|
-
'import/extensions': 'off',
|
|
37
|
-
'import/named': 'off',
|
|
38
|
-
'import/no-anonymous-default-export': 'off',
|
|
39
|
-
'import/no-cycle': 'off',
|
|
40
|
-
'import/no-extraneous-dependencies': 'off',
|
|
41
|
-
'import/no-named-as-default': 'off',
|
|
42
|
-
'import/no-unresolved': 'off',
|
|
43
|
-
'import/order': [
|
|
44
|
-
'error',
|
|
45
|
-
{
|
|
46
|
-
alphabetize: {
|
|
47
|
-
caseInsensitive: true,
|
|
48
|
-
order: 'asc'
|
|
49
|
-
},
|
|
50
|
-
groups: [ 'external', 'builtin', 'internal', 'sibling', 'parent', 'index' ],
|
|
51
|
-
'newlines-between': 'always'
|
|
52
|
-
}
|
|
53
|
-
],
|
|
54
|
-
indent: [ 'error', 'tab', { SwitchCase: 1 }],
|
|
55
|
-
'jsx-a11y/control-has-associated-label': 'off',
|
|
56
|
-
'jsx-quotes': [ 'error', 'prefer-single' ],
|
|
57
|
-
'linebreak-style': 'off',
|
|
58
|
-
'max-len': 'off',
|
|
59
|
-
'no-console': 'off',
|
|
60
|
-
'no-plusplus': 'off',
|
|
61
|
-
'no-restricted-exports': 'off',
|
|
62
|
-
'no-tabs': [ 'error', { allowIndentationTabs: true }],
|
|
63
|
-
'no-unused-vars': 'off',
|
|
64
|
-
'object-curly-newline': [ 'error', {
|
|
65
|
-
ExportDeclaration: 'never',
|
|
66
|
-
ImportDeclaration: 'never',
|
|
67
|
-
ObjectExpression: {
|
|
68
|
-
minProperties: 3,
|
|
69
|
-
multiline: true
|
|
70
|
-
},
|
|
71
|
-
ObjectPattern: { multiline: true }
|
|
72
|
-
}],
|
|
73
|
-
'react-hooks/exhaustive-deps': 'off',
|
|
74
|
-
'react/button-has-type': 'off',
|
|
75
|
-
'react/destructuring-assignment': 'off',
|
|
76
|
-
'react/function-component-definition': 'off',
|
|
77
|
-
'react/jsx-curly-brace-presence': [
|
|
78
|
-
'error',
|
|
79
|
-
{
|
|
80
|
-
children: 'never',
|
|
81
|
-
props: 'never'
|
|
82
|
-
}
|
|
83
|
-
],
|
|
84
|
-
'react/jsx-filename-extension': 'off',
|
|
85
|
-
'react/jsx-indent': [ 'error', 'tab' ],
|
|
86
|
-
'react/jsx-indent-props': [ 2, 'tab' ],
|
|
87
|
-
'react/jsx-props-no-spreading': 'off',
|
|
88
|
-
'react/jsx-sort-props': [
|
|
89
|
-
'error',
|
|
90
|
-
{
|
|
91
|
-
callbacksLast: true,
|
|
92
|
-
ignoreCase: true,
|
|
93
|
-
multiline: 'last',
|
|
94
|
-
noSortAlphabetically: false,
|
|
95
|
-
reservedFirst: false,
|
|
96
|
-
shorthandFirst: false,
|
|
97
|
-
shorthandLast: true
|
|
98
|
-
}
|
|
99
|
-
],
|
|
100
|
-
'react/prop-types': 'off',
|
|
101
|
-
'react/react-in-jsx-scope': 'off',
|
|
102
|
-
'react/require-default-props': 'off',
|
|
103
|
-
'require-jsdoc': 'off',
|
|
104
|
-
'sort-keys-fix/sort-keys-fix': 'error'
|
|
105
|
-
},
|
|
106
|
-
settings: {
|
|
107
|
-
'import/parsers': { '@typescript-eslint/parser': [ '.ts', '.tsx', '.js' ] },
|
|
108
|
-
react: { version: 'detect' }
|
|
109
|
-
}
|
|
1
|
+
module.exports = {
|
|
2
|
+
env: {
|
|
3
|
+
browser: true,
|
|
4
|
+
node: true
|
|
5
|
+
},
|
|
6
|
+
extends: [ 'airbnb', 'airbnb/hooks', 'eslint:recommended', 'plugin:react/recommended', 'plugin:import/recommended', 'plugin:storybook/recommended' ],
|
|
7
|
+
ignorePatterns: [ '.storybook', '*.d.ts', 'node_modules', 'build', 'dist', '**/env/*.js' ],
|
|
8
|
+
overrides: [
|
|
9
|
+
{
|
|
10
|
+
files: [ '*.ts', '*.tsx' ],
|
|
11
|
+
rules: { 'no-undef': 'off' }
|
|
12
|
+
}
|
|
13
|
+
],
|
|
14
|
+
parser: '@typescript-eslint/parser',
|
|
15
|
+
parserOptions: { warnOnUnsupportedTypeScriptVersion: false },
|
|
16
|
+
plugins: [ '@typescript-eslint', 'sort-keys-fix', 'prettier' ],
|
|
17
|
+
rules: {
|
|
18
|
+
'@typescript-eslint/ban-ts-comment': [
|
|
19
|
+
'error',
|
|
20
|
+
{ 'ts-ignore': 'allow-with-description' }
|
|
21
|
+
],
|
|
22
|
+
'@typescript-eslint/no-explicit-any': 'warn',
|
|
23
|
+
'@typescript-eslint/no-unused-vars': 'error',
|
|
24
|
+
'array-bracket-spacing': [
|
|
25
|
+
'error',
|
|
26
|
+
'always',
|
|
27
|
+
{
|
|
28
|
+
arraysInArrays: false,
|
|
29
|
+
objectsInArrays: false
|
|
30
|
+
}
|
|
31
|
+
],
|
|
32
|
+
'brace-style': [ 'error', 'allman' ],
|
|
33
|
+
'class-methods-use-this': 'off',
|
|
34
|
+
'comma-dangle': [ 'error', 'never' ],
|
|
35
|
+
'eol-last': [ 'error', 'never' ],
|
|
36
|
+
'import/extensions': 'off',
|
|
37
|
+
'import/named': 'off',
|
|
38
|
+
'import/no-anonymous-default-export': 'off',
|
|
39
|
+
'import/no-cycle': 'off',
|
|
40
|
+
'import/no-extraneous-dependencies': 'off',
|
|
41
|
+
'import/no-named-as-default': 'off',
|
|
42
|
+
'import/no-unresolved': 'off',
|
|
43
|
+
'import/order': [
|
|
44
|
+
'error',
|
|
45
|
+
{
|
|
46
|
+
alphabetize: {
|
|
47
|
+
caseInsensitive: true,
|
|
48
|
+
order: 'asc'
|
|
49
|
+
},
|
|
50
|
+
groups: [ 'external', 'builtin', 'internal', 'sibling', 'parent', 'index' ],
|
|
51
|
+
'newlines-between': 'always'
|
|
52
|
+
}
|
|
53
|
+
],
|
|
54
|
+
indent: [ 'error', 'tab', { SwitchCase: 1 }],
|
|
55
|
+
'jsx-a11y/control-has-associated-label': 'off',
|
|
56
|
+
'jsx-quotes': [ 'error', 'prefer-single' ],
|
|
57
|
+
'linebreak-style': 'off',
|
|
58
|
+
'max-len': 'off',
|
|
59
|
+
'no-console': 'off',
|
|
60
|
+
'no-plusplus': 'off',
|
|
61
|
+
'no-restricted-exports': 'off',
|
|
62
|
+
'no-tabs': [ 'error', { allowIndentationTabs: true }],
|
|
63
|
+
'no-unused-vars': 'off',
|
|
64
|
+
'object-curly-newline': [ 'error', {
|
|
65
|
+
ExportDeclaration: 'never',
|
|
66
|
+
ImportDeclaration: 'never',
|
|
67
|
+
ObjectExpression: {
|
|
68
|
+
minProperties: 3,
|
|
69
|
+
multiline: true
|
|
70
|
+
},
|
|
71
|
+
ObjectPattern: { multiline: true }
|
|
72
|
+
}],
|
|
73
|
+
'react-hooks/exhaustive-deps': 'off',
|
|
74
|
+
'react/button-has-type': 'off',
|
|
75
|
+
'react/destructuring-assignment': 'off',
|
|
76
|
+
'react/function-component-definition': 'off',
|
|
77
|
+
'react/jsx-curly-brace-presence': [
|
|
78
|
+
'error',
|
|
79
|
+
{
|
|
80
|
+
children: 'never',
|
|
81
|
+
props: 'never'
|
|
82
|
+
}
|
|
83
|
+
],
|
|
84
|
+
'react/jsx-filename-extension': 'off',
|
|
85
|
+
'react/jsx-indent': [ 'error', 'tab' ],
|
|
86
|
+
'react/jsx-indent-props': [ 2, 'tab' ],
|
|
87
|
+
'react/jsx-props-no-spreading': 'off',
|
|
88
|
+
'react/jsx-sort-props': [
|
|
89
|
+
'error',
|
|
90
|
+
{
|
|
91
|
+
callbacksLast: true,
|
|
92
|
+
ignoreCase: true,
|
|
93
|
+
multiline: 'last',
|
|
94
|
+
noSortAlphabetically: false,
|
|
95
|
+
reservedFirst: false,
|
|
96
|
+
shorthandFirst: false,
|
|
97
|
+
shorthandLast: true
|
|
98
|
+
}
|
|
99
|
+
],
|
|
100
|
+
'react/prop-types': 'off',
|
|
101
|
+
'react/react-in-jsx-scope': 'off',
|
|
102
|
+
'react/require-default-props': 'off',
|
|
103
|
+
'require-jsdoc': 'off',
|
|
104
|
+
'sort-keys-fix/sort-keys-fix': 'error'
|
|
105
|
+
},
|
|
106
|
+
settings: {
|
|
107
|
+
'import/parsers': { '@typescript-eslint/parser': [ '.ts', '.tsx', '.js' ] },
|
|
108
|
+
react: { version: 'detect' }
|
|
109
|
+
}
|
|
110
110
|
};
|
package/LICENSE
CHANGED
|
@@ -1,21 +1,21 @@
|
|
|
1
|
-
MIT License
|
|
2
|
-
|
|
3
|
-
Copyright (c) 2022 itcode.dev
|
|
4
|
-
|
|
5
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
-
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
-
in the Software without restriction, including without limitation the rights
|
|
8
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
-
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
-
furnished to do so, subject to the following conditions:
|
|
11
|
-
|
|
12
|
-
The above copyright notice and this permission notice shall be included in all
|
|
13
|
-
copies or substantial portions of the Software.
|
|
14
|
-
|
|
15
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
-
SOFTWARE.
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2022 itcode.dev
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,73 +1,73 @@
|
|
|
1
|
-
# @mint-ui/map
|
|
2
|
-
|
|
3
|
-
- React map library
|
|
4
|
-
- Control various map with one interface
|
|
5
|
-
- Google, Naver, Kakao map supported now
|
|
6
|
-
- Typescript supported
|
|
7
|
-
- Canvas marker supported (experimental)
|
|
8
|
-
|
|
9
|
-
## Installation
|
|
10
|
-
|
|
11
|
-
``` bash
|
|
12
|
-
yarn add @mint-ui/map
|
|
13
|
-
|
|
14
|
-
npm install @mint-ui/map
|
|
15
|
-
```
|
|
16
|
-
|
|
17
|
-
## Examples
|
|
18
|
-
|
|
19
|
-
``` javascript
|
|
20
|
-
...
|
|
21
|
-
...
|
|
22
|
-
|
|
23
|
-
import { MapMarkerWrapper, MintMap, Position } from '@mint-ui/map'
|
|
24
|
-
|
|
25
|
-
const root = ReactDOM.createRoot(
|
|
26
|
-
document.getElementById('root')
|
|
27
|
-
)
|
|
28
|
-
|
|
29
|
-
function MyMapComponent(){
|
|
30
|
-
|
|
31
|
-
return <MintMap
|
|
32
|
-
mapType={'google'}
|
|
33
|
-
mapKey={'YOUR_GOOGLE_MAP_KEY'}
|
|
34
|
-
mapId='YOUR_GOOGLE_MAP_ID' //Use advanced markers in Google maps
|
|
35
|
-
base={{center:new Position(-25.344, 131.031), zoomLevel:12}}
|
|
36
|
-
>
|
|
37
|
-
{/* Your marker */}
|
|
38
|
-
<MapMarkerWrapper position={new Position(-25.344, 131.031)}>
|
|
39
|
-
|
|
40
|
-
{/* Your marker elements */}
|
|
41
|
-
<div style={{width:'10px', height:'10px', background:'red', borderRadius:'10px'}}></div>
|
|
42
|
-
|
|
43
|
-
</MapMarkerWrapper>
|
|
44
|
-
|
|
45
|
-
{/* Overlay canvas */}
|
|
46
|
-
<MapCanvasWrapper>
|
|
47
|
-
|
|
48
|
-
{/* Canvas marker */}
|
|
49
|
-
<MapCanvasMarkerWrapper position={new Position(-25.344, 131.031)}
|
|
50
|
-
renderer={(renderer:MintMapCanvasRenderer, offset:Offset, _payload?:TestPayload)=>{
|
|
51
|
-
const {context} = renderer
|
|
52
|
-
context.fillStyle = `hsl(${(Math.random() * 360).toFixed(0)} 100% 60%)`
|
|
53
|
-
context.fillRect(Math.floor(offset.x), Math.floor(offset.y), 8, 8)
|
|
54
|
-
}}
|
|
55
|
-
boxWidth={8} boxHeight={8}
|
|
56
|
-
payload={testItem}
|
|
57
|
-
onClick={(e)=>{
|
|
58
|
-
alert('marker 1 clicked!!!'+e.x+','+e.y)
|
|
59
|
-
}}
|
|
60
|
-
></MapCanvasMarkerWrapper>
|
|
61
|
-
|
|
62
|
-
</MapCanvasWrapper>
|
|
63
|
-
|
|
64
|
-
</MintMap>
|
|
65
|
-
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
root.render((<MyMapComponent/>))
|
|
69
|
-
|
|
70
|
-
```
|
|
71
|
-
|
|
72
|
-
## Document / Reference Site
|
|
73
|
-
- To be continue...
|
|
1
|
+
# @mint-ui/map
|
|
2
|
+
|
|
3
|
+
- React map library
|
|
4
|
+
- Control various map with one interface
|
|
5
|
+
- Google, Naver, Kakao map supported now
|
|
6
|
+
- Typescript supported
|
|
7
|
+
- Canvas marker supported (experimental)
|
|
8
|
+
|
|
9
|
+
## Installation
|
|
10
|
+
|
|
11
|
+
``` bash
|
|
12
|
+
yarn add @mint-ui/map
|
|
13
|
+
|
|
14
|
+
npm install @mint-ui/map
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
## Examples
|
|
18
|
+
|
|
19
|
+
``` javascript
|
|
20
|
+
...
|
|
21
|
+
...
|
|
22
|
+
|
|
23
|
+
import { MapMarkerWrapper, MintMap, Position } from '@mint-ui/map'
|
|
24
|
+
|
|
25
|
+
const root = ReactDOM.createRoot(
|
|
26
|
+
document.getElementById('root')
|
|
27
|
+
)
|
|
28
|
+
|
|
29
|
+
function MyMapComponent(){
|
|
30
|
+
|
|
31
|
+
return <MintMap
|
|
32
|
+
mapType={'google'}
|
|
33
|
+
mapKey={'YOUR_GOOGLE_MAP_KEY'}
|
|
34
|
+
mapId='YOUR_GOOGLE_MAP_ID' //Use advanced markers in Google maps
|
|
35
|
+
base={{center:new Position(-25.344, 131.031), zoomLevel:12}}
|
|
36
|
+
>
|
|
37
|
+
{/* Your marker */}
|
|
38
|
+
<MapMarkerWrapper position={new Position(-25.344, 131.031)}>
|
|
39
|
+
|
|
40
|
+
{/* Your marker elements */}
|
|
41
|
+
<div style={{width:'10px', height:'10px', background:'red', borderRadius:'10px'}}></div>
|
|
42
|
+
|
|
43
|
+
</MapMarkerWrapper>
|
|
44
|
+
|
|
45
|
+
{/* Overlay canvas */}
|
|
46
|
+
<MapCanvasWrapper>
|
|
47
|
+
|
|
48
|
+
{/* Canvas marker */}
|
|
49
|
+
<MapCanvasMarkerWrapper position={new Position(-25.344, 131.031)}
|
|
50
|
+
renderer={(renderer:MintMapCanvasRenderer, offset:Offset, _payload?:TestPayload)=>{
|
|
51
|
+
const {context} = renderer
|
|
52
|
+
context.fillStyle = `hsl(${(Math.random() * 360).toFixed(0)} 100% 60%)`
|
|
53
|
+
context.fillRect(Math.floor(offset.x), Math.floor(offset.y), 8, 8)
|
|
54
|
+
}}
|
|
55
|
+
boxWidth={8} boxHeight={8}
|
|
56
|
+
payload={testItem}
|
|
57
|
+
onClick={(e)=>{
|
|
58
|
+
alert('marker 1 clicked!!!'+e.x+','+e.y)
|
|
59
|
+
}}
|
|
60
|
+
></MapCanvasMarkerWrapper>
|
|
61
|
+
|
|
62
|
+
</MapCanvasWrapper>
|
|
63
|
+
|
|
64
|
+
</MintMap>
|
|
65
|
+
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
root.render((<MyMapComponent/>))
|
|
69
|
+
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
## Document / Reference Site
|
|
73
|
+
- To be continue...
|
|
@@ -1,117 +1,10 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
base?: BaseProps;
|
|
12
|
-
visible?: boolean;
|
|
13
|
-
center?: Position;
|
|
14
|
-
centerMoveWithPanning?: boolean;
|
|
15
|
-
zoomLevel?: number;
|
|
16
|
-
draggable?: boolean;
|
|
17
|
-
keyboardShortcuts?: boolean;
|
|
18
|
-
markerCache?: boolean;
|
|
19
|
-
markerCachePoolSize?: number;
|
|
20
|
-
boundsChangeThrottlingTime?: number;
|
|
21
|
-
dissolveEffectWhenLoaded?: boolean;
|
|
22
|
-
mapLoadingComponent?: () => JSX.Element;
|
|
23
|
-
}
|
|
24
|
-
export interface MintMapEvents {
|
|
25
|
-
onBoundsChanged?: (bounds: Bounds) => void;
|
|
26
|
-
onZoomChanged?: (level: number) => void;
|
|
27
|
-
onLoad?: (map: MapVendorType, controller: MintMapController) => void;
|
|
28
|
-
onClick?: (positon: Position) => void;
|
|
29
|
-
onMouseMove?: (positon: Position) => void;
|
|
30
|
-
}
|
|
31
|
-
export declare class Position {
|
|
32
|
-
lat: number;
|
|
33
|
-
lng: number;
|
|
34
|
-
offset?: Offset;
|
|
35
|
-
constructor(lat: number, lng: number);
|
|
36
|
-
static equals(pos1: Position, pos2: Position): boolean;
|
|
37
|
-
}
|
|
38
|
-
export declare class Bounds {
|
|
39
|
-
nw: Position;
|
|
40
|
-
se: Position;
|
|
41
|
-
ne: Position;
|
|
42
|
-
sw: Position;
|
|
43
|
-
constructor(nw?: Position, se?: Position, ne?: Position, sw?: Position);
|
|
44
|
-
static fromNWSE(nw: Position, se: Position): Bounds;
|
|
45
|
-
static fromNESW(ne: Position, sw: Position): Bounds;
|
|
46
|
-
private covertNWSEtoNESW;
|
|
47
|
-
private covertNESWtoNWSE;
|
|
48
|
-
getCenter(): Position;
|
|
49
|
-
includesPosition(pos: Position): boolean;
|
|
50
|
-
getIncludedPositions(positions: Position[]): Position[];
|
|
51
|
-
includes(positions: Position | Position[]): boolean;
|
|
52
|
-
includesOnlyOnePoint(positions: Position[]): boolean;
|
|
53
|
-
intersects(positions: Position[]): boolean;
|
|
54
|
-
}
|
|
55
|
-
export declare class Offset {
|
|
56
|
-
x: number;
|
|
57
|
-
y: number;
|
|
58
|
-
constructor(x: number, y: number);
|
|
59
|
-
}
|
|
60
|
-
export interface BaseProps {
|
|
61
|
-
center?: Position;
|
|
62
|
-
zoomLevel?: number;
|
|
63
|
-
maxZoomLevel?: number;
|
|
64
|
-
minZoomLevel?: number;
|
|
65
|
-
}
|
|
66
|
-
export interface DrawableOptions {
|
|
67
|
-
position: Position | Position[] | [number, number][];
|
|
68
|
-
visible?: boolean;
|
|
69
|
-
event?: Map<keyof DocumentEventMap, (e: Event) => boolean | void>;
|
|
70
|
-
}
|
|
71
|
-
export declare abstract class Drawable {
|
|
72
|
-
native?: any;
|
|
73
|
-
abstract options: DrawableOptions;
|
|
74
|
-
}
|
|
75
|
-
export interface MarkerOptions extends DrawableOptions {
|
|
76
|
-
anchor?: Offset;
|
|
77
|
-
zIndex?: number;
|
|
78
|
-
}
|
|
79
|
-
export declare class Marker extends Drawable {
|
|
80
|
-
options: MarkerOptions;
|
|
81
|
-
element?: string | HTMLElement;
|
|
82
|
-
constructor(options: MarkerOptions);
|
|
83
|
-
}
|
|
84
|
-
export interface PolylineOptions extends DrawableOptions {
|
|
85
|
-
lineColor?: string;
|
|
86
|
-
lineSize?: number;
|
|
87
|
-
lineOpacity?: number;
|
|
88
|
-
editable?: boolean;
|
|
89
|
-
}
|
|
90
|
-
export declare class Polyline extends Drawable {
|
|
91
|
-
options: PolylineOptions;
|
|
92
|
-
constructor(options: PolylineOptions);
|
|
93
|
-
}
|
|
94
|
-
export interface PolygonOptions extends PolylineOptions {
|
|
95
|
-
innerPositions?: Position[][];
|
|
96
|
-
fillColor?: string;
|
|
97
|
-
fillOpacity?: number;
|
|
98
|
-
}
|
|
99
|
-
export declare class Polygon extends Drawable {
|
|
100
|
-
options: PolygonOptions;
|
|
101
|
-
constructor(options: PolygonOptions);
|
|
102
|
-
getCenter(): Position;
|
|
103
|
-
}
|
|
104
|
-
export declare function MintMap({ mapLoadingComponent, dissolveEffectWhenLoaded, mapType, children, base, ...props }: PropsWithChildren<MintMapProps>): JSX.Element;
|
|
105
|
-
export interface PointLoadingProps {
|
|
106
|
-
text?: string;
|
|
107
|
-
pointCount?: number;
|
|
108
|
-
speedMs?: number;
|
|
109
|
-
}
|
|
110
|
-
export declare function PointLoading({ text, pointCount, speedMs }: PointLoadingProps): JSX.Element;
|
|
111
|
-
export declare function MapLoadingWithImage({ size }: MapImageLoadingProps): JSX.Element;
|
|
112
|
-
interface MapImageLoadingProps {
|
|
113
|
-
size?: number;
|
|
114
|
-
duration?: number;
|
|
115
|
-
delay?: number;
|
|
116
|
-
}
|
|
117
|
-
export {};
|
|
1
|
+
import { PropsWithChildren } from "react";
|
|
2
|
+
import { MintMapProps } from "./types/MintMapProps";
|
|
3
|
+
/**
|
|
4
|
+
* Mint Map 컴포넌트
|
|
5
|
+
*
|
|
6
|
+
* @param {MintMapProps} MintMapProps
|
|
7
|
+
*
|
|
8
|
+
* @returns {JSX.Element} JSX
|
|
9
|
+
*/
|
|
10
|
+
export declare function MintMap({ mapLoadingComponent, dissolveEffectWhenLoaded, mapType, children, base, ...props }: PropsWithChildren<MintMapProps>): JSX.Element;
|