MCPcopy Create free account
hub / github.com/facebook/Rapid / _getAnnotation

Method _getAnnotation

modules/modes/DrawLineMode.js:275–287  ·  view source on GitHub ↗

* _getAnnotation * An annotation is a text associated with the edit, such as "Started a line". * @return {string?} String such as "Started a line", or undefined if the drawWay is incomplete

()

Source from the content-addressed store, hash-verified

273 * @return {string?} String such as "Started a line", or undefined if the drawWay is incomplete
274 */
275 _getAnnotation() {
276 const context = this.context;
277 const editor = context.systems.editor;
278 const graph = editor.staging.graph;
279 const l10n = context.systems.l10n;
280
281 const drawWay = this.drawWayID && graph.hasEntity(this.drawWayID);
282 const length = drawWay?.nodes?.length || 0;
283 if (length < 2) return undefined;
284
285 const which = length > 2 ? 'continue' : 'start';
286 return l10n.t(`operations.${which}.annotation.line`);
287 }
288
289
290 /**

Callers 3

_clickLocMethod · 0.95
_clickWayMethod · 0.95
_clickNodeMethod · 0.95

Calls 2

hasEntityMethod · 0.80
tMethod · 0.45

Tested by

no test coverage detected