File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ // compare = Object:
2+ // {
3+ // scaleX: 0.5,
4+ // scaleY: 1
5+ // }
6+
7+ var GetFirst = function ( items , compare , index )
8+ {
9+ for ( var i = index ; i < items . length ; i ++ )
10+ {
11+ var item = items [ i ] ;
12+
13+ var match = true ;
14+
15+ for ( var property in compare )
16+ {
17+ if ( item [ property ] !== compare [ property ] )
18+ {
19+ match = false ;
20+ }
21+ }
22+
23+ if ( match )
24+ {
25+ return item ;
26+ }
27+ }
28+
29+ return null ;
30+ } ;
31+
32+ module . exports = GetFirst ;
Original file line number Diff line number Diff line change @@ -4,6 +4,7 @@ module.exports = {
44
55 Angle : require ( './Angle' ) ,
66 Call : require ( './Call' ) ,
7+ GetFirst : require ( './GetFirst' ) ,
78 GridAlign : require ( './GridAlign' ) ,
89 IncAlpha : require ( './IncAlpha' ) ,
910 IncX : require ( './IncX' ) ,
Original file line number Diff line number Diff line change @@ -175,6 +175,13 @@ var Layer = new Class({
175175 return this . children . size ;
176176 } ,
177177
178+ getFirst : function ( compare , index )
179+ {
180+ if ( index === undefined ) { index = 0 ; }
181+
182+ return Actions . GetFirst ( this . children . entries , compare , index ) ;
183+ } ,
184+
178185 destroy : function ( )
179186 {
180187 this . children . clear ( ) ;
You can’t perform that action at this time.
0 commit comments