Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
10
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
lafabregue
MultiCube
Commits
1e2ec39f
Commit
1e2ec39f
authored
Aug 29, 2017
by
lafabregue
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
small fix 2
parent
8777df20
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
43 additions
and
2 deletions
+43
-2
src/mustic/gui/dialog/classifier/ConstraintsSelectionDialog.java
...tic/gui/dialog/classifier/ConstraintsSelectionDialog.java
+33
-0
src/mustic/gui/panels/ImagePanel.java
src/mustic/gui/panels/ImagePanel.java
+5
-0
src/mustic/utils/image/ZoomBoxPanel.java
src/mustic/utils/image/ZoomBoxPanel.java
+2
-2
src/mustic/utils/image/Zoomable.java
src/mustic/utils/image/Zoomable.java
+3
-0
No files found.
src/mustic/gui/dialog/classifier/ConstraintsSelectionDialog.java
View file @
1e2ec39f
...
...
@@ -10,6 +10,7 @@ import java.awt.Graphics;
import
java.awt.Graphics2D
;
import
java.awt.GridLayout
;
import
java.awt.Image
;
import
java.awt.Point
;
import
java.awt.event.ActionEvent
;
import
java.awt.event.ActionListener
;
import
java.awt.event.FocusEvent
;
...
...
@@ -135,6 +136,8 @@ public class ConstraintsSelectionDialog extends JInternalFrame implements mustic
private
JCheckBox
clusterDiameterCheckBox
;
private
JTextField
diameterTextField
;
private
Point
offSet
=
new
Point
(
0
,
0
);
/** Record steps of constraint construction */
private
int
currentStep
=
0
;
...
...
@@ -374,10 +377,33 @@ public class ConstraintsSelectionDialog extends JInternalFrame implements mustic
zoomBoxChkBox
.
doClick
();
}
int
step
=
10
;
// hide constraints
if
(
e
.
getKeyCode
()
==
KeyEvent
.
VK_H
)
{
check
.
doClick
();
}
if
(
e
.
getKeyCode
()
==
KeyEvent
.
VK_LEFT
)
{
offSet
.
x
+=
(
int
)
(
step
*
mZoomRate
);
displayPanel
.
repaint
();
}
else
if
(
e
.
getKeyCode
()
==
KeyEvent
.
VK_RIGHT
)
{
offSet
.
x
-=
(
int
)
(
step
*
mZoomRate
);
displayPanel
.
repaint
();
}
else
if
(
e
.
getKeyCode
()
==
KeyEvent
.
VK_UP
)
{
offSet
.
y
+=
(
int
)
(
step
*
mZoomRate
);
displayPanel
.
repaint
();
}
else
if
(
e
.
getKeyCode
()
==
KeyEvent
.
VK_DOWN
)
{
offSet
.
y
-=
(
int
)
(
step
*
mZoomRate
);
displayPanel
.
repaint
();
}
// if (offSet.x < 0) {
// offSet.x = 0;
// }
// if(offSet.y < 0) {
// offSet.y = 0;
// }
}
...
...
@@ -467,6 +493,8 @@ public class ConstraintsSelectionDialog extends JInternalFrame implements mustic
@Override
public
BufferedImage
getDisplayedImage
()
{
// return mNew.getSubimage(offSet.x, offSet.y,
// mNew.getWidth() - offSet.x, mNew.getHeight() - offSet.y);
return
mNew
;
}
...
...
@@ -1384,5 +1412,10 @@ public class ConstraintsSelectionDialog extends JInternalFrame implements mustic
}
}
@Override
public
Point
getOffset
()
{
return
offSet
;
}
}
src/mustic/gui/panels/ImagePanel.java
View file @
1e2ec39f
...
...
@@ -1207,4 +1207,9 @@ public class ImagePanel extends JPanel implements Zoomable {
return
rawImage
;
}
@Override
public
Point
getOffset
()
{
return
new
Point
(
0
,
0
);
}
}
src/mustic/utils/image/ZoomBoxPanel.java
View file @
1e2ec39f
...
...
@@ -174,8 +174,8 @@ public class ZoomBoxPanel extends JPanel{
return
new
Point
(
0
,
0
);
}
int
x
=
(
getWidth
()
-
dialog
.
getDisplayedImage
().
getWidth
())
/
2
;
int
y
=
(
getHeight
()
-
dialog
.
getDisplayedImage
().
getHeight
())
/
2
;
int
x
=
(
getWidth
()
-
dialog
.
getDisplayedImage
().
getWidth
())
/
2
+
dialog
.
getOffset
().
x
;
int
y
=
(
getHeight
()
-
dialog
.
getDisplayedImage
().
getHeight
())
/
2
+
dialog
.
getOffset
().
y
;
return
new
Point
(
x
,
y
);
}
...
...
src/mustic/utils/image/Zoomable.java
View file @
1e2ec39f
package
mustic.utils.image
;
import
java.awt.Image
;
import
java.awt.Point
;
import
java.awt.image.BufferedImage
;
/**
...
...
@@ -36,4 +37,6 @@ public interface Zoomable {
* @return the BufferedImage from the origin image
*/
public
Image
getMatchingImage
(
int
x
,
int
y
,
int
width
,
int
height
,
float
zoom
);
public
Point
getOffset
();
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment