mirror of https://gitee.com/antv-l7/antv-l7
commit
1fbcf4b46d
|
@ -44,7 +44,7 @@ module.exports = api => {
|
||||||
{
|
{
|
||||||
// https://babeljs.io/docs/en/babel-preset-env#usebuiltins
|
// https://babeljs.io/docs/en/babel-preset-env#usebuiltins
|
||||||
// useBuiltIns: 'usage',
|
// useBuiltIns: 'usage',
|
||||||
...isCDNBundle ? { corejs: '2.0.0' } : {},
|
...isCDNBundle ? { corejs: '3.0.0' } : {},
|
||||||
useBuiltIns: isCDNBundle ? 'usage' : false,
|
useBuiltIns: isCDNBundle ? 'usage' : false,
|
||||||
// set `modules: false` when building CDN bundle, let rollup do commonjs works
|
// set `modules: false` when building CDN bundle, let rollup do commonjs works
|
||||||
// @see https://github.com/rollup/rollup-plugin-babel#modules
|
// @see https://github.com/rollup/rollup-plugin-babel#modules
|
||||||
|
|
|
@ -323,6 +323,14 @@ scene.setPitch(pitch);
|
||||||
scene.fitBounds([112, 32, 114, 35]);
|
scene.fitBounds([112, 32, 114, 35]);
|
||||||
```
|
```
|
||||||
|
|
||||||
|
### getContainer
|
||||||
|
|
||||||
|
获取地图容器 return htmlElement
|
||||||
|
|
||||||
|
```javascript
|
||||||
|
scene.getContainer();
|
||||||
|
```
|
||||||
|
|
||||||
### removeLayer
|
### removeLayer
|
||||||
|
|
||||||
移除 layer
|
移除 layer
|
||||||
|
|
|
@ -208,6 +208,14 @@ scene.getPitch();
|
||||||
|
|
||||||
return {number} pitch
|
return {number} pitch
|
||||||
|
|
||||||
|
### getContainer
|
||||||
|
|
||||||
|
获取地图容器 return htmlElement
|
||||||
|
|
||||||
|
```javascript
|
||||||
|
scene.getContainer();
|
||||||
|
```
|
||||||
|
|
||||||
### setMapStyle
|
### setMapStyle
|
||||||
|
|
||||||
参数:`style` {string} 地图样式 具体样式格式和各底图设置方法一致
|
参数:`style` {string} 地图样式 具体样式格式和各底图设置方法一致
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
{
|
{
|
||||||
"filename": "covid_grid.tsx",
|
"filename": "covid_grid.tsx",
|
||||||
"title": "世界地图网格背景",
|
"title": "世界地图网格背景",
|
||||||
"screenshot": "https://gw.alipayobjects.com/mdn/rms_855bab/afts/img/A*YYNtRZpxH_4AAAAAAAAAAABkARQnAQ"
|
"screenshot": "https://gw.alipayobjects.com/mdn/rms_23a451/afts/img/A*CSUXTIYXXFwAAAAAAAAAAABkARQnAQ"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"filename": "covid_animate.tsx",
|
"filename": "covid_animate.tsx",
|
||||||
|
|
|
@ -149,7 +149,7 @@
|
||||||
"coveralls": "jest --coverage && cat ./tests/coverage/lcov.info | coveralls",
|
"coveralls": "jest --coverage && cat ./tests/coverage/lcov.info | coveralls",
|
||||||
"tsc": "tsc",
|
"tsc": "tsc",
|
||||||
"watch": "yarn clean && lerna exec --parallel -- cross-env BABEL_ENV=cjs NODE_ENV=production babel --watch src --root-mode upward --out-dir lib --source-maps --extensions .ts,.tsx --delete-dir-on-start --no-comments",
|
"watch": "yarn clean && lerna exec --parallel -- cross-env BABEL_ENV=cjs NODE_ENV=production babel --watch src --root-mode upward --out-dir lib --source-maps --extensions .ts,.tsx --delete-dir-on-start --no-comments",
|
||||||
"bundle": "cross-env BABEL_ENV=bundle node_modules/.bin/rollup -c ./build/rollup.config.js --environment BUILD:production,MINIFY:true",
|
"bundle": "cross-env BABEL_ENV=bundle NODE_ENV=production node_modules/.bin/rollup -c ./build/rollup.config.js --environment BUILD:production,MINIFY:true",
|
||||||
"bundle-dev": "cross-env BABEL_ENV=bundle node_modules/.bin/rollup -c ./build/rollup.config.js --environment 'BUILD:production,MINIFY:false'",
|
"bundle-dev": "cross-env BABEL_ENV=bundle node_modules/.bin/rollup -c ./build/rollup.config.js --environment 'BUILD:production,MINIFY:false'",
|
||||||
"bundle:watch": "cross-env BABEL_ENV=bundle node_modules/.bin/rollup -c ./build/rollup.config.js --watch",
|
"bundle:watch": "cross-env BABEL_ENV=bundle node_modules/.bin/rollup -c ./build/rollup.config.js --watch",
|
||||||
"glsl-minify": "node_modules/.bin/glsl-minifier -i ./build/example.frag -o ./build/example.min.frag",
|
"glsl-minify": "node_modules/.bin/glsl-minifier -i ./build/example.frag -o ./build/example.min.frag",
|
||||||
|
@ -175,7 +175,6 @@
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"resolutions": {
|
"resolutions": {
|
||||||
"../core-js": "3",
|
|
||||||
"d3-array": "1"
|
"d3-array": "1"
|
||||||
},
|
},
|
||||||
"tnpm": {
|
"tnpm": {
|
||||||
|
|
|
@ -31,6 +31,10 @@
|
||||||
"lint:ts": "run-p -c lint:ts-*",
|
"lint:ts": "run-p -c lint:ts-*",
|
||||||
"test": "jest"
|
"test": "jest"
|
||||||
},
|
},
|
||||||
|
"dependencies": {
|
||||||
|
"@antv/l7": "^2.1.3",
|
||||||
|
"@babel/runtime": "^7.7.7"
|
||||||
|
},
|
||||||
"bugs": {
|
"bugs": {
|
||||||
"url": "https://github.com/antvis/L7/issues"
|
"url": "https://github.com/antvis/L7/issues"
|
||||||
},
|
},
|
||||||
|
|
|
@ -0,0 +1,22 @@
|
||||||
|
import { ILayer } from '@antv/l7';
|
||||||
|
import DrawFeature from './draw_feature';
|
||||||
|
|
||||||
|
export default class DrawCircle extends DrawFeature {
|
||||||
|
private center: [number, number];
|
||||||
|
private drawCircleLayer: ILayer;
|
||||||
|
protected onDragStart() {
|
||||||
|
// @ts-ignore
|
||||||
|
this.scene.map.dragdrag.disable();
|
||||||
|
}
|
||||||
|
protected onDragging() {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected onDragEnd() {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected onClick() {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
|
@ -1,3 +1,4 @@
|
||||||
|
import { Scene } from '@antv/l7';
|
||||||
import { Feature, FeatureCollection } from '@turf/helpers';
|
import { Feature, FeatureCollection } from '@turf/helpers';
|
||||||
import DrawSource from '../source';
|
import DrawSource from '../source';
|
||||||
|
|
||||||
|
@ -5,26 +6,35 @@ export interface IDrawOption {
|
||||||
data: FeatureCollection;
|
data: FeatureCollection;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export type DrawStatus = 'Drawing' | 'Selected' | 'Edit' | 'Finish';
|
||||||
|
|
||||||
export default abstract class DrawFeature {
|
export default abstract class DrawFeature {
|
||||||
private source: DrawSource;
|
private source: DrawSource;
|
||||||
constructor(options: IDrawOption) {
|
private scene: Scene;
|
||||||
|
constructor(scene: Scene, options: IDrawOption) {
|
||||||
const { data } = options;
|
const { data } = options;
|
||||||
|
this.scene = scene;
|
||||||
this.source = new DrawSource(data);
|
this.source = new DrawSource(data);
|
||||||
}
|
}
|
||||||
|
public enable() {
|
||||||
protected onDragStart() {
|
this.scene.on('dragstart', this.onDragStart);
|
||||||
throw new Error('not imp');
|
this.scene.on('drag', this.onDragging);
|
||||||
|
this.scene.on('dragend', this.onDragEnd);
|
||||||
|
this.scene.on('click', this.onClick);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected onDragging() {
|
public disable() {
|
||||||
throw new Error('not imp');
|
this.scene.off('dragstart', this.onDragStart);
|
||||||
|
this.scene.off('drag', this.onDragging);
|
||||||
|
this.scene.off('dragend', this.onDragEnd);
|
||||||
|
this.scene.off('click', this.onClick);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected onDragEnd() {
|
protected abstract onDragStart(): any;
|
||||||
throw new Error('not imp');
|
|
||||||
}
|
|
||||||
|
|
||||||
protected onClick() {
|
protected abstract onDragging(): any;
|
||||||
throw new Error('not imp');
|
|
||||||
}
|
protected abstract onDragEnd(): any;
|
||||||
|
|
||||||
|
protected abstract onClick(): any;
|
||||||
}
|
}
|
||||||
|
|
|
@ -27,7 +27,7 @@
|
||||||
|
|
||||||
<script src="https://cdnjs.cloudflare.com/ajax/libs/babel-polyfill/7.8.3/polyfill.min.js"></script>
|
<script src="https://cdnjs.cloudflare.com/ajax/libs/babel-polyfill/7.8.3/polyfill.min.js"></script>
|
||||||
<script src="https://api.mapbox.com/mapbox-gl-js/v1.8.0/mapbox-gl.js"></script>
|
<script src="https://api.mapbox.com/mapbox-gl-js/v1.8.0/mapbox-gl.js"></script>
|
||||||
<script src="../dist/l7-dev.js"></script>
|
<script src="../dist/l7.js"></script>
|
||||||
<script>
|
<script>
|
||||||
console.log(L7);
|
console.log(L7);
|
||||||
const scene = new L7.Scene({
|
const scene = new L7.Scene({
|
||||||
|
|
|
@ -11,10 +11,10 @@
|
||||||
}
|
}
|
||||||
#map {
|
#map {
|
||||||
position: absolute;
|
position: absolute;
|
||||||
top: 0,
|
top: 0;
|
||||||
left: 0,
|
left: 0;
|
||||||
right: 0,
|
right: 0;
|
||||||
bottom: 0,
|
bottom: 0;
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
<link
|
<link
|
||||||
|
@ -24,11 +24,9 @@
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<div id="map"></div>
|
<div id="map"></div>
|
||||||
<!-- <script src="https://cdnjs.cloudflare.com/ajax/libs/babel-polyfill/7.8.3/polyfill.min.js"></script>-->
|
<script src="https://cdnjs.cloudflare.com/ajax/libs/babel-polyfill/7.8.3/polyfill.min.js"></script>
|
||||||
<!-- <script src="https://cdn.jsdelivr.net/npm/symbol-es6@0.1.2/symbol-es6.min.js"></script> -->
|
|
||||||
<script src="https://api.mapbox.com/mapbox-gl-js/v1.8.0/mapbox-gl.js"></script>
|
<script src="https://api.mapbox.com/mapbox-gl-js/v1.8.0/mapbox-gl.js"></script>
|
||||||
|
<script src="../dist/l7.js"></script>
|
||||||
<script src="../dist/l7-dev.js"></script>
|
|
||||||
<script>
|
<script>
|
||||||
const data =
|
const data =
|
||||||
{"type":"FeatureCollection","features":[
|
{"type":"FeatureCollection","features":[
|
||||||
|
@ -94,8 +92,8 @@
|
||||||
zoom: 3,
|
zoom: 3,
|
||||||
pitch: 0,
|
pitch: 0,
|
||||||
})
|
})
|
||||||
})
|
});
|
||||||
scene.on('loaded',()=>{
|
scene.on('loaded',function(){
|
||||||
console.log(L7);
|
console.log(L7);
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -3,3 +3,4 @@ export * from '@antv/l7-scene';
|
||||||
export * from '@antv/l7-maps';
|
export * from '@antv/l7-maps';
|
||||||
export * from '@antv/l7-layers';
|
export * from '@antv/l7-layers';
|
||||||
export * from '@antv/l7-component';
|
export * from '@antv/l7-component';
|
||||||
|
export const version = '2.1.5';
|
||||||
|
|
Loading…
Reference in New Issue