mirror of https://gitee.com/antv-l7/antv-l7
fix: 修复 simpleCoordinates datamapping
This commit is contained in:
parent
27e54e7a1c
commit
886598bf1e
|
@ -206,7 +206,10 @@ export default class DataMappingPlugin implements ILayerPlugin {
|
|||
private adjustData2SimpleCoordinates(mappedData: IEncodeFeature[]) {
|
||||
if (mappedData.length > 0 && this.mapService.version === Version.SIMPLE) {
|
||||
mappedData.map((d) => {
|
||||
d.coordinates = this.unProjectCoordinates(d.coordinates);
|
||||
if (!d.simpleCoordinate) {
|
||||
d.coordinates = this.unProjectCoordinates(d.coordinates);
|
||||
d.simpleCoordinate = true;
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
|
@ -22,9 +22,9 @@ export default class Demo extends React.Component {
|
|||
minZoom: 2,
|
||||
}),
|
||||
});
|
||||
scene.setBgColor('rgb(216, 209, 86)');
|
||||
scene.setBgColor('rgb(94, 182, 140)');
|
||||
|
||||
const textlayer = new PointLayer()
|
||||
const textlayer = new PointLayer({ zIndex: 2 })
|
||||
.source(
|
||||
[
|
||||
{
|
||||
|
@ -64,30 +64,37 @@ export default class Demo extends React.Component {
|
|||
.shape('t', 'text')
|
||||
.size(14)
|
||||
.active(true)
|
||||
.color('#000')
|
||||
.color('#0e0030')
|
||||
.style({
|
||||
// textAnchor: 'center', // 文本相对锚点的位置 center|left|right|top|bottom|top-left
|
||||
// textOffset: [ 0, 0 ], // 文本相对锚点的偏移量 [水平, 垂直]
|
||||
spacing: 2, // 字符间距
|
||||
// padding: [ 1, 1 ], // 文本包围盒 padding [水平,垂直],影响碰撞检测结果,避免相邻文本靠的太近
|
||||
stroke: '#ffffff', // 描边颜色
|
||||
strokeWidth: 1.5, // 描边宽度
|
||||
// strokeOpacity: 1.0,
|
||||
textAllowOverlap: true,
|
||||
});
|
||||
|
||||
const imagelayer = new ImageLayer({}).source(
|
||||
'https://gw.alipayobjects.com/mdn/rms_816329/afts/img/A*M1v5TKxzrHoAAAAAAAAAAAAAARQnAQ',
|
||||
'https://gw.alipayobjects.com/mdn/rms_816329/afts/img/A*I0X5R4jAUQ4AAAAAAAAAAAAAARQnAQ',
|
||||
{
|
||||
parser: {
|
||||
type: 'image',
|
||||
extent: [450, 400, 550, 600],
|
||||
extent: [360, 400, 640, 600],
|
||||
},
|
||||
},
|
||||
);
|
||||
|
||||
scene.on('loaded', () => {
|
||||
scene.addLayer(imagelayer);
|
||||
// scene.addLayer(imagelayer);
|
||||
|
||||
scene.addLayer(textlayer);
|
||||
// console.log(scene.mapService.getSize())
|
||||
// setTimeout(() => {
|
||||
// console.log(scene.mapService.getSize())
|
||||
// }, 2000 )
|
||||
console.log(scene.mapService.getCenter());
|
||||
// console.log(scene.mapService.getCenter());
|
||||
});
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue