Skip to content

Commit

Permalink
Merge branch 'master' of https://www.github.com/ecomfe/zrender
Browse files Browse the repository at this point in the history
  • Loading branch information
100pah committed Jul 29, 2018
2 parents c755c95 + b7e5c71 commit 2002a11
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 6 deletions.
12 changes: 8 additions & 4 deletions src/core/env.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@ if (typeof wx === 'object' && typeof wx.getSystemInfoSync === 'function') {
wxa: true, // Weixin Application
canvasSupported: true,
svgSupported: false,
touchEventsSupported: true
touchEventsSupported: true,
domSupported: false
}
}
else if (typeof document === 'undefined' && typeof self !== 'undefined') {
Expand All @@ -27,7 +28,8 @@ else if (typeof document === 'undefined' && typeof self !== 'undefined') {
os: {},
node: false,
worker: true,
canvasSupported: true
canvasSupported: true,
domSupported: false
};
}
else if (typeof navigator === 'undefined') {
Expand All @@ -39,7 +41,8 @@ else if (typeof navigator === 'undefined') {
worker: false,
// Assume canvas is supported
canvasSupported: true,
svgSupported: true
svgSupported: true,
domSupported: false
};
}
else {
Expand Down Expand Up @@ -148,8 +151,9 @@ function detect(ua) {
// events currently. So we dont use that on other browsers unless tested sufficiently.
// Although IE 10 supports pointer event, it use old style and is different from the
// standard. So we exclude that. (IE 10 is hardly used on touch device)
&& (browser.edge || (browser.ie && browser.version >= 11))
&& (browser.edge || (browser.ie && browser.version >= 11)),
// passiveSupported: detectPassiveSupport()
domSupported: typeof document !== 'undefined'
};
}

Expand Down
10 changes: 8 additions & 2 deletions src/graphic/helper/text.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@ import {
each,
normalizeCssArray,
isString,
isObject
isObject,
isFunction
} from '../../core/util';
import * as textContain from '../../contain/text';
import * as roundRectHelper from './roundRect';
Expand Down Expand Up @@ -305,6 +306,7 @@ function applyTextRotation(ctx, style, rect, x, y) {

function placeToken(hostEl, ctx, token, style, lineHeight, lineTop, x, textAlign) {
var tokenStyle = style.rich[token.styleName] || {};
tokenStyle.text = token.text;

// 'ctx.textBaseline' is always set as 'middle', for sake of
// the bias of "Microsoft YaHei".
Expand Down Expand Up @@ -370,7 +372,7 @@ function needDrawBackground(style) {
|| (style.textBorderWidth && style.textBorderColor);
}

// style: {textBackgroundColor, textBorderWidth, textBorderColor, textBorderRadius}
// style: {textBackgroundColor, textBorderWidth, textBorderColor, textBorderRadius, text}
// shape: {x, y, width, height}
function drawBackground(hostEl, ctx, style, x, y, width, height) {
var textBackgroundColor = style.textBackgroundColor;
Expand Down Expand Up @@ -410,6 +412,10 @@ function drawBackground(hostEl, ctx, style, x, y, width, height) {
ctx.fill();
}
}
else if (isFunction(textBackgroundColor)) {
setCtx(ctx, 'fillStyle', textBackgroundColor(style));
ctx.fill();
}
else if (isObject(textBackgroundColor)) {
var image = textBackgroundColor.image;

Expand Down

0 comments on commit 2002a11

Please sign in to comment.