@@ -140,8 +140,12 @@ function getSnappingGrid(x, y, width, height) {
140140 let snappingLines = { } ;
141141
142142 const deck = resources [ "deck" ] ;
143- if ( deck . constructor . name === "HamiltonSTARDeck" ) {
144- // TODO: vantage
143+ if (
144+ deck . constructor . name === "HamiltonSTARDeck" ||
145+ deck . constructor . name === "VantageDeck"
146+ ) {
147+ const railOffset = deck . constructor . name === "VantageDeck" ? 32.5 : 100 ;
148+
145149 if ( Math . abs ( y - deck . location . y - 63 ) < SNAP_MARGIN ) {
146150 snappingLines . resourceY = deck . location . y + 63 ;
147151 }
@@ -158,9 +162,8 @@ function getSnappingGrid(x, y, width, height) {
158162 snappingLines . resourceX = deck . location . x ;
159163 }
160164
161- // Check if the resource is on a Hamilton deck rail. (100 + 22.5 * i)
162165 for ( let rail = 0 ; rail < deck . num_rails ; rail ++ ) {
163- const railX = 100 + 22.5 * rail ;
166+ const railX = railOffset + 22.5 * rail ;
164167 if ( Math . abs ( x - railX ) < SNAP_MARGIN ) {
165168 snappingLines . resourceX = railX ;
166169 }
@@ -474,6 +477,76 @@ class HamiltonSTARDeck extends Deck {
474477 }
475478}
476479
480+ class VantageDeck extends Deck {
481+ constructor ( resourceData ) {
482+ super ( resourceData , undefined ) ;
483+ const { size } = resourceData ;
484+ this . size = size ;
485+ if ( size === 1.3 ) {
486+ this . num_rails = 54 ;
487+ } else {
488+ alert ( `Unsupported Vantage Deck size: ${ size } . Only 1.3 is supported.` ) ;
489+ this . num_rails = 0 ;
490+ }
491+ this . railHeight = 497 ;
492+ }
493+
494+ drawMainShape ( ) {
495+ let mainShape = new Konva . Group ( ) ;
496+ mainShape . add (
497+ new Konva . Rect ( {
498+ y : 63 ,
499+ width : this . size_x ,
500+ height : this . railHeight ,
501+ fill : "white" ,
502+ stroke : "black" ,
503+ strokeWidth : 1 ,
504+ } )
505+ ) ;
506+
507+ mainShape . add (
508+ new Konva . Rect ( {
509+ width : this . size_x ,
510+ height : this . size_y ,
511+ stroke : "black" ,
512+ strokeWidth : 1 ,
513+ } )
514+ ) ;
515+
516+ for ( let i = 0 ; i < this . num_rails ; i ++ ) {
517+ const railX = 32.5 + i * 22.5 ;
518+ const rail = new Konva . Line ( {
519+ points : [ railX , 63 , railX , this . railHeight + 63 ] ,
520+ stroke : "black" ,
521+ strokeWidth : 1 ,
522+ } ) ;
523+ mainShape . add ( rail ) ;
524+
525+ if ( ( i + 1 ) % 5 === 0 ) {
526+ const railLabel = new Konva . Text ( {
527+ x : railX ,
528+ y : 50 ,
529+ text : i + 1 ,
530+ fontSize : 12 ,
531+ fill : "black" ,
532+ } ) ;
533+ railLabel . scaleY ( - 1 ) ;
534+ mainShape . add ( railLabel ) ;
535+ }
536+ }
537+ return mainShape ;
538+ }
539+
540+ serialize ( ) {
541+ return {
542+ ...super . serialize ( ) ,
543+ ...{
544+ size : this . size ,
545+ } ,
546+ } ;
547+ }
548+ }
549+
477550const otDeckSiteLocations = [
478551 { x : 0.0 , y : 0.0 } ,
479552 { x : 132.5 , y : 0.0 } ,
@@ -948,10 +1021,7 @@ function classForResourceType(type) {
9481021 case "Trough" :
9491022 return Trough ;
9501023 case "VantageDeck" :
951- alert (
952- "VantageDeck is not completely implemented yet: the trash and plate loader are not drawn"
953- ) ;
954- return HamiltonSTARDeck ;
1024+ return VantageDeck ;
9551025 case "LiquidHandler" :
9561026 return LiquidHandler ;
9571027 case "TubeRack" :
0 commit comments