Deprecate exceedLength and replace with overflow
This commit is contained in:
@@ -691,7 +691,7 @@ ol.render.canvas.Replay.prototype.replay_ = function(
|
||||
var end = /** @type {number} */ (instruction[2]);
|
||||
var baseline = /** @type {number} */ (instruction[3]);
|
||||
declutterGroup = /** @type {ol.DeclutterGroup} */ (instruction[4]);
|
||||
var exceedLength = /** @type {number} */ (instruction[5]);
|
||||
var overflow = /** @type {number} */ (instruction[5]);
|
||||
var fillKey = /** @type {string} */ (instruction[6]);
|
||||
var maxAngle = /** @type {number} */ (instruction[7]);
|
||||
var measure = /** @type {function(string):number} */ (instruction[8]);
|
||||
@@ -704,7 +704,7 @@ ol.render.canvas.Replay.prototype.replay_ = function(
|
||||
|
||||
var pathLength = ol.geom.flat.length.lineString(pixelCoordinates, begin, end, 2);
|
||||
var textLength = measure(text);
|
||||
if (exceedLength || textLength <= pathLength) {
|
||||
if (overflow || textLength <= pathLength) {
|
||||
var textAlign = /** @type {ol.render.canvas.TextReplay} */ (this).textStates[textKey].textAlign;
|
||||
var startM = (pathLength - textLength) * ol.render.replay.TEXT_ALIGN[textAlign];
|
||||
var parts = ol.geom.flat.textpath.lineString(
|
||||
|
||||
@@ -239,7 +239,7 @@ ol.render.canvas.TextReplay.prototype.drawText = function(geometry, feature) {
|
||||
break;
|
||||
case ol.geom.GeometryType.POLYGON:
|
||||
flatCoordinates = /** @type {ol.geom.Polygon} */ (geometry).getFlatInteriorPoint();
|
||||
if (!textState.exceedLength && flatCoordinates[2] / this.resolution < width) {
|
||||
if (!textState.overflow && flatCoordinates[2] / this.resolution < width) {
|
||||
return;
|
||||
}
|
||||
stride = 3;
|
||||
@@ -248,7 +248,7 @@ ol.render.canvas.TextReplay.prototype.drawText = function(geometry, feature) {
|
||||
var interiorPoints = /** @type {ol.geom.MultiPolygon} */ (geometry).getFlatInteriorPoints();
|
||||
flatCoordinates = [];
|
||||
for (i = 0, ii = interiorPoints.length; i < ii; i += 3) {
|
||||
if (textState.exceedLength || interiorPoints[i + 2] / this.resolution >= width) {
|
||||
if (textState.overflow || interiorPoints[i + 2] / this.resolution >= width) {
|
||||
flatCoordinates.push(interiorPoints[i], interiorPoints[i + 1]);
|
||||
}
|
||||
}
|
||||
@@ -434,7 +434,7 @@ ol.render.canvas.TextReplay.prototype.drawChars_ = function(begin, end, declutte
|
||||
}
|
||||
this.instructions.push([ol.render.canvas.Instruction.DRAW_CHARS,
|
||||
begin, end, baseline, declutterGroup,
|
||||
textState.exceedLength, fillKey, textState.maxAngle,
|
||||
textState.overflow, fillKey, textState.maxAngle,
|
||||
function(text) {
|
||||
var width = widths[text];
|
||||
if (!width) {
|
||||
@@ -446,7 +446,7 @@ ol.render.canvas.TextReplay.prototype.drawChars_ = function(begin, end, declutte
|
||||
]);
|
||||
this.hitDetectionInstructions.push([ol.render.canvas.Instruction.DRAW_CHARS,
|
||||
begin, end, baseline, declutterGroup,
|
||||
textState.exceedLength, fillKey, textState.maxAngle,
|
||||
textState.overflow, fillKey, textState.maxAngle,
|
||||
function(text) {
|
||||
var width = widths[text];
|
||||
if (!width) {
|
||||
@@ -510,7 +510,7 @@ ol.render.canvas.TextReplay.prototype.setTextStyle = function(textStyle, declutt
|
||||
var font = textStyle.getFont() || ol.render.canvas.defaultFont;
|
||||
ol.render.canvas.checkFont(font);
|
||||
var textScale = textStyle.getScale();
|
||||
textState.exceedLength = textStyle.getExceedLength();
|
||||
textState.overflow = textStyle.getOverflow();
|
||||
textState.font = font;
|
||||
textState.maxAngle = textStyle.getMaxAngle();
|
||||
textState.placement = textStyle.getPlacement();
|
||||
|
||||
+10
-10
@@ -82,7 +82,7 @@ ol.style.Text = function(opt_options) {
|
||||
* @private
|
||||
* @type {boolean}
|
||||
*/
|
||||
this.exceedLength_ = options.exceedLength !== undefined ? options.exceedLength : false;
|
||||
this.overflow_ = options.overflow !== undefined ? options.overflow : false;
|
||||
|
||||
/**
|
||||
* @private
|
||||
@@ -142,7 +142,7 @@ ol.style.Text.prototype.clone = function() {
|
||||
font: this.getFont(),
|
||||
placement: this.getPlacement(),
|
||||
maxAngle: this.getMaxAngle(),
|
||||
exceedLength: this.getExceedLength(),
|
||||
overflow: this.getOverflow(),
|
||||
rotation: this.getRotation(),
|
||||
rotateWithView: this.getRotateWithView(),
|
||||
scale: this.getScale(),
|
||||
@@ -158,12 +158,12 @@ ol.style.Text.prototype.clone = function() {
|
||||
|
||||
|
||||
/**
|
||||
* Get the `exceedLength` configuration.
|
||||
* @return {boolean} Let text exceed the length of the path they follow.
|
||||
* Get the `overflow` configuration.
|
||||
* @return {boolean} Let text overflow the length of the path they follow.
|
||||
* @api
|
||||
*/
|
||||
ol.style.Text.prototype.getExceedLength = function() {
|
||||
return this.exceedLength_;
|
||||
ol.style.Text.prototype.getOverflow = function() {
|
||||
return this.overflow_;
|
||||
};
|
||||
|
||||
|
||||
@@ -328,13 +328,13 @@ ol.style.Text.prototype.getPadding = function() {
|
||||
|
||||
|
||||
/**
|
||||
* Set the `exceedLength` property.
|
||||
* Set the `overflow` property.
|
||||
*
|
||||
* @param {boolean} exceedLength Let text exceed the path that it follows.
|
||||
* @param {boolean} overflow Let text overflow the path that it follows.
|
||||
* @api
|
||||
*/
|
||||
ol.style.Text.prototype.setExceedLength = function(exceedLength) {
|
||||
this.exceedLength_ = exceedLength;
|
||||
ol.style.Text.prototype.setOverflow = function(overflow) {
|
||||
this.overflow_ = overflow;
|
||||
};
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user