-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
#166 create joist demo for testing Dialog
- Loading branch information
Showing
6 changed files
with
189 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,7 @@ | ||
{ | ||
"joist.name": { | ||
"value": "joist demo" | ||
}, | ||
"done": { | ||
"value": "Done" | ||
}, | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
<!DOCTYPE html> | ||
<!-- Copyright 2002-2015, University of Colorado Boulder --> | ||
<!--[if lt IE 7]> | ||
<html class="no-js lt-ie9 lt-ie8 lt-ie7"> <![endif]--> | ||
<!--[if IE 7]> | ||
<html class="no-js lt-ie9 lt-ie8"> <![endif]--> | ||
<!--[if IE 8]> | ||
<html class="no-js lt-ie9"> <![endif]--> | ||
<!--[if gt IE 8]><!--> | ||
<html class="no-js"> <!--<![endif]--> | ||
<head> | ||
<meta charset="utf-8"> | ||
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"> | ||
<meta name="description" content=""> | ||
<meta name="viewport" content="initial-scale=1,user-scalable=no,maximum-scale=1"> | ||
<meta name="apple-mobile-web-app-capable" content="yes"> | ||
<meta name="apple-mobile-web-app-status-bar-style" content="white"> | ||
|
||
<title>Joist Demo</title> | ||
|
||
<!-- Third-party libraries --> | ||
<script src="../sherpa/lib/jquery-2.1.0.js"></script> | ||
<script src='../sherpa/lib/lodash-2.4.1.js'></script> | ||
<script type="text/javascript" src="../sherpa/lib/FileSaver-b8054a2.js"></script> | ||
|
||
<!-- PhET common code that must be loaded pre-RequireJS --> | ||
<script type="text/javascript" src="../assert/js/assert.js"></script> | ||
<script type="text/javascript" src="../chipper/js/initialize-globals.js"></script> | ||
|
||
<!-- Simulation --> | ||
<script data-main="js/joist-config.js" src="../sherpa/lib/require-2.1.11.js"></script> | ||
|
||
</head> | ||
|
||
<body> | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
// Copyright 2002-2015, University of Colorado Boulder | ||
|
||
/** | ||
* View for demonstrating dialogs. | ||
* | ||
* @author Chris Malley (PixelZoom, Inc.) | ||
*/ | ||
define( function( require ) { | ||
'use strict'; | ||
|
||
// modules | ||
var Dialog = require( 'JOIST/Dialog' ); | ||
var inherit = require( 'PHET_CORE/inherit' ); | ||
var PhetFont = require( 'SCENERY_PHET/PhetFont' ); | ||
var RectangularPushButton = require( 'SUN/buttons/RectangularPushButton' ); | ||
var ScreenView = require( 'JOIST/ScreenView' ); | ||
var Text = require( 'SCENERY/nodes/Text' ); | ||
|
||
// constants | ||
var BUTTON_FONT = new PhetFont( { size: 20 } ); | ||
|
||
/** | ||
* @constructor | ||
*/ | ||
function DialogsDemoView() { | ||
|
||
ScreenView.call( this ); | ||
|
||
var modalDialogButton = new RectangularPushButton( { | ||
content: new Text( 'modal dialog', { font: BUTTON_FONT } ), | ||
listener: function() { | ||
createDialog( true ).show(); | ||
}, | ||
left: this.layoutBounds.left + 100, | ||
top: this.layoutBounds.top + 100 | ||
} ); | ||
this.addChild( modalDialogButton ); | ||
|
||
var nonModalDialogButton = new RectangularPushButton( { | ||
content: new Text( 'non-modal dialog', { font: BUTTON_FONT } ), | ||
listener: function() { | ||
createDialog( false ).show(); | ||
}, | ||
left: modalDialogButton.right + 20, | ||
top: modalDialogButton.top | ||
} ); | ||
this.addChild( nonModalDialogButton ); | ||
} | ||
|
||
/** | ||
* Creates a model or non-modal dialog | ||
* @param {boolean} modal | ||
* @returns {Dialog} | ||
*/ | ||
var createDialog = function( modal ) { | ||
var contentNode = new Text( modal ? 'modal dialog' : 'non-modal dialog', { | ||
font: new PhetFont( 20 ) | ||
} ); | ||
return new Dialog( contentNode, { | ||
modal: modal, | ||
hasCloseButton: !modal | ||
} ); | ||
}; | ||
|
||
return inherit( ScreenView, DialogsDemoView ); | ||
} ); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
// Copyright 2002-2015, University of Colorado Boulder | ||
|
||
// RequireJS configuration file for Joist demo. | ||
require.config( { | ||
deps: [ 'joist-main' ], | ||
|
||
paths: { | ||
|
||
// third party libs | ||
text: '../../sherpa/lib/text-2.0.12', | ||
|
||
// plugins | ||
image: '../../chipper/js/requirejs-plugins/image', | ||
mipmap: '../../chipper/js/requirejs-plugins/mipmap', | ||
string: '../../chipper/js/requirejs-plugins/string', | ||
|
||
// PhET libs, uppercase names to identify them in require.js imports | ||
AXON: '../../axon/js', | ||
BRAND: '../../brand/' + phet.chipper.brand + '/js', | ||
DOT: '../../dot/js', | ||
JOIST: '../../joist/js', | ||
KITE: '../../kite/js', | ||
PHETCOMMON: '../../phetcommon/js', | ||
REPOSITORY: '..', | ||
PHET_CORE: '../../phet-core/js', | ||
SCENERY: '../../scenery/js', | ||
SCENERY_PHET: '../../scenery-phet/js', | ||
SHERPA: '../../sherpa', | ||
SUN: '../../sun/js' | ||
}, | ||
|
||
// optional cache buster to make browser refresh load all included scripts, can be disabled with ?cacheBuster=false | ||
urlArgs: phet.chipper.getCacheBusterArgs() | ||
} ); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
// Copyright 2002-2015, University of Colorado Boulder | ||
|
||
/** | ||
* Main file for the Joist demo. | ||
* | ||
* @author Chris Malley (PixelZoom, Inc.) | ||
*/ | ||
define( function( require ) { | ||
'use strict'; | ||
|
||
// modules | ||
var DialogsDemoView = require( 'JOIST/demo/DialogsDemoView' ); | ||
var Rectangle = require( 'SCENERY/nodes/Rectangle' ); | ||
var Screen = require( 'JOIST/Screen' ); | ||
var Sim = require( 'JOIST/Sim' ); | ||
var SimLauncher = require( 'JOIST/SimLauncher' ); | ||
|
||
// strings | ||
var title = require( 'string!JOIST/joist.name' ); | ||
|
||
var screens = [ | ||
new Screen( 'Dialogs', | ||
new Rectangle( 0, 0, Screen.HOME_SCREEN_ICON_SIZE.width, Screen.HOME_SCREEN_ICON_SIZE.height, { fill: 'white' } ), | ||
function() { return {}; }, | ||
function( model ) { return new DialogsDemoView(); }, | ||
{ backgroundColor: 'white' } | ||
), | ||
new Screen( 'Dialogs 2', | ||
new Rectangle( 0, 0, Screen.HOME_SCREEN_ICON_SIZE.width, Screen.HOME_SCREEN_ICON_SIZE.height, { fill: 'white' } ), | ||
function() { return {}; }, | ||
function( model ) { return new DialogsDemoView(); }, | ||
{ backgroundColor: 'white' } | ||
) | ||
]; | ||
|
||
var options = { | ||
credits: { | ||
leadDesign: 'PhET' | ||
} | ||
}; | ||
|
||
SimLauncher.launch( function() { | ||
new Sim( title, screens, options ).start(); | ||
} ); | ||
} ); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters