Skip to content

Commit

Permalink
Updated GigaPan Desktop to version 0.5:
Browse files Browse the repository at this point in the history
* New viewer based on MultiScaleImage2 component from neorenderer branch.
* Spinner component for network activity indication
* Horizontal layout (work-in-progress)
* Third column for curated gigapans
* Switched to strongly typed value objects (GigaPan)
* Removed status message
* Implemented chrome idle hiding.
  • Loading branch information
gasi committed Jul 31, 2009
1 parent 8644547 commit a09aa6c
Show file tree
Hide file tree
Showing 11 changed files with 385 additions and 167 deletions.
8 changes: 4 additions & 4 deletions .actionScriptProperties
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
<?xml version="1.0" encoding="UTF-8"?>
<actionScriptProperties mainApplicationPath="GigaPanDesktop.mxml" version="3">
<compiler additionalCompilerArguments="-locale en_US" copyDependentFiles="false" enableModuleDebug="true" generateAccessible="false" htmlExpressInstall="true" htmlGenerate="false" htmlHistoryManagement="false" htmlPlayerVersion="9.0.124" htmlPlayerVersionCheck="true" outputFolderPath="bin-debug" sourceFolderPath="src" strict="true" useApolloConfig="true" verifyDigests="true" warn="true">
<compiler additionalCompilerArguments="-locale en_US -default-background-color #121212" copyDependentFiles="false" enableModuleDebug="true" generateAccessible="false" htmlExpressInstall="true" htmlGenerate="false" htmlHistoryManagement="false" htmlPlayerVersion="9.0.124" htmlPlayerVersionCheck="true" outputFolderPath="bin-debug" sourceFolderPath="src" strict="true" useApolloConfig="true" verifyDigests="true" warn="true">
<compilerSourcePath>
<compilerSourcePathEntry kind="1" linkType="1" path="${OPENZOOM}/src"/>
<compilerSourcePathEntry kind="1" linkType="1" path="${OPENZOOM}/lib/as3corelib/src"/>
<compilerSourcePathEntry kind="1" linkType="1" path="${OPENZOOM_SDK}/src"/>
<compilerSourcePathEntry kind="1" linkType="1" path="${OPENZOOM_SDK}/lib/as3corelib/src"/>
</compilerSourcePath>
<libraryPath defaultLinkType="1">
<libraryPathEntry kind="4" path=""/>
<libraryPathEntry kind="1" linkType="1" path="${OPENZOOM}/lib"/>
<libraryPathEntry kind="1" linkType="1" path="${OPENZOOM_SDK}/lib"/>
</libraryPath>
<sourceAttachmentPath/>
</compiler>
Expand Down
8 changes: 4 additions & 4 deletions .project
Original file line number Diff line number Diff line change
Expand Up @@ -23,14 +23,14 @@
</natures>
<linkedResources>
<link>
<name>[source path] OpenZoom SDK</name>
<name>[source path] OPENZOOM_SDK-src</name>
<type>2</type>
<locationURI>OPENZOOM/src</locationURI>
<locationURI>OPENZOOM_SDK/src</locationURI>
</link>
<link>
<name>[source path] as3corelib</name>
<name>[source path] as3corelib-src</name>
<type>2</type>
<locationURI>OPENZOOM/lib/as3corelib/src</locationURI>
<locationURI>OPENZOOM_SDK/lib/as%2533corelib/src</locationURI>
</link>
</linkedResources>
</projectDescription>
8 changes: 4 additions & 4 deletions assets/style/gigapan-desktop.css
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,8 @@ global {
}

Application {
background-gradient-colors: #090909, #090909;
background-color: #090909;
background-gradient-colors: #121212, #121212;
background-color: #121212;
}

Button {
Expand All @@ -52,8 +52,8 @@ List {
background-alpha: 0;
border-alpha: 0;
border-color: #000000;
item-roll-over-color: #111111;
item-selection-color: #222222;
item-roll-over-color: #090909;
item-selection-color: #090909;
}

Label {
Expand Down
6 changes: 3 additions & 3 deletions src/GigaPanDesktop-app.xml
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@
<name>GigaPan Desktop</name>

<!-- An application version designator (such as "v1", "2.5", or "Alpha 1"). Required. -->
<version>0.2</version>
<version>0.5</version>

<!-- Description, displayed in the AIR application installer.
May have multiple values for each language. See samples or xsd schema file. Optional. -->
Expand All @@ -63,10 +63,10 @@
<title>GigaPan Desktop</title>

<!-- The type of system chrome to use (either "standard" or "none"). Optional. Default standard. -->
<!-- <systemChrome></systemChrome> -->
<systemChrome>standard</systemChrome>

<!-- Whether the window is transparent. Only applicable when systemChrome is none. Optional. Default false. -->
<!-- <transparent></transparent> -->
<transparent>false</transparent>

<!-- Whether the window is initially visible. Optional. Default false. -->
<!-- <visible></visible> -->
Expand Down
184 changes: 134 additions & 50 deletions src/GigaPanDesktop.mxml
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,13 @@
minHeight="480"
width="960"
height="600"
showFlexChrome="false"
applicationComplete="applicationCompleteHandler(event)"
>
<mx:Style source="../assets/style/gigapan-desktop.css"/>
<mx:Script>
<![CDATA[
import org.openzoom.gigapan.GigaPan;
import flash.utils.setTimeout;
Expand All @@ -46,16 +48,20 @@
private static const API_POLICY_URI:String = "http://api.gigapan.org/crossdomain.xml"
private static const MOST_RECENT_URI:String = API_ENDPOINT_URI + "most_recent.json"
private static const MOST_POPULAR_URI:String = API_ENDPOINT_URI + "most_popular.json"
private static const CURRATED_URI:String = API_ENDPOINT_URI + "currated.json"
// Obama Inauguration
private static const DEFAULT_DESCRIPTOR:GigaPanDescriptor = new GigaPanDescriptor(15374, 59783, 24658)
// private static const DEFAULT_DESCRIPTOR:GigaPanDescriptor = GigaPanDescriptor.fromID(17217, 56646, 27788)
private static const LOGO_HIDE_DELAY:Number = 2000
private static const SIDEBAR_HIDE_DELAY:Number = 3000
// Apollo
private static const DEFAULT_DESCRIPTOR:GigaPanDescriptor = GigaPanDescriptor.fromID(25500, 33620, 3416)
private static const UI_HIDE_DELAY:Number = 2000
private static const SIDEBAR_HIDE_DELAY:Number = 2500
private var hiddenSideBarEnabled:Boolean = false
private var loader:INetworkQueue
private var uiTimer:Timer
private function applicationCompleteHandler(event:FlexEvent):void
{
Expand All @@ -64,18 +70,20 @@
initSideBar()
}
private function initApplication():void
{
Security.loadPolicyFile(API_POLICY_URI)
stage.addEventListener(KeyboardEvent.KEY_DOWN,
stage_keyDownHandler,
false, 0, true)
stage.addEventListener(MouseEvent.MOUSE_MOVE,
stage_mouseMoveHandler,
false, 0, true)
uiTimer = new Timer(UI_HIDE_DELAY, 1)
uiTimer.addEventListener(TimerEvent.TIMER_COMPLETE,
uiTimer_completeHandler,
false, 0, true)
uiTimer.start()
setTimeout(sideBarDelayClosure, SIDEBAR_HIDE_DELAY)
}
Expand All @@ -86,9 +94,33 @@
private function initViewer():void
{
viewer.image.addEventListener(Event.INIT,
image_initHandler,
false, 0, true)
viewer.image.addEventListener(ProgressEvent.PROGRESS,
image_progressHandler,
false, 0, true)
viewer.image.addEventListener(Event.COMPLETE,
image_completeHandler,
false, 0, true)
viewer.loadDescriptor(DEFAULT_DESCRIPTOR)
}
private function image_initHandler(event:Event):void
{
imageSpinner.visible = true
}
private function image_progressHandler(event:ProgressEvent):void
{
imageSpinner.visible = true
}
private function image_completeHandler(event:Event):void
{
imageSpinner.visible = false
}
private function initSideBar():void
{
loader = new NetworkQueue()
Expand All @@ -99,58 +131,75 @@
request_completeHandler,
false, 0, true)
// TODO
// request = loader.addRequest(MOST_POPULAR_URI, String, MOST_POPULAR_URI)
// request.addEventListener(Event.COMPLETE,
// request_completeHandler,
// false, 0, true)
request = loader.addRequest(MOST_POPULAR_URI, String, MOST_POPULAR_URI)
request.addEventListener(Event.COMPLETE,
request_completeHandler,
false, 0, true)
request = loader.addRequest(CURRATED_URI, String, CURRATED_URI)
request.addEventListener(Event.COMPLETE,
request_completeHandler,
false, 0, true)
}
private function request_completeHandler(event:NetworkRequestEvent):void
{
var data:Object = JSON.decode(event.data)
var collection:Array = []
for each (var item:Object in data.items)
{
var gigapan:GigaPan = new GigaPan()
gigapan.id = item[1].id
gigapan.width = item[1].width
gigapan.height = item[1].height
collection.push(gigapan)
}
if (event.context == MOST_RECENT_URI)
sideBar.mostRecent = new ArrayCollection(data.items)
else
sideBar.mostPopular = new ArrayCollection(data.items)
sideBar.mostRecentCollection = new ArrayCollection(collection)
if (event.context == MOST_POPULAR_URI)
sideBar.mostPopularCollection = new ArrayCollection(collection)
if (event.context == CURRATED_URI)
sideBar.curratedCollection = new ArrayCollection(collection)
}
private function sideBar_itemSelectedHandler(event:Event):void
{
var item:Object = sideBar.selectedItem
var gigapan:GigaPan = sideBar.selectedItem as GigaPan
if (item.hasOwnProperty("width") && item.hasOwnProperty("height"))
if (gigapan.width == 0 || gigapan.height == 0)
{
var descriptor:GigaPanDescriptor
descriptor = new GigaPanDescriptor(item.id, item.width, item.height)
viewer.loadDescriptor(descriptor)
viewer.loadId(gigapan.id)
}
else
{
viewer.loadId(item.id)
var descriptor:GigaPanDescriptor
descriptor = GigaPanDescriptor.fromID(gigapan.id, gigapan.width, gigapan.height)
viewer.loadDescriptor(descriptor)
}
}
private function stage_keyDownHandler(event:KeyboardEvent):void
private function uiTimer_completeHandler(event:TimerEvent):void
{
if (event.keyCode == 70) // F
{
if (stage.displayState == StageDisplayState.NORMAL)
stage.displayState = StageDisplayState.FULL_SCREEN_INTERACTIVE
else
stage.displayState = StageDisplayState.NORMAL
}
hideUI()
}
private function stage_mouseMoveHandler(event:MouseEvent):void
{
uiTimer.reset()
uiTimer.start()
showUI()
if (!hiddenSideBarEnabled)
return
if (event.stageX > stage.stageWidth - 64)
if (event.stageY > stage.stageHeight - 64)
showSideBar()
if (sideBar.visible && event.stageX < stage.stageWidth - sideBar.width - 64)
if (sideBar.visible && event.stageY < stage.stageHeight - sideBar.height - 64)
hideSideBar()
}
Expand All @@ -163,6 +212,24 @@
{
currentState = "full"
}
private function showUI():void
{
if (!logo.visible)
{
logo.visible = true
Mouse.show()
}
}
private function hideUI():void
{
if (logo.visible)
{
logo.visible = false
Mouse.hide()
}
}
]]>
</mx:Script>

Expand All @@ -173,20 +240,20 @@
<mx:transitions>
<mx:Transition fromState="" toState="full">
<mx:Sequence target="{sideBar}">
<mx:SetPropertyAction name="previousWidth" value="{sideBar.width}"/>
<mx:Resize widthTo="0" duration="800"/>
<mx:SetPropertyAction name="previousHeight" value="{sideBar.height}"/>
<mx:Resize heightTo="0" duration="800"/>
<mx:SetPropertyAction name="includeInLayout" value="false"/>
</mx:Sequence>
</mx:Transition>
<mx:Transition fromState="full" toState="">
<mx:Sequence target="{sideBar}">
<mx:SetPropertyAction name="includeInLayout" value="true"/>
<mx:Resize widthTo="{sideBar.previousWidth}" duration="600"/>
<mx:Resize heightTo="{sideBar.previousHeight}" duration="600"/>
</mx:Sequence>
</mx:Transition>
</mx:transitions>

<mx:HDividedBox
<mx:VDividedBox
top="0"
right="0"
bottom="0"
Expand All @@ -198,29 +265,46 @@
height="100%"
backgroundColor="#000000"
>
<ui:StatusMessage
message="Loading…"
horizontalCenter="0"
verticalCenter="0"
/>
<ui:Spinner
horizontalCenter="0"
verticalCenter="0"
/>
<ui:Viewer
id="viewer"
top="0"
right="0"
bottom="0"
left="0"
/>
<ui:Spinner
id="imageSpinner"
radius="4"
right="20"
top="20"
showEffect="Fade"
hideEffect="Fade"
/>
</mx:Canvas>

<ui:Sidebar
id="sideBar"
width="180"
maxWidth="320"
minWidth="140"
height="100%"
height="320"
maxHeight="480"
minHeight="320"
width="100%"
itemSelected="sideBar_itemSelectedHandler(event)"
showEffect="Fade"
hideEffect="Fade"
/>
</mx:HDividedBox>
<ui:Logo width="94" height="32" x="5"/>
</mx:WindowedApplication>
</mx:VDividedBox>

<ui:Logo
id="logo"
width="94"
height="32"
x="5"
showEffect="Fade"
hideEffect="Fade"
/>

</mx:WindowedApplication>
Loading

0 comments on commit a09aa6c

Please sign in to comment.