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)
|
||||
.shape('name', 'text')
|
||||
.active(true)
|
||||
.size(48) // default 1
|
||||
.size(12) // default 1
|
||||
.color('name')
|
||||
.style({
|
||||
stroke: '#999',
|
||||
|
|
|
@ -29,7 +29,7 @@ function generateTextBuffer(layerData, fontAtlasManager) {
|
|||
const size = element.size;
|
||||
const pos = element.coordinates;
|
||||
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();
|
||||
for (let i = 0; i < text.length; i++) {
|
||||
const metric = mapping[text[i]];
|
||||
|
|
|
@ -54,7 +54,6 @@ void main() {
|
|||
return;
|
||||
}else if(dis2center>ri){
|
||||
gl_FragColor= u_stroke;
|
||||
gl_FragColor.a = * u_stroke;
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -18,12 +18,12 @@ varying vec4 v_color;
|
|||
void main(){
|
||||
mat4 matModelViewProjection=projectionMatrix*modelViewMatrix;
|
||||
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);
|
||||
if(pickingId == u_activeId) {
|
||||
v_color = u_activeColor;
|
||||
}
|
||||
v_texcoord=(textUv.xy+vec2(uv.x,1.-uv.y)*textUv.zw)/u_textTextureSize;
|
||||
v_texcoord=(textUv.xy + vec2(uv.x,1.-uv.y) * textUv.zw)/u_textTextureSize;
|
||||
worldId = id_toPickColor(pickingId);
|
||||
|
||||
}
|
||||
|
|
|
@ -18,8 +18,8 @@ export default function DrawText(attributes, style) {
|
|||
u_strokeWidth: strokeWidth,
|
||||
u_stroke: stroke,
|
||||
u_textTextureSize: [ attributes.fontAtlas.width, attributes.fontAtlas.height ],
|
||||
u_gamma: 0.02,
|
||||
u_buffer: 0.75,
|
||||
u_gamma: 0.1,
|
||||
u_buffer: 0.68,
|
||||
u_opacity: opacity,
|
||||
u_glSize: [ width, height ],
|
||||
u_activeColor: activeColor
|
||||
|
|
Loading…
Reference in New Issue