MCPcopy Index your code
hub / github.com/apache/echarts / render

Method render

src/component/thumbnail/ThumbnailView.ts:64–127  ·  view source on GitHub ↗
(thumbnailModel: ThumbnailModel, ecModel: GlobalModel, api: ExtensionAPI)

Source from the content-addressed store, hash-verified

62 private _renderVersion: number;
63
64 render(thumbnailModel: ThumbnailModel, ecModel: GlobalModel, api: ExtensionAPI): void {
65 this._api = api;
66 this._model = thumbnailModel;
67 if (!this._coordSys) {
68 this._coordSys = new View();
69 }
70
71 if (!this._isEnabled()) {
72 this._clear();
73 return;
74 }
75
76 this._renderVersion = api.getECUpdateCycleVersion();
77 const group = this.group;
78
79 group.removeAll();
80
81 const itemStyleModel = thumbnailModel.getModel('itemStyle');
82 const itemStyle = itemStyleModel.getItemStyle();
83 if (itemStyle.fill == null) {
84 itemStyle.fill = ecModel.get('backgroundColor') || tokens.color.neutral00;
85 }
86
87 const refContainer = createBoxLayoutReference(thumbnailModel, api).refContainer;
88 const boxRect = getLayoutRect(
89 getBoxLayoutParams(thumbnailModel, true),
90 refContainer
91 );
92 const boxBorderWidth = itemStyle.lineWidth || 0;
93 const contentRect = this._contentRect = expandOrShrinkRect(
94 boxRect.clone(), boxBorderWidth / 2, true, true
95 );
96
97 const contentGroup = new Group();
98 group.add(contentGroup);
99 contentGroup.setClipPath(new Rect({shape: contentRect.plain()}));
100
101 const targetGroup = this._targetGroup = new Group();
102 contentGroup.add(targetGroup);
103
104 // Draw border and background and shadow of thumbnail box.
105 const borderShape: RectShape = boxRect.plain();
106 borderShape.r = itemStyleModel.getShallow('borderRadius', true) as (number | number[]);
107 group.add(this._bgRect = new Rect({
108 style: itemStyle,
109 shape: borderShape,
110 silent: false, // Prevent from hovering on the lower elements.
111 cursor: 'grab',
112 }));
113
114 const windowStyleModel = thumbnailModel.getModel('windowStyle');
115 const windowR = windowStyleModel.getShallow('borderRadius', true) as (number | number[]);
116 contentGroup.add(this._windowRect = new Rect({
117 shape: {x: 0, y: 0, width: 0, height: 0, r: windowR},
118 style: windowStyleModel.getItemStyle(),
119 silent: false, // Prevent from hovering on the lower elements.
120 cursor: 'grab',
121 }));

Callers

nothing calls this directly

Calls 15

_isEnabledMethod · 0.95
_clearMethod · 0.95
_dealRenderContentMethod · 0.95
_dealUpdateWindowMethod · 0.95
createBoxLayoutReferenceFunction · 0.90
getLayoutRectFunction · 0.90
getBoxLayoutParamsFunction · 0.90
expandOrShrinkRectFunction · 0.90
getItemStyleMethod · 0.80
getShallowMethod · 0.80
updateZFunction · 0.70

Tested by

no test coverage detected