Skip to content

Commit

Permalink
12/27/2011 *0.1 Build 415*
Browse files Browse the repository at this point in the history
----------------------

* Fixed PathActor to be able to draw background image or color.
* Fixed key event system. Now, the original key event is 'preventDefault'ed, and the notification callback receives an
  object of the form:

  new CAAT.KeyEvent(
      key,
      'up' | 'down',
      {
          alt:        CAAT.KEY_MODIFIERS.alt,
          control:    CAAT.KEY_MODIFIERS.control,
          shift:      CAAT.KEY_MODIFIERS.shift
      },
      source_event );
  • Loading branch information
hyperandroid committed Dec 27, 2011
1 parent 9b44533 commit 7c9d4d1
Show file tree
Hide file tree
Showing 60 changed files with 697 additions and 348 deletions.
3 changes: 0 additions & 3 deletions .idea/misc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions build/caat-box2d-min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions build/caat-box2d.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,11 @@ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
Version: 0.1 build: 407
Version: 0.1 build: 415
Created on:
DATE: 2011-12-18
TIME: 16:41:42
DATE: 2011-12-27
TIME: 20:33:29
*/


Expand Down
25 changes: 13 additions & 12 deletions build/caat-css-min.js

Large diffs are not rendered by default.

78 changes: 70 additions & 8 deletions build/caat-css.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,11 @@ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
Version: 0.1 build: 407
Version: 0.1 build: 415
Created on:
DATE: 2011-12-18
TIME: 16:41:42
DATE: 2011-12-27
TIME: 20:33:29
*/


Expand Down Expand Up @@ -9193,6 +9193,49 @@ CAAT.KEY_MODIFIERS= {
shift: false
};

/**
* Define a key event.
* @constructor
* @param keyCode
* @param up_or_down
* @param modifiers
* @param originalEvent
*/
CAAT.KeyEvent= function( keyCode, up_or_down, modifiers, originalEvent ) {
this.keyCode= keyCode;
this.action= up_or_down;
this.modifiers= modifiers;
this.sourceEvent= originalEvent;

this.getKeyCode= function() {
return this.keyCode;
};

this.getAction= function() {
return this.action;
};

this.modifiers= function() {
return this.modifiers;
};

this.isShiftPressed= function() {
return this.modifiers.shift;
};

this.isControlPressed= function() {
return this.modifiers.control;
};

this.isAltPressed= function() {
return this.modifiers.alt;
};

this.getSourceEvent= function() {
return this.sourceEvent;
};
};

/**
* Enable window level input events, keys and redimension.
*/
Expand All @@ -9208,6 +9251,8 @@ CAAT.GlobalEnableEvents= function __GlobalEnableEvents() {
function(evt) {
var key = (evt.which) ? evt.which : evt.keyCode;

evt.preventDefault();

if ( key===CAAT.SHIFT_KEY ) {
CAAT.KEY_MODIFIERS.shift= true;
} else if ( key===CAAT.CONTROL_KEY ) {
Expand All @@ -9216,22 +9261,25 @@ CAAT.GlobalEnableEvents= function __GlobalEnableEvents() {
CAAT.KEY_MODIFIERS.alt= true;
} else {
for( var i=0; i<CAAT.keyListeners.length; i++ ) {
CAAT.keyListeners[i](
CAAT.keyListeners[i]( new CAAT.KeyEvent(
key,
'down',
{
alt: CAAT.KEY_MODIFIERS.alt,
control: CAAT.KEY_MODIFIERS.control,
shift: CAAT.KEY_MODIFIERS.shift
},
evt);
evt)) ;
}
}
},
false);

window.addEventListener('keyup',
function(evt) {

evt.preventDefault();

var key = (evt.which) ? evt.which : evt.keyCode;
if ( key===CAAT.SHIFT_KEY ) {
CAAT.KEY_MODIFIERS.shift= false;
Expand All @@ -9242,15 +9290,15 @@ CAAT.GlobalEnableEvents= function __GlobalEnableEvents() {
} else {

for( var i=0; i<CAAT.keyListeners.length; i++ ) {
CAAT.keyListeners[i](
CAAT.keyListeners[i]( new CAAT.KeyEvent(
key,
'up',
{
alt: CAAT.KEY_MODIFIERS.alt,
control: CAAT.KEY_MODIFIERS.control,
shift: CAAT.KEY_MODIFIERS.shift
},
evt);
evt));
}
}
},
Expand Down Expand Up @@ -11640,7 +11688,19 @@ CAAT.modules.CircleManager = CAAT.modules.CircleManager || {};/**
return this;
},

createDefault : function( padding ) {
var str="";
for( var i=32; i<128; i++ ) {
str= str+String.fromCharCode(i);
}

return this.create( str, padding );
},

create : function( chars, padding ) {

this.padding= padding;

var canvas= document.createElement('canvas');
canvas.width= 1;
canvas.height= 1;
Expand All @@ -11656,7 +11716,7 @@ CAAT.modules.CircleManager = CAAT.modules.CircleManager || {};/**
var cchar;

for( i=0; i<chars.length; i++ ) {
var cw= Math.max( 1, ctx.measureText( chars.charAt(i) ).width>>0 ) + 2 * padding;
var cw= Math.max( 1, (ctx.measureText( chars.charAt(i) ).width>>0)+1 ) + 2 * padding ;
charWidth.push(cw);
textWidth+= cw;
}
Expand Down Expand Up @@ -13573,6 +13633,8 @@ CAAT.modules.CircleManager = CAAT.modules.CircleManager || {};/**
*/
paint : function(director, time) {

CAAT.PathActor.superclass.paint.call( this, director, time );

var canvas= director.crc;

canvas.strokeStyle='black';
Expand Down
Loading

0 comments on commit 7c9d4d1

Please sign in to comment.