ui.js 17 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061
  1. /**
  2. * @author mrdoob / http://mrdoob.com/
  3. */
  4. var UI = {};
  5. UI.Element = function ( dom ) {
  6. this.dom = dom;
  7. };
  8. UI.Element.prototype = {
  9. add: function () {
  10. for ( var i = 0; i < arguments.length; i ++ ) {
  11. var argument = arguments[ i ];
  12. if ( argument instanceof UI.Element ) {
  13. this.dom.appendChild( argument.dom );
  14. } else {
  15. console.error( 'UI.Element:', argument, 'is not an instance of UI.Element.' )
  16. }
  17. }
  18. return this;
  19. },
  20. remove: function () {
  21. for ( var i = 0; i < arguments.length; i ++ ) {
  22. var argument = arguments[ i ];
  23. if ( argument instanceof UI.Element ) {
  24. this.dom.removeChild( argument.dom );
  25. } else {
  26. console.error( 'UI.Element:', argument, 'is not an instance of UI.Element.' )
  27. }
  28. }
  29. return this;
  30. },
  31. clear: function () {
  32. while ( this.dom.children.length ) {
  33. this.dom.removeChild( this.dom.lastChild );
  34. }
  35. },
  36. setId: function ( id ) {
  37. this.dom.id = id;
  38. return this;
  39. },
  40. setClass: function ( name ) {
  41. this.dom.className = name;
  42. return this;
  43. },
  44. setStyle: function ( style, array ) {
  45. for ( var i = 0; i < array.length; i ++ ) {
  46. this.dom.style[ style ] = array[ i ];
  47. }
  48. return this;
  49. },
  50. setDisabled: function ( value ) {
  51. this.dom.disabled = value;
  52. return this;
  53. },
  54. setTextContent: function ( value ) {
  55. this.dom.textContent = value;
  56. return this;
  57. }
  58. }
  59. // properties
  60. var properties = [ 'position', 'left', 'top', 'right', 'bottom', 'width', 'height', 'border', 'borderLeft',
  61. 'borderTop', 'borderRight', 'borderBottom', 'borderColor', 'display', 'overflow', 'margin', 'marginLeft', 'marginTop', 'marginRight', 'marginBottom', 'padding', 'paddingLeft', 'paddingTop', 'paddingRight', 'paddingBottom', 'color',
  62. 'backgroundColor', 'opacity', 'fontSize', 'fontWeight', 'textAlign', 'textDecoration', 'textTransform', 'cursor', 'zIndex' ];
  63. properties.forEach( function ( property ) {
  64. var method = 'set' + property.substr( 0, 1 ).toUpperCase() + property.substr( 1, property.length );
  65. UI.Element.prototype[ method ] = function () {
  66. this.setStyle( property, arguments );
  67. return this;
  68. };
  69. } );
  70. // events
  71. var events = [ 'KeyUp', 'KeyDown', 'MouseOver', 'MouseOut', 'Click', 'DblClick', 'Change' ];
  72. events.forEach( function ( event ) {
  73. var method = 'on' + event;
  74. UI.Element.prototype[ method ] = function ( callback ) {
  75. this.dom.addEventListener( event.toLowerCase(), callback.bind( this ), false );
  76. return this;
  77. };
  78. } );
  79. // Span
  80. UI.Span = function () {
  81. UI.Element.call( this );
  82. this.dom = document.createElement( 'span' );
  83. return this;
  84. };
  85. UI.Span.prototype = Object.create( UI.Element.prototype );
  86. UI.Span.prototype.constructor = UI.Span;
  87. // Panel
  88. UI.Panel = function () {
  89. UI.Element.call( this );
  90. var dom = document.createElement( 'div' );
  91. dom.className = 'Panel';
  92. this.dom = dom;
  93. return this;
  94. };
  95. UI.Panel.prototype = Object.create( UI.Element.prototype );
  96. UI.Panel.prototype.constructor = UI.Panel;
  97. // Collapsible Panel
  98. UI.CollapsiblePanel = function () {
  99. UI.Panel.call( this );
  100. this.setClass( 'Panel Collapsible' );
  101. var scope = this;
  102. this.static = new UI.Panel();
  103. this.static.setClass( 'Static' );
  104. this.static.onClick( function () {
  105. scope.toggle();
  106. } );
  107. this.dom.appendChild( this.static.dom );
  108. this.contents = new UI.Panel();
  109. this.contents.setClass( 'Content' );
  110. this.dom.appendChild( this.contents.dom );
  111. var button = new UI.Panel();
  112. button.setClass( 'Button' );
  113. this.static.add( button );
  114. this.isCollapsed = false;
  115. return this;
  116. };
  117. UI.CollapsiblePanel.prototype = Object.create( UI.Panel.prototype );
  118. UI.CollapsiblePanel.prototype.constructor = UI.CollapsiblePanel;
  119. UI.CollapsiblePanel.prototype.addStatic = function () {
  120. this.static.add.apply( this.static, arguments );
  121. return this;
  122. };
  123. UI.CollapsiblePanel.prototype.removeStatic = function () {
  124. this.static.remove.apply( this.static, arguments );
  125. return this;
  126. };
  127. UI.CollapsiblePanel.prototype.clearStatic = function () {
  128. this.static.clear();
  129. return this;
  130. };
  131. UI.CollapsiblePanel.prototype.add = function () {
  132. this.contents.add.apply( this.contents, arguments );
  133. return this;
  134. };
  135. UI.CollapsiblePanel.prototype.remove = function () {
  136. this.contents.remove.apply( this.contents, arguments );
  137. return this;
  138. };
  139. UI.CollapsiblePanel.prototype.clear = function () {
  140. this.contents.clear();
  141. return this;
  142. };
  143. UI.CollapsiblePanel.prototype.toggle = function() {
  144. this.setCollapsed( !this.isCollapsed );
  145. };
  146. UI.CollapsiblePanel.prototype.collapse = function() {
  147. this.setCollapsed( true );
  148. };
  149. UI.CollapsiblePanel.prototype.expand = function() {
  150. this.setCollapsed( false );
  151. };
  152. UI.CollapsiblePanel.prototype.setCollapsed = function( boolean ) {
  153. if ( boolean ) {
  154. this.dom.classList.add( 'collapsed' );
  155. } else {
  156. this.dom.classList.remove( 'collapsed' );
  157. }
  158. this.isCollapsed = boolean;
  159. if ( this.onCollapsedChangeCallback !== undefined ) {
  160. this.onCollapsedChangeCallback( boolean );
  161. }
  162. };
  163. UI.CollapsiblePanel.prototype.onCollapsedChange = function ( callback ) {
  164. this.onCollapsedChangeCallback = callback;
  165. };
  166. // Text
  167. UI.Text = function ( text ) {
  168. UI.Element.call( this );
  169. var dom = document.createElement( 'span' );
  170. dom.className = 'Text';
  171. dom.style.cursor = 'default';
  172. dom.style.display = 'inline-block';
  173. dom.style.verticalAlign = 'middle';
  174. this.dom = dom;
  175. this.setValue( text );
  176. return this;
  177. };
  178. UI.Text.prototype = Object.create( UI.Element.prototype );
  179. UI.Text.prototype.constructor = UI.Text;
  180. UI.Text.prototype.getValue = function () {
  181. return this.dom.textContent;
  182. };
  183. UI.Text.prototype.setValue = function ( value ) {
  184. if ( value !== undefined ) {
  185. this.dom.textContent = value;
  186. }
  187. return this;
  188. };
  189. // Input
  190. UI.Input = function ( text ) {
  191. UI.Element.call( this );
  192. var scope = this;
  193. var dom = document.createElement( 'input' );
  194. dom.className = 'Input';
  195. dom.style.padding = '2px';
  196. dom.style.border = '1px solid transparent';
  197. dom.addEventListener( 'keydown', function ( event ) {
  198. event.stopPropagation();
  199. }, false );
  200. this.dom = dom;
  201. this.setValue( text );
  202. return this;
  203. };
  204. UI.Input.prototype = Object.create( UI.Element.prototype );
  205. UI.Input.prototype.constructor = UI.Input;
  206. UI.Input.prototype.getValue = function () {
  207. return this.dom.value;
  208. };
  209. UI.Input.prototype.setValue = function ( value ) {
  210. this.dom.value = value;
  211. return this;
  212. };
  213. // TextArea
  214. UI.TextArea = function () {
  215. UI.Element.call( this );
  216. var scope = this;
  217. var dom = document.createElement( 'textarea' );
  218. dom.className = 'TextArea';
  219. dom.style.padding = '2px';
  220. dom.spellcheck = false;
  221. dom.addEventListener( 'keydown', function ( event ) {
  222. event.stopPropagation();
  223. if ( event.keyCode === 9 ) {
  224. event.preventDefault();
  225. var cursor = dom.selectionStart;
  226. dom.value = dom.value.substring( 0, cursor ) + '\t' + dom.value.substring( cursor );
  227. dom.selectionStart = cursor + 1;
  228. dom.selectionEnd = dom.selectionStart;
  229. }
  230. }, false );
  231. this.dom = dom;
  232. return this;
  233. };
  234. UI.TextArea.prototype = Object.create( UI.Element.prototype );
  235. UI.TextArea.prototype.constructor = UI.TextArea;
  236. UI.TextArea.prototype.getValue = function () {
  237. return this.dom.value;
  238. };
  239. UI.TextArea.prototype.setValue = function ( value ) {
  240. this.dom.value = value;
  241. return this;
  242. };
  243. // Select
  244. UI.Select = function () {
  245. UI.Element.call( this );
  246. var scope = this;
  247. var dom = document.createElement( 'select' );
  248. dom.className = 'Select';
  249. dom.style.padding = '2px';
  250. this.dom = dom;
  251. return this;
  252. };
  253. UI.Select.prototype = Object.create( UI.Element.prototype );
  254. UI.Select.prototype.constructor = UI.Select;
  255. UI.Select.prototype.setMultiple = function ( boolean ) {
  256. this.dom.multiple = boolean;
  257. return this;
  258. };
  259. UI.Select.prototype.setOptions = function ( options ) {
  260. var selected = this.dom.value;
  261. while ( this.dom.children.length > 0 ) {
  262. this.dom.removeChild( this.dom.firstChild );
  263. }
  264. for ( var key in options ) {
  265. var option = document.createElement( 'option' );
  266. option.value = key;
  267. option.innerHTML = options[ key ];
  268. this.dom.appendChild( option );
  269. }
  270. this.dom.value = selected;
  271. return this;
  272. };
  273. UI.Select.prototype.getValue = function () {
  274. return this.dom.value;
  275. };
  276. UI.Select.prototype.setValue = function ( value ) {
  277. value = String( value );
  278. if ( this.dom.value !== value ) {
  279. this.dom.value = value;
  280. }
  281. return this;
  282. };
  283. // Checkbox
  284. UI.Checkbox = function ( boolean ) {
  285. UI.Element.call( this );
  286. var scope = this;
  287. var dom = document.createElement( 'input' );
  288. dom.className = 'Checkbox';
  289. dom.type = 'checkbox';
  290. this.dom = dom;
  291. this.setValue( boolean );
  292. return this;
  293. };
  294. UI.Checkbox.prototype = Object.create( UI.Element.prototype );
  295. UI.Checkbox.prototype.constructor = UI.Checkbox;
  296. UI.Checkbox.prototype.getValue = function () {
  297. return this.dom.checked;
  298. };
  299. UI.Checkbox.prototype.setValue = function ( value ) {
  300. if ( value !== undefined ) {
  301. this.dom.checked = value;
  302. }
  303. return this;
  304. };
  305. // Color
  306. UI.Color = function () {
  307. UI.Element.call( this );
  308. var scope = this;
  309. var dom = document.createElement( 'input' );
  310. dom.className = 'Color';
  311. dom.style.width = '64px';
  312. dom.style.height = '16px';
  313. dom.style.border = '0px';
  314. dom.style.padding = '0px';
  315. dom.style.backgroundColor = 'transparent';
  316. try {
  317. dom.type = 'color';
  318. dom.value = '#ffffff';
  319. } catch ( exception ) {}
  320. this.dom = dom;
  321. return this;
  322. };
  323. UI.Color.prototype = Object.create( UI.Element.prototype );
  324. UI.Color.prototype.constructor = UI.Color;
  325. UI.Color.prototype.getValue = function () {
  326. return this.dom.value;
  327. };
  328. UI.Color.prototype.getHexValue = function () {
  329. return parseInt( this.dom.value.substr( 1 ), 16 );
  330. };
  331. UI.Color.prototype.setValue = function ( value ) {
  332. this.dom.value = value;
  333. return this;
  334. };
  335. UI.Color.prototype.setHexValue = function ( hex ) {
  336. this.dom.value = '#' + ( '000000' + hex.toString( 16 ) ).slice( -6 );
  337. return this;
  338. };
  339. // Number
  340. UI.Number = function ( number ) {
  341. UI.Element.call( this );
  342. var scope = this;
  343. var dom = document.createElement( 'input' );
  344. dom.className = 'Number';
  345. dom.value = '0.00';
  346. dom.addEventListener( 'keydown', function ( event ) {
  347. event.stopPropagation();
  348. if ( event.keyCode === 13 ) dom.blur();
  349. }, false );
  350. this.min = - Infinity;
  351. this.max = Infinity;
  352. this.precision = 2;
  353. this.step = 1;
  354. this.dom = dom;
  355. this.setValue( number );
  356. var changeEvent = document.createEvent( 'HTMLEvents' );
  357. changeEvent.initEvent( 'change', true, true );
  358. var distance = 0;
  359. var onMouseDownValue = 0;
  360. var pointer = [ 0, 0 ];
  361. var prevPointer = [ 0, 0 ];
  362. var onMouseDown = function ( event ) {
  363. event.preventDefault();
  364. distance = 0;
  365. onMouseDownValue = parseFloat( dom.value );
  366. prevPointer = [ event.clientX, event.clientY ];
  367. document.addEventListener( 'mousemove', onMouseMove, false );
  368. document.addEventListener( 'mouseup', onMouseUp, false );
  369. };
  370. var onMouseMove = function ( event ) {
  371. var currentValue = dom.value;
  372. pointer = [ event.clientX, event.clientY ];
  373. distance += ( pointer[ 0 ] - prevPointer[ 0 ] ) - ( pointer[ 1 ] - prevPointer[ 1 ] );
  374. var number = onMouseDownValue + ( distance / ( event.shiftKey ? 5 : 50 ) ) * scope.step;
  375. dom.value = Math.min( scope.max, Math.max( scope.min, number ) ).toFixed( scope.precision );
  376. if ( currentValue !== dom.value ) dom.dispatchEvent( changeEvent );
  377. prevPointer = [ event.clientX, event.clientY ];
  378. };
  379. var onMouseUp = function ( event ) {
  380. document.removeEventListener( 'mousemove', onMouseMove, false );
  381. document.removeEventListener( 'mouseup', onMouseUp, false );
  382. if ( Math.abs( distance ) < 2 ) {
  383. dom.focus();
  384. dom.select();
  385. }
  386. };
  387. var onChange = function ( event ) {
  388. var value = 0;
  389. try {
  390. value = eval( dom.value );
  391. } catch ( error ) {
  392. console.error( error.message );
  393. }
  394. dom.value = parseFloat( value );
  395. };
  396. var onFocus = function ( event ) {
  397. dom.style.backgroundColor = '';
  398. dom.style.borderColor = '#ccc';
  399. dom.style.cursor = '';
  400. };
  401. var onBlur = function ( event ) {
  402. dom.style.backgroundColor = 'transparent';
  403. dom.style.borderColor = 'transparent';
  404. dom.style.cursor = 'col-resize';
  405. };
  406. dom.addEventListener( 'mousedown', onMouseDown, false );
  407. dom.addEventListener( 'change', onChange, false );
  408. dom.addEventListener( 'focus', onFocus, false );
  409. dom.addEventListener( 'blur', onBlur, false );
  410. return this;
  411. };
  412. UI.Number.prototype = Object.create( UI.Element.prototype );
  413. UI.Number.prototype.constructor = UI.Number;
  414. UI.Number.prototype.getValue = function () {
  415. return parseFloat( this.dom.value );
  416. };
  417. UI.Number.prototype.setValue = function ( value ) {
  418. if ( value !== undefined ) {
  419. this.dom.value = value.toFixed( this.precision );
  420. }
  421. return this;
  422. };
  423. UI.Number.prototype.setRange = function ( min, max ) {
  424. this.min = min;
  425. this.max = max;
  426. return this;
  427. };
  428. UI.Number.prototype.setPrecision = function ( precision ) {
  429. this.precision = precision;
  430. return this;
  431. };
  432. // Integer
  433. UI.Integer = function ( number ) {
  434. UI.Element.call( this );
  435. var scope = this;
  436. var dom = document.createElement( 'input' );
  437. dom.className = 'Number';
  438. dom.value = '0.00';
  439. dom.addEventListener( 'keydown', function ( event ) {
  440. event.stopPropagation();
  441. }, false );
  442. this.min = - Infinity;
  443. this.max = Infinity;
  444. this.step = 1;
  445. this.dom = dom;
  446. this.setValue( number );
  447. var changeEvent = document.createEvent( 'HTMLEvents' );
  448. changeEvent.initEvent( 'change', true, true );
  449. var distance = 0;
  450. var onMouseDownValue = 0;
  451. var pointer = [ 0, 0 ];
  452. var prevPointer = [ 0, 0 ];
  453. var onMouseDown = function ( event ) {
  454. event.preventDefault();
  455. distance = 0;
  456. onMouseDownValue = parseFloat( dom.value );
  457. prevPointer = [ event.clientX, event.clientY ];
  458. document.addEventListener( 'mousemove', onMouseMove, false );
  459. document.addEventListener( 'mouseup', onMouseUp, false );
  460. };
  461. var onMouseMove = function ( event ) {
  462. var currentValue = dom.value;
  463. pointer = [ event.clientX, event.clientY ];
  464. distance += ( pointer[ 0 ] - prevPointer[ 0 ] ) - ( pointer[ 1 ] - prevPointer[ 1 ] );
  465. var number = onMouseDownValue + ( distance / ( event.shiftKey ? 5 : 50 ) ) * scope.step;
  466. dom.value = Math.min( scope.max, Math.max( scope.min, number ) ) | 0;
  467. if ( currentValue !== dom.value ) dom.dispatchEvent( changeEvent );
  468. prevPointer = [ event.clientX, event.clientY ];
  469. };
  470. var onMouseUp = function ( event ) {
  471. document.removeEventListener( 'mousemove', onMouseMove, false );
  472. document.removeEventListener( 'mouseup', onMouseUp, false );
  473. if ( Math.abs( distance ) < 2 ) {
  474. dom.focus();
  475. dom.select();
  476. }
  477. };
  478. var onChange = function ( event ) {
  479. var value = 0;
  480. try {
  481. value = eval( dom.value );
  482. } catch ( error ) {
  483. console.error( error.message );
  484. }
  485. dom.value = parseInt( value );
  486. };
  487. var onFocus = function ( event ) {
  488. dom.style.backgroundColor = '';
  489. dom.style.borderColor = '#ccc';
  490. dom.style.cursor = '';
  491. };
  492. var onBlur = function ( event ) {
  493. dom.style.backgroundColor = 'transparent';
  494. dom.style.borderColor = 'transparent';
  495. dom.style.cursor = 'col-resize';
  496. };
  497. dom.addEventListener( 'mousedown', onMouseDown, false );
  498. dom.addEventListener( 'change', onChange, false );
  499. dom.addEventListener( 'focus', onFocus, false );
  500. dom.addEventListener( 'blur', onBlur, false );
  501. return this;
  502. };
  503. UI.Integer.prototype = Object.create( UI.Element.prototype );
  504. UI.Integer.prototype.constructor = UI.Integer;
  505. UI.Integer.prototype.getValue = function () {
  506. return parseInt( this.dom.value );
  507. };
  508. UI.Integer.prototype.setValue = function ( value ) {
  509. if ( value !== undefined ) {
  510. this.dom.value = value | 0;
  511. }
  512. return this;
  513. };
  514. UI.Integer.prototype.setRange = function ( min, max ) {
  515. this.min = min;
  516. this.max = max;
  517. return this;
  518. };
  519. // Break
  520. UI.Break = function () {
  521. UI.Element.call( this );
  522. var dom = document.createElement( 'br' );
  523. dom.className = 'Break';
  524. this.dom = dom;
  525. return this;
  526. };
  527. UI.Break.prototype = Object.create( UI.Element.prototype );
  528. UI.Break.prototype.constructor = UI.Break;
  529. // HorizontalRule
  530. UI.HorizontalRule = function () {
  531. UI.Element.call( this );
  532. var dom = document.createElement( 'hr' );
  533. dom.className = 'HorizontalRule';
  534. this.dom = dom;
  535. return this;
  536. };
  537. UI.HorizontalRule.prototype = Object.create( UI.Element.prototype );
  538. UI.HorizontalRule.prototype.constructor = UI.HorizontalRule;
  539. // Button
  540. UI.Button = function ( value ) {
  541. UI.Element.call( this );
  542. var scope = this;
  543. var dom = document.createElement( 'button' );
  544. dom.className = 'Button';
  545. this.dom = dom;
  546. this.dom.textContent = value;
  547. return this;
  548. };
  549. UI.Button.prototype = Object.create( UI.Element.prototype );
  550. UI.Button.prototype.constructor = UI.Button;
  551. UI.Button.prototype.setLabel = function ( value ) {
  552. this.dom.textContent = value;
  553. return this;
  554. };
  555. // Dialog
  556. UI.Dialog = function ( value ) {
  557. var scope = this;
  558. var dom = document.createElement( 'dialog' );
  559. if ( dom.showModal === undefined ) {
  560. // fallback
  561. dom = document.createElement( 'div' );
  562. dom.style.display = 'none';
  563. dom.showModal = function () {
  564. dom.style.position = 'absolute';
  565. dom.style.left = '100px';
  566. dom.style.top = '100px';
  567. dom.style.zIndex = 1;
  568. dom.style.display = '';
  569. };
  570. }
  571. dom.className = 'Dialog';
  572. this.dom = dom;
  573. return this;
  574. };
  575. UI.Dialog.prototype = Object.create( UI.Panel.prototype );
  576. UI.Dialog.prototype.constructor = UI.Dialog;
  577. UI.Dialog.prototype.showModal = function () {
  578. this.dom.showModal();
  579. return this;
  580. };