forked from eclipse-platform/eclipse.platform.swt
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Use MonitorAware Coordinates in multi zoom
This commit contributes to the use of MonitorAware points and rectangles in the multi zoom coordinate system mapper for translation between points and pixels. contributes to eclipse-platform#62 and eclipse-platform#127
- Loading branch information
1 parent
d441a95
commit 5b103b1
Showing
6 changed files
with
262 additions
and
91 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
55 changes: 55 additions & 0 deletions
55
bundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/graphics/MonitorAwarePoint.java
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,55 @@ | ||
/******************************************************************************* | ||
* Copyright (c) 2025 Yatta Solutions and others. | ||
* | ||
* This program and the accompanying materials | ||
* are made available under the terms of the Eclipse Public License 2.0 | ||
* which accompanies this distribution, and is available at | ||
* https://www.eclipse.org/legal/epl-2.0/ | ||
* | ||
* SPDX-License-Identifier: EPL-2.0 | ||
* | ||
* Contributors: | ||
* Yatta Solutions - initial API and implementation | ||
*******************************************************************************/ | ||
package org.eclipse.swt.graphics; | ||
|
||
import org.eclipse.swt.widgets.*; | ||
|
||
/** | ||
* Instances of this class represent {@link org.eclipse.swt.graphics.Point} | ||
* objects along with the context of the monitor in relation to which they are | ||
* placed on the display. The monitor awareness makes it easy to scale and | ||
* translate the points between pixels and points | ||
* | ||
* @since 3.129 | ||
* @noreference This class is not intended to be referenced by clients | ||
*/ | ||
public final class MonitorAwarePoint extends Point { | ||
|
||
private static final long serialVersionUID = 6077427420686999194L; | ||
|
||
/** | ||
* Constructs a new MonitorAwarePoint | ||
* | ||
* @param x the x coordinate of the point | ||
* @param y the y coordinate of the point | ||
* @param monitor the monitor with whose context the point is created | ||
* | ||
* @since 3.129 | ||
*/ | ||
public MonitorAwarePoint(int x, int y, Monitor monitor) { | ||
super(x, y); | ||
this.monitor = monitor; | ||
} | ||
|
||
/** | ||
* Gets the monitor with whose context the instance is created | ||
* | ||
* @since 3.129 | ||
*/ | ||
public Monitor getMonitor() { | ||
return monitor; | ||
} | ||
|
||
private final Monitor monitor; | ||
} |
57 changes: 57 additions & 0 deletions
57
...es/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/graphics/MonitorAwareRectangle.java
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,57 @@ | ||
/******************************************************************************* | ||
* Copyright (c) 2025 Yatta Solutions and others. | ||
* | ||
* This program and the accompanying materials | ||
* are made available under the terms of the Eclipse Public License 2.0 | ||
* which accompanies this distribution, and is available at | ||
* https://www.eclipse.org/legal/epl-2.0/ | ||
* | ||
* SPDX-License-Identifier: EPL-2.0 | ||
* | ||
* Contributors: | ||
* Yatta Solutions - initial API and implementation | ||
*******************************************************************************/ | ||
package org.eclipse.swt.graphics; | ||
|
||
import org.eclipse.swt.widgets.*; | ||
|
||
/** | ||
* Instances of this class represent {@link org.eclipse.swt.graphics.Rectangle} | ||
* objects along with the context of the monitor in relation to which they are | ||
* placed on the display. The monitor awareness makes it easy to scale and | ||
* translate the rectangles between pixels and points | ||
* | ||
* @since 3.129 | ||
* @noreference This class is not intended to be referenced by clients | ||
*/ | ||
public final class MonitorAwareRectangle extends Rectangle { | ||
|
||
private static final long serialVersionUID = 5041911840525116925L; | ||
|
||
/** | ||
* Constructs a new MonitorAwareRectangle | ||
* | ||
* @param x the x coordinate of the top left corner of the rectangle | ||
* @param y the y coordinate of the top left corner of the rectangle | ||
* @param width the width of the rectangle | ||
* @param height the height of the rectangle | ||
* @param monitor the monitor with whose context the rectangle is created | ||
* | ||
* @since 3.129 | ||
*/ | ||
public MonitorAwareRectangle(int x, int y, int width, int height, Monitor monitor) { | ||
super(x, y, width, height); | ||
this.monitor = monitor; | ||
} | ||
|
||
/** | ||
* Gets the monitor with whose context the instance is created | ||
* | ||
* @since 3.129 | ||
*/ | ||
public Monitor getMonitor() { | ||
return monitor; | ||
} | ||
|
||
private final Monitor monitor; | ||
} |
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
Oops, something went wrong.