Rename lastDraw to lastStroke and remember last stroke drawn, thanks @elemoine
This commit is contained in:
@@ -312,12 +312,12 @@ ol.render.canvas.LineStringReplay = function() {
|
|||||||
/**
|
/**
|
||||||
* @private
|
* @private
|
||||||
* @type {{currentStrokeStyle: ?ol.style.Stroke,
|
* @type {{currentStrokeStyle: ?ol.style.Stroke,
|
||||||
* lastDraw: number,
|
* lastStroke: number,
|
||||||
* strokeStyle: ?ol.style.Stroke}|null}
|
* strokeStyle: ?ol.style.Stroke}|null}
|
||||||
*/
|
*/
|
||||||
this.state_ = {
|
this.state_ = {
|
||||||
currentStrokeStyle: null,
|
currentStrokeStyle: null,
|
||||||
lastDraw: 0,
|
lastStroke: 0,
|
||||||
strokeStyle: null
|
strokeStyle: null
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -337,8 +337,9 @@ ol.render.canvas.LineStringReplay.prototype.drawFlatCoordinates_ =
|
|||||||
function(flatCoordinates, offset, end, stride) {
|
function(flatCoordinates, offset, end, stride) {
|
||||||
var state = this.state_;
|
var state = this.state_;
|
||||||
if (!ol.style.stroke.equals(state.currentStrokeStyle, state.strokeStyle)) {
|
if (!ol.style.stroke.equals(state.currentStrokeStyle, state.strokeStyle)) {
|
||||||
if (state.lastDraw != this.coordinates.length) {
|
if (state.lastStroke != this.coordinates.length) {
|
||||||
this.instructions.push([ol.render.canvas.Instruction.STROKE]);
|
this.instructions.push([ol.render.canvas.Instruction.STROKE]);
|
||||||
|
state.lastStroke = this.coordinates.length;
|
||||||
}
|
}
|
||||||
this.instructions.push(
|
this.instructions.push(
|
||||||
[ol.render.canvas.Instruction.SET_STROKE_STYLE, state.strokeStyle],
|
[ol.render.canvas.Instruction.SET_STROKE_STYLE, state.strokeStyle],
|
||||||
@@ -391,7 +392,7 @@ ol.render.canvas.LineStringReplay.prototype.drawMultiLineStringGeometry =
|
|||||||
ol.render.canvas.LineStringReplay.prototype.finish = function() {
|
ol.render.canvas.LineStringReplay.prototype.finish = function() {
|
||||||
var state = this.state_;
|
var state = this.state_;
|
||||||
goog.asserts.assert(!goog.isNull(state));
|
goog.asserts.assert(!goog.isNull(state));
|
||||||
if (state.lastDraw != this.coordinates.length) {
|
if (state.lastStroke != this.coordinates.length) {
|
||||||
this.instructions.push([ol.render.canvas.Instruction.STROKE]);
|
this.instructions.push([ol.render.canvas.Instruction.STROKE]);
|
||||||
}
|
}
|
||||||
this.state_ = null;
|
this.state_ = null;
|
||||||
|
|||||||
Reference in New Issue
Block a user