* @function LevelRenderer.Shape.prototype.beforeBrush * @description 具体绘制操作前的一些公共操作。 * * @param {CanvasRenderingContext2D} ctx - Context2D 上下文。 * @param {boolean} isHighlight - 是否使用高亮属性。 * @return {Object} 处理后的样式。
(ctx, isHighlight)
| 305 | * @return {Object} 处理后的样式。 |
| 306 | */ |
| 307 | beforeBrush(ctx, isHighlight) { |
| 308 | var style = this.style; |
| 309 | |
| 310 | if (this.brushTypeOnly) { |
| 311 | style.brushType = this.brushTypeOnly; |
| 312 | } |
| 313 | |
| 314 | if (isHighlight) { |
| 315 | // 根据style扩展默认高亮样式 |
| 316 | style = this.getHighlightStyle( |
| 317 | style, |
| 318 | this.highlightStyle || {}, |
| 319 | this.brushTypeOnly |
| 320 | ); |
| 321 | } |
| 322 | |
| 323 | if (this.brushTypeOnly == 'stroke') { |
| 324 | style.strokeColor = style.strokeColor || style.color; |
| 325 | } |
| 326 | |
| 327 | ctx.save(); |
| 328 | |
| 329 | this.doClip(ctx); |
| 330 | |
| 331 | this.setContext(ctx, style); |
| 332 | |
| 333 | // 设置transform |
| 334 | this.setTransform(ctx); |
| 335 | |
| 336 | return style; |
| 337 | } |
| 338 | |
| 339 | |
| 340 | /** |
no test coverage detected