| 59 | const Group = graphic.Group; |
| 60 | |
| 61 | class LegendView extends ComponentView { |
| 62 | static type = 'legend.plain'; |
| 63 | type = LegendView.type; |
| 64 | |
| 65 | newlineDisabled = false; |
| 66 | |
| 67 | private _contentGroup: graphic.Group; |
| 68 | |
| 69 | private _backgroundEl: graphic.Rect; |
| 70 | |
| 71 | private _selectorGroup: graphic.Group; |
| 72 | |
| 73 | /** |
| 74 | * If first rendering, `contentGroup.position` is [0, 0], which |
| 75 | * does not make sense and may cause unexpected animation if adopted. |
| 76 | */ |
| 77 | private _isFirstRender: boolean; |
| 78 | |
| 79 | init() { |
| 80 | |
| 81 | this.group.add(this._contentGroup = new Group()); |
| 82 | this.group.add(this._selectorGroup = new Group()); |
| 83 | |
| 84 | this._isFirstRender = true; |
| 85 | } |
| 86 | |
| 87 | /** |
| 88 | * @protected |
| 89 | */ |
| 90 | getContentGroup() { |
| 91 | return this._contentGroup; |
| 92 | } |
| 93 | |
| 94 | /** |
| 95 | * @protected |
| 96 | */ |
| 97 | getSelectorGroup() { |
| 98 | return this._selectorGroup; |
| 99 | } |
| 100 | |
| 101 | /** |
| 102 | * @override |
| 103 | */ |
| 104 | render( |
| 105 | legendModel: LegendModel, |
| 106 | ecModel: GlobalModel, |
| 107 | api: ExtensionAPI |
| 108 | ) { |
| 109 | const isFirstRender = this._isFirstRender; |
| 110 | this._isFirstRender = false; |
| 111 | |
| 112 | this.resetInner(); |
| 113 | |
| 114 | if (!legendModel.get('show', true)) { |
| 115 | return; |
| 116 | } |
| 117 | |
| 118 | let itemAlign = legendModel.get('align'); |
nothing calls this directly
no outgoing calls
no test coverage detected
searching dependent graphs…