MCPcopy Index your code
hub / github.com/SuperMap/iClient-JavaScript / brush

Method brush

src/common/overlay/levelRenderer/Shape.js:262–296  ·  view source on GitHub ↗

* @function LevelRenderer.Shape.prototype.brush * @description 绘制图形。 * * @param {CanvasRenderingContext2D} ctx - Context2D 上下文。 * @param {boolean} isHighlight - 是否使用高亮属性。 * @param {function} updateCallback - 需要异步加载资源的 shape 可以通过这个 callback(e),让painter更新视图,base.brush 没用,需要的话重

(ctx, isHighlight)

Source from the content-addressed store, hash-verified

260 * @param {function} updateCallback - 需要异步加载资源的 shape 可以通过这个 callback(e),让painter更新视图,base.brush 没用,需要的话重载 brush。
261 */
262 brush(ctx, isHighlight) {
263
264 var style = this.beforeBrush(ctx, isHighlight);
265
266 ctx.beginPath();
267 this.buildPath(ctx, style);
268
269 switch (style.brushType) {
270 /* jshint ignore:start */
271 case 'both':
272 this.setCtxGlobalAlpha(ctx, "fill", style);
273 ctx.fill();
274 if (style.lineWidth > 0) {
275 this.setCtxGlobalAlpha(ctx, "stroke", style);
276 ctx.stroke();
277 }
278 this.setCtxGlobalAlpha(ctx, "reset", style);
279 break;
280 case 'stroke':
281 this.setCtxGlobalAlpha(ctx, "stroke", style);
282 style.lineWidth > 0 && ctx.stroke();
283 this.setCtxGlobalAlpha(ctx, "reset", style);
284 break;
285 /* jshint ignore:end */
286 default:
287 this.setCtxGlobalAlpha(ctx, "fill", style);
288 ctx.fill();
289 this.setCtxGlobalAlpha(ctx, "reset", style);
290 break;
291 }
292
293 this.drawText(ctx, style, this.style);
294
295 this.afterBrush(ctx);
296 }
297
298
299 /**

Callers 15

SmicPolygonSpec.jsFile · 0.45
SmicImageSpec.jsFile · 0.45
SmicTextSpec.jsFile · 0.45
ShapeSpec.jsFile · 0.45
_paintListMethod · 0.45
toDataURLMethod · 0.45
_brushHoverMethod · 0.45
_shapeToImageMethod · 0.45

Calls 5

beforeBrushMethod · 0.95
buildPathMethod · 0.95
setCtxGlobalAlphaMethod · 0.95
drawTextMethod · 0.95
afterBrushMethod · 0.95

Tested by

no test coverage detected