Ignore:
Timestamp:
04/15/14 12:56:30 (10 years ago)
Author:
bln4
Message:

Added Magnetic Constraints

Magnetic Constraints are a new type of constraint between items; particularly text. Items can have their neighbours set (for example: who is to my right) and then have custom actions run when a item and its neighbour interact in a defined way. For example: one text item grows enough for hits its right neighbour; so its right neighbour moves over to compensate.
Files changed: org.expeditee.{ gui.DisplayIO, io.DefaultFrameReader, io.DefaultFrameWriter, items.Item, items.Text }

Added ability to have 'delayed' properties on items. With the invention of Magnetic Constraints it was found that the saving and loading of properties now required (greatly benifited from) a way to set a property after all items have been loaded in; rather than as the perticular item was being loaded in. This is that ability.

Files changed: org.expeditee.io.{ DefaultFrameReader, ExpReader }

Let through some non letter characters as names of properties. The tokens ',', '', and '_' have been used as property names to describe neighbors. In order to do this the isValidLine(String) method was altered to let these through. This is not the ideal solution, and should be looked at later.

Files changed: org.expeditee.io.ExpReader

Bug fix: setting a custom title support was added previously. If a custom title had been set the title was: [Your Custom Title] ~ [Expeditee Title]. However the tildas where showing up even without a custom title set. This is now fixed.

File:
1 edited

Legend:

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

    r905 r906  
    2424import java.awt.geom.Rectangle2D;
    2525import java.io.File;
    26 import java.io.IOException;
     26
    2727import java.text.AttributedString;
    2828import java.util.Collection;
     
    4141import org.expeditee.gui.FrameUtils;
    4242import org.expeditee.gui.FreeItems;
     43import org.expeditee.items.MagneticConstraint.MagneticConstraints;
    4344import org.expeditee.math.ExpediteeJEP;
    4445import org.expeditee.settings.experimental.ExperimentalFeatures;
     
    691692         */
    692693        public Point2D.Float insertText(String text, float mouseX, float mouseY) {
    693                 return insertText(text, mouseX, mouseY, -1);
     694                final Point2D.Float newPos = insertText(text, mouseX, mouseY, -1);
     695                return newPos;
    694696        }
    695697
     
    14091411                        return;
    14101412
     1413                int preChangeWidth = 0;
     1414                if (_poly != null)
     1415                        preChangeWidth = _poly.getBounds().width;
     1416
    14111417                _poly = new Polygon();
    14121418
     
    14571463
    14581464                _poly.translate(getX(), getY());
     1465                                               
     1466                if(preChangeWidth != 0 && preChangeWidth != _poly.getBounds().width)
     1467                        if(_poly.getBounds().width > preChangeWidth) MagneticConstraints.getInstance().textGrown(this, _poly.getBounds().width - preChangeWidth);
     1468                        else MagneticConstraints.getInstance().textShrunk(this, preChangeWidth - _poly.getBounds().width);
    14591469        }
    14601470
Note: See TracChangeset for help on using the changeset viewer.