Skip to content

Commit

Permalink
fix: fix ol7 support close #115
Browse files Browse the repository at this point in the history
  • Loading branch information
sakitam-fdd committed May 24, 2024
1 parent f174728 commit c85a8c6
Show file tree
Hide file tree
Showing 9 changed files with 373 additions and 66 deletions.
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,10 @@
| [ol3-echarts](https://github.com/sakitam-fdd/ol3Echarts/packages/ol3-echarts) | [![Build Status](https://travis-ci.org/sakitam-fdd/ol3Echarts.svg?branch=master)](https://www.travis-ci.org/sakitam-fdd/ol3Echarts) | [![Npm package](https://img.shields.io/npm/v/ol3-echarts.svg)](https://www.npmjs.org/package/ol3-echarts) | [![NPM downloads](https://img.shields.io/npm/dm/ol3-echarts.svg)](https://npmjs.org/package/ol3-echarts) | [![](https://data.jsdelivr.com/v1/package/npm/ol3-echarts/badge)](https://www.jsdelivr.com/package/npm/ol3-echarts) | support for openlayers3-4 |
| [ol-echarts](https://github.com/sakitam-fdd/ol3Echarts/packages/ol-echarts) | [![Build Status](https://travis-ci.org/sakitam-fdd/ol3Echarts.svg?branch=master)](https://www.travis-ci.org/sakitam-fdd/ol3Echarts) | [![Npm package](https://img.shields.io/npm/v/ol-echarts.svg)](https://www.npmjs.org/package/ol-echarts) | [![NPM downloads](https://img.shields.io/npm/dm/ol-echarts.svg)](https://npmjs.org/package/ol-echarts) | [![](https://data.jsdelivr.com/v1/package/npm/ol-echarts/badge)](https://www.jsdelivr.com/package/npm/ol-echarts) | support for openlayers5+ |

### TIP

ol 7.x 以后请使用 ol-echarts v4.x,ol 7.x 之前请使用 ol-echarts v3.x,原因见 [issues/115](https://github.com/sakitam-fdd/ol3Echarts/issues/115#issuecomment-1627004544)

## 下载

```bash
Expand Down
5 changes: 5 additions & 0 deletions docs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,11 @@
| [ol3-echarts](https://github.com/sakitam-fdd/ol3Echarts/packages/ol3-echarts) | [![Build Status](https://travis-ci.org/sakitam-fdd/ol3Echarts.svg?branch=master)](https://www.travis-ci.org/sakitam-fdd/ol3Echarts) | [![Npm package](https://img.shields.io/npm/v/ol3-echarts.svg)](https://www.npmjs.org/package/ol3-echarts) | [![NPM downloads](https://img.shields.io/npm/dm/ol3-echarts.svg)](https://npmjs.org/package/ol3-echarts) | [![](https://data.jsdelivr.com/v1/package/npm/ol3-echarts/badge)](https://www.jsdelivr.com/package/npm/ol3-echarts) | support for openlayers3-4 |
| [ol-echarts](https://github.com/sakitam-fdd/ol3Echarts/packages/ol-echarts) | [![Build Status](https://travis-ci.org/sakitam-fdd/ol3Echarts.svg?branch=master)](https://www.travis-ci.org/sakitam-fdd/ol3Echarts) | [![Npm package](https://img.shields.io/npm/v/ol-echarts.svg)](https://www.npmjs.org/package/ol-echarts) | [![NPM downloads](https://img.shields.io/npm/dm/ol-echarts.svg)](https://npmjs.org/package/ol-echarts) | [![](https://data.jsdelivr.com/v1/package/npm/ol-echarts/badge)](https://www.jsdelivr.com/package/npm/ol-echarts) | support for openlayers5+ |

### TIP

ol 7.x 以后请使用 ol-echarts v4.x,ol 7.x 之前请使用 ol-echarts v3.x,原因见 [issues/115](https://github.com/sakitam-fdd/ol3Echarts/issues/115#issuecomment-1627004544)


## 下载

```bash
Expand Down
1 change: 0 additions & 1 deletion docs/guide/quickstart.md
Original file line number Diff line number Diff line change
Expand Up @@ -212,4 +212,3 @@
好吧,2.0版本又修改了一些参数,主要是新增一些配置项,移除了自定义容器`target`的配置, 默认只允许添加到`ol-overlaycontainer``ol-overlaycontainer-stopevent`容器,
这样能保证了事件的正确捕获。同样针对 `openlayers5+`出现的事件捕获异常添加了一个polyfill, 可以通过配置项`polyfillEvents` 进行开启,如果没有碰到此问题可以忽略此参数。
并且修复了多地图容器时自定义坐标系不起作用的问题,另外较大的改变是支持了`typescript`。其他相关配置项的改变详见 `API` 文档。
jin
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@
"rollup-plugin-local-resolve": "^1.0.7",
"rollup-plugin-node-resolve": "^4.2.3",
"rollup-plugin-replace": "^2.2.0",
"rollup-plugin-uglify": "^6.0.2",
"rollup-plugin-terser": "^7.0.2",
"rollup-plugin-glslify": "^1.1.0",
"rollup-plugin-typescript2": "^0.19.3",
"tslib": "^1.9.3",
Expand Down
40 changes: 35 additions & 5 deletions packages/ol-echarts/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "ol-echarts",
"version": "3.0.0",
"version": "4.0.0",
"description": "a openlayers extension to echarts",
"author": "sakitam-fdd <smilefdd@gmail.com>",
"homepage": "https://sakitam-fdd.github.io/ol3Echarts",
Expand All @@ -12,8 +12,16 @@
"namespace": "EChartsLayer",
"types": "types/index.d.ts",
"publishConfig": {
"access": "public"
"access": "public",
"registry": "https://registry.npmjs.org/"
},
"files": [
"dist",
"types",
"LICENSE",
"README.md",
"package.json"
],
"repository": {
"type": "git",
"url": "https://github.com/sakitam-fdd/ol3Echarts.git",
Expand All @@ -38,14 +46,36 @@
"karma.single": "karma start karma.config.js --single-run --browsers Chrome",
"karma.travis": "cross-env TRAVIS_ENV=true karma start karma.config.js --single-run --browsers ChromeHeadless"
},
"exports": {
".": {
"types": "./types/index.d.ts",
"node": {
"import": {
"production": "./dist/ol-echarts.esm.js",
"development": "./dist/ol-echarts.esm.js",
"default": "./dist/ol-echarts.esm.js"
},
"require": {
"production": "./dist/ol-echarts.common.js",
"development": "./dist/ol-echarts.common.js",
"default": "./dist/ol-echarts.common.js"
}
},
"import": "./dist/ol-echarts.esm.js",
"require": "./dist/ol-echarts.common.js"
},
"./dist/*": "./dist/*",
"./package.json": "./package.json"
},
"peerDependencies": {
"echarts": ">=5.0.0",
"ol": ">=5.0.0"
"ol": ">=7.0.0"
},
"devDependencies": {
"@types/ol": "^5.3.6",
"echarts": "^5.0.0",
"ol": "^5.1.3",
"ol": "^7.0.0"
},
"dependencies": {
"zrender": "^5.3.0"
},
"engines": {
Expand Down
10 changes: 5 additions & 5 deletions packages/ol-echarts/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ import { ProjectionLike, transform } from 'ol/proj';
import Event from 'ol/events/Event';
import { Coordinate } from 'ol/coordinate';
import * as echarts from 'echarts';
import * as matrix from 'zrender/lib/core/matrix';
import Transformable from 'zrender/lib/core/Transformable';
import BoundingRect from 'zrender/lib/core/BoundingRect';

Expand Down Expand Up @@ -782,7 +781,7 @@ class EChartsLayer extends obj {
protected _rawTransformable = new Transformable();

// @ts-ignore
private _rawTransform: matrix.MatrixArray;
private _rawTransform: number[];

private _viewRect: BoundingRect = new BoundingRect(0, 0, 0, 0);

Expand Down Expand Up @@ -951,7 +950,7 @@ class EChartsLayer extends obj {
* @param event
*/
public dispatchEvent(event: object | Event | string) {
return super.dispatchEvent(event);
return super.dispatchEvent(event as Event);
}

public set(key: string, value: any, optSilent?: boolean) {
Expand All @@ -967,11 +966,12 @@ class EChartsLayer extends obj {
}

// @ts-ignore
public on(type: (string | string[]), listener: (p0: any) => void) {
public on(type: any, listener: (p0: any) => void) {
return super.on(type, listener);
}

public un(type: (string | string[]), listener: (p0: any) => void) {
// @ts-ignore
public un(type: any, listener: (p0: any) => void) {
return super.un(type, listener);
}
}
Expand Down
4 changes: 2 additions & 2 deletions packages/ol-echarts/types/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ declare class EChartsLayer extends obj {
set(key: string, value: any, optSilent?: boolean): void;
get(key: string): any;
unset(key: string, optSilent?: boolean): void;
on(type: (string | string[]), listener: (p0: any) => void): import("ol/events").EventsKey | import("ol/events").EventsKey[];
un(type: (string | string[]), listener: (p0: any) => void): void;
on(type: any, listener: (p0: any) => void): import("ol/events").EventsKey;
un(type: any, listener: (p0: any) => void): void;
}
export default EChartsLayer;
4 changes: 2 additions & 2 deletions rollup/rollup.prod.config.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
const { uglify } = require('rollup-plugin-uglify');
const { terser } = require('rollup-plugin-terser');
const { banner, handleMinEsm, pkg, resolve } = require('./utils');
const baseConfig = require('./rollup.base.config');
const ol = require('./ol/globals');
Expand All @@ -23,6 +23,6 @@ const config = Object.assign(baseConfig, {
]
});

config.plugins.push(uglify());
config.plugins.push(terser());

module.exports = config;
Loading

0 comments on commit c85a8c6

Please sign in to comment.