Normalized whitespace: removed space on blank lines

This commit is contained in:
Nathan Dinsmore 2014-06-24 17:31:18 -04:00
parent 73ce84c772
commit c5d0b5e637
49 changed files with 258 additions and 258 deletions

View file

@ -22,7 +22,7 @@ package {
import flash.display.DisplayObject;
import flash.geom.Point;
import flash.geom.Rectangle;
public class ChildRender extends BitmapData {
private const allowPartial:Boolean = true;
private const maxSize:uint = 1022;
@ -68,11 +68,11 @@ package {
}
if(bounds.right > orig_width)
bounds.width += orig_width - bounds.right;
inner_x = bounds.x / orig_width;
inner_w = maxSize / orig_width;
}
if(orig_height > maxSize) {
if(!bounds) bounds = getVisibleBounds(dispObj, penLayer);
bounds.inflate(0, halfSize - bounds.height / 2);
@ -82,7 +82,7 @@ package {
}
if(bounds.bottom > orig_height)
bounds.height += orig_height - bounds.bottom;
inner_y = bounds.y / orig_height;
inner_h = maxSize / orig_height;
}
@ -148,4 +148,4 @@ package {
return visibleBounds;
}
}
}
}

View file

@ -143,7 +143,7 @@ internal final class Dbg
public static function printObj(obj:*):String
{
var memoryHash:String;
try
{
FakeClass(obj);
@ -152,7 +152,7 @@ internal final class Dbg
{
memoryHash = String(e).replace(/.*([@|\$].*?) to .*$/gi, '$1');
}
return flash.utils.getQualifiedClassName(obj) + memoryHash;
}
}

View file

@ -19,7 +19,7 @@
package {
import flash.display.BitmapData;
public class SpriteStamp extends BitmapData {
private var fx:Object;
public function SpriteStamp(width:int, height:int, fx:Object) {
@ -36,7 +36,7 @@ package {
fx[prop] = o[prop];
}
}
public function get effects():Object {
return fx;
}

View file

@ -24,13 +24,13 @@
package primitives {
import blocks.*;
import flash.display.*;
import flash.geom.*;
import flash.utils.Dictionary;
import interpreter.*;
import scratch.*;
public class MotionAndPenPrims {

View file

@ -62,7 +62,7 @@ public class ScratchCostume {
public var baseLayerData:ByteArray;
public static const WasEdited:int = -10; // special baseLayerID used to indicate costumes that have been edited
public var svgRoot:SVGElement; // non-null for an SVG costume
public var svgLoading:Boolean; // true while loading bitmaps embedded in an SVG
private var svgSprite:Sprite;
@ -521,7 +521,7 @@ public class ScratchCostume {
json.writeKeyValue('textLayerMD5', textLayerMD5);
}
}
public function readJSON(jsonObj:Object):void {
costumeName = jsonObj.costumeName;
baseLayerID = jsonObj.baseLayerID;

View file

@ -25,23 +25,23 @@
package scratch {
import blocks.*;
import filters.FilterPack;
import flash.display.*;
import flash.events.MouseEvent;
import flash.geom.ColorTransform;
import flash.utils.*;
import interpreter.*;
import scratch.ScratchComment;
import scratch.ScratchSprite;
import translation.Translator;
import util.*;
import watchers.*;
public class ScratchObj extends Sprite {

View file

@ -86,11 +86,11 @@ public class SqueakSoundDecoder {
}
delta += step;
sample += ((code & signMask) != 0) ? -delta : delta;
index += indexTable[code];
if (index < 0) index = 0;
if (index > 88) index = 88;
if (sample > 32767) sample = 32767;
if (sample < -32768) sample = -32768;
result.writeShort(sample);

View file

@ -27,11 +27,11 @@ public class DrawProperties {
public function set color(c:uint):void { rawColor = c }
public function get color():uint { return rawColor & 0xFFFFFF }
public function get alpha():Number { return ((rawColor >> 24) & 0xFF) / 0xFF }
public function set secondColor(c:uint):void { rawSecondColor = c }
public function get secondColor():uint { return rawSecondColor & 0xFFFFFF }
public function get secondAlpha():Number { return ((rawSecondColor >> 24) & 0xFF) / 0xFF }
// stroke
public var smoothness:Number = 1;
private var rawStrokeWidth:Number = 1;

View file

@ -433,7 +433,7 @@ public class DrawPropertyUI extends Sprite {
updateStrokeWidthDisplay();
sendChangeEvent();
}
var ttBg:Sprite = new Sprite();
addChild(ttBg);

View file

@ -259,7 +259,7 @@ return 1; // Force integer scaling in both editors for now
var lineColor:int = 0xB0B0B0;
var thickness:Number = 0.5;
var centerX:Number = canvasWidth / 2;
var centerY:Number = canvasHeight / 2;
var centerY:Number = canvasHeight / 2;
g.beginFill(lineColor);
g.drawRect(centerX - 4, centerY - (thickness / 2), 8, thickness);
g.beginFill(lineColor);
@ -363,9 +363,9 @@ return 1; // Force integer scaling in both editors for now
// -----------------------------
// Cursor Tool Support
//------------------------------
private const growthFactor:Number = 1.2;
public function handleTool(tool:String, evt:MouseEvent):void {
if ('help' == tool) Scratch.app.showTip('paint');
var bitmapEditor:BitmapEdit = editor as BitmapEdit;

View file

@ -26,7 +26,7 @@ package svgeditor
import svgeditor.objs.SVGGroup;
import svgeditor.objs.SVGShape;
import svgeditor.objs.SVGTextField;
public class Renderer
{
@ -65,4 +65,4 @@ package svgeditor
}
}
}
}

View file

@ -24,19 +24,19 @@ package svgeditor {
import flash.geom.*;
import flash.text.*;
import flash.utils.*;
import scratch.ScratchCostume;
import svgeditor.*;
import svgeditor.objs.*;
import svgeditor.tools.*;
import svgutils.*;
import ui.parts.ImagesPart;
import uiwidgets.*;
public class SVGEdit extends ImageEdit {
public static const tools:Array = [
{ name: 'select', desc: 'Select' },
@ -524,4 +524,4 @@ package svgeditor {
return null;
}
}
}
}

View file

@ -29,15 +29,15 @@ package svgeditor
import flash.geom.Point;
import flash.geom.Rectangle;
import flash.text.TextFieldType;
import svgeditor.objs.ISVGEditable;
import svgeditor.objs.SVGBitmap;
import svgeditor.objs.SVGGroup;
import svgeditor.objs.SVGShape;
import svgeditor.objs.SVGTextField;
import svgutils.SVGElement;
public class Selection implements IEventDispatcher
{
private var selectedObjects:Array;
@ -75,7 +75,7 @@ package svgeditor
public function cloneObjs(contentLayer:Sprite):Array {
var copiedObjects:Array = null;
if(!selectedObjects.length) return copiedObjects;
// Get a copy of the selected objects
var objsCopy:Array = [];
for(var i:uint=0; i<selectedObjects.length; ++i) {
@ -155,7 +155,7 @@ package svgeditor
p.removeChild(selectedObjects[i]);
else
trace("Selection contained orphaned objects");
selectedObjects = [];
}
@ -174,7 +174,7 @@ package svgeditor
return new Selection([g]);
}
return this;
}
@ -194,7 +194,7 @@ package svgeditor
newSelObjs.push(dObj);
// Put the object at the same level the group was
g.parent.addChildAt(dObj,idx);
g.parent.addChildAt(dObj,idx);
}
// Delete the group
@ -224,7 +224,7 @@ package svgeditor
public function isImage():Boolean {
return (selectedObjects.length == 1 && selectedObjects[0] is SVGBitmap);
}
public function getObjs():Array {
return selectedObjects;
}
@ -250,7 +250,7 @@ package svgeditor
s.transform.matrix = m;
return s.rotation;
}
return 0;
}
@ -326,7 +326,7 @@ package svgeditor
}
anchorPt = refDispObj.parent.globalToLocal(refDispObj.localToGlobal(anchorPt));
// Maintain aspect ratio if we're resizing a shape and
// Maintain aspect ratio if we're resizing a shape and
if(maintainAspectRatio) {
sx = sy = Math.min(sx, sy);
}
@ -354,7 +354,7 @@ package svgeditor
public function flip(vertical:Boolean = false):void {
var r:Rectangle = getBounds(refDispObj.parent);
var anchorPt:Point = new Point((r.left+r.right)/2, (r.top+r.bottom)/2);
for(var i:uint=0; i<selectedObjects.length; ++i) {
var obj:DisplayObject = selectedObjects[i];
flipAroundPoint(obj, anchorPt.x, anchorPt.y, vertical);
@ -378,7 +378,7 @@ package svgeditor
public function startRotation(center:Point):void {
rotationCenter = refDispObj.parent.globalToLocal(center);
saveMatrices();
initialTempMatrix = refDispObj.transform.matrix.clone();
}

View file

@ -20,7 +20,7 @@
package svgeditor.objs
{
import flash.geom.Point;
public class PathDrawContext
{
public var cmds:Array;
@ -33,4 +33,4 @@ package svgeditor.objs
adjust = false;
}
}
}
}

View file

@ -23,12 +23,12 @@ package svgeditor.objs
import flash.display.BitmapData;
import flash.display.DisplayObject;
import flash.events.Event;
import svgeditor.objs.ISVGEditable;
import svgutils.SVGDisplayRender;
import svgutils.SVGElement;
public class SVGBitmap extends Bitmap implements ISVGEditable
{
private var element:SVGElement;
@ -55,4 +55,4 @@ package svgeditor.objs
return copy;
}
}
}
}

View file

@ -21,11 +21,11 @@ package svgeditor.objs
{
import flash.display.DisplayObject;
import flash.display.Sprite;
import svgeditor.objs.ISVGEditable;
import svgutils.SVGElement;
public class SVGGroup extends Sprite implements ISVGEditable
{
private var element:SVGElement;
@ -34,13 +34,13 @@ package svgeditor.objs
super();
element = elem;
}
public function getElement():SVGElement {
element.subElements = getSubElements();
element.transform = transform.matrix;
return element;
}
public function redraw(forHitTest:Boolean = false):void {
if(element.transform) transform.matrix = element.transform;
@ -63,7 +63,7 @@ package svgeditor.objs
}
return elements;
}
public function clone():ISVGEditable {
var copy:SVGGroup = new SVGGroup(element.clone());
(copy as DisplayObject).transform.matrix = transform.matrix.clone();
@ -80,4 +80,4 @@ package svgeditor.objs
return copy;
}
}
}
}

View file

@ -25,10 +25,10 @@ package svgeditor.objs
import flash.geom.Matrix;
import flash.geom.Point;
import flash.geom.Rectangle;
import svgeditor.objs.ISVGEditable;
import svgeditor.tools.PixelPerfectCollisionDetection;
import svgutils.SVGDisplayRender;
import svgutils.SVGElement;
import svgutils.SVGExport;
@ -117,7 +117,7 @@ package svgeditor.objs
parent.addChild(debugCD);
}
var path:SVGPath = element.path;
var path:SVGPath = element.path;
var cmd:Array = path[index];
var p1:Point = path.getPos(index-1);
var p2:Point = path.getPos(index);
@ -150,7 +150,7 @@ package svgeditor.objs
}
}
}
showIntersections(intersections);
}
@ -172,7 +172,7 @@ package svgeditor.objs
if(npt.subtract(pt).length > distCheck) {
// Recurse to get a more precise time
interval *= 0.5;
return getNextCollisionChange(ct, p1, cp1, cp2, p2, otherShape);
return getNextCollisionChange(ct, p1, cp1, cp2, p2, otherShape);
}
else {
collisionState = colliding;
@ -180,7 +180,7 @@ package svgeditor.objs
}
}
}
return -1;
}
@ -197,12 +197,12 @@ package svgeditor.objs
var forceLines:Boolean = (element.path.length < 3 );
var dRect:Rectangle = getBounds(this);
// Adjust the path so that the top left is at 0,0 locally
// This allows us to create the smallest bitmap for rendering it to
var bmp:BitmapData = new BitmapData(dRect.width, dRect.height, true, 0);
var m:Matrix = new Matrix(1, 0, 0, 1, -dRect.topLeft.x, -dRect.topLeft.y);
var lastCP:Point = new Point();
var startP:Point = new Point();
var mousePos:Point = new Point(mouseX, mouseY);
@ -211,10 +211,10 @@ package svgeditor.objs
for(var i:uint = 0; i <= max; ++i) {
// Clear the bitmap
bmp.fillRect(bmp.rect, 0x00000000);
// Draw the path up until point #i
SVGPath.renderPathCmd(element.path[i], g, lastCP, startP);
// Return this index if the mouse location has been drawn on
bmp.draw(canvas, m);
if(bmp.hitTest(dRect.topLeft, 0xFF, mousePos)) {
@ -222,7 +222,7 @@ package svgeditor.objs
break;
}
}
bmp.dispose();
return index;
}
@ -242,7 +242,7 @@ package svgeditor.objs
var img:BitmapData = new BitmapData(rect.width, rect.height, true, 0x00000000);
var m:Matrix = transform.concatenatedMatrix.clone();
m.translate(-rect.x, -rect.y);
var removedPoint:Boolean = false;
var start:Number = (new Date).getTime();
var elem:SVGElement = getElement();
@ -261,12 +261,12 @@ package svgeditor.objs
img.fillRect(img.rect, 0);
img.draw(this, m);
img.threshold(img, img.rect, new Point, "<", 0xF0000000, 0, 0xF0000000);
var cmd:Array = elem.path[index];
elem.path.splice(index, 1);
elem.path.adjustPathAroundAnchor(index, 3, 1);
redraw();
img.draw(this, m, null, BlendMode.ERASE);
img.threshold(img, img.rect, new Point, "<", 0xF0000000, 0, 0xF0000000);
var r:Rectangle = img.getColorBoundsRect(0xFF000000, 0xFF000000, true);
@ -318,7 +318,7 @@ package svgeditor.objs
elem.setAttribute('stroke', 'black');
elem.setAttribute('stroke-width', 2);
}
// Take a snapshot
redraw();
var rect:Rectangle = getBounds(stage);
@ -338,7 +338,7 @@ package svgeditor.objs
for(var j:uint = or.top; j<or.bottom; ++j)
if((img.getPixel32(i, j)>>24) & 0xF0)
++totalPixels;
var removedPoint:Boolean = false;
var start:Number = (new Date).getTime();
var passCount:uint = 0;
@ -362,12 +362,12 @@ package svgeditor.objs
// Get a fresh copy of the original render
img2.copyPixels(img, img.rect, new Point);
var cmd:Array = elem.path[index];
elem.path.splice(index, 1);
elem.path.adjustPathAroundAnchor(index, 3, 1);
redraw();
img2.draw(this, m, null, BlendMode.ERASE);
img2.threshold(img, img.rect, new Point, "<", 0xF0000000, 0, 0xF0000000);
var r:Rectangle = img.getColorBoundsRect(0xFF000000, 0xFF000000, true);
@ -399,7 +399,7 @@ package svgeditor.objs
} while(removedPoint)
img.dispose();
img2.dispose();
// Reset stroke and fill then redraw
elem.setAttribute('stroke', stroke);
elem.setAttribute('stroke-width', strokeWidth);
@ -426,7 +426,7 @@ package svgeditor.objs
parent.addChild(debugShape);
debugShape.transform = transform;
}
for(var i:int=0; i<intersections.length; ++i) {
var section:Object = intersections[i];
var stopTime:Number = (section.end && section.start.index == section.end.index) ? section.end.time : 1.0;
@ -440,7 +440,7 @@ package svgeditor.objs
}
}
}
public function showPoints():void {
debugShape.graphics.lineStyle(2, 0x00CCFF);
for(var j:int=0; j<element.path.length; ++j) {
@ -448,7 +448,7 @@ package svgeditor.objs
debugShape.graphics.drawCircle(pt.x, pt.y, 3);
}
}
private function showPartialCurve(index:int, start:Number, stop:Number):void {
if(!debugMode)
return;
@ -470,7 +470,7 @@ package svgeditor.objs
//g.moveTo(pt.x, pt.y);
//var grn:int = ((1 - percComp) * 0xFF) << 8;
//g.lineStyle(5, 0xFF0000 + grn, 0.5, false, "normal", CapsStyle.NONE, JointStyle.MITER, 0);
pt = SVGPath.getPosByTime(i, p1, c1, c2, p2);
g.lineTo(pt.x, pt.y);
}
@ -517,16 +517,16 @@ package svgeditor.objs
var args:Array = otherElem.path.concat();
if(endContinued)
args.shift();
args.unshift(endContinued ? 0 : 1);
var insertIndex:int = (endContinued ? indexContinued + 1 : indexContinued);
args.unshift(insertIndex);
// Insert the curve commands
var pc:SVGPath = element.path;
pc.splice.apply(pc, args);
// Close the path?
endPts = element.path.getSegmentEndPoints();
if(element.path.getPos(endPts[0]).subtract(element.path.getPos(endPts[1])).length < strokeWidth * 2) {
@ -537,4 +537,4 @@ package svgeditor.objs
return true;
}
}
}
}

View file

@ -28,12 +28,12 @@ package svgeditor.objs
import flash.text.TextField;
import flash.text.TextFieldAutoSize;
import flash.text.TextFieldType;
import svgeditor.objs.ISVGEditable;
import svgutils.SVGDisplayRender;
import svgutils.SVGElement;
public class SVGTextField extends TextField implements ISVGEditable
{
private var element:SVGElement;
@ -72,4 +72,4 @@ package svgeditor.objs
return copy as ISVGEditable;
}
}
}
}

View file

@ -26,11 +26,11 @@ package svgeditor.tools
import flash.geom.Matrix;
import flash.geom.Point;
import flash.geom.Rectangle;
import svgeditor.*;
import svgeditor.objs.ISVGEditable;
import svgeditor.objs.SVGShape;
import svgutils.SVGElement;
public final class CloneTool extends SVGCreateTool
@ -66,7 +66,7 @@ package svgeditor.tools
copiedObjects = s.cloneObjs(contentLayer);
previewObjects = s.cloneObjs(contentLayer);
}
override protected function init():void {
super.init();
editor.getToolsLayer().mouseEnabled = false;
@ -139,7 +139,7 @@ package svgeditor.tools
holder.scaleX = m.deltaTransformPoint(new Point(0,1)).length;
holder.scaleY = m.deltaTransformPoint(new Point(1,0)).length;
//
//
for(var i:uint=0; i<copiedObjects.length; ++i) {
var dObj:DisplayObject = previewObjects[i] as DisplayObject;
holder.addChild(dObj);
@ -159,7 +159,7 @@ package svgeditor.tools
private var highlightedObj:DisplayObject;
private function checkUnderMouse(clear:Boolean = false):void {
var obj:ISVGEditable = clear ? null : getEditableUnderMouse();
if(obj != highlightedObj) {
if(highlightedObj) highlightedObj.filters = [];
highlightedObj = obj as DisplayObject;
@ -167,4 +167,4 @@ package svgeditor.tools
}
}
}
}
}

View file

@ -21,11 +21,11 @@ package svgeditor.tools
{
import flash.display.DisplayObject;
import flash.geom.Point;
import svgeditor.DrawProperties;
import svgeditor.ImageEdit;
import svgeditor.objs.SVGShape;
import svgutils.SVGElement;
public final class EllipseTool extends SVGCreateTool
@ -62,7 +62,7 @@ package svgeditor.tools
newObject = new SVGShape(newElement);
contentLayer.addChild(newObject as DisplayObject);
}
override protected function mouseMove(p:Point):void {
if(!createOrigin) return;
@ -73,10 +73,10 @@ package svgeditor.tools
// Shift key makes a circle
if(currentEvent.shiftKey) {
w = h = Math.max(w, h);
p.x = createOrigin.x + (ofs.x < 0 ? w : -w);
p.y = createOrigin.y + (ofs.y < 0 ? h : -h);
p.x = createOrigin.x + (ofs.x < 0 ? w : -w);
p.y = createOrigin.y + (ofs.y < 0 ? h : -h);
}
var rx:Number = w/2;
var ry:Number = h/2;
newElement.setAttribute('cx', Math.min(p.x, createOrigin.x) + rx);
@ -87,4 +87,4 @@ package svgeditor.tools
newObject.redraw();
}
}
}
}

View file

@ -20,7 +20,7 @@
package svgeditor.tools
{
import assets.Resources;
import flash.display.Bitmap;
import flash.display.BitmapData;
import flash.display.BlendMode;
@ -35,14 +35,14 @@ package svgeditor.tools
import flash.geom.Matrix;
import flash.geom.Point;
import flash.geom.Rectangle;
import svgeditor.DrawProperties;
import svgeditor.ImageEdit;
import svgeditor.objs.ISVGEditable;
import svgeditor.objs.SVGBitmap;
import svgeditor.objs.SVGGroup;
import svgeditor.objs.SVGShape;
import svgutils.SVGElement;
import svgutils.SVGExport;
import svgutils.SVGPath;
@ -60,7 +60,7 @@ package svgeditor.tools
eraserShape = new Shape();
lastPos = null;
erased = false;
cursorHotSpot = new Point(7,18);
}
@ -122,7 +122,7 @@ package svgeditor.tools
lastPos = new Point(eraserShape.mouseX, eraserShape.mouseY);
}
private function getObjectsUnderEraser():Array {
var objs:Array = [];
var cl:Sprite = editor.getContentLayer();
@ -180,7 +180,7 @@ package svgeditor.tools
g.endFill();
g.moveTo(p.x, p.y);
}
// Force the draw cache to refresh
eraserShape.visible = true;
eraserShape.visible = false;
@ -191,7 +191,7 @@ package svgeditor.tools
var m:Matrix = bmObj.transform.concatenatedMatrix;
m.invert();
bmObj.bitmapData.draw(eraserShape, m, null, BlendMode.ERASE, null);
var r:Rectangle = bmObj.bitmapData.getColorBoundsRect(0xFF000000, 0x00000000, false);
if(!r || r.width == 0 || r.height == 0) {
bmObj.parent.removeChild(bmObj);
@ -204,10 +204,10 @@ package svgeditor.tools
// Does the path collide with the backdrop shapes?
if(!PixelPerfectCollisionDetection.isColliding(svgShape, eraserShape)) return;
//trace("Path intersects with backdrop!");
var thisSW:* = svgShape.getElement().getAttribute('stroke-width');
var thisSC:* = svgShape.getElement().getAttribute('stroke-linecap');
// Make sure that it isn't just the stroke width that is causing the intersection.
// We want paths which intersect and not just "touch"
//svgShape.getElement().setAttribute('stroke-width', 2.0);
@ -269,7 +269,7 @@ trace(str);
var endCmds:Array = path.slice(endIndex + 1);
var startTime:Number = inter.start.time;
if(startIndex == inter.end.index + ofs) {
if(startIndex == inter.end.index + ofs) {
startTime = startTime / endTime;
}
@ -295,7 +295,7 @@ trace(str);
// Copy the commands but not the ending 'Z' command
var cmds:Array = path.splice(indices[0], indices[1] + 1);
var stitchIndex:int = cmds.length - 1;
// Re-insert the commands at the beginning
cmds.unshift(1);
cmds.unshift(0);
@ -330,4 +330,4 @@ trace(str);
}
}
}
}
}

View file

@ -25,12 +25,12 @@ package svgeditor.tools
import flash.events.MouseEvent;
import flash.geom.Matrix;
import flash.geom.Point;
import svgeditor.BitmapEdit;
import svgeditor.ImageEdit;
import svgeditor.objs.ISVGEditable;
import svgeditor.objs.SVGBitmap;
import svgutils.SVGElement;
public final class EyeDropperTool extends SVGTool
@ -46,17 +46,17 @@ package svgeditor.tools
super.init();
editor.getWorkArea().addEventListener(MouseEvent.MOUSE_DOWN, mouseDown, false, 0, true);
}
override protected function shutdown():void {
editor.getWorkArea().removeEventListener(MouseEvent.MOUSE_DOWN, mouseDown);
mouseUp();
super.shutdown();
}
private function mouseDown(event:MouseEvent):void {
currentEvent = event;
grabColor();
editor.stage.addEventListener(MouseEvent.MOUSE_MOVE, mouseMove, false, 0, true);
editor.stage.addEventListener(MouseEvent.MOUSE_UP, mouseUp, false, 0, true);
event.stopPropagation();
@ -66,12 +66,12 @@ package svgeditor.tools
currentEvent = event;
grabColor();
}
private function mouseUp(event:MouseEvent = null):void {
editor.stage.removeEventListener(MouseEvent.MOUSE_MOVE, mouseMove);
editor.stage.removeEventListener(MouseEvent.MOUSE_UP, mouseUp);
}
private function grabColor():void {
var c:uint;
var obj:ISVGEditable;
@ -96,4 +96,4 @@ package svgeditor.tools
}
}
}
}
}

View file

@ -22,10 +22,10 @@ package svgeditor.tools
import flash.display.DisplayObject;
import flash.events.*;
import flash.geom.*;
import svgeditor.*;
import svgeditor.objs.*;
import svgutils.SVGElement;
public final class PaintBrushTool extends SVGEditTool
@ -85,7 +85,7 @@ package svgeditor.tools
elem = shapeUnderMouse.getElement();
elem.setAttribute('fill', oldFill);
elem.setAttribute('stroke', oldStroke);
elem.setAttribute('stroke-width', oldStrokeW);
elem.setAttribute('stroke-width', oldStrokeW);
elem.setAttribute('stroke-opacity', oldStrokeO);
shapeUnderMouse.redraw();
}
@ -189,4 +189,4 @@ package svgeditor.tools
return grad;
}
}
}
}

View file

@ -25,7 +25,7 @@ package svgeditor.tools
import flash.events.Event;
import flash.events.MouseEvent;
import flash.geom.Point;
import svgeditor.ImageEdit;
import svgeditor.objs.ISVGEditable;
import svgeditor.objs.SVGShape;
@ -83,14 +83,14 @@ package svgeditor.tools
isEndPoint = ep;
render(graphics, false, isEndPoint);
}
public function get endPoint():Boolean {
return isEndPoint;
}
private function removedFromStage(e:Event):void {
if(e.target != this) return;
removeEventListener(Event.REMOVED, removedFromStage);
pathEditTool.removeChild(controlPoints.pop());
pathEditTool.removeChild(controlPoints.pop());
@ -152,4 +152,4 @@ package svgeditor.tools
render(graphics, e.type == MouseEvent.MOUSE_OVER, isEndPoint);
}
}
}
}

View file

@ -24,7 +24,7 @@ package svgeditor.tools
import flash.display.Sprite;
import flash.events.MouseEvent;
import flash.geom.Point;
import svgeditor.ImageEdit;
import svgeditor.objs.ISVGEditable;
import svgeditor.objs.SVGShape;
@ -97,4 +97,4 @@ package svgeditor.tools
render(graphics, e.type == MouseEvent.MOUSE_OVER);
}
}
}
}

View file

@ -32,12 +32,12 @@ package svgeditor.tools
import flash.geom.Matrix;
import flash.geom.Point;
import flash.geom.Rectangle;
import svgeditor.ImageEdit;
import svgeditor.objs.ISVGEditable;
import svgeditor.objs.PathDrawContext;
import svgeditor.objs.SVGShape;
import svgutils.SVGElement;
import svgutils.SVGPath;
@ -62,7 +62,7 @@ package svgeditor.tools
super.shutdown();
PathEndPointManager.removeEndPoints();
}
private function reset():void {
pathElem = null;
controlPoints = null;
@ -87,7 +87,7 @@ package svgeditor.tools
if(object) {
for(var i:uint = 0; i< controlPoints.length; ++i)
removeChild(controlPoints[i]);
reset();
}
@ -109,13 +109,13 @@ package svgeditor.tools
if(object) {
var indx:int = (object as SVGShape).getPathCmdIndexUnderMouse();
if(indx < 0) return;
// Add the new point
var dObj:DisplayObject = (object as DisplayObject);
addPoint(indx, new Point(dObj.mouseX, dObj.mouseY));
}
}
// SVG Element access
private function getAttribute(attr:String):* {
return pathElem.getAttribute(attr);
@ -202,7 +202,7 @@ package svgeditor.tools
pathElem.path.getPos(index).subtract(pathElem.path.getPos(currentEndPoints[1])).length < w) ||
(currentEndPoints[1] == index &&
pathElem.path.getPos(index).subtract(pathElem.path.getPos(currentEndPoints[0])).length < w)) {
// Close the path and refresh the anchor points
pathElem.path.splice(currentEndPoints[1] + 1, 0, ['Z']);
pathElem.path.adjustPathAroundAnchor(currentEndPoints[1], 1, 1);
@ -226,7 +226,7 @@ package svgeditor.tools
}
else if(!movingPoint) {
currentEndPoints = pathElem.path.getSegmentEndPoints(index);
if(!currentEndPoints[2] && (index == currentEndPoints[0] || index == currentEndPoints[1]))
if(!currentEndPoints[2] && (index == currentEndPoints[0] || index == currentEndPoints[1]))
PathEndPointManager.makeEndPoints(dObj);
movingPoint = true;
}
@ -257,7 +257,7 @@ package svgeditor.tools
// If we want to prevent removing 2-point paths by removing a point,
// then uncomment this code:
//if(endPoints[1] - endPoints[0] < 2) return;
// Cut the path here if the shift key was down and the point is not an end-point
var pos:Point;
if((index < endPoints[1] || (endPoints[2] && index == endPoints[1])) && index > endPoints[0] && event.shiftKey) {
@ -274,12 +274,12 @@ package svgeditor.tools
var cmds:Array = pathElem.path.splice(indices[0], indices[1] + 1);
cmds.length--;
var stitchIndex:int = cmds.length - 1;
// Re-insert the commands at the beginning
cmds.unshift(1);
cmds.unshift(0);
pathElem.path.splice.apply(pathElem.path, cmds);
pathElem.path.adjustPathAroundAnchor(stitchIndex, 2);
pathElem.path.adjustPathAroundAnchor(0, 2);
endPoints = pathElem.path.getSegmentEndPoints(0);
@ -294,12 +294,12 @@ package svgeditor.tools
// Make a copy to hold the path after the point
var newPath:SVGShape = (object as SVGShape).clone() as SVGShape;
(object as SVGShape).parent.addChildAt(newPath, (object as SVGShape).parent.getChildIndex(object as DisplayObject));
// TODO: Make work with inner paths???
// TODO: Handle closed paths!
newPath.getElement().path.splice(0, index + 1);
newPath.redraw();
// Now truncate the existing path
pathElem.path.length = index + 1;
}
@ -358,7 +358,7 @@ package svgeditor.tools
}
++i;
}
// Shift the indices of the control points after the inserted point
resetControlPointIndices();
redrawObj();

View file

@ -24,7 +24,7 @@ package svgeditor.tools
import flash.display.Sprite;
import flash.events.MouseEvent;
import flash.geom.Point;
import svgeditor.ImageEdit;
import svgeditor.tools.PathEndPointManager;
import svgeditor.objs.ISVGEditable;
@ -70,4 +70,4 @@ package svgeditor.tools
PathEndPointManager.updateOrb((new Point(mouseX, mouseY)).length < w);
}
}
}
}

View file

@ -22,13 +22,13 @@ package svgeditor.tools
import flash.display.DisplayObject;
import flash.display.Sprite;
import flash.geom.Point;
import svgeditor.ImageEdit;
import svgeditor.objs.ISVGEditable;
import svgeditor.objs.SVGGroup;
import svgeditor.objs.SVGShape;
import svgeditor.tools.PathAnchorPoint;
import svgutils.SVGPath;
public final class PathEndPointManager
@ -123,4 +123,4 @@ package svgeditor.tools
}
}
}
}
}

View file

@ -67,7 +67,7 @@ import flash.geom.Rectangle;
scaleY = Math.floor(20 / limits.height);
limits.height *= scaleY;
}
var image:BitmapData = new BitmapData(limits.width, limits.height, true);
image.fillRect(image.rect, 0x00000000);
var matrix:Matrix = object1.transform.concatenatedMatrix.clone();
@ -110,4 +110,4 @@ if(debugSpr) {
return null;
}
    }
}
}

View file

@ -21,11 +21,11 @@ package svgeditor.tools
{
import flash.display.DisplayObject;
import flash.geom.Point;
import svgeditor.ImageEdit;
import svgeditor.DrawProperties;
import svgeditor.objs.SVGShape;
import svgutils.SVGElement;
public final class RectangleTool extends SVGCreateTool
@ -58,7 +58,7 @@ package svgeditor.tools
newObject = new SVGShape(newElement);
contentLayer.addChild(newObject as DisplayObject);
}
override protected function mouseMove(p:Point):void {
if(!createOrigin) return;
@ -69,8 +69,8 @@ package svgeditor.tools
// Shift key makes a square
if(currentEvent.shiftKey) {
w = h = Math.max(w, h);
p.x = createOrigin.x + (ofs.x < 0 ? w : -w);
p.y = createOrigin.y + (ofs.y < 0 ? h : -h);
p.x = createOrigin.x + (ofs.x < 0 ? w : -w);
p.y = createOrigin.y + (ofs.y < 0 ? h : -h);
}
newElement.setAttribute('x', Math.min(p.x, createOrigin.x));
@ -82,4 +82,4 @@ package svgeditor.tools
newObject.redraw();
}
}
}
}

View file

@ -25,7 +25,7 @@ package svgeditor.tools
import flash.events.EventDispatcher;
import flash.events.MouseEvent;
import flash.geom.Point;
import svgeditor.ImageEdit;
import svgeditor.ImageCanvas;
import svgeditor.DrawProperties;
@ -81,7 +81,7 @@ package svgeditor.tools
}
newObject = null;
}
super.cancel();
}
@ -91,7 +91,7 @@ package svgeditor.tools
p.x = Math.min(ImageCanvas.canvasWidth, Math.max(0, p.x));
p.y = Math.min(ImageCanvas.canvasHeight, Math.max(0, p.y));
currentEvent = e;
if(e.type == MouseEvent.MOUSE_DOWN) {
//editor.toggleZoomUI(false);
mouseDown(p);
@ -133,4 +133,4 @@ package svgeditor.tools
}
}
}
}
}

View file

@ -25,7 +25,7 @@ package svgeditor.tools
import flash.events.MouseEvent;
import flash.filters.GlowFilter;
import flash.geom.Point;
import svgeditor.ImageEdit;
import svgeditor.Selection;
import svgeditor.objs.ISVGEditable;
@ -59,14 +59,14 @@ package svgeditor.tools
// so that the mouseDown method below is overridden
protected function edit(obj:ISVGEditable, event:MouseEvent):void {
if(obj == object) return;
if(object) {
//(object as DisplayObject).filters = [];
}
if(obj && (!editTag || editTag.indexOf(obj.getElement().tag) > -1)) {
object = obj;
if(object) {
//(object as DisplayObject).filters = [new GlowFilter(0x28A5DA)];
}
@ -95,7 +95,7 @@ package svgeditor.tools
currentEvent = event;
edit(obj, event);
currentEvent = null;
event.stopPropagation();
}
}

View file

@ -24,10 +24,10 @@ package svgeditor.tools
import flash.events.Event;
import flash.events.MouseEvent;
import flash.geom.Point;
import svgeditor.ImageEdit;
import svgeditor.objs.*;
import svgutils.SVGPath;
public class SVGTool extends Sprite
@ -126,7 +126,7 @@ package svgeditor.tools
protected function getContinuableShapeUnderMouse(strokeWidth:Number):Object {
// Hide the current path so we don't get that
var obj:ISVGEditable = getEditableUnderMouse(false);
if(obj is SVGShape) {
var s:SVGShape = obj as SVGShape;
var path:SVGPath = s.getElement().path;
@ -145,7 +145,7 @@ package svgeditor.tools
}
}
}
return null;
}
}

View file

@ -34,11 +34,11 @@ package svgeditor.tools
import flash.text.TextFieldAutoSize;
import flash.text.TextFieldType;
import flash.utils.Timer;
import svgeditor.*;
import svgeditor.objs.ISVGEditable;
import svgeditor.objs.SVGTextField;
import svgutils.SVGElement;
// TODO: Make it non-sticky when the editor is a BitmapEdit instance
@ -140,11 +140,11 @@ package svgeditor.tools
// TODO: Fix redraw, it's currently moving the text field (due to the matrix?)
//tf.redraw();
if(editor is SVGEdit) tf.filters = [];
if(tf.text == '' || tf.text == ' ') {// || tf.text.match(new RegExp('/^\s+$/'))) {
tf.parent.removeChild(tf);
}
setObject(null);
}
@ -186,17 +186,17 @@ package svgeditor.tools
}
else {
var contentLayer:Sprite = editor.getContentLayer();
var el:SVGElement = new SVGElement('text', '');
el.setAttribute('text-anchor', 'start');
el.text = '';
el.setShapeFill(editor.getShapeProps());
el.setFont(editor.getShapeProps().fontName, 22);
var tf:SVGTextField = new SVGTextField(el);
contentLayer.addChild(tf);
tf.redraw();
var p:Point = new Point(contentLayer.mouseX, contentLayer.mouseY);
var ascent:Number = tf.getLineMetrics(0).ascent;
tf.x = p.x;
@ -213,4 +213,4 @@ package svgeditor.tools
}
}
}
}
}

View file

@ -31,7 +31,7 @@ package svgutils {
import flash.display.*;
import flash.geom.*;
import flash.text.*;
import svgeditor.DrawProperties;
public class SVGElement {

View file

@ -29,7 +29,7 @@
// * 'subElements' field of group elements
// * 'transform' field (null if element is not transformed)
// * gradient fills: an SVGElement with a 'stop' subElement for each color
package svgutils {
import flash.display.Sprite;
import flash.geom.*;
@ -193,7 +193,7 @@ public class SVGExport {
if ((m.a == 1) && (m.b == 0) && (m.c == 0) && (m.d == 1) && (m.tx == 0) && (m.ty == 0)) return; // identity
node.@['transform'] = 'matrix(' + m.a + ', ' + m.b + ', ' + m.c + ', ' + m.d + ', ' + m.tx + ', ' + m.ty + ')';
}
// Gradients
private function defineGradient(gradEl:SVGElement):String {

View file

@ -25,7 +25,7 @@
// A simplified path contains only M, L, C, and Q commands with absolute coordinates.
//
// Using a standard path format simplifies the rendering and editing code.
package svgutils {
import flash.geom.Point;
@ -65,7 +65,7 @@ public class SVGImportPath {
quarterCircle(false, cx + rx, cy, cx, cy + ry),
quarterCircle(true, cx, cy + ry, cx - rx, cy),
quarterCircle(false, cx - rx, cy, cx, cy - ry),['Z']);
path.splitCurve(1, 0.5);
path.splitCurve(3, 0.5);
path.splitCurve(5, 0.5);
@ -83,7 +83,7 @@ public class SVGImportPath {
['C', srcX + (k * dx), srcY, dstX, dstY - (k * dy), dstX, dstY] :
['C', srcX, srcY + (k * dy), dstX - (k * dx), dstY, dstX, dstY];
}
private function cmdsForLine(el:SVGElement):SVGPath {
return new SVGPath(
['M', el.getAttribute('x1', 0), el.getAttribute('y1', 0)],
@ -312,7 +312,7 @@ public class SVGImportPath {
var c1y:Number = p0y + (lastCY - p0y) * 2/3;
var c2x:Number = lastX + (lastCX - lastX) * 2/3;
var c2y:Number = lastY + (lastCY - lastY) * 2/3;
return ['C', c1x, c1y, c2x, c2y, lastX, lastY];
}
@ -329,7 +329,7 @@ public class SVGImportPath {
var c1y:Number = p0y + (lastCY - p0y) * 2/3;
var c2x:Number = lastX + (lastCX - lastX) * 2/3;
var c2y:Number = lastY + (lastCY - lastY) * 2/3;
return ['C', c1x, c1y, c2x, c2y, lastX, lastY];
}

View file

@ -51,7 +51,7 @@ import util.Base64Encoder;
import flash.display.Loader;
import flash.events.Event;
import flash.geom.*;
public class SVGImporter {
public var root:SVGElement; // root of the visible element tree
@ -239,7 +239,7 @@ public class SVGImporter {
for each (var parentEl:SVGElement in parentList) {
alpha = alpha * parentEl.getAttribute('opacity', 1);
}
if (alpha != 1) el.attributes['opacity'] = alpha;
if (alpha != 1) el.attributes['opacity'] = alpha;
}
private function inheritedValue(attrName:String, parentList:Array):* {
@ -309,12 +309,12 @@ public class SVGImporter {
var stopsEl:SVGElement = elements[href];
for each (var el:SVGElement in stopsEl.subElements) {
// clone stops into gradEl
gradEl.subElements.push(el.clone());
gradEl.subElements.push(el.clone());
}
}
}
}
// -----------------------------
// URL Reference Resolution
//------------------------------

View file

@ -33,7 +33,7 @@ public class CameraDialog extends DialogBox {
return ['Camera', 'Save', 'Close'];
}
public function CameraDialog(saveFunc:Function) {
public function CameraDialog(saveFunc:Function) {
super();
this.saveFunc = saveFunc;
@ -41,7 +41,7 @@ public class CameraDialog extends DialogBox {
var container:Sprite = new Sprite();
addWidget(container);
picture = new Bitmap();
picture.bitmapData = new BitmapData(320, 240, true);
picture.visible = false;
@ -54,9 +54,9 @@ public class CameraDialog extends DialogBox {
var b:Button;
addChild(b = new Button(Translator.map('Save'), savePicture));
buttons.push(b);
buttons.push(b);
addChild(b = new Button(Translator.map('Close'), closeDialog));
buttons.push(b);
buttons.push(b);
}
private function savePicture():void {

View file

@ -123,7 +123,7 @@ public class MediaLibraryItem extends Sprite {
function setThumbnail(bm:BitmapData):void {
if (!bm) return;
thumbnailCache[md5] = bm;
if (spriteMD5) thumbnailCache[spriteMD5] = bm;
if (spriteMD5) thumbnailCache[spriteMD5] = bm;
setThumbnailBM(bm);
done();
}
@ -217,7 +217,7 @@ public class MediaLibraryItem extends Sprite {
info.y = frameHeight - 17;
addChild(info);
}
private function addPlayButton():void {
playButton = new IconButton(toggleSoundPlay, 'play');
playButton.x = 75;

View file

@ -82,7 +82,7 @@ public class SoundsPart extends UIPart {
editor.updateTranslation();
SimpleTooltips.add(libraryButton, {text: 'Choose sound from library', direction: 'bottom'});
SimpleTooltips.add(recordButton, {text: 'Record new sound', direction: 'bottom'});
SimpleTooltips.add(importButton, {text: 'Upload sound from file', direction: 'bottom'});
SimpleTooltips.add(importButton, {text: 'Upload sound from file', direction: 'bottom'});
fixlayout();
}
@ -169,7 +169,7 @@ public class SoundsPart extends UIPart {
editor.x = contentsX;
editor.y = 50;
}
private function addNewSoundButtons():void {
var left:int = 16;
var buttonY:int = 31;
@ -185,7 +185,7 @@ public class SoundsPart extends UIPart {
b.y = y;
return b;
}
private function addListFrame():void {
listFrame = new ScrollFrame();
listFrame.setContents(app.getMediaPane(app, 'sounds'));
@ -208,7 +208,7 @@ public class SoundsPart extends UIPart {
// -----------------------------
// Undo/Redo
//------------------------------
private function addUndoButtons():void {
addChild(undoButton = new IconButton(editor.waveform.undo, makeButtonImg('undo', true), makeButtonImg('undo', false)));
addChild(redoButton = new IconButton(editor.waveform.redo, makeButtonImg('redo', true), makeButtonImg('redo', false)));
@ -220,7 +220,7 @@ public class SoundsPart extends UIPart {
undoButton.setDisabled(!editor.waveform.canUndo(), 0.5);
redoButton.setDisabled(!editor.waveform.canRedo(), 0.5);
}
public static function makeButtonImg(iconName:String, isOn:Boolean, buttonSize:Point = null):Sprite {
var icon:Bitmap = Resources.createBmp(iconName + (isOn ? 'On' : 'Off'));
var buttonW:int = Math.max(icon.width, buttonSize ? buttonSize.x : 24);

View file

@ -37,7 +37,7 @@ package ui.parts {
import translation.Translator;
import uiwidgets.IconButton;
import util.DrawPath;
public class UIPart extends Sprite {
protected static const cornerRadius:int = 8;

View file

@ -22,14 +22,14 @@ package uiwidgets {
import flash.events.MouseEvent;
import flash.geom.Matrix;
import flash.text.*;
public class Button extends Sprite {
private var labelOrIcon:DisplayObject;
private var color:* = CSS.titleBarColors;
private var minWidth:int = 50;
private var compact:Boolean;
private var action:Function;
private var tipName:String;
@ -83,7 +83,7 @@ public class Button extends Sprite {
if (color is Array) {
var matr:Matrix = new Matrix();
matr.createGradientBox(minW, minH, Math.PI / 2, 0, 0);
graphics.beginGradientFill(GradientType.LINEAR, CSS.titleBarColors , [100, 100], [0x00, 0xFF], matr);
graphics.beginGradientFill(GradientType.LINEAR, CSS.titleBarColors , [100, 100], [0x00, 0xFF], matr);
}
else graphics.beginFill(color);
graphics.drawRoundRect(0, 0, minW, minH, 12);

View file

@ -24,7 +24,7 @@ package uiwidgets {
import flash.system.Capabilities;
import flash.ui.*;
import assets.Resources;
public class CursorTool {
public static var tool:String; // null or one of: copy, cut, grow, shrink, help

View file

@ -32,20 +32,20 @@ import translation.Translator;
public class SimpleTooltips {
static private var instance:SimpleTooltip = null;
/**
* Add a tooltip to a DisplayObject
* Add a tooltip to a DisplayObject
* @param dObj Attach the tooltip to this
* @param opts Options (just 'text' and 'direction' right now)
*
*
*/
static public function add(dObj:DisplayObject, opts:Object):void {
if(!instance) instance = new SimpleTooltip();
instance.addTooltip(dObj, opts);
}
static public function hideAll():void {
if(instance) instance.forceHide();
}
static public function showOnce(dObj:DisplayObject, opts:Object):void {
if(!instance) instance = new SimpleTooltip();
instance.showOnce(dObj, opts);
@ -68,20 +68,20 @@ class SimpleTooltip {
private var tipObjs:Dictionary = new Dictionary();
private var currentTipObj:DisplayObject;
private var nextTipObj:DisplayObject;
// Timing values (in milliseconds)
private const delay:uint = 500;
private const linger:uint = 1000;
private const fadeIn:uint = 200;
private const fadeOut:uint = 500;
private const bgColor:uint = 0xfcfed4;
// Timers
private var showTimer:Timer;
private var hideTimer:Timer;
private var animTimer:Timer;
private var sprite:Sprite;
private var textField:TextField;
private var stage:Stage;
@ -91,7 +91,7 @@ class SimpleTooltip {
showTimer.addEventListener(TimerEvent.TIMER, eventHandler);
hideTimer = new Timer(linger);
hideTimer.addEventListener(TimerEvent.TIMER, eventHandler);
// Setup display objects
sprite = new Sprite();
sprite.mouseEnabled = false;
@ -105,7 +105,7 @@ class SimpleTooltip {
textField.textColor = CSS.buttonLabelColor;
sprite.addChild(textField);
}
static private var instance:*;
public function addTooltip(dObj:DisplayObject, opts:Object):void {
if(!opts.hasOwnProperty('text') || !opts.hasOwnProperty('direction') ||
@ -113,13 +113,13 @@ class SimpleTooltip {
trace('Invalid parameters!');
return;
}
if(tipObjs[dObj] == null) {
dObj.addEventListener(MouseEvent.MOUSE_OVER, eventHandler);
}
tipObjs[dObj] = opts;
}
private function eventHandler(evt:Event):void {
switch(evt.type) {
case MouseEvent.MOUSE_OVER:
@ -127,12 +127,12 @@ class SimpleTooltip {
break;
case MouseEvent.MOUSE_OUT:
(evt.currentTarget as DisplayObject).removeEventListener(MouseEvent.MOUSE_OUT, eventHandler);
if(showTimer.running) {
showTimer.reset();
nextTipObj = null;
}
startHideTimer(evt.currentTarget as DisplayObject);
break;
case TimerEvent.TIMER:
@ -148,7 +148,7 @@ class SimpleTooltip {
break;
}
}
private function startShow():void {
//trace('startShow()');
showTimer.reset();
@ -157,16 +157,16 @@ class SimpleTooltip {
var ttOpts:Object = tipObjs[nextTipObj];
renderTooltip(ttOpts.text);
currentTipObj = nextTipObj;
// TODO: Make it fade in
sprite.alpha = 1;
stage.addChild(sprite);
var pos:Point = getPos(ttOpts.direction);
sprite.x = pos.x;
sprite.y = pos.y;
}
public function showOnce(dObj:DisplayObject, ttOpts:Object):void {
if(!stage && dObj.stage) stage = dObj.stage;
//trace('showOnce()');
@ -176,22 +176,22 @@ class SimpleTooltip {
sprite.alpha = 0;
renderTooltip(ttOpts.text);
currentTipObj = dObj;
// TODO: Make it fade in
sprite.alpha = 1;
stage.addChild(sprite);
var pos:Point = getPos(ttOpts.direction);
sprite.x = pos.x;
sprite.y = pos.y;
// Show the tooltip for twice as long
var myTimer:Timer = new Timer(5000);
myTimer.addEventListener(TimerEvent.TIMER, eventHandler);
myTimer.reset();
myTimer.start();
}
private function getPos(direction:String):Point {
var rect:Rectangle = currentTipObj.getBounds(stage);
var pos:Point;
@ -213,11 +213,11 @@ class SimpleTooltip {
if (pos.y < 0) pos.y = 0;
return pos;
}
public function forceHide():void {
startHide(hideTimer);
}
private function startHide(timer:Timer):void {
//trace('startHide()');
hideTimer.reset();
@ -225,7 +225,7 @@ class SimpleTooltip {
sprite.alpha = 0;
if(sprite.parent) stage.removeChild(sprite);
}
private function renderTooltip(text:String):void {
//trace('renderTooltip(\''+text+'\')');
var g:Graphics = sprite.graphics;
@ -236,30 +236,30 @@ class SimpleTooltip {
g.drawRect(0, 0, textField.textWidth + 5, textField.textHeight + 3);
g.endFill();
}
private function startShowTimer(dObj:DisplayObject):void {
//trace('startShowTimer()');
if(!stage && dObj.stage) stage = dObj.stage;
dObj.addEventListener(MouseEvent.MOUSE_OUT, eventHandler);
if(dObj === currentTipObj) {
hideTimer.reset();
return;
}
if(tipObjs[dObj] is Object) {
nextTipObj = dObj;
showTimer.reset();
showTimer.start();
}
}
private function startHideTimer(dObj:DisplayObject):void {
//trace('startHideTimer()');
if(dObj !== currentTipObj) return;
hideTimer.reset();
hideTimer.start();
}

View file

@ -60,7 +60,7 @@ public class Slider extends Sprite implements DragClient {
public function get max():Number { return maxValue; }
public function set max(n:Number):void { maxValue = n; }
public function get value():Number { return positionFraction * (maxValue - minValue) + minValue; }
public function set value(n:Number):void {
// Update the slider value (0-1).
@ -89,7 +89,7 @@ public class Slider extends Sprite implements DragClient {
g.beginFill(slotColor);
}
g.drawRoundRect(0, 0, w, h, slotRadius, slotRadius);
g.endFill();
g.endFill();
}
private function drawKnob(w:int, h:int):void {
@ -151,4 +151,4 @@ public class Slider extends Sprite implements DragClient {
dispatchEvent(new Event(Event.COMPLETE));
}
}}
}}

View file

@ -19,14 +19,14 @@
package util {
import flash.display.Graphics;
public class DrawPath {
static public function drawPath(path:Array, g:Graphics):void {
var startx:Number = 0, starty:Number = 0;
var pathx:Number = 0, pathy:Number = 0;
for each (var item:Array in path) {
switch (item[0].toLowerCase()) {
switch (item[0].toLowerCase()) {
case 'm':
startx = item[1];
starty = item[2];
@ -35,7 +35,7 @@ public class DrawPath {
case 'l': g.lineTo(pathx += item[1], pathy += item[2]); break;
case 'h': g.lineTo(pathx += item[1], pathy); break;
case 'v': g.lineTo(pathx, pathy += item[1]); break;
case 'c':
case 'c':
var cx:Number = pathx + item[1];
var cy:Number = pathy + item[2];
var px:Number = pathx + item[3];

View file

@ -31,7 +31,7 @@ public class Multipart {
private const crlf:String = '\r\n';
private var parts:Array = []; // list of name-value-type triples
public function Multipart() {
separator = generateSeparator();
}
@ -77,4 +77,4 @@ public class Multipart {
return result;
}
}}
}}

View file

@ -22,7 +22,7 @@ package util {
import flash.utils.ByteArray;
public class ZipIO {
private const Version:int = 10;
private const FileEntryID:uint = 0x04034b50; // Local File Header Record
private const DirEntryID:uint = 0x02014b50; // Central Directory Record
@ -229,12 +229,12 @@ public class ZipIO {
buf.position = 0;
return buf;
}
private function writeFileHeader(e:Entry):void {
buf.writeUnsignedInt(FileEntryID);
buf.writeShort(Version);
buf.writeShort(0); // flags
buf.writeShort(e.compressionMethod);
buf.writeShort(e.compressionMethod);
buf.writeUnsignedInt(e.time);
buf.writeUnsignedInt(e.crc);
buf.writeUnsignedInt(e.compressedSize);
@ -244,7 +244,7 @@ public class ZipIO {
buf.writeUTFBytes(e.name);
// optional extra info would go here
}
private function writeDirectoryEntry(e:Entry):void {
buf.writeUnsignedInt(DirEntryID);
buf.writeShort(Version); // version created by
@ -266,7 +266,7 @@ public class ZipIO {
// optional extra info would go here
// optional comment would go here
}
private function writeEndRecord(dirStart:uint, dirSize:uint):void {
buf.writeUnsignedInt(EndID);
buf.writeShort(0); // number of this disk