diff --git a/packages/jaeger-ui/src/components/common/utils.css b/packages/jaeger-ui/src/components/common/utils.css index 9f8fe68d1e..3a9027f584 100644 --- a/packages/jaeger-ui/src/components/common/utils.css +++ b/packages/jaeger-ui/src/components/common/utils.css @@ -136,7 +136,7 @@ limitations under the License. .u-miniMap > .plexus-MiniMap--button { background: #ccc; - color: #888; + color: #444; cursor: pointer; font-size: 1.6em; line-height: 0; diff --git a/packages/plexus/package.json b/packages/plexus/package.json index 1fe677ed89..4882d94f48 100644 --- a/packages/plexus/package.json +++ b/packages/plexus/package.json @@ -54,7 +54,8 @@ "d3-selection": "^3.0.0", "d3-zoom": "^3.0.0", "memoize-one": "6.0.0", - "viz.js": "1.8.1" + "viz.js": "1.8.1", + "react-icons": "^4.10.1" }, "scripts": { "_tasks/build/lib/js": "node_modules/.bin/babel src --extensions '.tsx,.js' --out-dir lib", diff --git a/packages/plexus/src/zoom/MiniMap.tsx b/packages/plexus/src/zoom/MiniMap.tsx index 41c4114ae2..4bc76104fe 100644 --- a/packages/plexus/src/zoom/MiniMap.tsx +++ b/packages/plexus/src/zoom/MiniMap.tsx @@ -14,7 +14,7 @@ import * as React from 'react'; -import resetZoomIcon from './resetZoomIcon'; +import { HiMiniArrowsPointingOut, HiMagnifyingGlassPlus, HiMagnifyingGlassMinus } from 'react-icons/hi2'; /* eslint-disable react/no-unused-prop-types */ type TProps = { @@ -23,6 +23,8 @@ type TProps = { contentHeight: number; contentWidth: number; viewAll: () => void; + zoomIn: () => void; + zoomOut: () => void; viewportHeight: number; viewportWidth: number; k?: number; @@ -88,8 +90,14 @@ export function MiniMap(props: TProps) {
+
+ +
+
+ +
- {resetZoomIcon} +
); diff --git a/packages/plexus/src/zoom/ZoomManager.tsx b/packages/plexus/src/zoom/ZoomManager.tsx index b8b1a6de6d..b9ec763499 100644 --- a/packages/plexus/src/zoom/ZoomManager.tsx +++ b/packages/plexus/src/zoom/ZoomManager.tsx @@ -45,6 +45,8 @@ type TZoomProps = { contentHeight: number; contentWidth: number; viewAll: () => void; + zoomIn: () => void; + zoomOut: () => void; viewportHeight: number; viewportWidth: number; }; @@ -96,6 +98,24 @@ export default class ZoomManager { this.resetZoom(); } + public zoomIn = () => { + const selection = this.selection; + if (!selection) { + this.updateCallback(zoomIdentity); + return; + } + this.zoom.scaleBy(selection, 1.2); + }; + + public zoomOut = () => { + const selection = this.selection; + if (!selection) { + this.updateCallback(zoomIdentity); + return; + } + this.zoom.scaleBy(selection, 0.8); + }; + public resetZoom = () => { const elem = this.elem; const selection = this.selection; @@ -123,6 +143,8 @@ export default class ZoomManager { x, y, viewAll: this.resetZoom, + zoomIn: this.zoomIn, + zoomOut: this.zoomOut, }; } diff --git a/packages/plexus/src/zoom/resetZoomIcon.tsx b/packages/plexus/src/zoom/resetZoomIcon.tsx deleted file mode 100644 index c9b9f1107c..0000000000 --- a/packages/plexus/src/zoom/resetZoomIcon.tsx +++ /dev/null @@ -1,27 +0,0 @@ -// Copyright (c) 2018 Uber Technologies, Inc. -// -// 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 * as React from 'react'; - -// SVG is from React Icons: -// https://github.com/react-icons/react-icons/blob/396b4d9241a61b6d22f3907273158b6a91aea2fd/md/zoom-out-map.js -// LICENSE: MIT -// https://github.com/react-icons/react-icons/blob/396b4d9241a61b6d22f3907273158b6a91aea2fd/package.json#L26 -export default ( - - - - - -);