-
Notifications
You must be signed in to change notification settings - Fork 33
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[FEAT] Add a new API to zoom the BPMN diagram
The API lets do zoom in and zoom out from the center of the bpmn-container. Introduce the `Navigation` class that exposes all diagram navigation features. It also includes the existing `fit` function. The former one that is defined in `BpmnVisualization` class is deprecated to not break compatibility. It will be removed in a future release. The demo and the diagram test page displays zoom buttons to demonstrate the usage of the new API. In the demo page: - the zoom buttons replace the zoom debounce/throttle settings. They were only displayed for information and weren't useful for the end user. - some elements like labels could previously get focus. This is now fixed. Refactor - In BpmnGraph, the `cumulativeZoomFactor` has been renamed into `currentZoomLevel` for clarification. Rationale: in mxGraph code, `factor` properties are not naming scale values, but a value used to multiply the scale. Here, we use something related to the scale, so we couldn't keep using the `factor` name. - In e2e tests, clarify the signature of the `pageTester.mouseZoom` utils method: - Use zoomType instead of `deltaX` values. Arbitrary `deltaX` values were used at several places. The value is too much tight to the mouse event implementation. The zoom type is now clearer and this reduces usage of duplicated constants. - Put the xTimes parameter at the end of the signature to allow default values. This also makes the signature consistent with the new `doZoomWithButton` function.
- Loading branch information
Showing
19 changed files
with
342 additions
and
106 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
/** | ||
* Copyright 2022 Bonitasoft S.A. | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
import type { BpmnGraph } from './mxgraph/BpmnGraph'; | ||
import type { FitOptions, ZoomType } from './options'; | ||
|
||
/** | ||
* Perform BPMN diagram navigation. | ||
* @category Navigation | ||
* @experimental subject to change, feedback welcome. | ||
*/ | ||
export class Navigation { | ||
constructor(private readonly graph: BpmnGraph) {} | ||
|
||
fit(options?: FitOptions): void { | ||
this.graph.customFit(options); | ||
} | ||
|
||
zoom(type: ZoomType): void { | ||
type == 'in' ? this.graph.zoomIn() : this.graph.zoomOut(); | ||
} | ||
} |
Oops, something went wrong.