Skip to content

Commit

Permalink
Change the name of renderedZone to renderThreshold.
Browse files Browse the repository at this point in the history
  • Loading branch information
manthey committed Jun 27, 2018
1 parent d814dc2 commit 95f10c9
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 10 deletions.
8 changes: 4 additions & 4 deletions src/canvas/textFeature.js
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ var canvas_textFeature = function (arg) {
this._renderOnCanvas = function (context2d, map) {
var data = m_this.data(),
posFunc = m_this.style.get('position'),
renderedZone = m_this.style.get('renderedZone')(data),
renderThreshold = m_this.style.get('renderThreshold')(data),
textFunc = m_this.style.get('text'),
mapRotation = map.rotation(),
mapZoom = map.zoom(),
Expand All @@ -125,9 +125,9 @@ var canvas_textFeature = function (arg) {
* render it, even if the offset of size would be sufficient to make it
* appear in the viewport. */
pos = posArray[i];
if (renderedZone > 0 && (
pos.x < -renderedZone || pos.x > mapSize.width + renderedZone ||
pos.y < -renderedZone || pos.y > mapSize.height + renderedZone)) {
if (renderThreshold > 0 && (
pos.x < -renderThreshold || pos.x > mapSize.width + renderThreshold ||
pos.y < -renderThreshold || pos.y > mapSize.height + renderThreshold)) {
return;
}
visible = m_this.style.get('visible')(d, i);
Expand Down
2 changes: 1 addition & 1 deletion src/textFeature.js
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ var feature = require('./feature');
* stroke color. May include opacity.
* @property {geo.geoColor|function} [style.textStrokeWidth=0] Text stroke
* width in pixels.
* @property {number|function} [style.renderedZone] If this is a positive
* @property {number|function} [style.renderThreshold] If this is a positive
* number, text elements may not be rendered if their base position
* (before offset and font effects are applied) is more than this distance
* in pixels outside of the current viewport. If it is known that such
Expand Down
10 changes: 5 additions & 5 deletions tests/cases/textFeature.js
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,7 @@ describe('geo.textFeature', function () {
expect(text.getFontFromStyles(true, text.data()[3], 3)).toBe('italic small-caps bold condensed 40px/60px serif');
expect(text.getFontFromStyles(true, text.data()[11], 11)).toBe('bold 16px/60px sans-serif');
});
it('renderedZone', function () {
it('renderThreshold', function () {
mockAnimationFrame();
logCanvas2D();
map = createMap();
Expand All @@ -207,22 +207,22 @@ describe('geo.textFeature', function () {
text.draw();
stepAnimationFrame();
var count1 = $.extend({}, window._canvasLog.counts).fillText;
text.style({renderedZone: 0});
text.style({renderThreshold: 0});
text.draw();
stepAnimationFrame();
var count2 = $.extend({}, window._canvasLog.counts).fillText;
expect(count2 - count1).toBe(14);
text.style({renderedZone: 1});
text.style({renderThreshold: 1});
text.draw();
stepAnimationFrame();
var count3 = $.extend({}, window._canvasLog.counts).fillText;
expect(count3 - count2).toBe(6);
text.style({renderedZone: 20});
text.style({renderThreshold: 20});
text.draw();
stepAnimationFrame();
var count4 = $.extend({}, window._canvasLog.counts).fillText;
expect(count4 - count3).toBe(8);
text.style({renderedZone: 0});
text.style({renderThreshold: 0});
text.draw();
stepAnimationFrame();
var count5 = $.extend({}, window._canvasLog.counts).fillText;
Expand Down

0 comments on commit 95f10c9

Please sign in to comment.