Merge pull request #620 from LLK/add_sprite_tiles

Added white background to sprite thumbnails.
This commit is contained in:
Chris Willis-Ford 2015-02-10 08:08:16 -08:00
commit d53aaf3d21
2 changed files with 23 additions and 12 deletions

View file

@ -58,6 +58,7 @@ public class SpriteThumbnail extends Sprite {
this.targetObj = targetObj; this.targetObj = targetObj;
this.app = app; this.app = app;
addFrame();
addSelectedFrame(); addSelectedFrame();
addHighlightFrame(); addHighlightFrame();
@ -92,6 +93,18 @@ public class SpriteThumbnail extends Sprite {
addChild(detailsButton); addChild(detailsButton);
} }
private function addFrame():void {
if (targetObj.isStage) return;
var frame:Shape = new Shape();
var g:Graphics = frame.graphics;
g.lineStyle(NaN);
g.beginFill(0xFFFFFF);
g.drawRoundRect(0, 0, frameW, frameH, 12, 12);
g.endFill();
addChild(frame);
}
private function addSelectedFrame():void { private function addSelectedFrame():void {
selectedFrame = new Shape(); selectedFrame = new Shape();
var g:Graphics = selectedFrame.graphics; var g:Graphics = selectedFrame.graphics;

View file

@ -23,22 +23,20 @@
// This part holds the Sprite Library and the UI elements around it. // This part holds the Sprite Library and the UI elements around it.
package ui.parts { package ui.parts {
import flash.display.*; import flash.display.*;
import flash.geom.*; import flash.text.*;
import flash.text.*; import flash.utils.*;
import flash.utils.*; import scratch.*;
import scratch.*; import translation.Translator;
import translation.Translator; import ui.media.*;
import ui.media.*; import ui.SpriteThumbnail;
import ui.SpriteThumbnail; import uiwidgets.*;
import uiwidgets.*;
import util.ProjectIO;
public class LibraryPart extends UIPart { public class LibraryPart extends UIPart {
private const smallTextFormat:TextFormat = new TextFormat(CSS.font, 10, CSS.textColor); private const smallTextFormat:TextFormat = new TextFormat(CSS.font, 10, CSS.textColor);
private const bgColor:int = 0xFFFFFF; private const bgColor:int = CSS.tabColor;
private const stageAreaWidth:int = 77; private const stageAreaWidth:int = 77;
private const updateInterval:int = 200; // msecs between thumbnail updates private const updateInterval:int = 200; // msecs between thumbnail updates
@ -136,7 +134,7 @@ public class LibraryPart extends UIPart {
g.lineStyle(); g.lineStyle();
g.beginFill(CSS.tabColor); g.beginFill(CSS.tabColor);
g.drawRect(1, CSS.titleBarH + 1, stageAreaWidth - 1, h - CSS.titleBarH - 1); g.drawRect(1, CSS.titleBarH + 1, stageAreaWidth - 1, h - CSS.titleBarH - 1);
g.endFill() g.endFill();
fixLayout(); fixLayout();
if (app.viewedObj()) refresh(); // refresh, but not during initialization if (app.viewedObj()) refresh(); // refresh, but not during initialization
} }