@@ -7,6 +7,7 @@ class MapProperties {
77 this . mapModes = [ "Linear" , "Expression" ] ;
88 this . mapProtocols = [ "UDP" , "TCP" ] ;
99 this . boundaryIcons = [ "none" , "right" , "left" , "mute" , "clamp" , "wrap" ] ;
10+ this . cachedProperty = { "key" : null , "value" : null } ;
1011
1112 $ ( this . container ) . append (
1213 "<div' class='topMenu' id='mapPropsContainer' style='width:calc(100% - 605px);'>" +
@@ -74,12 +75,17 @@ class MapProperties {
7475
7576 // The range input handler
7677 $ ( '#mapPropsContainer' ) . on ( {
77- keydown : function ( e ) {
78+ keydown : function ( e ) { e . stopPropagation ( ) ; } ,
79+ keyup : function ( e ) {
7880 e . stopPropagation ( ) ;
7981 if ( e . which == 13 || e . which == 9 ) { //'enter' or 'tab' key
8082 self . setMapProperty ( $ ( this ) . attr ( 'id' ) . split ( ' ' ) [ 0 ] ,
8183 this . value ) ;
8284 }
85+ else {
86+ self . cacheMapProperty ( $ ( this ) . attr ( 'id' ) . split ( ' ' ) [ 0 ] ,
87+ this . value ) ;
88+ }
8389 } ,
8490 click : function ( e ) { e . stopPropagation ( ) ; } ,
8591 focusout : function ( e ) {
@@ -91,19 +97,27 @@ class MapProperties {
9197
9298 // The expression input handler
9399 $ ( '#mapPropsContainer' ) . on ( {
94- keydown : function ( e ) {
100+ keydown : function ( e ) { e . stopPropagation ( ) ; } ,
101+ keyup : function ( e ) {
95102 e . stopPropagation ( ) ;
96103 if ( e . which == 13 ) { //'enter' key
97- if ( counter >= 1 ) {
104+ // check if expression contains a semicolon
105+ if ( this . value . indexOf ( ';' ) == - 1 || counter >= 1 ) {
98106 self . setMapProperty ( $ ( this ) . attr ( 'id' ) . split ( ' ' ) [ 0 ] ,
99107 this . value ) ;
100- counter = 0 ;
108+ counter = 0 ;
101109 }
102- else
110+ else {
103111 counter += 1 ;
112+ self . cacheMapProperty ( $ ( this ) . attr ( 'id' ) . split ( ' ' ) [ 0 ] ,
113+ this . value ) ;
114+ }
104115 }
105- else
116+ else {
106117 counter = 0 ;
118+ self . cacheMapProperty ( $ ( this ) . attr ( 'id' ) . split ( ' ' ) [ 0 ] ,
119+ this . value ) ;
120+ }
107121 } ,
108122 click : function ( e ) { e . stopPropagation ( ) ; } ,
109123 focusout : function ( e ) {
@@ -344,8 +358,19 @@ class MapProperties {
344358 this . updateMapProperties ( ) ;
345359 }
346360
361+ cacheMapProperty ( key , value ) {
362+ this . cachedProperty . key = key ;
363+ this . cachedProperty . value = value ;
364+ }
365+
366+ sendCachedProperty ( ) {
367+ if ( ! this . cachedProperty . key || ! this . cachedProperty . value )
368+ return ;
369+ this . setMapProperty ( this . cachedProperty . key , this . cachedProperty . value ) ;
370+ }
371+
347372 setMapProperty ( key , value ) {
348- let container = $ ( this . container ) ;
373+ this . cacheMapProperty ( ) ;
349374 let modes = this . mapModeCommands ;
350375 this . database . maps . filter ( this . selected ) . forEach ( function ( map ) {
351376 if ( map [ key ] && ( map [ key ] == value || map [ key ] == parseFloat ( value ) ) )
0 commit comments