@mint-ui/map 0.7.2-beta → 0.7.4-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 -10
- package/dist/components/mint-map/MintMap.js +6 -6
- package/dist/components/mint-map/core/MintMapCanvasRenderer.d.ts +4 -4
- package/dist/components/mint-map/core/MintMapController.d.ts +69 -66
- package/dist/components/mint-map/core/MintMapController.js +62 -10
- package/dist/components/mint-map/core/MintMapCore.d.ts +3 -3
- package/dist/components/mint-map/core/advanced/MapBuildingProjection.d.ts +15 -15
- package/dist/components/mint-map/core/advanced/MapLoadingComponents.d.ts +17 -17
- package/dist/components/mint-map/core/advanced/index.d.ts +3 -3
- package/dist/components/mint-map/core/advanced/shapes/CircleMarker.d.ts +22 -22
- package/dist/components/mint-map/core/advanced/shapes/CircleMarker.js +6 -6
- package/dist/components/mint-map/core/advanced/shapes/PolygonMarker.d.ts +28 -28
- package/dist/components/mint-map/core/advanced/shapes/PolygonMarker.js +6 -6
- package/dist/components/mint-map/core/advanced/shapes/base/SVGCircle.d.ts +8 -8
- package/dist/components/mint-map/core/advanced/shapes/base/SVGPolygon.d.ts +12 -12
- package/dist/components/mint-map/core/advanced/shapes/base/SVGRect.d.ts +10 -10
- package/dist/components/mint-map/core/advanced/shapes/base/index.d.ts +3 -3
- package/dist/components/mint-map/core/advanced/shapes/index.d.ts +3 -3
- package/dist/components/mint-map/core/hooks/MarkerMovingHook.d.ts +6 -6
- 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/cluster.d.ts +18 -18
- package/dist/components/mint-map/core/util/geo.d.ts +38 -38
- package/dist/components/mint-map/core/util/index.d.ts +7 -7
- package/dist/components/mint-map/core/util/log.d.ts +1 -1
- package/dist/components/mint-map/core/util/polygon.d.ts +42 -42
- package/dist/components/mint-map/core/util/status.d.ts +9 -9
- package/dist/components/mint-map/core/util/waiting.d.ts +1 -1
- package/dist/components/mint-map/core/wrapper/MapCanvasMarkerWrapper.d.ts +27 -27
- package/dist/components/mint-map/core/wrapper/MapCanvasMarkerWrapper.js +6 -6
- package/dist/components/mint-map/core/wrapper/MapCanvasWrapper.d.ts +11 -11
- package/dist/components/mint-map/core/wrapper/MapCanvasWrapper.js +6 -6
- package/dist/components/mint-map/core/wrapper/MapControlWrapper.d.ts +19 -19
- package/dist/components/mint-map/core/wrapper/MapControlWrapper.js +6 -6
- package/dist/components/mint-map/core/wrapper/MapMarkerWrapper.d.ts +51 -51
- package/dist/components/mint-map/core/wrapper/MapMarkerWrapper.js +6 -6
- package/dist/components/mint-map/core/wrapper/MapPolygonWrapper.d.ts +12 -12
- package/dist/components/mint-map/core/wrapper/MapPolygonWrapper.js +6 -6
- package/dist/components/mint-map/core/wrapper/MapPolylineWrapper.d.ts +12 -12
- package/dist/components/mint-map/core/wrapper/MapPolylineWrapper.js +6 -6
- package/dist/components/mint-map/core/wrapper/index.d.ts +6 -6
- package/dist/components/mint-map/google/GoogleMintMapController.d.ts +53 -51
- package/dist/components/mint-map/google/GoogleMintMapController.js +17 -6
- package/dist/components/mint-map/index.d.ts +5 -5
- package/dist/components/mint-map/kakao/KakaoMintMapController.d.ts +57 -55
- package/dist/components/mint-map/kakao/KakaoMintMapController.js +22 -13
- package/dist/components/mint-map/naver/NaverMintMapController.d.ts +55 -53
- package/dist/components/mint-map/naver/NaverMintMapController.js +20 -11
- package/dist/components/mint-map/types/CommonTypes.d.ts +11 -11
- package/dist/components/mint-map/types/MapDrawables.d.ts +118 -118
- package/dist/components/mint-map/types/MapDrawables.js +8 -8
- package/dist/components/mint-map/types/MapEventTypes.d.ts +44 -44
- package/dist/components/mint-map/types/MapTypes.d.ts +60 -60
- package/dist/components/mint-map/types/MapTypes.js +13 -13
- package/dist/components/mint-map/types/MintMapEvents.d.ts +25 -25
- package/dist/components/mint-map/types/MintMapProps.d.ts +106 -101
- package/dist/components/mint-map/types/index.d.ts +6 -6
- package/dist/index.d.ts +7 -7
- package/dist/index.es.js +195 -114
- package/dist/index.umd.js +195 -114
- package/package.json +77 -77
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,10 +1,10 @@
|
|
|
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;
|
|
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;
|
|
@@ -23,12 +23,12 @@ var DEFAULT_CENTER = {
|
|
|
23
23
|
lat: 37.5036845,
|
|
24
24
|
lng: 127.0448698
|
|
25
25
|
};
|
|
26
|
-
/**
|
|
27
|
-
* Mint Map 컴포넌트
|
|
28
|
-
*
|
|
29
|
-
* @param {MintMapProps} MintMapProps
|
|
30
|
-
*
|
|
31
|
-
* @returns {JSX.Element} JSX
|
|
26
|
+
/**
|
|
27
|
+
* Mint Map 컴포넌트
|
|
28
|
+
*
|
|
29
|
+
* @param {MintMapProps} MintMapProps
|
|
30
|
+
*
|
|
31
|
+
* @returns {JSX.Element} JSX
|
|
32
32
|
*/
|
|
33
33
|
|
|
34
34
|
function MintMap(_a) {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export declare class MintMapCanvasRenderer {
|
|
2
|
-
context: CanvasRenderingContext2D;
|
|
3
|
-
constructor(context: CanvasRenderingContext2D);
|
|
4
|
-
}
|
|
1
|
+
export declare class MintMapCanvasRenderer {
|
|
2
|
+
context: CanvasRenderingContext2D;
|
|
3
|
+
constructor(context: CanvasRenderingContext2D);
|
|
4
|
+
}
|
|
@@ -1,66 +1,69 @@
|
|
|
1
|
-
import { MapType, MapVendorType } from '../types/CommonTypes';
|
|
2
|
-
import { Drawable, Marker, MarkerOptions, Polygon, PolygonOptions, Polyline, PolylineOptions } from '../types/MapDrawables';
|
|
3
|
-
import { EventCallback, EventParamType, MapEvent, MapEventName, MapUIEvent } from '../types/MapEventTypes';
|
|
4
|
-
import { Bounds, Offset, Position } from '../types/MapTypes';
|
|
5
|
-
import { MintMapProps } from '../types/MintMapProps';
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
abstract
|
|
9
|
-
abstract
|
|
10
|
-
abstract
|
|
11
|
-
abstract
|
|
12
|
-
abstract
|
|
13
|
-
abstract
|
|
14
|
-
abstract
|
|
15
|
-
abstract
|
|
16
|
-
abstract
|
|
17
|
-
abstract
|
|
18
|
-
abstract
|
|
19
|
-
abstract
|
|
20
|
-
abstract
|
|
21
|
-
abstract
|
|
22
|
-
abstract
|
|
23
|
-
abstract
|
|
24
|
-
abstract
|
|
25
|
-
abstract
|
|
26
|
-
abstract
|
|
27
|
-
abstract
|
|
28
|
-
abstract
|
|
29
|
-
abstract
|
|
30
|
-
abstract
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
abstract
|
|
34
|
-
abstract
|
|
35
|
-
abstract
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
*
|
|
51
|
-
*
|
|
52
|
-
* @
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
1
|
+
import { MapType, MapVendorType } from '../types/CommonTypes';
|
|
2
|
+
import { Drawable, Marker, MarkerOptions, Polygon, PolygonOptions, Polyline, PolylineOptions } from '../types/MapDrawables';
|
|
3
|
+
import { EventCallback, EventParamType, MapEvent, MapEventName, MapUIEvent } from '../types/MapEventTypes';
|
|
4
|
+
import { Bounds, Offset, Position } from '../types/MapTypes';
|
|
5
|
+
import { MintMapProps } from '../types/MintMapProps';
|
|
6
|
+
import { Property } from "csstype";
|
|
7
|
+
export declare abstract class MintMapController {
|
|
8
|
+
abstract type: MapType;
|
|
9
|
+
abstract map: MapVendorType | null;
|
|
10
|
+
abstract scriptUrl: string;
|
|
11
|
+
abstract scriptModules: string[];
|
|
12
|
+
abstract initializingMap(divElement: HTMLDivElement): Promise<MapVendorType>;
|
|
13
|
+
abstract destroyMap(): void;
|
|
14
|
+
abstract loadMapApi(): Promise<boolean>;
|
|
15
|
+
abstract getCurrBounds(): Bounds;
|
|
16
|
+
abstract panningTo(targetCenter: Position): void;
|
|
17
|
+
abstract getZoomLevel(): number;
|
|
18
|
+
abstract setZoomLevel(zoom: number): void;
|
|
19
|
+
abstract getCenter(): Position;
|
|
20
|
+
abstract setCenter(position: Position): void;
|
|
21
|
+
abstract setMapCursor(cursor: Property.Cursor): void;
|
|
22
|
+
abstract createMarker(marker: Marker): void;
|
|
23
|
+
abstract updateMarker(marker: Marker, options: MarkerOptions): void;
|
|
24
|
+
abstract clearDrawable(drawable: Drawable): boolean;
|
|
25
|
+
abstract markerToTheTop(marker: Marker): void;
|
|
26
|
+
abstract isMapDragged(): boolean;
|
|
27
|
+
abstract setMapDragged(value: boolean): void;
|
|
28
|
+
abstract setMarkerZIndex(marker: Marker, zIndex: number): void;
|
|
29
|
+
abstract createPolyline(polyline: Polyline): void;
|
|
30
|
+
abstract updatePolyline(polyline: Polyline, options: PolylineOptions): void;
|
|
31
|
+
abstract createPolygon(polygon: Polygon): void;
|
|
32
|
+
abstract updatePolygon(polygon: Polygon, options: PolygonOptions): void;
|
|
33
|
+
protected abstract mapEvent: MapEvent;
|
|
34
|
+
protected abstract mapUIEvent: MapUIEvent;
|
|
35
|
+
abstract addEventListener(eventName: MapEventName, callback: EventCallback<EventParamType>): void;
|
|
36
|
+
abstract removeEventListener(eventName: MapEventName, callback: EventCallback<EventParamType>): void;
|
|
37
|
+
abstract removeAllEventListener(eventName?: MapEventName): void;
|
|
38
|
+
mapProps: MintMapProps;
|
|
39
|
+
mapApiLoaded: boolean;
|
|
40
|
+
mapInitialized: boolean;
|
|
41
|
+
mapDivElement: HTMLDivElement;
|
|
42
|
+
constructor(props: MintMapProps);
|
|
43
|
+
getMap(): MapVendorType | null;
|
|
44
|
+
getMapType(): MapType;
|
|
45
|
+
positionToOffset(position: Position): Offset;
|
|
46
|
+
offsetToPosition(offset: Offset): Position;
|
|
47
|
+
loadScript(url: string, id: string, checkLoaded: () => boolean): Promise<boolean>;
|
|
48
|
+
getRandomFunctionName(prefix: string): string;
|
|
49
|
+
/**
|
|
50
|
+
* URL 빌더 메서드
|
|
51
|
+
*
|
|
52
|
+
* @param {string} baseUrl: 기본 URL
|
|
53
|
+
* @param {{ [ key: string ]: string | string[] }} param: 파라미터 JSON
|
|
54
|
+
* @returns {string} URL
|
|
55
|
+
*/
|
|
56
|
+
buildUrl(baseUrl: string, param: {
|
|
57
|
+
[key: string]: string | string[] | boolean;
|
|
58
|
+
}): string;
|
|
59
|
+
private processedTime;
|
|
60
|
+
/**
|
|
61
|
+
* 쓰로틀링 처리
|
|
62
|
+
* @returns
|
|
63
|
+
*/
|
|
64
|
+
checkBoundsChangeThrottleTime(): boolean;
|
|
65
|
+
getBaseToMapZoom(zoomBase: number): number;
|
|
66
|
+
getMapToBaseZoom(mapZoom: number): number;
|
|
67
|
+
focusPositionsToFitViewport(positions: Position[]): void;
|
|
68
|
+
printStatus(): void;
|
|
69
|
+
}
|