mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
IDEA-330584 SvgViewer: handle empty image properly at setZoom
GitOrigin-RevId: 6e779224e4db224ad096f780f6e8f8a65a43333f
This commit is contained in:
committed by
intellij-monorepo-bot
parent
cd321dd908
commit
4cf4033b3a
@@ -127,7 +127,7 @@
|
||||
|
||||
<body>
|
||||
<div id="control_panel" style="display: none; z-index: 30">
|
||||
<input type="text" style="width: 100%;" id="url_input">
|
||||
<input type="text" style="width: 100%;" id="url_input" value="http://localhost/image">
|
||||
<button onclick="zoomIn()">+</button>
|
||||
<button onclick="zoomOut()">-</button>
|
||||
<button onclick="fitToViewport()">fit</button>
|
||||
@@ -308,7 +308,12 @@
|
||||
anchor_on_viewport = {x: gUI.view_port.offsetWidth / 2, y: gUI.view_port.offsetHeight / 2}
|
||||
}
|
||||
zoom = Math.min(MAX_ZOOM, zoom)
|
||||
zoom = Math.max(zoom, MIN_IMAGE_SIZE / gUI.image.clientWidth, MIN_IMAGE_SIZE / gUI.image.clientHeight)
|
||||
if (gUI.image.clientWidth === 0 || gUI.image.clientHeight === 0) {
|
||||
// Set some zoom to show the empty image
|
||||
zoom = 1
|
||||
} else {
|
||||
zoom = Math.max(zoom, MIN_IMAGE_SIZE / gUI.image.clientWidth, MIN_IMAGE_SIZE / gUI.image.clientHeight)
|
||||
}
|
||||
|
||||
if (Math.abs(zoom - 1.0) < 0.05) zoom = 1.0
|
||||
|
||||
|
||||
Reference in New Issue
Block a user