tangrams / tangram

WebGL map rendering engine for creative cartography
https://tangram.city
MIT License
2.22k stars 290 forks source link

Negative `buffer` value shouldn't be allowed #610

Closed bcamper closed 7 years ago

bcamper commented 7 years ago

See #602.

A negative buffer value has unexpected effects on label collision, and the most straightforward thing to do is to just require that buffer be greater than or equal to zero.

A negative buffer value will be treated as zero.

bcamper commented 7 years ago

cc @matteblair for ES related changes (if needed)

nvkelso commented 7 years ago

cc @burritojustice as he's used negative buffer as a feature before in some of his maps.

bcamper commented 7 years ago

Yeah, @matteblair and I discussed that a bit, but our feeling is that we need to provide a consistent experience, and there are complications with a negative buffer (like if it shrinks the collision box by more than 100% of the label and it inverts, which may explain some of the weird behavior seen), and we do not feel it is worth the complexity for this use case as-is.

bcamper commented 7 years ago

See 19b7474f7c3f1780959d78094dc20986b5e2d724

bcamper commented 7 years ago

Note, I forgot the first time to apply the same restrictions to buffer on points (in addition to standalone text). Done in https://github.com/tangrams/tangram/commit/9d770b0e4de3cf0ea88099cddd2daf4a76574512.

bcamper commented 7 years ago

Released in v0.14.0.