• R/O
  • SSH

Commit

Tags

Frequently used words (click to add to your profile)

javac++androidlinuxc#objective-cqtwindows誰得cocoapythonphprubygameguibathyscaphec翻訳omegat計画中(planning stage)frameworktwittertestdomvb.netdirectxbtronarduinopreviewerゲームエンジン

Commit MetaInfo

Revision40628c5dc031aac1a51dbf663b89b52fd1778236 (tree)
Zeit2015-07-07 22:38:08
Autor <15b05@15b0...>

Log Message

ZincGadgetZoom, ZincGadgetMove 内部構造を等価交換

Ändern Zusammenfassung

Diff

diff -r f4baff405095 -r 40628c5dc031 mirrg.applet.mathematics.zinc/src/mirrg/applet/mathematics/zinc/gadgets/ZincGadgetMove.java
--- a/mirrg.applet.mathematics.zinc/src/mirrg/applet/mathematics/zinc/gadgets/ZincGadgetMove.java Tue Jul 07 22:37:05 2015 +0900
+++ b/mirrg.applet.mathematics.zinc/src/mirrg/applet/mathematics/zinc/gadgets/ZincGadgetMove.java Tue Jul 07 22:38:08 2015 +0900
@@ -24,22 +24,27 @@
2424 int dmy = zincCanvas.getInputStatus().getMouseY() - zincCanvas.getInputStatus().getMouseYPrevious();
2525
2626 if (dmx != 0 || dmy != 0) {
27- // save working buffer
28- zincCanvas.getBufferWorking().getGraphics().drawImage(
29- zincCanvas.getBufferMathematical().getBuffer(), 0, 0, null);
3027
31- zincCanvas.getTransform().centerCoordX -= dmx / zincCanvas.getTransform().pixelsPerX;
32- zincCanvas.getTransform().centerCoordY -= dmy / zincCanvas.getTransform().pixelsPerY;
28+ moveScreen(-dmx, -dmy);
3329
3430 zincCanvas.dirty();
35-
36- // load working buffer
37- zincCanvas.getBufferMathematical().getGraphics().drawImage(
38- zincCanvas.getBufferWorking().getBuffer(), dmx, dmy, null);
39-
4031 zincCanvas.getEventManager().post(new NitrogenEventZincMove.Moved(dmx, dmy));
4132 }
4233 }
4334 }
4435
36+ public void moveScreen(double dx, double dy)
37+ {
38+ // save working buffer
39+ zincCanvas.getBufferWorking().getGraphics().drawImage(
40+ zincCanvas.getBufferMathematical().getBuffer(), 0, 0, null);
41+
42+ zincCanvas.getTransform().centerCoordX += dx / zincCanvas.getTransform().pixelsPerX;
43+ zincCanvas.getTransform().centerCoordY += dy / zincCanvas.getTransform().pixelsPerY;
44+
45+ // load working buffer
46+ zincCanvas.getBufferMathematical().getGraphics().drawImage(
47+ zincCanvas.getBufferWorking().getBuffer(), (int) (-dx), (int) (-dy), null);
48+ }
49+
4550 }
diff -r f4baff405095 -r 40628c5dc031 mirrg.applet.mathematics.zinc/src/mirrg/applet/mathematics/zinc/gadgets/ZincGadgetZoom.java
--- a/mirrg.applet.mathematics.zinc/src/mirrg/applet/mathematics/zinc/gadgets/ZincGadgetZoom.java Tue Jul 07 22:37:05 2015 +0900
+++ b/mirrg.applet.mathematics.zinc/src/mirrg/applet/mathematics/zinc/gadgets/ZincGadgetZoom.java Tue Jul 07 22:38:08 2015 +0900
@@ -22,54 +22,61 @@
2222 @Override
2323 public void doInput()
2424 {
25- ZincTransform t = zincCanvas.getTransform();
2625 InputStatus is = zincCanvas.getInputStatus();
2726
2827 int dmw = is.getMouseW() - is.getMouseWPrevious();
2928
3029 if (dmw != 0) {
31- double rate2X = 1;
32- double rate2Y = 1;
33-
34- // save working buffer
35- zincCanvas.getBufferWorking().getGraphics().drawImage(
36- zincCanvas.getBufferMathematical().getBuffer(), 0, 0, null);
30+ double rateX = 1;
31+ double rateY = 1;
3732
3833 if (is.getKeyBoard().getState(KeyEvent.VK_CONTROL) <= 0) {
39- rate2X = Math.pow(wheelRate, -dmw);
40- t.centerCoordX += (is.getMouseX() - t.getScreenWidth() / 2) / t.pixelsPerX;
41- t.pixelsPerX *= rate2X;
42- t.centerCoordX -= (is.getMouseX() - t.getScreenWidth() / 2) / t.pixelsPerX;
34+ rateX *= Math.pow(wheelRate, -dmw);
4335 }
4436
4537 if (is.getKeyBoard().getState(KeyEvent.VK_SHIFT) <= 0) {
46- rate2Y = Math.pow(wheelRate, -dmw);
47- t.centerCoordY += (is.getMouseY() - t.getScreenHeight() / 2) / t.pixelsPerY;
48- t.pixelsPerY *= rate2Y;
49- t.centerCoordY -= (is.getMouseY() - t.getScreenHeight() / 2) / t.pixelsPerY;
38+ rateY *= Math.pow(wheelRate, -dmw);
5039 }
5140
52- zincCanvas.dirty();
41+ if (is.getKeyBoard().getState(KeyEvent.VK_Z) == 1) {
42+ rateX *= -1;
43+ }
44+ if (is.getKeyBoard().getState(KeyEvent.VK_X) == 1) {
45+ rateY *= -1;
46+ }
5347
54- // load working buffer
55- zincCanvas.getBufferMathematical().getGraphics().drawImage(
56- zincCanvas.getBufferWorking().getBuffer(),
57- (int) (is.getMouseX() * (1 - rate2X)),
58- (int) (is.getMouseY() * (1 - rate2Y)),
59- (int) (zincCanvas.getWidth() * rate2X),
60- (int) (zincCanvas.getHeight() * rate2Y),
61- null);
62- }
48+ zoom(rateX, rateY);
6349
64- if (is.getKeyBoard().getState(KeyEvent.VK_Z) == 1) {
65- t.pixelsPerX = -t.pixelsPerX;
66- zincCanvas.dirty();
67- }
68- if (is.getKeyBoard().getState(KeyEvent.VK_X) == 1) {
69- t.pixelsPerY = -t.pixelsPerY;
7050 zincCanvas.dirty();
7151 }
7252
7353 }
7454
55+ public void zoom(double rate2X, double rate2Y)
56+ {
57+ ZincTransform t = zincCanvas.getTransform();
58+ InputStatus is = zincCanvas.getInputStatus();
59+
60+ // save working buffer
61+ zincCanvas.getBufferWorking().getGraphics().drawImage(
62+ zincCanvas.getBufferMathematical().getBuffer(), 0, 0, null);
63+
64+ t.centerCoordX += (is.getMouseX() - t.getScreenWidth() / 2) / t.pixelsPerX;
65+ t.pixelsPerX *= rate2X;
66+ t.centerCoordX -= (is.getMouseX() - t.getScreenWidth() / 2) / t.pixelsPerX;
67+
68+ t.centerCoordY += (is.getMouseY() - t.getScreenHeight() / 2) / t.pixelsPerY;
69+ t.pixelsPerY *= rate2Y;
70+ t.centerCoordY -= (is.getMouseY() - t.getScreenHeight() / 2) / t.pixelsPerY;
71+
72+ // load working buffer
73+ zincCanvas.getBufferMathematical().getGraphics().drawImage(
74+ zincCanvas.getBufferWorking().getBuffer(),
75+ (int) (is.getMouseX() * (1 - rate2X)),
76+ (int) (is.getMouseY() * (1 - rate2Y)),
77+ (int) (zincCanvas.getWidth() * rate2X),
78+ (int) (zincCanvas.getHeight() * rate2Y),
79+ null);
80+ }
81+
7582 }