@@ -19,6 +19,7 @@ import {ComponentManager} from './component_manager.js';
1919import * as Css from './css.js' ;
2020import { EventType } from './events/type.js' ;
2121import * as eventUtils from './events/utils.js' ;
22+ import type { IComponent } from './interfaces/i_component.js' ;
2223import { IFocusableNode } from './interfaces/i_focusable_node.js' ;
2324import type { IPositionable } from './interfaces/i_positionable.js' ;
2425import type { UiMetrics } from './metrics_manager.js' ;
@@ -39,9 +40,9 @@ import type {WorkspaceSvg} from './workspace_svg.js';
3940 *
4041 * @internal
4142 */
42- abstract class ZoomControl implements IFocusableNode {
43+ abstract class ZoomControl implements IFocusableNode , IComponent {
4344 private pointerDownHandler : browserEvents . Data ;
44- private id : string ;
45+ id : string ;
4546
4647 constructor (
4748 protected workspace : WorkspaceSvg ,
@@ -60,10 +61,6 @@ abstract class ZoomControl implements IFocusableNode {
6061 this . group . id = this . id ;
6162 }
6263
63- getId ( ) {
64- return this . id ;
65- }
66-
6764 /**
6865 * Handles a mouse down event on the zoom in or zoom out buttons on the
6966 * workspace.
@@ -385,6 +382,21 @@ export class ZoomControls implements IPositionable {
385382 this . svgGroup ,
386383 ) ;
387384 }
385+
386+ for ( const control of [
387+ this . zoomOutControl ,
388+ this . zoomInControl ,
389+ this . zoomResetControl ,
390+ ] ) {
391+ if ( ! control ) continue ;
392+
393+ this . workspace . getComponentManager ( ) . addComponent ( {
394+ component : control ,
395+ weight : ComponentManager . ComponentWeight . ZOOM_CONTROLS_WEIGHT ,
396+ capabilities : [ ComponentManager . Capability . FOCUSABLE ] ,
397+ } ) ;
398+ }
399+
388400 return this . svgGroup ;
389401 }
390402
@@ -508,24 +520,6 @@ export class ZoomControls implements IPositionable {
508520 'translate(' + this . left + ',' + this . top + ')' ,
509521 ) ;
510522 }
511-
512- /**
513- * Returns the individual zoom control, if any, with the given ID. Used for
514- * focus management.
515- *
516- * @internal
517- */
518- getControlWithId ( id : string ) {
519- for ( const control of [
520- this . zoomInControl ,
521- this . zoomOutControl ,
522- this . zoomResetControl ,
523- ] ) {
524- if ( control ?. getId ( ) === id ) {
525- return control ;
526- }
527- }
528- }
529523}
530524
531525/** CSS for zoom controls. See css.js for use. */
0 commit comments