Skip to content

Commit

Permalink
fix: observerable打包问题
Browse files Browse the repository at this point in the history
  • Loading branch information
lzxue committed Mar 20, 2020
1 parent 63433f5 commit 412e2a8
Show file tree
Hide file tree
Showing 9 changed files with 25,143 additions and 26 deletions.
2 changes: 1 addition & 1 deletion babel.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ module.exports = api => {
{
// https://babeljs.io/docs/en/babel-preset-env#usebuiltins
// useBuiltIns: 'usage',
...isCDNBundle ? { corejs: '2.0.0' } : {},
...isCDNBundle ? { corejs: '3.0.0' } : {},
useBuiltIns: isCDNBundle ? 'usage' : false,
// set `modules: false` when building CDN bundle, let rollup do commonjs works
// @see https://github.com/rollup/rollup-plugin-babel#modules
Expand Down
3 changes: 1 addition & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@
"coveralls": "jest --coverage && cat ./tests/coverage/lcov.info | coveralls",
"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",
"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: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",
Expand All @@ -175,7 +175,6 @@
}
},
"resolutions": {
"core-js": "3",
"d3-array": "1"
},
"tnpm": {
Expand Down
4 changes: 4 additions & 0 deletions packages/draw/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,10 @@
"lint:ts": "run-p -c lint:ts-*",
"test": "jest"
},
"dependencies": {
"@antv/l7": "^2.1.3",
"@babel/runtime": "^7.7.7"
},
"bugs": {
"url": "https://github.com/antvis/L7/issues"
},
Expand Down
22 changes: 22 additions & 0 deletions packages/draw/src/modes/draw_circle.ts
Original file line number Diff line number Diff line change
@@ -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;
}
}
34 changes: 22 additions & 12 deletions packages/draw/src/modes/draw_feature.ts
Original file line number Diff line number Diff line change
@@ -1,30 +1,40 @@
import { Scene } from '@antv/l7';
import { Feature, FeatureCollection } from '@turf/helpers';
import DrawSource from '../source';

export interface IDrawOption {
data: FeatureCollection;
}

export type DrawStatus = 'Drawing' | 'Selected' | 'Edit' | 'Finish';

export default abstract class DrawFeature {
private source: DrawSource;
constructor(options: IDrawOption) {
private scene: Scene;
constructor(scene: Scene, options: IDrawOption) {
const { data } = options;
this.scene = scene;
this.source = new DrawSource(data);
}

protected onDragStart() {
throw new Error('not imp');
public enable() {
this.scene.on('dragstart', this.onDragStart);
this.scene.on('drag', this.onDragging);
this.scene.on('dragend', this.onDragEnd);
this.scene.on('click', this.onClick);
}

protected onDragging() {
throw new Error('not imp');
public disable() {
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() {
throw new Error('not imp');
}
protected abstract onDragStart(): any;

protected onClick() {
throw new Error('not imp');
}
protected abstract onDragging(): any;

protected abstract onDragEnd(): any;

protected abstract onClick(): any;
}
2 changes: 1 addition & 1 deletion packages/l7/demo/circle.html
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@

<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="../dist/l7-dev.js"></script>
<script src="../dist/l7.js"></script>
<script>
console.log(L7);
const scene = new L7.Scene({
Expand Down
18 changes: 8 additions & 10 deletions packages/l7/demo/polygon.html
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,10 @@
}
#map {
position: absolute;
top: 0,
left: 0,
right: 0,
bottom: 0,
top: 0;
left: 0;
right: 0;
bottom: 0;
}
</style>
<link
Expand All @@ -24,11 +24,9 @@
</head>
<body>
<div id="map"></div>
<!-- <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://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="../dist/l7-dev.js"></script>
<script src="../dist/l7.js"></script>
<script>
const data =
{"type":"FeatureCollection","features":[
Expand Down Expand Up @@ -94,8 +92,8 @@
zoom: 3,
pitch: 0,
})
})
scene.on('loaded',()=>{
});
scene.on('loaded',function(){
console.log(L7);


Expand Down
1 change: 1 addition & 0 deletions packages/l7/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,4 @@ export * from '@antv/l7-scene';
export * from '@antv/l7-maps';
export * from '@antv/l7-layers';
export * from '@antv/l7-component';
export const version = '2.1.5';
Loading

0 comments on commit 412e2a8

Please sign in to comment.