Skip to content

Commit

Permalink
Fix Image Editor background and border color IDEA-289934
Browse files Browse the repository at this point in the history
GitOrigin-RevId: 7e00239c1bd57db41b892e8bf6584706a605465a
  • Loading branch information
bulenkov authored and intellij-monorepo-bot committed Oct 1, 2022
1 parent 8d9a24e commit d8df511
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ public final class ImageEditorImpl implements ImageEditor {
private boolean disposed;

public ImageEditorImpl(@NotNull Project project, @NotNull VirtualFile file) {
this(project, file, false, true);
this(project, file, false, false);
}

/**
Expand Down
15 changes: 12 additions & 3 deletions images/src/org/intellij/images/editor/impl/ImageEditorUI.java
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@
import com.intellij.openapi.Disposable;
import com.intellij.openapi.actionSystem.*;
import com.intellij.openapi.diagnostic.Logger;
import com.intellij.openapi.editor.colors.EditorColors;
import com.intellij.openapi.editor.colors.EditorColorsManager;
import com.intellij.openapi.ide.CopyPasteManager;
import com.intellij.openapi.ui.Messages;
import com.intellij.openapi.util.text.StringUtil;
Expand All @@ -31,12 +33,15 @@
import com.intellij.psi.PsiElement;
import com.intellij.psi.PsiFile;
import com.intellij.psi.PsiManager;
import com.intellij.ui.JBColor;
import com.intellij.ui.PopupHandler;
import com.intellij.ui.ScrollPaneFactory;
import com.intellij.ui.components.JBLayeredPane;
import com.intellij.ui.components.Magnificator;
import com.intellij.ui.components.panels.NonOpaquePanel;
import com.intellij.ui.scale.ScaleContext;
import com.intellij.util.LazyInitializer;
import com.intellij.util.ObjectUtils;
import com.intellij.util.SVGLoader;
import com.intellij.util.ui.JBUI;
import org.intellij.images.ImagesBundle;
Expand Down Expand Up @@ -98,7 +103,7 @@ final class ImageEditorUI extends JPanel implements DataProvider, CopyProvider,
private final boolean isEmbedded;

ImageEditorUI(@Nullable ImageEditor editor) {
this(editor, false, true);
this(editor, false, false);
}

ImageEditorUI(@Nullable ImageEditor editor, boolean isEmbedded, boolean isOpaque) {
Expand Down Expand Up @@ -152,6 +157,7 @@ final class ImageEditorUI extends JPanel implements DataProvider, CopyProvider,
actionToolbar.setTargetComponent(this);

toolbarPanel = actionToolbar.getComponent();
toolbarPanel.setBackground(JBColor.lazy(() -> getBackground()));
toolbarPanel.addMouseListener(new FocusRequester());
}

Expand All @@ -167,7 +173,7 @@ final class ImageEditorUI extends JPanel implements DataProvider, CopyProvider,
contentPanel.add(myScrollPane, IMAGE_PANEL);
contentPanel.add(errorPanel, ERROR_PANEL);

JPanel topPanel = new JPanel(new BorderLayout());
JPanel topPanel = new NonOpaquePanel(new BorderLayout());
if (!isEmbedded) {
topPanel.add(toolbarPanel, BorderLayout.WEST);
infoLabel = new JLabel((String)null, SwingConstants.RIGHT);
Expand All @@ -186,12 +192,15 @@ public void componentResized(ComponentEvent e) {
});

if (!isOpaque) {
setOpaque(false);
//setOpaque(false);
contentPanel.setOpaque(false);
myScrollPane.setOpaque(false);
myScrollPane.getViewport().setOpaque(false);
}

setBackground(JBColor.lazy(() -> ObjectUtils.notNull(
EditorColorsManager.getInstance().getGlobalScheme().getColor(EditorColors.PREVIEW_BACKGROUND),
EditorColorsManager.getInstance().getGlobalScheme().getDefaultBackground())));
updateInfo();
}

Expand Down

0 comments on commit d8df511

Please sign in to comment.