Ignore:
Timestamp:
02/19/20 15:29:48 (4 years ago)
Author:
bnemhaus
Message:

You now have the ability to anchor Items to the center of the frame. AnchorCenterX: 0 will anchor a item directly to the vertical center of the frame. AnchorCenterY: 0 to the horizontal center of the frame. Negative numbers go left/up from the center, positive numbers right/down.

More work to come to deal with connected items such as rectangles made up on connected dots.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/expeditee/items/Item.java

    r1511 r1513  
    36583658                }
    36593659        }
     3660       
     3661        public void setAnchorCenterX(Integer anchor) {
     3662                this._anchoring.setCenterXAnchor(anchor);
     3663                if (anchor != null) {
     3664                        anchorConstraints();
     3665                        int alignedToLeft = DisplayController.getFramePaintArea().getCentreX() + anchor;
     3666                        int alignedToCenter = alignedToLeft - (getBoundsWidth() / 2);
     3667                        setX(alignedToCenter);
     3668                }
     3669               
     3670                if (isSurrogate()) {
     3671                        surrogatePropertyInheritance.put(DefaultFrameWriter.ANCHOR_CENTERX_STR, false);
     3672                        Item primary = getPrimary();
     3673                        if (subjectToInheritanceCheckOnSave(DefaultFrameWriter.ANCHOR_CENTERX_STR)) {
     3674                                EncryptionDetail inheritanceCheckOnSave = new EncryptionDetail(EncryptionDetail.Type.InheritanceCheckOnSave);
     3675                                primary.primaryPropertyEncryption.put(DefaultFrameWriter.ANCHOR_CENTERX_STR, inheritanceCheckOnSave);
     3676                        }
     3677                }
     3678        }
    36603679
    36613680        public void setAnchorRight(Integer anchor) {
     
    36943713                }
    36953714        }
     3715       
     3716        public void setAnchorCenterY(Integer anchor) {
     3717                this._anchoring.setCenterYAnchor(anchor);
     3718                if (anchor != null) {
     3719                        anchorConstraints();
     3720                        int alignedToTop = DisplayController.getFramePaintArea().getCentreY() + anchor;
     3721                        int alignedToCenter = alignedToTop - (getBoundsHeight() / 2);
     3722                        setY(alignedToCenter);
     3723                }
     3724               
     3725                if (isSurrogate()) {
     3726                        surrogatePropertyInheritance.put(DefaultFrameWriter.ANCHOR_CENTERY_STR, false);
     3727                        Item primary = getPrimary();
     3728                        if (subjectToInheritanceCheckOnSave(DefaultFrameWriter.ANCHOR_CENTERY_STR)) {
     3729                                EncryptionDetail inheritanceCheckOnSave = new EncryptionDetail(EncryptionDetail.Type.InheritanceCheckOnSave);
     3730                                primary.primaryPropertyEncryption.put(DefaultFrameWriter.ANCHOR_CENTERY_STR, inheritanceCheckOnSave);
     3731                        }
     3732                }
     3733        }
    36963734
    36973735
     
    37123750                }
    37133751        }
    3714 
     3752               
    37153753        public boolean isAnchored()
    37163754        {
     
    37553793                } else {
    37563794                        return _anchoring.getBottomAnchor();
     3795                }
     3796        }
     3797       
     3798        public Integer getAnchorCenterX() {
     3799                if (isSurrogate() && surrogatePropertyInheritance.get(DefaultFrameWriter.ANCHOR_CENTERX_STR)) {
     3800                        return this.getPrimary().getAnchorCenterX();
     3801                } else {
     3802                        return _anchoring.getCenterXAnchor();
     3803                }
     3804        }
     3805       
     3806        public Integer getAnchorCenterY() {
     3807                if (isSurrogate() && surrogatePropertyInheritance.get(DefaultFrameWriter.ANCHOR_CENTERY_STR)) {
     3808                        return this.getPrimary().getAnchorCenterY();
     3809                } else {
     3810                        return _anchoring.getCenterYAnchor();
    37573811                }
    37583812        }
Note: See TracChangeset for help on using the changeset viewer.