diff --git a/src/main/java/cit/PureATN/MultiNote/KeyEvent_on_MultiNote.java b/src/main/java/cit/PureATN/MultiNote/KeyEvent_on_MultiNote.java index deb2060..a49e8b5 100644 --- a/src/main/java/cit/PureATN/MultiNote/KeyEvent_on_MultiNote.java +++ b/src/main/java/cit/PureATN/MultiNote/KeyEvent_on_MultiNote.java @@ -26,6 +26,7 @@ // System.out.println("keyCode=" + e.getKeyCode() + " keyChar [" + e.getKeyChar() + "]"); if (e.getKeyCode() == KeyEvent.VK_ENTER) { MultiNote mn = (MultiNote)Note.theapp; + mn.toggleExpandMode(); mn.vlayout(); mn.iroduke(); } @@ -50,6 +51,8 @@ if (e.getKeyCode() == KeyEvent.VK_R) { MultiNote mn = (MultiNote)Note.theapp; mn.showStat(); + mn.rotate(); + mn.vlayout(); } if (e.getKeyCode() == KeyEvent.VK_DELETE) { MultiNote mn = (MultiNote)Note.theapp; diff --git a/src/main/java/cit/PureATN/MultiNote/MultiNote.java b/src/main/java/cit/PureATN/MultiNote/MultiNote.java index 934e06f..acc7d0c 100644 --- a/src/main/java/cit/PureATN/MultiNote/MultiNote.java +++ b/src/main/java/cit/PureATN/MultiNote/MultiNote.java @@ -29,6 +29,9 @@ public class MultiNote extends Note { static int width = 920; static int height = (int) (width * 1.42); + static double rotation = 0; + static int muki = 0; + static boolean isTate = true; public MultiNote() { this(null); @@ -45,8 +48,9 @@ // dPenReceiver = new DPenReceiver(this); } - public static float penID2HSBH(int i){ - return ((i+3)%10)/10.0f; + + public static float penID2HSBH(int i) { + return ((i + 3) % 10) / 10.0f; } public PPath[] shitajikiNodes = new PPath[11]; @@ -75,6 +79,7 @@ // moveTarget = (PNode) target.getAttribute("moveTarget"); // } stjk.addAttribute("moveTarget", stjk); + // stjk.setRotation(rotation); getCanvas().getLayer().addChild(stjk); } @@ -112,6 +117,7 @@ } repaint(); } + // 色を戻す d public void irodukeOrig() { Enumeration ite = PenUser.penusers.keys(); @@ -121,7 +127,7 @@ int penid = Integer.parseInt(penid0x); // System.out.println(penid+" "+penid*penid); //pen06 - Color c = new Color(0,0,90);//Color.getHSBColor(penID2HSBH(penid), 0.7f, 0.7f); + Color c = new Color(0, 0, 90);// Color.getHSBColor(penID2HSBH(penid), 0.7f, 0.7f); ArrayList sss = PenUser.find(penidStr).strokes; for (ShortStroke s : sss) { s.setStrokePaint(c); @@ -134,7 +140,6 @@ repaint(); } - // stroke.addAttribute("moveTarget", stroke); public void setMoveTargetToShortStroke(boolean isenable) { Enumeration ite = PenUser.penusers.keys(); @@ -202,38 +207,77 @@ boolean expandMode = false; // 初期状態は「たたんでいる」 public void vlayout() { - setExpandMode(!expandMode); + vlayout(expandMode); + } + + public void toggleExpandMode() { + expandMode = !expandMode; } public void setExpandMode(boolean b) { expandMode = b; - vlayout(expandMode); + } + + public PBounds getWholeBounds() { + double hidariue_x = 0, hidariue_y = 0; + + if (muki == 1) { + hidariue_x = -height; + } else if (muki == 2) { + hidariue_x = -width; + } + if (muki == 2) { + hidariue_y = -height; + } else if (muki == 3) { + hidariue_y = -width; + } + double ww, hh; + ww = width; + hh = height; + if (!isTate) { + ww = height; + hh = width; + } + if (expandMode) { + return new PBounds(hidariue_x, hidariue_y, ww * 5, hh * 2); + + } else { + return new PBounds(hidariue_x, hidariue_y, ww, hh); + + } } public void vlayout(boolean doexpand) { PTransformActivity ta = null; + double ww, hh; + ww = width; + hh = height; + if (!isTate) { + ww = height; + hh = width; + } if (doexpand) { for (int i = 1; i < 6; i++) { - shitajikiNodes[i].animateToPositionScaleRotation((i - 1) * width, 0, 1, 0, 1000); + shitajikiNodes[i].animateToPositionScaleRotation((i - 1) * ww, 0, 1, rotation, 1000); } for (int i = 6; i < 11; i++) { - ta = shitajikiNodes[i].animateToPositionScaleRotation((i - 6) * width, height, 1, 0, 1000); + ta = shitajikiNodes[i].animateToPositionScaleRotation((i - 6) * ww, hh, 1, rotation, 1000); } PTransformActivity ta2 = getCanvas().getCamera().animateViewToCenterBounds( // getCanvas().getLayer().getFullBounds(), - new PBounds(0, 0, width * 5, height * 2), + getWholeBounds(), true, 1000); ta2.startAfter(ta); } else { // たたむ for (int i = 1; i < 11; i++) { - ta = shitajikiNodes[i].animateToPositionScaleRotation(0, 0, 1, 0, 1000); + ta = shitajikiNodes[i].animateToPositionScaleRotation(0, 0, 1, rotation, 1000); } PTransformActivity ta2 = getCanvas().getCamera().animateViewToCenterBounds( // getCanvas().getLayer().getFullBounds(), - new PBounds(0, 0, width, height), + getWholeBounds(), true, 1000); ta2.startAfter(ta); @@ -268,14 +312,20 @@ for (int i = 1; i < 11; i++) { PPath stjk = shitajikiNodes[i]; stjk.removeAllChildren(); - // var children = stjk.getChildrenReference(); - // for (var child : children) { - // if (child instanceof PPath) { - // PPath pchild = (PPath) child; - // pchild.removeFromParent(); - // } - // } - // } + // var children = stjk.getChildrenReference(); + // for (var child : children) { + // if (child instanceof PPath) { + // PPath pchild = (PPath) child; + // pchild.removeFromParent(); + // } + // } + // } } } + + public void rotate() { + muki = (muki + 1) % 4; + rotation = (Math.PI / 2) * muki; + isTate = !isTate; + } }