committed by
Frederic Junod
parent
5f5bc2ecdb
commit
71ebed07bf
@@ -124,14 +124,15 @@ ol.render.canvas.LineStringReplay.prototype.setStrokeStyle_ = function() {
|
||||
state.currentLineWidth != lineWidth ||
|
||||
state.currentMiterLimit != miterLimit) {
|
||||
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(
|
||||
[ol.render.canvas.Instruction.SET_STROKE_STYLE,
|
||||
strokeStyle, lineWidth, lineCap, lineJoin, miterLimit, lineDash],
|
||||
[ol.render.canvas.Instruction.BEGIN_PATH]);
|
||||
this.instructions.push([
|
||||
ol.render.canvas.Instruction.SET_STROKE_STYLE,
|
||||
strokeStyle, lineWidth, lineCap, lineJoin, miterLimit, lineDash
|
||||
], [
|
||||
ol.render.canvas.Instruction.BEGIN_PATH
|
||||
]);
|
||||
state.currentStrokeStyle = strokeStyle;
|
||||
state.currentLineCap = lineCap;
|
||||
state.currentLineDash = lineDash;
|
||||
@@ -155,15 +156,16 @@ ol.render.canvas.LineStringReplay.prototype.drawLineString = function(lineString
|
||||
}
|
||||
this.setStrokeStyle_();
|
||||
this.beginGeometry(lineStringGeometry, feature);
|
||||
this.hitDetectionInstructions.push(
|
||||
[ol.render.canvas.Instruction.SET_STROKE_STYLE,
|
||||
state.strokeStyle, state.lineWidth, state.lineCap, state.lineJoin,
|
||||
state.miterLimit, state.lineDash],
|
||||
[ol.render.canvas.Instruction.BEGIN_PATH]);
|
||||
this.hitDetectionInstructions.push([
|
||||
ol.render.canvas.Instruction.SET_STROKE_STYLE,
|
||||
state.strokeStyle, state.lineWidth, state.lineCap, state.lineJoin,
|
||||
state.miterLimit, state.lineDash
|
||||
], [
|
||||
ol.render.canvas.Instruction.BEGIN_PATH
|
||||
]);
|
||||
var flatCoordinates = lineStringGeometry.getFlatCoordinates();
|
||||
var stride = lineStringGeometry.getStride();
|
||||
this.drawFlatCoordinates_(
|
||||
flatCoordinates, 0, flatCoordinates.length, stride);
|
||||
this.drawFlatCoordinates_(flatCoordinates, 0, flatCoordinates.length, stride);
|
||||
this.hitDetectionInstructions.push([ol.render.canvas.Instruction.STROKE]);
|
||||
this.endGeometry(lineStringGeometry, feature);
|
||||
};
|
||||
@@ -182,11 +184,13 @@ ol.render.canvas.LineStringReplay.prototype.drawMultiLineString = function(multi
|
||||
}
|
||||
this.setStrokeStyle_();
|
||||
this.beginGeometry(multiLineStringGeometry, feature);
|
||||
this.hitDetectionInstructions.push(
|
||||
[ol.render.canvas.Instruction.SET_STROKE_STYLE,
|
||||
state.strokeStyle, state.lineWidth, state.lineCap, state.lineJoin,
|
||||
state.miterLimit, state.lineDash],
|
||||
[ol.render.canvas.Instruction.BEGIN_PATH]);
|
||||
this.hitDetectionInstructions.push([
|
||||
ol.render.canvas.Instruction.SET_STROKE_STYLE,
|
||||
state.strokeStyle, state.lineWidth, state.lineCap, state.lineJoin,
|
||||
state.miterLimit, state.lineDash
|
||||
], [
|
||||
ol.render.canvas.Instruction.BEGIN_PATH
|
||||
]);
|
||||
var ends = multiLineStringGeometry.getEnds();
|
||||
var flatCoordinates = multiLineStringGeometry.getFlatCoordinates();
|
||||
var stride = multiLineStringGeometry.getStride();
|
||||
|
||||
@@ -135,14 +135,16 @@ ol.render.canvas.PolygonReplay.prototype.drawCircle = function(circleGeometry, f
|
||||
this.setFillStrokeStyles_(circleGeometry);
|
||||
this.beginGeometry(circleGeometry, feature);
|
||||
// always fill the circle for hit detection
|
||||
this.hitDetectionInstructions.push(
|
||||
[ol.render.canvas.Instruction.SET_FILL_STYLE,
|
||||
ol.color.asString(ol.render.canvas.defaultFillStyle)]);
|
||||
this.hitDetectionInstructions.push([
|
||||
ol.render.canvas.Instruction.SET_FILL_STYLE,
|
||||
ol.color.asString(ol.render.canvas.defaultFillStyle)
|
||||
]);
|
||||
if (state.strokeStyle !== undefined) {
|
||||
this.hitDetectionInstructions.push(
|
||||
[ol.render.canvas.Instruction.SET_STROKE_STYLE,
|
||||
state.strokeStyle, state.lineWidth, state.lineCap, state.lineJoin,
|
||||
state.miterLimit, state.lineDash]);
|
||||
this.hitDetectionInstructions.push([
|
||||
ol.render.canvas.Instruction.SET_STROKE_STYLE,
|
||||
state.strokeStyle, state.lineWidth, state.lineCap, state.lineJoin,
|
||||
state.miterLimit, state.lineDash
|
||||
]);
|
||||
}
|
||||
var flatCoordinates = circleGeometry.getFlatCoordinates();
|
||||
var stride = circleGeometry.getStride();
|
||||
@@ -185,14 +187,16 @@ ol.render.canvas.PolygonReplay.prototype.drawPolygon = function(polygonGeometry,
|
||||
this.setFillStrokeStyles_(polygonGeometry);
|
||||
this.beginGeometry(polygonGeometry, feature);
|
||||
// always fill the polygon for hit detection
|
||||
this.hitDetectionInstructions.push(
|
||||
[ol.render.canvas.Instruction.SET_FILL_STYLE,
|
||||
ol.color.asString(ol.render.canvas.defaultFillStyle)]);
|
||||
this.hitDetectionInstructions.push([
|
||||
ol.render.canvas.Instruction.SET_FILL_STYLE,
|
||||
ol.color.asString(ol.render.canvas.defaultFillStyle)]
|
||||
);
|
||||
if (state.strokeStyle !== undefined) {
|
||||
this.hitDetectionInstructions.push(
|
||||
[ol.render.canvas.Instruction.SET_STROKE_STYLE,
|
||||
state.strokeStyle, state.lineWidth, state.lineCap, state.lineJoin,
|
||||
state.miterLimit, state.lineDash]);
|
||||
this.hitDetectionInstructions.push([
|
||||
ol.render.canvas.Instruction.SET_STROKE_STYLE,
|
||||
state.strokeStyle, state.lineWidth, state.lineCap, state.lineJoin,
|
||||
state.miterLimit, state.lineDash
|
||||
]);
|
||||
}
|
||||
var ends = polygonGeometry.getEnds();
|
||||
var flatCoordinates = polygonGeometry.getOrientedFlatCoordinates();
|
||||
@@ -220,14 +224,16 @@ ol.render.canvas.PolygonReplay.prototype.drawMultiPolygon = function(multiPolygo
|
||||
this.setFillStrokeStyles_(multiPolygonGeometry);
|
||||
this.beginGeometry(multiPolygonGeometry, feature);
|
||||
// always fill the multi-polygon for hit detection
|
||||
this.hitDetectionInstructions.push(
|
||||
[ol.render.canvas.Instruction.SET_FILL_STYLE,
|
||||
ol.color.asString(ol.render.canvas.defaultFillStyle)]);
|
||||
this.hitDetectionInstructions.push([
|
||||
ol.render.canvas.Instruction.SET_FILL_STYLE,
|
||||
ol.color.asString(ol.render.canvas.defaultFillStyle)
|
||||
]);
|
||||
if (state.strokeStyle !== undefined) {
|
||||
this.hitDetectionInstructions.push(
|
||||
[ol.render.canvas.Instruction.SET_STROKE_STYLE,
|
||||
state.strokeStyle, state.lineWidth, state.lineCap, state.lineJoin,
|
||||
state.miterLimit, state.lineDash]);
|
||||
this.hitDetectionInstructions.push([
|
||||
ol.render.canvas.Instruction.SET_STROKE_STYLE,
|
||||
state.strokeStyle, state.lineWidth, state.lineCap, state.lineJoin,
|
||||
state.miterLimit, state.lineDash
|
||||
]);
|
||||
}
|
||||
var endss = multiPolygonGeometry.getEndss();
|
||||
var flatCoordinates = multiPolygonGeometry.getOrientedFlatCoordinates();
|
||||
@@ -365,9 +371,10 @@ ol.render.canvas.PolygonReplay.prototype.setFillStrokeStyles_ = function(geometr
|
||||
state.currentLineJoin != lineJoin ||
|
||||
state.currentLineWidth != lineWidth ||
|
||||
state.currentMiterLimit != miterLimit) {
|
||||
this.instructions.push(
|
||||
[ol.render.canvas.Instruction.SET_STROKE_STYLE,
|
||||
strokeStyle, lineWidth, lineCap, lineJoin, miterLimit, lineDash]);
|
||||
this.instructions.push([
|
||||
ol.render.canvas.Instruction.SET_STROKE_STYLE,
|
||||
strokeStyle, lineWidth, lineCap, lineJoin, miterLimit, lineDash
|
||||
]);
|
||||
state.currentStrokeStyle = strokeStyle;
|
||||
state.currentLineCap = lineCap;
|
||||
state.currentLineDash = lineDash;
|
||||
|
||||
Reference in New Issue
Block a user