7bf22a7de95a6d7ee0407cf7b01c9aeb5300c9516a680983689e7b6096b3a988122086fc3af40e982a80a4c2e42c26e60bbd2b9ffa4aef011fe0873c14d69f 3.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192
  1. import { ComponentOption, ZRColor, VisualOptionFixed } from '../../util/types.js';
  2. import ComponentModel from '../../model/Component.js';
  3. import BrushTargetManager from '../helper/BrushTargetManager.js';
  4. import { BrushCoverCreatorConfig, BrushMode, BrushCoverConfig, BrushDimensionMinMax, BrushAreaRange, BrushTypeUncertain, BrushType } from '../helper/BrushController.js';
  5. import { ModelFinderObject } from '../../util/model.js';
  6. /**
  7. * The input to define brush areas.
  8. * (1) Can be created by user when calling dispatchAction.
  9. * (2) Can be created by `BrushController`
  10. * for brush behavior. area params are picked from `cover.__brushOptoin`.
  11. * In `BrushController`, "covers" are create or updated for each "area".
  12. */
  13. export interface BrushAreaParam extends ModelFinderObject {
  14. brushType: BrushCoverConfig['brushType'];
  15. id?: BrushCoverConfig['id'];
  16. range?: BrushCoverConfig['range'];
  17. panelId?: BrushCoverConfig['panelId'];
  18. coordRange?: BrushAreaRange;
  19. coordRanges?: BrushAreaRange[];
  20. __rangeOffset?: {
  21. offset: BrushDimensionMinMax[] | BrushDimensionMinMax;
  22. xyMinMax: BrushDimensionMinMax[];
  23. };
  24. }
  25. /**
  26. * Generated by `brushModel.setAreas`, which merges
  27. * `area: BrushAreaParam` and `brushModel.option: BrushOption`.
  28. * See `generateBrushOption`.
  29. */
  30. export interface BrushAreaParamInternal extends BrushAreaParam {
  31. brushMode: BrushMode;
  32. brushStyle: BrushCoverConfig['brushStyle'];
  33. transformable: BrushCoverConfig['transformable'];
  34. removeOnClick: BrushCoverConfig['removeOnClick'];
  35. z: BrushCoverConfig['z'];
  36. __rangeOffset?: {
  37. offset: BrushDimensionMinMax | BrushDimensionMinMax[];
  38. xyMinMax: BrushDimensionMinMax[];
  39. };
  40. }
  41. export declare type BrushToolboxIconType = BrushType | 'keep' | 'clear';
  42. export interface BrushOption extends ComponentOption, ModelFinderObject {
  43. mainType?: 'brush';
  44. toolbox?: BrushToolboxIconType[];
  45. brushLink?: number[] | 'all' | 'none';
  46. throttleType?: 'fixRate' | 'debounce';
  47. throttleDelay?: number;
  48. inBrush?: VisualOptionFixed;
  49. outOfBrush?: VisualOptionFixed;
  50. brushType?: BrushTypeUncertain;
  51. brushStyle?: {
  52. borderWidth?: number;
  53. color?: ZRColor;
  54. borderColor?: ZRColor;
  55. };
  56. transformable?: boolean;
  57. brushMode?: BrushMode;
  58. removeOnClick?: boolean;
  59. }
  60. declare class BrushModel extends ComponentModel<BrushOption> {
  61. static type: "brush";
  62. type: "brush";
  63. static dependencies: string[];
  64. static defaultOption: BrushOption;
  65. /**
  66. * @readOnly
  67. */
  68. areas: BrushAreaParamInternal[];
  69. /**
  70. * Current activated brush type.
  71. * If null, brush is inactived.
  72. * see module:echarts/component/helper/BrushController
  73. * @readOnly
  74. */
  75. brushType: BrushTypeUncertain;
  76. /**
  77. * Current brush painting area settings.
  78. * @readOnly
  79. */
  80. brushOption: BrushCoverCreatorConfig;
  81. brushTargetManager: BrushTargetManager;
  82. optionUpdated(newOption: BrushOption, isInit: boolean): void;
  83. /**
  84. * If `areas` is null/undefined, range state remain.
  85. */
  86. setAreas(areas?: BrushAreaParam[]): void;
  87. /**
  88. * Set the current painting brush option.
  89. */
  90. setBrushOption(brushOption: BrushCoverCreatorConfig): void;
  91. }
  92. export default BrushModel;