mirror of https://gitee.com/antv-l7/antv-l7
fix(text): layer
This commit is contained in:
parent
c8e8814879
commit
f527be22cc
|
@ -37,7 +37,7 @@ scene.on('loaded', () => {
|
||||||
.source(data)
|
.source(data)
|
||||||
.shape('name', 'text')
|
.shape('name', 'text')
|
||||||
.active(true)
|
.active(true)
|
||||||
.size(48) // default 1
|
.size(12) // default 1
|
||||||
.color('name')
|
.color('name')
|
||||||
.style({
|
.style({
|
||||||
stroke: '#999',
|
stroke: '#999',
|
||||||
|
|
|
@ -29,7 +29,7 @@ function generateTextBuffer(layerData, fontAtlasManager) {
|
||||||
const size = element.size;
|
const size = element.size;
|
||||||
const pos = element.coordinates;
|
const pos = element.coordinates;
|
||||||
let text = element.shape || '';
|
let text = element.shape || '';
|
||||||
const pen = { x: -text.length * size / 2, y: 0 };
|
const pen = { x: -text.length * size / 2 + size / 2, y: 0 };
|
||||||
text = text.toString();
|
text = text.toString();
|
||||||
for (let i = 0; i < text.length; i++) {
|
for (let i = 0; i < text.length; i++) {
|
||||||
const metric = mapping[text[i]];
|
const metric = mapping[text[i]];
|
||||||
|
|
|
@ -54,7 +54,6 @@ void main() {
|
||||||
return;
|
return;
|
||||||
}else if(dis2center>ri){
|
}else if(dis2center>ri){
|
||||||
gl_FragColor= u_stroke;
|
gl_FragColor= u_stroke;
|
||||||
gl_FragColor.a = * u_stroke;
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -18,7 +18,7 @@ varying vec4 v_color;
|
||||||
void main(){
|
void main(){
|
||||||
mat4 matModelViewProjection=projectionMatrix*modelViewMatrix;
|
mat4 matModelViewProjection=projectionMatrix*modelViewMatrix;
|
||||||
vec4 cur_position=matModelViewProjection*vec4(a_position.xy,0,1);
|
vec4 cur_position=matModelViewProjection*vec4(a_position.xy,0,1);
|
||||||
gl_Position=cur_position/cur_position.w+vec4(a_textSize*position.xy/u_glSize/2.,0.,0.)+vec4(a_textOffset/u_glSize,0,0);
|
gl_Position=cur_position / cur_position.w+ vec4(a_textSize*position.xy/u_glSize, 0., 0.)+vec4(a_textOffset/u_glSize * 2.0,0,0);
|
||||||
v_color=vec4(a_color.rgb,a_color.a*u_opacity);
|
v_color=vec4(a_color.rgb,a_color.a*u_opacity);
|
||||||
if(pickingId == u_activeId) {
|
if(pickingId == u_activeId) {
|
||||||
v_color = u_activeColor;
|
v_color = u_activeColor;
|
||||||
|
|
|
@ -18,8 +18,8 @@ export default function DrawText(attributes, style) {
|
||||||
u_strokeWidth: strokeWidth,
|
u_strokeWidth: strokeWidth,
|
||||||
u_stroke: stroke,
|
u_stroke: stroke,
|
||||||
u_textTextureSize: [ attributes.fontAtlas.width, attributes.fontAtlas.height ],
|
u_textTextureSize: [ attributes.fontAtlas.width, attributes.fontAtlas.height ],
|
||||||
u_gamma: 0.02,
|
u_gamma: 0.1,
|
||||||
u_buffer: 0.75,
|
u_buffer: 0.68,
|
||||||
u_opacity: opacity,
|
u_opacity: opacity,
|
||||||
u_glSize: [ width, height ],
|
u_glSize: [ width, height ],
|
||||||
u_activeColor: activeColor
|
u_activeColor: activeColor
|
||||||
|
|
Loading…
Reference in New Issue