Add text style default values
This commit is contained in:
@@ -3,6 +3,12 @@ goog.provide('ol.render.canvas');
|
|||||||
goog.require('ol.color');
|
goog.require('ol.color');
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @const {string}
|
||||||
|
*/
|
||||||
|
ol.render.canvas.defaultFont = '10px sans-serif';
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @const {ol.Color}
|
* @const {ol.Color}
|
||||||
*/
|
*/
|
||||||
@@ -39,6 +45,18 @@ ol.render.canvas.defaultMiterLimit = 10;
|
|||||||
ol.render.canvas.defaultStrokeStyle = ol.color.fromString('black');
|
ol.render.canvas.defaultStrokeStyle = ol.color.fromString('black');
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @const {string}
|
||||||
|
*/
|
||||||
|
ol.render.canvas.defaultTextAlign = 'start';
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @const {string}
|
||||||
|
*/
|
||||||
|
ol.render.canvas.defaultTextBaseline = 'alphabetic';
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @const {number}
|
* @const {number}
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -452,11 +452,11 @@ ol.render.canvas.Immediate.prototype.setTextStyle = function(textStyle) {
|
|||||||
if (!ol.style.Text.equals(state.textStyle, textStyle)) {
|
if (!ol.style.Text.equals(state.textStyle, textStyle)) {
|
||||||
if (goog.isDefAndNotNull(textStyle)) {
|
if (goog.isDefAndNotNull(textStyle)) {
|
||||||
context.font = goog.isDef(textStyle.font) ?
|
context.font = goog.isDef(textStyle.font) ?
|
||||||
textStyle.font : '10px sans-serif';
|
textStyle.font : ol.render.canvas.defaultFont;
|
||||||
context.textAlign = goog.isDef(textStyle.textAlign) ?
|
context.textAlign = goog.isDef(textStyle.textAlign) ?
|
||||||
textStyle.textAlign : 'start';
|
textStyle.textAlign : ol.render.canvas.defaultTextAlign;
|
||||||
context.textBaseline = goog.isDef(textStyle.textBaseline) ?
|
context.textBaseline = goog.isDef(textStyle.textBaseline) ?
|
||||||
textStyle.textBaseline : 'alphabetic';
|
textStyle.textBaseline : ol.render.canvas.defaultTextBaseline;
|
||||||
}
|
}
|
||||||
state.textStyle = textStyle;
|
state.textStyle = textStyle;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user