Skip to content

Commit a90534a

Browse files
Merge branch 'v10.1.3' of https://github.com/SuperMap/iClient-JavaScript into v10.1.3
2 parents d4be1d8 + a95853a commit a90534a

File tree

7 files changed

+45
-15
lines changed

7 files changed

+45
-15
lines changed

dist/leaflet/include-leaflet.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -138,13 +138,13 @@
138138
inputCSS('../../dist/leaflet/iclient-leaflet.min.css');
139139
}
140140
if (inArray(includes, 'iclient-plot-leaflet')) {
141-
inputCSS('https://iclient.supermap.io/web/libs/plotting/leaflet/10.1.2/iclient-plot-leaflet.css');
141+
inputCSS('https://iclient.supermap.io/web/libs/plotting/leaflet/10.1.3/iclient-plot-leaflet.css');
142142
if (supportES6()) {
143143
inputScript(
144-
'https://iclient.supermap.io/web/libs/plotting/leaflet/10.1.2/iclient-plot-leaflet-es6.min.js'
144+
'https://iclient.supermap.io/web/libs/plotting/leaflet/10.1.3/iclient-plot-leaflet-es6.min.js'
145145
);
146146
} else {
147-
inputScript('https://iclient.supermap.io/web/libs/plotting/leaflet/10.1.2/iclient-plot-leaflet.min.js');
147+
inputScript('https://iclient.supermap.io/web/libs/plotting/leaflet/10.1.3/iclient-plot-leaflet.min.js');
148148
}
149149
}
150150
if (inArray(includes, 'ant-design-vue')) {

examples-test/leaflet/04_bufferAnalystServiceIT.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ module.exports = {
99
browser.waitForElementPresent('.leaflet-pane.leaflet-overlay-pane svg', 10000);
1010
browser.waitForElementPresent('.leaflet-pane.leaflet-overlay-pane svg g', 10000);
1111
browser.waitForElementPresent('.leaflet-pane.leaflet-overlay-pane svg g path', 10000);
12-
browser.pause(2000);
12+
browser.pause(10000);
1313
browser.elements('tag name', 'path', function (result) {
1414
this.assert.equal(result.value.length, 2, "expect Number of bufferAnalystServices path to be 2, actual is " + result.value.length);
1515
});

examples-test/leaflet/04_densityKernelAnalystServiceIT.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ module.exports = {
1111
browser.waitForElementPresent('.leaflet-pane.leaflet-map-pane', 10000);
1212
browser.waitForElementPresent('.leaflet-pane.leaflet-tile-pane', 10000);
1313
browser.waitForElementPresent('.leaflet-layer', 10000);
14-
browser.pause(5000);
14+
browser.pause(10000);
1515
browser.elements('css selector', '.leaflet-layer', function (result) {
1616
browser.assert.equal(result.value.length, 2, "expect Number of leaflet-layer to be 2, actual is " + result.value.length);
1717
});
@@ -28,4 +28,4 @@ module.exports = {
2828
});
2929
browser.end();
3030
}
31-
};
31+
};

examples-test/leaflet/04_generateSpatialDataServiceIT.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ module.exports = {
1111
browser.waitForElementPresent('.leaflet-pane.leaflet-map-pane', 10000);
1212
browser.waitForElementPresent('.leaflet-pane.leaflet-tile-pane', 10000);
1313
browser.waitForElementPresent('.leaflet-layer', 10000);
14-
browser.pause(5000);
14+
browser.pause(10000);
1515
browser.elements('css selector', '.leaflet-layer', function (result) {
1616
this.assert.equal(result.value.length, 2, "expect Number of leaflet-layer to be 2, actual is " + result.value.length);
1717
});

src/openlayers/overlay/graphic/CanvasRenderer.js

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -47,11 +47,10 @@ export class GraphicCanvasRenderer extends olObject {
4747
CommonUtil.extend(this, opt);
4848
this.highLightStyle = this.layer.highLightStyle;
4949

50-
this.mapWidth = this.size[0];
51-
this.mapHeight = this.size[1];
50+
this.mapWidth = this.size[0] / this.pixelRatio;
51+
this.mapHeight = this.size[1] / this.pixelRatio;
5252
this.width = this.map.getSize()[0];
5353
this.height = this.map.getSize()[1];
54-
5554
this.context = Util.createCanvasContext2D(this.mapWidth, this.mapHeight);
5655
this.context.scale(this.pixelRatio, this.pixelRatio);
5756
this.canvas = this.context.canvas;
@@ -79,7 +78,6 @@ export class GraphicCanvasRenderer extends olObject {
7978
this.height = height;
8079
this.mapWidth = this.mapWidth * xRatio;
8180
this.mapHeight = this.mapHeight * yRatio;
82-
8381
this.canvas.width = this.mapWidth;
8482
this.canvas.height = this.mapHeight;
8583
this.canvas.style.width = this.width + 'px';
@@ -114,18 +112,18 @@ export class GraphicCanvasRenderer extends olObject {
114112
*/
115113
drawGraphics(graphics) {
116114
this.graphics_ = graphics || [];
117-
let mapWidth = this.mapWidth / this.pixelRatio;
118-
let mapHeight = this.mapHeight / this.pixelRatio;
115+
let mapWidth = this.mapWidth;
116+
let mapHeight = this.mapHeight;
119117

120118
let vectorContext = olRender.toContext(this.context, {
121119
size: [mapWidth, mapHeight],
122120
pixelRatio: this.pixelRatio
123121
});
124-
var defaultStyle = this.layer._getDefaultStyle();
122+
let defaultStyle = this.layer._getDefaultStyle();
125123
let me = this,
126124
layer = me.layer,
127125
map = layer.map;
128-
graphics.map(function(graphic) {
126+
graphics.map(function (graphic) {
129127
let style = graphic.getStyle() || defaultStyle;
130128
if (me.selected === graphic) {
131129
let defaultHighLightStyle = style;
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
import { GraphicCanvasRenderer } from '../../../../src/openlayers/overlay/graphic/CanvasRenderer';
2+
import Map from 'ol/Map';
3+
import View from 'ol/View';
4+
5+
var map = new Map({
6+
target: 'map',
7+
view: new View({
8+
center: [116.85, 39.79],
9+
zoom: 0,
10+
projection: 'EPSG:4326'
11+
})
12+
});
13+
describe('openlayers_render', () => {
14+
var render;
15+
it('constructor', () => {
16+
spyOn(map, 'getSize').and.callFake(() => {
17+
return [0, 0];
18+
});
19+
const size = [1920, 1080];
20+
let pixelRatio = 1;
21+
render = new GraphicCanvasRenderer('layer', { size, pixelRatio, map });
22+
expect(render).not.toBeNull();
23+
expect(render.mapWidth).toBe(1920);
24+
expect(render.mapHeight).toBe(1080);
25+
pixelRatio = 1.5;
26+
render = new GraphicCanvasRenderer('layer', { size, pixelRatio, map });
27+
expect(render).not.toBeNull();
28+
expect(render.mapWidth).toBe(1280);
29+
expect(render.mapHeight).toBe(720);
30+
});
31+
});

test/test-main-openlayers.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ import './openlayers/mapping/WebMapSpec.js';
1515
import './openlayers/overlay/DataFlowSpec.js';
1616
import './openlayers/overlay/graphic/GraphicSpec.js';
1717
import './openlayers/overlay/GraphicSpec.js';
18+
import './openlayers/overlay/graphic/CanvasRendererSpec';
1819

1920
import './openlayers/overlay/GraphSpec.js';
2021
import './openlayers/overlay/HeatMapSpec.js';

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy