@@ -84,55 +84,6 @@ function setCookie(cookieName, value, expireDays) {
8484
8585const ANIMATION_SPEED_DEFAULT = 75 ;
8686
87- // TODO: Move these out of global space into animation manager?
88-
89- function controlKey ( keyASCII ) {
90- return (
91- keyASCII === 8 ||
92- keyASCII === 9 ||
93- keyASCII === 37 ||
94- keyASCII === 38 ||
95- keyASCII === 39 ||
96- keyASCII === 40 ||
97- keyASCII === 46
98- ) ;
99- }
100-
101- function returnSubmit ( field , func , maxSize , intOnly ) {
102- if ( maxSize !== undefined ) {
103- field . size = maxSize ;
104- }
105- return function ( event ) {
106- let keyASCII = 0 ;
107- if ( window . event ) {
108- // IE
109- keyASCII = event . keyCode ;
110- } else if ( event . which ) {
111- // Netscape/Firefox/Opera
112- keyASCII = event . which ;
113- }
114-
115- if ( keyASCII === 13 ) {
116- func ( ) ;
117- return false ;
118- } else if (
119- keyASCII === 59 ||
120- keyASCII === 45 ||
121- keyASCII === 46 ||
122- keyASCII === 190 ||
123- keyASCII === 173
124- ) {
125- return false ;
126- } else if (
127- ( maxSize !== undefined && field . value . length >= maxSize ) ||
128- ( intOnly && ( keyASCII < 48 || keyASCII > 57 ) )
129- ) {
130- if ( ! controlKey ( keyASCII ) ) return false ;
131- }
132- return true ;
133- } ;
134- }
135-
13687function addControlToAnimationBar ( animBarRef , type , name , callback ) {
13788 const element = document . createElement ( 'input' ) ;
13889
@@ -276,7 +227,7 @@ export default class AnimationManager extends EventListener {
276227 />
277228 ) ;
278229
279- let tableEntry = document . createElement ( 'td' ) ;
230+ const tableEntry = document . createElement ( 'td' ) ;
280231
281232 const controlBar = document . getElementById ( 'GeneralAnimationControls' ) ;
282233
@@ -295,7 +246,7 @@ export default class AnimationManager extends EventListener {
295246 midLevel = document . createElement ( 'tr' ) ;
296247 bottomLevel = document . createElement ( 'td' ) ;
297248 bottomLevel . align = 'center' ;
298- let txtNode = document . createTextNode ( 'Animation Speed' ) ;
249+ const txtNode = document . createTextNode ( 'Animation Speed' ) ;
299250 midLevel . appendChild ( bottomLevel ) ;
300251 bottomLevel . classList . add ( 'txt-node' ) ;
301252 bottomLevel . appendChild ( txtNode ) ;
@@ -312,45 +263,10 @@ export default class AnimationManager extends EventListener {
312263
313264 addDivisorToAnimationBar ( animBarRef ) ;
314265
315- let width = getCookie ( 'VisualizationWidth' ) ;
316- width = width == null || width === '' ? 1500 : parseInt ( width ) ;
317-
318- let height = getCookie ( 'VisualizationHeight' ) ;
319- height = height == null || height === '' ? 555 : parseInt ( height ) ;
320-
321- canvas . width = width ;
322- canvas . height = height ;
323-
324- tableEntry = document . createElement ( 'td' ) ;
325- txtNode = document . createTextNode ( 'Canvas height:' ) ;
326- tableEntry . classList . add ( 'txt-node' ) ;
327- tableEntry . appendChild ( txtNode ) ;
328- controlBar . appendChild ( tableEntry ) ;
329-
330- this . heightEntry = addControlToAnimationBar ( animBarRef , 'Text' , canvas . height , ( ) =>
331- returnSubmit (
332- this . heightEntry ,
333- ( ) =>
334- this . changeSize (
335- document . documentElement . clientWidth ,
336- parseInt ( this . heightEntry . value ) ,
337- ) ,
338- 4 ,
339- true ,
340- ) ,
341- ) ;
342-
343- this . heightEntry . size = 4 ;
344- this . sizeButton = addControlToAnimationBar ( animBarRef , 'Button' , 'Change Canvas Size' , ( ) =>
345- this . changeSize ( ) ,
346- ) ;
347-
348266 this . addListener ( 'AnimationStarted' , this , this . animStarted ) ;
349267 this . addListener ( 'AnimationEnded' , this , this . animEnded ) ;
350268 this . addListener ( 'AnimationWaiting' , this , this . animWaiting ) ;
351269 this . addListener ( 'AnimationUndoUnavailable' , this , this . animUndoUnavailable ) ;
352- this . objectManager . width = canvas . width ;
353- this . objectManager . height = canvas . height ;
354270 }
355271
356272 lerp ( from , to , percent ) {
@@ -397,14 +313,11 @@ export default class AnimationManager extends EventListener {
397313 if ( width > 100 ) {
398314 canvas . width = width ;
399315 this . animatedObjects . width = width ;
400- setCookie ( 'VisualizationWidth' , String ( width ) , 30 ) ;
401316 }
402317 if ( height > 100 ) {
403318 canvas . height = height ;
404319 this . animatedObjects . height = height ;
405- setCookie ( 'VisualizationHeight' , String ( height ) , 30 ) ;
406320 }
407- this . heightEntry . value = canvas . height ;
408321
409322 this . animatedObjects . draw ( ) ;
410323 this . fireEvent ( 'CanvasSizeChanged' , { width : canvas . width , height : canvas . height } ) ;
0 commit comments