ibom.html 191 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713271427152716271727182719272027212722272327242725272627272728272927302731273227332734273527362737273827392740274127422743274427452746274727482749275027512752275327542755275627572758275927602761276227632764276527662767276827692770277127722773277427752776277727782779278027812782278327842785278627872788278927902791279227932794279527962797279827992800280128022803280428052806280728082809281028112812281328142815281628172818281928202821282228232824282528262827282828292830283128322833283428352836283728382839284028412842284328442845284628472848284928502851285228532854285528562857285828592860286128622863286428652866286728682869287028712872287328742875287628772878287928802881288228832884288528862887288828892890289128922893289428952896289728982899290029012902290329042905290629072908290929102911291229132914291529162917291829192920292129222923292429252926292729282929293029312932293329342935293629372938293929402941294229432944294529462947294829492950295129522953295429552956295729582959296029612962296329642965296629672968296929702971297229732974297529762977297829792980298129822983298429852986298729882989299029912992299329942995299629972998299930003001300230033004300530063007300830093010301130123013301430153016301730183019302030213022302330243025302630273028302930303031303230333034303530363037303830393040304130423043304430453046304730483049305030513052305330543055305630573058305930603061306230633064306530663067306830693070307130723073307430753076307730783079308030813082308330843085308630873088308930903091309230933094309530963097309830993100310131023103310431053106310731083109311031113112311331143115311631173118311931203121312231233124312531263127312831293130313131323133313431353136313731383139314031413142314331443145314631473148314931503151315231533154315531563157315831593160316131623163316431653166316731683169317031713172317331743175317631773178317931803181318231833184318531863187318831893190319131923193319431953196319731983199320032013202320332043205320632073208320932103211321232133214321532163217321832193220322132223223322432253226322732283229323032313232323332343235323632373238323932403241324232433244324532463247324832493250325132523253325432553256325732583259326032613262326332643265326632673268326932703271327232733274327532763277327832793280328132823283328432853286328732883289329032913292329332943295329632973298329933003301330233033304330533063307330833093310331133123313331433153316331733183319332033213322332333243325332633273328332933303331333233333334333533363337333833393340334133423343334433453346334733483349335033513352335333543355335633573358335933603361336233633364336533663367336833693370337133723373337433753376337733783379338033813382338333843385338633873388338933903391339233933394339533963397339833993400340134023403340434053406340734083409341034113412341334143415341634173418341934203421342234233424342534263427342834293430343134323433343434353436343734383439344034413442344334443445344634473448344934503451345234533454345534563457345834593460346134623463346434653466346734683469347034713472347334743475347634773478347934803481348234833484348534863487348834893490349134923493349434953496349734983499350035013502350335043505350635073508350935103511351235133514351535163517351835193520352135223523352435253526352735283529353035313532353335343535353635373538353935403541354235433544354535463547354835493550355135523553355435553556355735583559356035613562356335643565356635673568356935703571357235733574357535763577357835793580358135823583358435853586358735883589359035913592359335943595359635973598359936003601360236033604360536063607360836093610361136123613361436153616361736183619362036213622362336243625362636273628362936303631363236333634363536363637363836393640364136423643364436453646364736483649365036513652365336543655365636573658365936603661366236633664366536663667366836693670367136723673367436753676367736783679368036813682368336843685368636873688368936903691369236933694369536963697369836993700370137023703370437053706370737083709371037113712371337143715371637173718371937203721372237233724372537263727372837293730373137323733373437353736373737383739374037413742374337443745374637473748374937503751375237533754375537563757375837593760376137623763376437653766376737683769377037713772377337743775377637773778377937803781378237833784378537863787378837893790379137923793379437953796379737983799380038013802380338043805380638073808380938103811381238133814381538163817381838193820382138223823382438253826382738283829383038313832383338343835383638373838383938403841384238433844384538463847384838493850385138523853385438553856385738583859386038613862386338643865386638673868386938703871387238733874387538763877387838793880388138823883388438853886388738883889389038913892389338943895389638973898389939003901390239033904390539063907390839093910391139123913391439153916391739183919392039213922392339243925392639273928392939303931393239333934393539363937393839393940394139423943394439453946394739483949395039513952395339543955395639573958395939603961396239633964396539663967396839693970397139723973397439753976397739783979398039813982398339843985398639873988398939903991399239933994399539963997399839994000400140024003400440054006400740084009401040114012401340144015401640174018401940204021402240234024402540264027402840294030403140324033403440354036403740384039404040414042404340444045404640474048404940504051405240534054405540564057405840594060406140624063406440654066406740684069407040714072407340744075407640774078407940804081408240834084408540864087408840894090409140924093409440954096409740984099410041014102410341044105410641074108410941104111411241134114411541164117411841194120412141224123412441254126412741284129413041314132413341344135413641374138413941404141414241434144414541464147414841494150415141524153415441554156415741584159416041614162416341644165416641674168416941704171417241734174417541764177417841794180418141824183418441854186418741884189419041914192419341944195419641974198419942004201420242034204420542064207420842094210421142124213421442154216421742184219422042214222422342244225422642274228422942304231423242334234423542364237423842394240424142424243424442454246424742484249425042514252425342544255425642574258425942604261426242634264426542664267426842694270427142724273427442754276427742784279428042814282428342844285428642874288428942904291429242934294429542964297429842994300430143024303430443054306430743084309431043114312431343144315431643174318431943204321432243234324432543264327432843294330433143324333433443354336433743384339434043414342434343444345434643474348434943504351435243534354435543564357435843594360436143624363436443654366436743684369437043714372437343744375437643774378437943804381438243834384438543864387438843894390439143924393439443954396439743984399440044014402440344044405440644074408440944104411441244134414441544164417441844194420442144224423442444254426442744284429443044314432443344344435443644374438443944404441444244434444444544464447444844494450445144524453445444554456445744584459446044614462446344644465446644674468446944704471447244734474447544764477447844794480448144824483448444854486448744884489449044914492449344944495449644974498449945004501450245034504450545064507450845094510451145124513451445154516451745184519452045214522452345244525452645274528452945304531453245334534453545364537453845394540454145424543454445454546454745484549455045514552455345544555455645574558455945604561456245634564456545664567456845694570457145724573457445754576457745784579458045814582458345844585458645874588458945904591459245934594459545964597459845994600460146024603460446054606460746084609461046114612461346144615461646174618461946204621462246234624462546264627462846294630463146324633463446354636463746384639464046414642464346444645464646474648464946504651465246534654465546564657465846594660466146624663466446654666466746684669
  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head>
  4. <meta charset="UTF-8">
  5. <meta name="viewport" content="width=device-width, initial-scale=1.0">
  6. <title>Interactive BOM for KiCAD</title>
  7. <style type="text/css">
  8. :root {
  9. --pcb-edge-color: black;
  10. --pad-color: #878787;
  11. --pad-hole-color: #CCCCCC;
  12. --pad-color-highlight: #D04040;
  13. --pad-color-highlight-both: #D0D040;
  14. --pad-color-highlight-marked: #44a344;
  15. --pin1-outline-color: #ffb629;
  16. --pin1-outline-color-highlight: #ffb629;
  17. --pin1-outline-color-highlight-both: #fcbb39;
  18. --pin1-outline-color-highlight-marked: #fdbe41;
  19. --silkscreen-edge-color: #aa4;
  20. --silkscreen-polygon-color: #4aa;
  21. --silkscreen-text-color: #4aa;
  22. --fabrication-edge-color: #907651;
  23. --fabrication-polygon-color: #907651;
  24. --fabrication-text-color: #a27c24;
  25. --track-color: #def5f1;
  26. --track-color-highlight: #D04040;
  27. --zone-color: #def5f1;
  28. --zone-color-highlight: #d0404080;
  29. }
  30. html,
  31. body {
  32. margin: 0px;
  33. height: 100%;
  34. font-family: Verdana, sans-serif;
  35. }
  36. .dark.topmostdiv {
  37. --pcb-edge-color: #eee;
  38. --pad-color: #808080;
  39. --pin1-outline-color: #ffa800;
  40. --pin1-outline-color-highlight: #ccff00;
  41. --track-color: #42524f;
  42. --zone-color: #42524f;
  43. background-color: #252c30;
  44. color: #eee;
  45. }
  46. button {
  47. background-color: #eee;
  48. border: 1px solid #888;
  49. color: black;
  50. height: 44px;
  51. width: 44px;
  52. text-align: center;
  53. text-decoration: none;
  54. display: inline-block;
  55. font-size: 14px;
  56. font-weight: bolder;
  57. }
  58. .dark button {
  59. /* This will be inverted */
  60. background-color: #c3b7b5;
  61. }
  62. button.depressed {
  63. background-color: #0a0;
  64. color: white;
  65. }
  66. .dark button.depressed {
  67. /* This will be inverted */
  68. background-color: #b3b;
  69. }
  70. button:focus {
  71. outline: 0;
  72. }
  73. button#tb-btn {
  74. background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 8.47 8.47'%3E%3Crect transform='translate(0 -288.53)' ry='1.17' y='288.8' x='.27' height='7.94' width='7.94' fill='%23f9f9f9'/%3E%3Cg transform='translate(0 -288.53)'%3E%3Crect width='7.94' height='7.94' x='.27' y='288.8' ry='1.17' fill='none' stroke='%23000' stroke-width='.4' stroke-linejoin='round'/%3E%3Cpath d='M1.32 290.12h5.82M1.32 291.45h5.82' fill='none' stroke='%23000' stroke-width='.4'/%3E%3Cpath d='M4.37 292.5v4.23M.26 292.63H8.2' fill='none' stroke='%23000' stroke-width='.3'/%3E%3Ctext font-weight='700' font-size='3.17' font-family='sans-serif'%3E%3Ctspan x='1.35' y='295.73'%3EF%3C/tspan%3E%3Ctspan x='5.03' y='295.68'%3EB%3C/tspan%3E%3C/text%3E%3C/g%3E%3C/svg%3E%0A");
  75. }
  76. button#lr-btn {
  77. background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 8.47 8.47'%3E%3Crect transform='translate(0 -288.53)' ry='1.17' y='288.8' x='.27' height='7.94' width='7.94' fill='%23f9f9f9'/%3E%3Cg transform='translate(0 -288.53)'%3E%3Crect width='7.94' height='7.94' x='.27' y='288.8' ry='1.17' fill='none' stroke='%23000' stroke-width='.4' stroke-linejoin='round'/%3E%3Cpath d='M1.06 290.12H3.7m-2.64 1.33H3.7m-2.64 1.32H3.7m-2.64 1.3H3.7m-2.64 1.33H3.7' fill='none' stroke='%23000' stroke-width='.4'/%3E%3Cpath d='M4.37 288.8v7.94m0-4.11h3.96' fill='none' stroke='%23000' stroke-width='.3'/%3E%3Ctext font-weight='700' font-size='3.17' font-family='sans-serif'%3E%3Ctspan x='5.11' y='291.96'%3EF%3C/tspan%3E%3Ctspan x='5.03' y='295.68'%3EB%3C/tspan%3E%3C/text%3E%3C/g%3E%3C/svg%3E%0A");
  78. }
  79. button#bom-btn {
  80. background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 8.47 8.47'%3E%3Crect transform='translate(0 -288.53)' ry='1.17' y='288.8' x='.27' height='7.94' width='7.94' fill='%23f9f9f9'/%3E%3Cg transform='translate(0 -288.53)' fill='none' stroke='%23000' stroke-width='.4'%3E%3Crect width='7.94' height='7.94' x='.27' y='288.8' ry='1.17' stroke-linejoin='round'/%3E%3Cpath d='M1.59 290.12h5.29M1.59 291.45h5.33M1.59 292.75h5.33M1.59 294.09h5.33M1.59 295.41h5.33'/%3E%3C/g%3E%3C/svg%3E");
  81. }
  82. button#bom-grouped-btn {
  83. background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='32' height='32'%3E%3Cg stroke='%23000' stroke-linejoin='round' class='layer'%3E%3Crect width='29' height='29' x='1.5' y='1.5' stroke-width='2' fill='%23fff' rx='5' ry='5'/%3E%3Cpath stroke-linecap='square' stroke-width='2' d='M6 10h4m4 0h5m4 0h3M6.1 22h3m3.9 0h5m4 0h4m-16-8h4m4 0h4'/%3E%3Cpath stroke-linecap='null' d='M5 17.5h22M5 26.6h22M5 5.5h22'/%3E%3C/g%3E%3C/svg%3E");
  84. }
  85. button#bom-ungrouped-btn {
  86. background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='32' height='32'%3E%3Cg stroke='%23000' stroke-linejoin='round' class='layer'%3E%3Crect width='29' height='29' x='1.5' y='1.5' stroke-width='2' fill='%23fff' rx='5' ry='5'/%3E%3Cpath stroke-linecap='square' stroke-width='2' d='M6 10h4m-4 8h3m-3 8h4'/%3E%3Cpath stroke-linecap='null' d='M5 13.5h22m-22 8h22M5 5.5h22'/%3E%3C/g%3E%3C/svg%3E");
  87. }
  88. button#bom-netlist-btn {
  89. background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='32' height='32'%3E%3Cg fill='none' stroke='%23000' class='layer'%3E%3Crect width='29' height='29' x='1.5' y='1.5' stroke-width='2' fill='%23fff' rx='5' ry='5'/%3E%3Cpath stroke-width='2' d='M6 26l6-6v-8m13.8-6.3l-6 6v8'/%3E%3Ccircle cx='11.8' cy='9.5' r='2.8' stroke-width='2'/%3E%3Ccircle cx='19.8' cy='22.8' r='2.8' stroke-width='2'/%3E%3C/g%3E%3C/svg%3E");
  90. }
  91. button#copy {
  92. background-image: url("data:image/svg+xml,%3Csvg height='48' viewBox='0 0 48 48' width='48' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M0 0h48v48h-48z' fill='none'/%3E%3Cpath d='M32 2h-24c-2.21 0-4 1.79-4 4v28h4v-28h24v-4zm6 8h-22c-2.21 0-4 1.79-4 4v28c0 2.21 1.79 4 4 4h22c2.21 0 4-1.79 4-4v-28c0-2.21-1.79-4-4-4zm0 32h-22v-28h22v28z'/%3E%3C/svg%3E");
  93. background-position: 6px 6px;
  94. background-repeat: no-repeat;
  95. background-size: 26px 26px;
  96. border-radius: 6px;
  97. height: 40px;
  98. width: 40px;
  99. margin: 10px 5px;
  100. }
  101. button#copy:active {
  102. box-shadow: inset 0px 0px 5px #6c6c6c;
  103. }
  104. textarea.clipboard-temp {
  105. position: fixed;
  106. top: 0;
  107. left: 0;
  108. width: 2em;
  109. height: 2em;
  110. padding: 0;
  111. border: None;
  112. outline: None;
  113. box-shadow: None;
  114. background: transparent;
  115. }
  116. .left-most-button {
  117. border-right: 0;
  118. border-top-left-radius: 6px;
  119. border-bottom-left-radius: 6px;
  120. }
  121. .middle-button {
  122. border-right: 0;
  123. }
  124. .right-most-button {
  125. border-top-right-radius: 6px;
  126. border-bottom-right-radius: 6px;
  127. }
  128. .button-container {
  129. font-size: 0;
  130. margin: 0.4rem 0.4rem 0.4rem 0;
  131. }
  132. .dark .button-container {
  133. filter: invert(1);
  134. }
  135. .button-container button {
  136. background-size: 32px 32px;
  137. background-position: 5px 5px;
  138. background-repeat: no-repeat;
  139. }
  140. @media print {
  141. .hideonprint {
  142. display: none;
  143. }
  144. }
  145. canvas {
  146. cursor: crosshair;
  147. }
  148. canvas:active {
  149. cursor: grabbing;
  150. }
  151. .fileinfo {
  152. width: 100%;
  153. max-width: 1000px;
  154. border: none;
  155. padding: 3px;
  156. }
  157. .fileinfo .title {
  158. font-size: 20pt;
  159. font-weight: bold;
  160. }
  161. .fileinfo td {
  162. overflow: hidden;
  163. white-space: nowrap;
  164. max-width: 1px;
  165. width: 50%;
  166. text-overflow: ellipsis;
  167. }
  168. .bom {
  169. border-collapse: collapse;
  170. font-family: Consolas, "DejaVu Sans Mono", Monaco, monospace;
  171. font-size: 10pt;
  172. table-layout: fixed;
  173. width: 100%;
  174. margin-top: 1px;
  175. position: relative;
  176. }
  177. .bom th,
  178. .bom td {
  179. border: 1px solid black;
  180. padding: 5px;
  181. word-wrap: break-word;
  182. text-align: center;
  183. position: relative;
  184. }
  185. .dark .bom th,
  186. .dark .bom td {
  187. border: 1px solid #777;
  188. }
  189. .bom th {
  190. background-color: #CCCCCC;
  191. background-clip: padding-box;
  192. }
  193. .dark .bom th {
  194. background-color: #3b4749;
  195. }
  196. .bom tr.highlighted:nth-child(n) {
  197. background-color: #cfc;
  198. }
  199. .dark .bom tr.highlighted:nth-child(n) {
  200. background-color: #226022;
  201. }
  202. .bom tr:nth-child(even) {
  203. background-color: #f2f2f2;
  204. }
  205. .dark .bom tr:nth-child(even) {
  206. background-color: #313b40;
  207. }
  208. .bom tr.checked {
  209. color: #1cb53d;
  210. }
  211. .dark .bom tr.checked {
  212. color: #2cce54;
  213. }
  214. .bom tr {
  215. transition: background-color 0.2s;
  216. }
  217. .bom .numCol {
  218. width: 30px;
  219. }
  220. .bom .value {
  221. width: 15%;
  222. }
  223. .bom .quantity {
  224. width: 65px;
  225. }
  226. .bom th .sortmark {
  227. position: absolute;
  228. right: 1px;
  229. top: 1px;
  230. margin-top: -5px;
  231. border-width: 5px;
  232. border-style: solid;
  233. border-color: transparent transparent #221 transparent;
  234. transform-origin: 50% 85%;
  235. transition: opacity 0.2s, transform 0.4s;
  236. }
  237. .dark .bom th .sortmark {
  238. filter: invert(1);
  239. }
  240. .bom th .sortmark.none {
  241. opacity: 0;
  242. }
  243. .bom th .sortmark.desc {
  244. transform: rotate(180deg);
  245. }
  246. .bom th:hover .sortmark.none {
  247. opacity: 0.5;
  248. }
  249. .bom .bom-checkbox {
  250. width: 30px;
  251. position: relative;
  252. user-select: none;
  253. -moz-user-select: none;
  254. }
  255. .bom .bom-checkbox:before {
  256. content: "";
  257. position: absolute;
  258. border-width: 15px;
  259. border-style: solid;
  260. border-color: #51829f transparent transparent transparent;
  261. visibility: hidden;
  262. top: -15px;
  263. }
  264. .bom .bom-checkbox:after {
  265. content: "Double click to set/unset all";
  266. position: absolute;
  267. color: white;
  268. top: -35px;
  269. left: -26px;
  270. background: #51829f;
  271. padding: 5px 15px;
  272. border-radius: 8px;
  273. white-space: nowrap;
  274. visibility: hidden;
  275. }
  276. .bom .bom-checkbox:hover:before,
  277. .bom .bom-checkbox:hover:after {
  278. visibility: visible;
  279. transition: visibility 0.2s linear 1s;
  280. }
  281. .split {
  282. -webkit-box-sizing: border-box;
  283. -moz-box-sizing: border-box;
  284. box-sizing: border-box;
  285. overflow-y: auto;
  286. overflow-x: hidden;
  287. background-color: inherit;
  288. }
  289. .split.split-horizontal,
  290. .gutter.gutter-horizontal {
  291. height: 100%;
  292. float: left;
  293. }
  294. .gutter {
  295. background-color: #ddd;
  296. background-repeat: no-repeat;
  297. background-position: 50%;
  298. transition: background-color 0.3s;
  299. }
  300. .dark .gutter {
  301. background-color: #777;
  302. }
  303. .gutter.gutter-horizontal {
  304. background-image: url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAUAAAAeCAYAAADkftS9AAAAIklEQVQoU2M4c+bMfxAGAgYYmwGrIIiDjrELjpo5aiZeMwF+yNnOs5KSvgAAAABJRU5ErkJggg==');
  305. cursor: ew-resize;
  306. width: 5px;
  307. }
  308. .gutter.gutter-vertical {
  309. background-image: url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAB4AAAAFAQMAAABo7865AAAABlBMVEVHcEzMzMzyAv2sAAAAAXRSTlMAQObYZgAAABBJREFUeF5jOAMEEAIEEFwAn3kMwcB6I2AAAAAASUVORK5CYII=');
  310. cursor: ns-resize;
  311. height: 5px;
  312. }
  313. .searchbox {
  314. float: left;
  315. height: 40px;
  316. margin: 10px 5px;
  317. padding: 12px 32px;
  318. font-family: Consolas, "DejaVu Sans Mono", Monaco, monospace;
  319. font-size: 18px;
  320. box-sizing: border-box;
  321. border: 1px solid #888;
  322. border-radius: 6px;
  323. outline: none;
  324. background-color: #eee;
  325. transition: background-color 0.2s, border 0.2s;
  326. background-image: url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAABNklEQVQ4T8XSMUvDQBQH8P/LElFa/AIZHcTBQSz0I/gFstTBRR2KUC4ldDxw7h0Bl3RRUATxi4iiODgoiLNrbQYp5J6cpJJqomkX33Z37/14d/dIa33MzDuYI4johOI4XhyNRteO46zNYjDzAxE1yBZprVeZ+QbAUhXEGJMA2Ox2u4+fQIa0mPmsCgCgJYQ4t7lfgF0opQYAdv9ABkKI/UnOFCClXKjX61cA1osQY8x9kiRNKeV7IWA3oyhaSdP0FkAtjxhj3hzH2RBCPOf3pzqYHCilfAAX+URm9oMguPzeWSGQvUcMYC8rOBJCHBRdqxTo9/vbRHRqi8bj8XKv1xvODbiuW2u32/bvf0SlDv4XYOY7z/Mavu+nM1+BmQ+NMc0wDF/LprP0DbTWW0T00ul0nn4b7Q87+X4Qmfiq2wAAAABJRU5ErkJggg==');
  327. background-position: 10px 10px;
  328. background-repeat: no-repeat;
  329. }
  330. .dark .searchbox {
  331. background-color: #111;
  332. color: #eee;
  333. }
  334. .searchbox::placeholder {
  335. color: #ccc;
  336. }
  337. .dark .searchbox::placeholder {
  338. color: #666;
  339. }
  340. .filter {
  341. width: calc(60% - 64px);
  342. }
  343. .reflookup {
  344. width: calc(40% - 10px);
  345. }
  346. input[type=text]:focus {
  347. background-color: white;
  348. border: 1px solid #333;
  349. }
  350. .dark input[type=text]:focus {
  351. background-color: #333;
  352. border: 1px solid #ccc;
  353. }
  354. mark.highlight {
  355. background-color: #5050ff;
  356. color: #fff;
  357. padding: 2px;
  358. border-radius: 6px;
  359. }
  360. .dark mark.highlight {
  361. background-color: #76a6da;
  362. color: #111;
  363. }
  364. .menubtn {
  365. background-color: white;
  366. border: none;
  367. background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='36' height='36' viewBox='0 0 20 20'%3E%3Cpath fill='none' d='M0 0h20v20H0V0z'/%3E%3Cpath d='M15.95 10.78c.03-.25.05-.51.05-.78s-.02-.53-.06-.78l1.69-1.32c.15-.12.19-.34.1-.51l-1.6-2.77c-.1-.18-.31-.24-.49-.18l-1.99.8c-.42-.32-.86-.58-1.35-.78L12 2.34c-.03-.2-.2-.34-.4-.34H8.4c-.2 0-.36.14-.39.34l-.3 2.12c-.49.2-.94.47-1.35.78l-1.99-.8c-.18-.07-.39 0-.49.18l-1.6 2.77c-.1.18-.06.39.1.51l1.69 1.32c-.04.25-.07.52-.07.78s.02.53.06.78L2.37 12.1c-.15.12-.19.34-.1.51l1.6 2.77c.1.18.31.24.49.18l1.99-.8c.42.32.86.58 1.35.78l.3 2.12c.04.2.2.34.4.34h3.2c.2 0 .37-.14.39-.34l.3-2.12c.49-.2.94-.47 1.35-.78l1.99.8c.18.07.39 0 .49-.18l1.6-2.77c.1-.18.06-.39-.1-.51l-1.67-1.32zM10 13c-1.65 0-3-1.35-3-3s1.35-3 3-3 3 1.35 3 3-1.35 3-3 3z'/%3E%3C/svg%3E%0A");
  368. background-position: center;
  369. background-repeat: no-repeat;
  370. }
  371. .statsbtn {
  372. background-color: white;
  373. border: none;
  374. background-image: url("data:image/svg+xml,%3Csvg width='36' height='36' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M4 6h28v24H4V6zm0 8h28v8H4m9-16v24h10V5.8' fill='none' stroke='%23000' stroke-width='2'/%3E%3C/svg%3E");
  375. background-position: center;
  376. background-repeat: no-repeat;
  377. }
  378. .iobtn {
  379. background-color: white;
  380. border: none;
  381. background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='36' height='36'%3E%3Cpath fill='none' stroke='%23000' stroke-width='2' d='M3 33v-7l6.8-7h16.5l6.7 7v7H3zM3.2 26H33M21 9l5-5.9 5 6h-2.5V15h-5V9H21zm-4.9 0l-5 6-5-6h2.5V3h5v6h2.5z'/%3E%3Cpath fill='none' stroke='%23000' d='M6.1 29.5H10'/%3E%3C/svg%3E");
  382. background-position: center;
  383. background-repeat: no-repeat;
  384. }
  385. .visbtn {
  386. background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24'%3E%3Cpath fill='none' stroke='%23333' d='M2.5 4.5h5v15h-5zM9.5 4.5h5v15h-5zM16.5 4.5h5v15h-5z'/%3E%3C/svg%3E");
  387. background-position: center;
  388. background-repeat: no-repeat;
  389. padding: 15px;
  390. }
  391. #vismenu-content {
  392. left: 0px;
  393. font-family: Verdana, sans-serif;
  394. }
  395. .dark .statsbtn,
  396. .dark .savebtn,
  397. .dark .menubtn,
  398. .dark .iobtn,
  399. .dark .visbtn {
  400. filter: invert(1);
  401. }
  402. .flexbox {
  403. display: flex;
  404. align-items: center;
  405. justify-content: space-between;
  406. width: 100%;
  407. }
  408. .savebtn {
  409. background-color: #d6d6d6;
  410. width: auto;
  411. height: 30px;
  412. flex-grow: 1;
  413. margin: 5px;
  414. border-radius: 4px;
  415. }
  416. .savebtn:active {
  417. background-color: #0a0;
  418. color: white;
  419. }
  420. .dark .savebtn:active {
  421. /* This will be inverted */
  422. background-color: #b3b;
  423. }
  424. .stats {
  425. border-collapse: collapse;
  426. font-size: 12pt;
  427. table-layout: fixed;
  428. width: 100%;
  429. min-width: 450px;
  430. }
  431. .dark .stats td {
  432. border: 1px solid #bbb;
  433. }
  434. .stats td {
  435. border: 1px solid black;
  436. padding: 5px;
  437. word-wrap: break-word;
  438. text-align: center;
  439. position: relative;
  440. }
  441. #checkbox-stats div {
  442. position: absolute;
  443. left: 0;
  444. top: 0;
  445. height: 100%;
  446. width: 100%;
  447. display: flex;
  448. align-items: center;
  449. justify-content: center;
  450. }
  451. #checkbox-stats .bar {
  452. background-color: rgba(28, 251, 0, 0.6);
  453. }
  454. .menu {
  455. position: relative;
  456. display: inline-block;
  457. margin: 0.4rem 0.4rem 0.4rem 0;
  458. }
  459. .menu-content {
  460. font-size: 12pt !important;
  461. text-align: left !important;
  462. font-weight: normal !important;
  463. display: none;
  464. position: absolute;
  465. background-color: white;
  466. right: 0;
  467. min-width: 300px;
  468. box-shadow: 0px 8px 16px 0px rgba(0, 0, 0, 0.2);
  469. z-index: 100;
  470. padding: 8px;
  471. }
  472. .dark .menu-content {
  473. background-color: #111;
  474. }
  475. .menu:hover .menu-content {
  476. display: block;
  477. }
  478. .menu:hover .menubtn,
  479. .menu:hover .iobtn,
  480. .menu:hover .statsbtn {
  481. background-color: #eee;
  482. }
  483. .menu-label {
  484. display: inline-block;
  485. padding: 8px;
  486. border: 1px solid #ccc;
  487. border-top: 0;
  488. width: calc(100% - 18px);
  489. }
  490. .menu-label-top {
  491. border-top: 1px solid #ccc;
  492. }
  493. .menu-textbox {
  494. float: left;
  495. height: 24px;
  496. margin: 10px 5px;
  497. padding: 5px 5px;
  498. font-family: Consolas, "DejaVu Sans Mono", Monaco, monospace;
  499. font-size: 14px;
  500. box-sizing: border-box;
  501. border: 1px solid #888;
  502. border-radius: 4px;
  503. outline: none;
  504. background-color: #eee;
  505. transition: background-color 0.2s, border 0.2s;
  506. width: calc(100% - 10px);
  507. }
  508. .menu-textbox.invalid,
  509. .dark .menu-textbox.invalid {
  510. color: red;
  511. }
  512. .dark .menu-textbox {
  513. background-color: #222;
  514. color: #eee;
  515. }
  516. .radio-container {
  517. margin: 4px;
  518. }
  519. .topmostdiv {
  520. display: flex;
  521. flex-direction: column;
  522. width: 100%;
  523. background-color: white;
  524. transition: background-color 0.3s;
  525. }
  526. #top {
  527. display: flex;
  528. flex-wrap: wrap;
  529. justify-content: flex-end;
  530. align-items: center;
  531. }
  532. #topdivider {
  533. border-bottom: 2px solid black;
  534. display: flex;
  535. justify-content: center;
  536. align-items: center;
  537. }
  538. .dark #topdivider {
  539. border-bottom: 2px solid #ccc;
  540. }
  541. #topdivider>div {
  542. position: relative;
  543. }
  544. #toptoggle {
  545. cursor: pointer;
  546. user-select: none;
  547. position: absolute;
  548. padding: 0.1rem 0.3rem;
  549. top: -0.4rem;
  550. left: -1rem;
  551. font-size: 1.4rem;
  552. line-height: 60%;
  553. border: 1px solid black;
  554. border-radius: 1rem;
  555. background-color: #fff;
  556. z-index: 100;
  557. }
  558. .flipped {
  559. transform: rotate(0.5turn);
  560. }
  561. .dark #toptoggle {
  562. border: 1px solid #fff;
  563. background-color: #222;
  564. }
  565. #fileinfodiv {
  566. flex: 20rem 1 0;
  567. overflow: auto;
  568. }
  569. #bomcontrols {
  570. display: flex;
  571. flex-direction: row-reverse;
  572. }
  573. #bomcontrols>* {
  574. flex-shrink: 0;
  575. }
  576. #dbg {
  577. display: block;
  578. }
  579. ::-webkit-scrollbar {
  580. width: 8px;
  581. }
  582. ::-webkit-scrollbar-track {
  583. background: #aaa;
  584. }
  585. ::-webkit-scrollbar-thumb {
  586. background: #666;
  587. border-radius: 3px;
  588. }
  589. ::-webkit-scrollbar-thumb:hover {
  590. background: #555;
  591. }
  592. .slider {
  593. -webkit-appearance: none;
  594. width: 100%;
  595. margin: 3px 0;
  596. padding: 0;
  597. outline: none;
  598. opacity: 0.7;
  599. -webkit-transition: .2s;
  600. transition: opacity .2s;
  601. border-radius: 3px;
  602. }
  603. .slider:hover {
  604. opacity: 1;
  605. }
  606. .slider:focus {
  607. outline: none;
  608. }
  609. .slider::-webkit-slider-runnable-track {
  610. -webkit-appearance: none;
  611. width: 100%;
  612. height: 8px;
  613. background: #d3d3d3;
  614. border-radius: 3px;
  615. border: none;
  616. }
  617. .slider::-webkit-slider-thumb {
  618. -webkit-appearance: none;
  619. width: 15px;
  620. height: 15px;
  621. border-radius: 50%;
  622. background: #0a0;
  623. cursor: pointer;
  624. margin-top: -4px;
  625. }
  626. .dark .slider::-webkit-slider-thumb {
  627. background: #3d3;
  628. }
  629. .slider::-moz-range-thumb {
  630. width: 15px;
  631. height: 15px;
  632. border-radius: 50%;
  633. background: #0a0;
  634. cursor: pointer;
  635. }
  636. .slider::-moz-range-track {
  637. height: 8px;
  638. background: #d3d3d3;
  639. border-radius: 3px;
  640. }
  641. .dark .slider::-moz-range-thumb {
  642. background: #3d3;
  643. }
  644. .slider::-ms-track {
  645. width: 100%;
  646. height: 8px;
  647. border-width: 3px 0;
  648. background: transparent;
  649. border-color: transparent;
  650. color: transparent;
  651. transition: opacity .2s;
  652. }
  653. .slider::-ms-fill-lower {
  654. background: #d3d3d3;
  655. border: none;
  656. border-radius: 3px;
  657. }
  658. .slider::-ms-fill-upper {
  659. background: #d3d3d3;
  660. border: none;
  661. border-radius: 3px;
  662. }
  663. .slider::-ms-thumb {
  664. width: 15px;
  665. height: 15px;
  666. border-radius: 50%;
  667. background: #0a0;
  668. cursor: pointer;
  669. margin: 0;
  670. }
  671. .shameless-plug {
  672. font-size: 0.8em;
  673. text-align: center;
  674. display: block;
  675. }
  676. a {
  677. color: #0278a4;
  678. }
  679. .dark a {
  680. color: #00b9fd;
  681. }
  682. #frontcanvas,
  683. #backcanvas {
  684. touch-action: none;
  685. }
  686. .placeholder {
  687. border: 1px dashed #9f9fda !important;
  688. background-color: #edf2f7 !important;
  689. }
  690. .dragging {
  691. z-index: 999;
  692. }
  693. .dark .dragging>table>tbody>tr {
  694. background-color: #252c30;
  695. }
  696. .dark .placeholder {
  697. filter: invert(1);
  698. }
  699. .column-spacer {
  700. top: 0;
  701. left: 0;
  702. width: calc(100% - 4px);
  703. position: absolute;
  704. cursor: pointer;
  705. user-select: none;
  706. height: 100%;
  707. }
  708. .column-width-handle {
  709. top: 0;
  710. right: 0;
  711. width: 4px;
  712. position: absolute;
  713. cursor: col-resize;
  714. user-select: none;
  715. height: 100%;
  716. }
  717. .column-width-handle:hover {
  718. background-color: #4f99bd;
  719. }
  720. .help-link {
  721. border: 1px solid #0278a4;
  722. padding-inline: 0.3rem;
  723. border-radius: 3px;
  724. cursor: pointer;
  725. }
  726. .dark .help-link {
  727. border: 1px solid #00b9fd;
  728. }
  729. .bom-color {
  730. width: 20%;
  731. }
  732. .color-column input {
  733. width: 1.6rem;
  734. height: 1rem;
  735. border: 1px solid black;
  736. cursor: pointer;
  737. padding: 0;
  738. }
  739. /* removes default styling from input color element */
  740. ::-webkit-color-swatch {
  741. border: none;
  742. }
  743. ::-webkit-color-swatch-wrapper {
  744. padding: 0;
  745. }
  746. ::-moz-color-swatch,
  747. ::-moz-focus-inner {
  748. border: none;
  749. }
  750. ::-moz-focus-inner {
  751. padding: 0;
  752. }
  753. /* #bomhead {
  754. position: sticky;
  755. top: 0px;
  756. z-index: 1;
  757. } */
  758. </style>
  759. <script type="text/javascript" >
  760. ///////////////////////////////////////////////
  761. /*
  762. Split.js - v1.3.5
  763. MIT License
  764. https://github.com/nathancahill/Split.js
  765. */
  766. !function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):e.Split=t()}(this,function(){"use strict";var e=window,t=e.document,n="addEventListener",i="removeEventListener",r="getBoundingClientRect",s=function(){return!1},o=e.attachEvent&&!e[n],a=["","-webkit-","-moz-","-o-"].filter(function(e){var n=t.createElement("div");return n.style.cssText="width:"+e+"calc(9px)",!!n.style.length}).shift()+"calc",l=function(e){return"string"==typeof e||e instanceof String?t.querySelector(e):e};return function(u,c){function z(e,t,n){var i=A(y,t,n);Object.keys(i).forEach(function(t){return e.style[t]=i[t]})}function h(e,t){var n=B(y,t);Object.keys(n).forEach(function(t){return e.style[t]=n[t]})}function f(e){var t=E[this.a],n=E[this.b],i=t.size+n.size;t.size=e/this.size*i,n.size=i-e/this.size*i,z(t.element,t.size,this.aGutterSize),z(n.element,n.size,this.bGutterSize)}function m(e){var t;this.dragging&&((t="touches"in e?e.touches[0][b]-this.start:e[b]-this.start)<=E[this.a].minSize+M+this.aGutterSize?t=E[this.a].minSize+this.aGutterSize:t>=this.size-(E[this.b].minSize+M+this.bGutterSize)&&(t=this.size-(E[this.b].minSize+this.bGutterSize)),f.call(this,t),c.onDrag&&c.onDrag())}function g(){var e=E[this.a].element,t=E[this.b].element;this.size=e[r]()[y]+t[r]()[y]+this.aGutterSize+this.bGutterSize,this.start=e[r]()[G]}function d(){var t=this,n=E[t.a].element,r=E[t.b].element;t.dragging&&c.onDragEnd&&c.onDragEnd(),t.dragging=!1,e[i]("mouseup",t.stop),e[i]("touchend",t.stop),e[i]("touchcancel",t.stop),t.parent[i]("mousemove",t.move),t.parent[i]("touchmove",t.move),delete t.stop,delete t.move,n[i]("selectstart",s),n[i]("dragstart",s),r[i]("selectstart",s),r[i]("dragstart",s),n.style.userSelect="",n.style.webkitUserSelect="",n.style.MozUserSelect="",n.style.pointerEvents="",r.style.userSelect="",r.style.webkitUserSelect="",r.style.MozUserSelect="",r.style.pointerEvents="",t.gutter.style.cursor="",t.parent.style.cursor=""}function S(t){var i=this,r=E[i.a].element,o=E[i.b].element;!i.dragging&&c.onDragStart&&c.onDragStart(),t.preventDefault(),i.dragging=!0,i.move=m.bind(i),i.stop=d.bind(i),e[n]("mouseup",i.stop),e[n]("touchend",i.stop),e[n]("touchcancel",i.stop),i.parent[n]("mousemove",i.move),i.parent[n]("touchmove",i.move),r[n]("selectstart",s),r[n]("dragstart",s),o[n]("selectstart",s),o[n]("dragstart",s),r.style.userSelect="none",r.style.webkitUserSelect="none",r.style.MozUserSelect="none",r.style.pointerEvents="none",o.style.userSelect="none",o.style.webkitUserSelect="none",o.style.MozUserSelect="none",o.style.pointerEvents="none",i.gutter.style.cursor=j,i.parent.style.cursor=j,g.call(i)}function v(e){e.forEach(function(t,n){if(n>0){var i=F[n-1],r=E[i.a],s=E[i.b];r.size=e[n-1],s.size=t,z(r.element,r.size,i.aGutterSize),z(s.element,s.size,i.bGutterSize)}})}function p(){F.forEach(function(e){e.parent.removeChild(e.gutter),E[e.a].element.style[y]="",E[e.b].element.style[y]=""})}void 0===c&&(c={});var y,b,G,E,w=l(u[0]).parentNode,D=e.getComputedStyle(w).flexDirection,U=c.sizes||u.map(function(){return 100/u.length}),k=void 0!==c.minSize?c.minSize:100,x=Array.isArray(k)?k:u.map(function(){return k}),L=void 0!==c.gutterSize?c.gutterSize:10,M=void 0!==c.snapOffset?c.snapOffset:30,O=c.direction||"horizontal",j=c.cursor||("horizontal"===O?"ew-resize":"ns-resize"),C=c.gutter||function(e,n){var i=t.createElement("div");return i.className="gutter gutter-"+n,i},A=c.elementStyle||function(e,t,n){var i={};return"string"==typeof t||t instanceof String?i[e]=t:i[e]=o?t+"%":a+"("+t+"% - "+n+"px)",i},B=c.gutterStyle||function(e,t){return n={},n[e]=t+"px",n;var n};"horizontal"===O?(y="width","clientWidth",b="clientX",G="left","paddingLeft"):"vertical"===O&&(y="height","clientHeight",b="clientY",G="top","paddingTop");var F=[];return E=u.map(function(e,t){var i,s={element:l(e),size:U[t],minSize:x[t]};if(t>0&&(i={a:t-1,b:t,dragging:!1,isFirst:1===t,isLast:t===u.length-1,direction:O,parent:w},i.aGutterSize=L,i.bGutterSize=L,i.isFirst&&(i.aGutterSize=L/2),i.isLast&&(i.bGutterSize=L/2),"row-reverse"===D||"column-reverse"===D)){var a=i.a;i.a=i.b,i.b=a}if(!o&&t>0){var c=C(t,O);h(c,L),c[n]("mousedown",S.bind(i)),c[n]("touchstart",S.bind(i)),w.insertBefore(c,s.element),i.gutter=c}0===t||t===u.length-1?z(s.element,s.size,L/2):z(s.element,s.size,L);var f=s.element[r]()[y];return f<s.minSize&&(s.minSize=f),t>0&&F.push(i),s}),o?{setSizes:v,destroy:p}:{setSizes:v,getSizes:function(){return E.map(function(e){return e.size})},collapse:function(e){if(e===F.length){var t=F[e-1];g.call(t),o||f.call(t,t.size-t.bGutterSize)}else{var n=F[e];g.call(n),o||f.call(n,n.aGutterSize)}},destroy:p}}});
  767. ///////////////////////////////////////////////
  768. ///////////////////////////////////////////////
  769. // Copyright (c) 2013 Pieroxy <pieroxy@pieroxy.net>
  770. // This work is free. You can redistribute it and/or modify it
  771. // under the terms of the WTFPL, Version 2
  772. // For more information see LICENSE.txt or http://www.wtfpl.net/
  773. //
  774. // For more information, the home page:
  775. // http://pieroxy.net/blog/pages/lz-string/testing.html
  776. //
  777. // LZ-based compression algorithm, version 1.4.4
  778. var LZString=function(){var o=String.fromCharCode,i={};var n={decompressFromBase64:function(o){return null==o?"":""==o?null:n._decompress(o.length,32,function(n){return function(o,n){if(!i[o]){i[o]={};for(var t=0;t<o.length;t++)i[o][o.charAt(t)]=t}return i[o][n]}("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",o.charAt(n))})},_decompress:function(i,n,t){var r,e,a,s,p,u,l,f=[],c=4,d=4,h=3,v="",g=[],m={val:t(0),position:n,index:1};for(r=0;r<3;r+=1)f[r]=r;for(a=0,p=Math.pow(2,2),u=1;u!=p;)s=m.val&m.position,m.position>>=1,0==m.position&&(m.position=n,m.val=t(m.index++)),a|=(s>0?1:0)*u,u<<=1;switch(a){case 0:for(a=0,p=Math.pow(2,8),u=1;u!=p;)s=m.val&m.position,m.position>>=1,0==m.position&&(m.position=n,m.val=t(m.index++)),a|=(s>0?1:0)*u,u<<=1;l=o(a);break;case 1:for(a=0,p=Math.pow(2,16),u=1;u!=p;)s=m.val&m.position,m.position>>=1,0==m.position&&(m.position=n,m.val=t(m.index++)),a|=(s>0?1:0)*u,u<<=1;l=o(a);break;case 2:return""}for(f[3]=l,e=l,g.push(l);;){if(m.index>i)return"";for(a=0,p=Math.pow(2,h),u=1;u!=p;)s=m.val&m.position,m.position>>=1,0==m.position&&(m.position=n,m.val=t(m.index++)),a|=(s>0?1:0)*u,u<<=1;switch(l=a){case 0:for(a=0,p=Math.pow(2,8),u=1;u!=p;)s=m.val&m.position,m.position>>=1,0==m.position&&(m.position=n,m.val=t(m.index++)),a|=(s>0?1:0)*u,u<<=1;f[d++]=o(a),l=d-1,c--;break;case 1:for(a=0,p=Math.pow(2,16),u=1;u!=p;)s=m.val&m.position,m.position>>=1,0==m.position&&(m.position=n,m.val=t(m.index++)),a|=(s>0?1:0)*u,u<<=1;f[d++]=o(a),l=d-1,c--;break;case 2:return g.join("")}if(0==c&&(c=Math.pow(2,h),h++),f[l])v=f[l];else{if(l!==d)return null;v=e+e.charAt(0)}g.push(v),f[d++]=e+v.charAt(0),e=v,0==--c&&(c=Math.pow(2,h),h++)}}};return n}();"function"==typeof define&&define.amd?define(function(){return LZString}):"undefined"!=typeof module&&null!=module?module.exports=LZString:"undefined"!=typeof angular&&null!=angular&&angular.module("LZString",[]).factory("LZString",function(){return LZString});
  779. ///////////////////////////////////////////////
  780. ///////////////////////////////////////////////
  781. /*!
  782. * PEP v0.4.3 | https://github.com/jquery/PEP
  783. * Copyright jQuery Foundation and other contributors | http://jquery.org/license
  784. */
  785. !function(a,b){"object"==typeof exports&&"undefined"!=typeof module?module.exports=b():"function"==typeof define&&define.amd?define(b):a.PointerEventsPolyfill=b()}(this,function(){"use strict";function a(a,b){b=b||Object.create(null);var c=document.createEvent("Event");c.initEvent(a,b.bubbles||!1,b.cancelable||!1);
  786. for(var d,e=2;e<m.length;e++)d=m[e],c[d]=b[d]||n[e];c.buttons=b.buttons||0;
  787. var f=0;return f=b.pressure&&c.buttons?b.pressure:c.buttons?.5:0,c.x=c.clientX,c.y=c.clientY,c.pointerId=b.pointerId||0,c.width=b.width||0,c.height=b.height||0,c.pressure=f,c.tiltX=b.tiltX||0,c.tiltY=b.tiltY||0,c.twist=b.twist||0,c.tangentialPressure=b.tangentialPressure||0,c.pointerType=b.pointerType||"",c.hwTimestamp=b.hwTimestamp||0,c.isPrimary=b.isPrimary||!1,c}function b(){this.array=[],this.size=0}function c(a,b,c,d){this.addCallback=a.bind(d),this.removeCallback=b.bind(d),this.changedCallback=c.bind(d),A&&(this.observer=new A(this.mutationWatcher.bind(this)))}function d(a){return"body /shadow-deep/ "+e(a)}function e(a){return'[touch-action="'+a+'"]'}function f(a){return"{ -ms-touch-action: "+a+"; touch-action: "+a+"; }"}function g(){if(F){D.forEach(function(a){String(a)===a?(E+=e(a)+f(a)+"\n",G&&(E+=d(a)+f(a)+"\n")):(E+=a.selectors.map(e)+f(a.rule)+"\n",G&&(E+=a.selectors.map(d)+f(a.rule)+"\n"))});var a=document.createElement("style");a.textContent=E,document.head.appendChild(a)}}function h(){if(!window.PointerEvent){if(window.PointerEvent=a,window.navigator.msPointerEnabled){var b=window.navigator.msMaxTouchPoints;Object.defineProperty(window.navigator,"maxTouchPoints",{value:b,enumerable:!0}),u.registerSource("ms",_)}else Object.defineProperty(window.navigator,"maxTouchPoints",{value:0,enumerable:!0}),u.registerSource("mouse",N),void 0!==window.ontouchstart&&u.registerSource("touch",V);u.register(document)}}function i(a){if(!u.pointermap.has(a)){var b=new Error("InvalidPointerId");throw b.name="InvalidPointerId",b}}function j(a){for(var b=a.parentNode;b&&b!==a.ownerDocument;)b=b.parentNode;if(!b){var c=new Error("InvalidStateError");throw c.name="InvalidStateError",c}}function k(a){var b=u.pointermap.get(a);return 0!==b.buttons}function l(){window.Element&&!Element.prototype.setPointerCapture&&Object.defineProperties(Element.prototype,{setPointerCapture:{value:W},releasePointerCapture:{value:X},hasPointerCapture:{value:Y}})}
  788. var m=["bubbles","cancelable","view","detail","screenX","screenY","clientX","clientY","ctrlKey","altKey","shiftKey","metaKey","button","relatedTarget","pageX","pageY"],n=[!1,!1,null,null,0,0,0,0,!1,!1,!1,!1,0,null,0,0],o=window.Map&&window.Map.prototype.forEach,p=o?Map:b;b.prototype={set:function(a,b){return void 0===b?this["delete"](a):(this.has(a)||this.size++,void(this.array[a]=b))},has:function(a){return void 0!==this.array[a]},"delete":function(a){this.has(a)&&(delete this.array[a],this.size--)},get:function(a){return this.array[a]},clear:function(){this.array.length=0,this.size=0},forEach:function(a,b){return this.array.forEach(function(c,d){a.call(b,c,d,this)},this)}};var q=["bubbles","cancelable","view","detail","screenX","screenY","clientX","clientY","ctrlKey","altKey","shiftKey","metaKey","button","relatedTarget","buttons","pointerId","width","height","pressure","tiltX","tiltY","pointerType","hwTimestamp","isPrimary","type","target","currentTarget","which","pageX","pageY","timeStamp"],r=[!1,!1,null,null,0,0,0,0,!1,!1,!1,!1,0,null,0,0,0,0,0,0,0,"",0,!1,"",null,null,0,0,0,0],s={pointerover:1,pointerout:1,pointerenter:1,pointerleave:1},t="undefined"!=typeof SVGElementInstance,u={pointermap:new p,eventMap:Object.create(null),captureInfo:Object.create(null),eventSources:Object.create(null),eventSourceList:[],registerSource:function(a,b){var c=b,d=c.events;d&&(d.forEach(function(a){c[a]&&(this.eventMap[a]=c[a].bind(c))},this),this.eventSources[a]=c,this.eventSourceList.push(c))},register:function(a){for(var b,c=this.eventSourceList.length,d=0;d<c&&(b=this.eventSourceList[d]);d++)
  789. b.register.call(b,a)},unregister:function(a){for(var b,c=this.eventSourceList.length,d=0;d<c&&(b=this.eventSourceList[d]);d++)
  790. b.unregister.call(b,a)},contains:function(a,b){try{return a.contains(b)}catch(c){return!1}},down:function(a){a.bubbles=!0,this.fireEvent("pointerdown",a)},move:function(a){a.bubbles=!0,this.fireEvent("pointermove",a)},up:function(a){a.bubbles=!0,this.fireEvent("pointerup",a)},enter:function(a){a.bubbles=!1,this.fireEvent("pointerenter",a)},leave:function(a){a.bubbles=!1,this.fireEvent("pointerleave",a)},over:function(a){a.bubbles=!0,this.fireEvent("pointerover",a)},out:function(a){a.bubbles=!0,this.fireEvent("pointerout",a)},cancel:function(a){a.bubbles=!0,this.fireEvent("pointercancel",a)},leaveOut:function(a){this.out(a),this.propagate(a,this.leave,!1)},enterOver:function(a){this.over(a),this.propagate(a,this.enter,!0)},eventHandler:function(a){if(!a._handledByPE){var b=a.type,c=this.eventMap&&this.eventMap[b];c&&c(a),a._handledByPE=!0}},listen:function(a,b){b.forEach(function(b){this.addEvent(a,b)},this)},unlisten:function(a,b){b.forEach(function(b){this.removeEvent(a,b)},this)},addEvent:function(a,b){a.addEventListener(b,this.boundHandler)},removeEvent:function(a,b){a.removeEventListener(b,this.boundHandler)},makeEvent:function(b,c){this.captureInfo[c.pointerId]&&(c.relatedTarget=null);var d=new a(b,c);return c.preventDefault&&(d.preventDefault=c.preventDefault),d._target=d._target||c.target,d},fireEvent:function(a,b){var c=this.makeEvent(a,b);return this.dispatchEvent(c)},cloneEvent:function(a){for(var b,c=Object.create(null),d=0;d<q.length;d++)b=q[d],c[b]=a[b]||r[d],!t||"target"!==b&&"relatedTarget"!==b||c[b]instanceof SVGElementInstance&&(c[b]=c[b].correspondingUseElement);return a.preventDefault&&(c.preventDefault=function(){a.preventDefault()}),c},getTarget:function(a){var b=this.captureInfo[a.pointerId];return b?a._target!==b&&a.type in s?void 0:b:a._target},propagate:function(a,b,c){for(var d=a.target,e=[];d!==document&&!d.contains(a.relatedTarget);) if(e.push(d),d=d.parentNode,!d)return;c&&e.reverse(),e.forEach(function(c){a.target=c,b.call(this,a)},this)},setCapture:function(b,c,d){this.captureInfo[b]&&this.releaseCapture(b,d),this.captureInfo[b]=c,this.implicitRelease=this.releaseCapture.bind(this,b,d),document.addEventListener("pointerup",this.implicitRelease),document.addEventListener("pointercancel",this.implicitRelease);var e=new a("gotpointercapture");e.pointerId=b,e._target=c,d||this.asyncDispatchEvent(e)},releaseCapture:function(b,c){var d=this.captureInfo[b];if(d){this.captureInfo[b]=void 0,document.removeEventListener("pointerup",this.implicitRelease),document.removeEventListener("pointercancel",this.implicitRelease);var e=new a("lostpointercapture");e.pointerId=b,e._target=d,c||this.asyncDispatchEvent(e)}},dispatchEvent:/*scope.external.dispatchEvent || */function(a){var b=this.getTarget(a);if(b)return b.dispatchEvent(a)},asyncDispatchEvent:function(a){requestAnimationFrame(this.dispatchEvent.bind(this,a))}};u.boundHandler=u.eventHandler.bind(u);var v={shadow:function(a){if(a)return a.shadowRoot||a.webkitShadowRoot},canTarget:function(a){return a&&Boolean(a.elementFromPoint)},targetingShadow:function(a){var b=this.shadow(a);if(this.canTarget(b))return b},olderShadow:function(a){var b=a.olderShadowRoot;if(!b){var c=a.querySelector("shadow");c&&(b=c.olderShadowRoot)}return b},allShadows:function(a){for(var b=[],c=this.shadow(a);c;)b.push(c),c=this.olderShadow(c);return b},searchRoot:function(a,b,c){if(a){var d,e,f=a.elementFromPoint(b,c);for(e=this.targetingShadow(f);e;){if(d=e.elementFromPoint(b,c)){var g=this.targetingShadow(d);return this.searchRoot(g,b,c)||d} e=this.olderShadow(e)} return f}},owner:function(a){
  791. for(var b=a;b.parentNode;)b=b.parentNode;
  792. return b.nodeType!==Node.DOCUMENT_NODE&&b.nodeType!==Node.DOCUMENT_FRAGMENT_NODE&&(b=document),b},findTarget:function(a){var b=a.clientX,c=a.clientY,d=this.owner(a.target);
  793. return d.elementFromPoint(b,c)||(d=document),this.searchRoot(d,b,c)}},w=Array.prototype.forEach.call.bind(Array.prototype.forEach),x=Array.prototype.map.call.bind(Array.prototype.map),y=Array.prototype.slice.call.bind(Array.prototype.slice),z=Array.prototype.filter.call.bind(Array.prototype.filter),A=window.MutationObserver||window.WebKitMutationObserver,B="[touch-action]",C={subtree:!0,childList:!0,attributes:!0,attributeOldValue:!0,attributeFilter:["touch-action"]};c.prototype={watchSubtree:function(a){
  794. //
  795. this.observer&&v.canTarget(a)&&this.observer.observe(a,C)},enableOnSubtree:function(a){this.watchSubtree(a),a===document&&"complete"!==document.readyState?this.installOnLoad():this.installNewSubtree(a)},installNewSubtree:function(a){w(this.findElements(a),this.addElement,this)},findElements:function(a){return a.querySelectorAll?a.querySelectorAll(B):[]},removeElement:function(a){this.removeCallback(a)},addElement:function(a){this.addCallback(a)},elementChanged:function(a,b){this.changedCallback(a,b)},concatLists:function(a,b){return a.concat(y(b))},
  796. installOnLoad:function(){document.addEventListener("readystatechange",function(){"complete"===document.readyState&&this.installNewSubtree(document)}.bind(this))},isElement:function(a){return a.nodeType===Node.ELEMENT_NODE},flattenMutationTree:function(a){
  797. var b=x(a,this.findElements,this);
  798. return b.push(z(a,this.isElement)),b.reduce(this.concatLists,[])},mutationWatcher:function(a){a.forEach(this.mutationHandler,this)},mutationHandler:function(a){if("childList"===a.type){var b=this.flattenMutationTree(a.addedNodes);b.forEach(this.addElement,this);var c=this.flattenMutationTree(a.removedNodes);c.forEach(this.removeElement,this)}else"attributes"===a.type&&this.elementChanged(a.target,a.oldValue)}};var D=["none","auto","pan-x","pan-y",{rule:"pan-x pan-y",selectors:["pan-x pan-y","pan-y pan-x"]}],E="",F=window.PointerEvent||window.MSPointerEvent,G=!window.ShadowDOMPolyfill&&document.head.createShadowRoot,H=u.pointermap,I=25,J=[1,4,2,8,16],K=!1;try{K=1===new MouseEvent("test",{buttons:1}).buttons}catch(L){}
  799. var M,N={POINTER_ID:1,POINTER_TYPE:"mouse",events:["mousedown","mousemove","mouseup","mouseover","mouseout"],register:function(a){u.listen(a,this.events)},unregister:function(a){u.unlisten(a,this.events)},lastTouches:[],
  800. isEventSimulatedFromTouch:function(a){for(var b,c=this.lastTouches,d=a.clientX,e=a.clientY,f=0,g=c.length;f<g&&(b=c[f]);f++){
  801. var h=Math.abs(d-b.x),i=Math.abs(e-b.y);if(h<=I&&i<=I)return!0}},prepareEvent:function(a){var b=u.cloneEvent(a),c=b.preventDefault;return b.preventDefault=function(){a.preventDefault(),c()},b.pointerId=this.POINTER_ID,b.isPrimary=!0,b.pointerType=this.POINTER_TYPE,b},prepareButtonsForMove:function(a,b){var c=H.get(this.POINTER_ID);
  802. 0!==b.which&&c?a.buttons=c.buttons:a.buttons=0,b.buttons=a.buttons},mousedown:function(a){if(!this.isEventSimulatedFromTouch(a)){var b=H.get(this.POINTER_ID),c=this.prepareEvent(a);K||(c.buttons=J[c.button],b&&(c.buttons|=b.buttons),a.buttons=c.buttons),H.set(this.POINTER_ID,a),b&&0!==b.buttons?u.move(c):u.down(c)}},mousemove:function(a){if(!this.isEventSimulatedFromTouch(a)){var b=this.prepareEvent(a);K||this.prepareButtonsForMove(b,a),b.button=-1,H.set(this.POINTER_ID,a),u.move(b)}},mouseup:function(a){if(!this.isEventSimulatedFromTouch(a)){var b=H.get(this.POINTER_ID),c=this.prepareEvent(a);if(!K){var d=J[c.button];
  803. c.buttons=b?b.buttons&~d:0,a.buttons=c.buttons}H.set(this.POINTER_ID,a),
  804. c.buttons&=~J[c.button],0===c.buttons?u.up(c):u.move(c)}},mouseover:function(a){if(!this.isEventSimulatedFromTouch(a)){var b=this.prepareEvent(a);K||this.prepareButtonsForMove(b,a),b.button=-1,H.set(this.POINTER_ID,a),u.enterOver(b)}},mouseout:function(a){if(!this.isEventSimulatedFromTouch(a)){var b=this.prepareEvent(a);K||this.prepareButtonsForMove(b,a),b.button=-1,u.leaveOut(b)}},cancel:function(a){var b=this.prepareEvent(a);u.cancel(b),this.deactivateMouse()},deactivateMouse:function(){H["delete"](this.POINTER_ID)}},O=u.captureInfo,P=v.findTarget.bind(v),Q=v.allShadows.bind(v),R=u.pointermap,S=2500,T=200,U="touch-action",V={events:["touchstart","touchmove","touchend","touchcancel"],register:function(a){M.enableOnSubtree(a)},unregister:function(){},elementAdded:function(a){var b=a.getAttribute(U),c=this.touchActionToScrollType(b);c&&(a._scrollType=c,u.listen(a,this.events),
  805. Q(a).forEach(function(a){a._scrollType=c,u.listen(a,this.events)},this))},elementRemoved:function(a){a._scrollType=void 0,u.unlisten(a,this.events),
  806. Q(a).forEach(function(a){a._scrollType=void 0,u.unlisten(a,this.events)},this)},elementChanged:function(a,b){var c=a.getAttribute(U),d=this.touchActionToScrollType(c),e=this.touchActionToScrollType(b);
  807. d&&e?(a._scrollType=d,Q(a).forEach(function(a){a._scrollType=d},this)):e?this.elementRemoved(a):d&&this.elementAdded(a)},scrollTypes:{EMITTER:"none",XSCROLLER:"pan-x",YSCROLLER:"pan-y",SCROLLER:/^(?:pan-x pan-y)|(?:pan-y pan-x)|auto$/},touchActionToScrollType:function(a){var b=a,c=this.scrollTypes;return"none"===b?"none":b===c.XSCROLLER?"X":b===c.YSCROLLER?"Y":c.SCROLLER.exec(b)?"XY":void 0},POINTER_TYPE:"touch",firstTouch:null,isPrimaryTouch:function(a){return this.firstTouch===a.identifier},setPrimaryTouch:function(a){
  808. (0===R.size||1===R.size&&R.has(1))&&(this.firstTouch=a.identifier,this.firstXY={X:a.clientX,Y:a.clientY},this.scrolling=!1,this.cancelResetClickCount())},removePrimaryPointer:function(a){a.isPrimary&&(this.firstTouch=null,this.firstXY=null,this.resetClickCount())},clickCount:0,resetId:null,resetClickCount:function(){var a=function(){this.clickCount=0,this.resetId=null}.bind(this);this.resetId=setTimeout(a,T)},cancelResetClickCount:function(){this.resetId&&clearTimeout(this.resetId)},typeToButtons:function(a){var b=0;return"touchstart"!==a&&"touchmove"!==a||(b=1),b},touchToPointer:function(a){var b=this.currentTouchEvent,c=u.cloneEvent(a),d=c.pointerId=a.identifier+2;c.target=O[d]||P(c),c.bubbles=!0,c.cancelable=!0,c.detail=this.clickCount,c.button=0,c.buttons=this.typeToButtons(b.type),c.width=2*(a.radiusX||a.webkitRadiusX||0),c.height=2*(a.radiusY||a.webkitRadiusY||0),c.pressure=a.force||a.webkitForce||.5,c.isPrimary=this.isPrimaryTouch(a),c.pointerType=this.POINTER_TYPE,
  809. c.altKey=b.altKey,c.ctrlKey=b.ctrlKey,c.metaKey=b.metaKey,c.shiftKey=b.shiftKey;
  810. var e=this;return c.preventDefault=function(){e.scrolling=!1,e.firstXY=null,b.preventDefault()},c},processTouches:function(a,b){var c=a.changedTouches;this.currentTouchEvent=a;for(var d,e=0;e<c.length;e++)d=c[e],b.call(this,this.touchToPointer(d))},
  811. shouldScroll:function(a){if(this.firstXY){var b,c=a.currentTarget._scrollType;if("none"===c)
  812. b=!1;else if("XY"===c)
  813. b=!0;else{var d=a.changedTouches[0],e=c,f="Y"===c?"X":"Y",g=Math.abs(d["client"+e]-this.firstXY[e]),h=Math.abs(d["client"+f]-this.firstXY[f]);
  814. b=g>=h}return this.firstXY=null,b}},findTouch:function(a,b){for(var c,d=0,e=a.length;d<e&&(c=a[d]);d++)if(c.identifier===b)return!0},
  815. vacuumTouches:function(a){var b=a.touches;
  816. if(R.size>=b.length){var c=[];R.forEach(function(a,d){
  817. if(1!==d&&!this.findTouch(b,d-2)){var e=a.out;c.push(e)}},this),c.forEach(this.cancelOut,this)}},touchstart:function(a){this.vacuumTouches(a),this.setPrimaryTouch(a.changedTouches[0]),this.dedupSynthMouse(a),this.scrolling||(this.clickCount++,this.processTouches(a,this.overDown))},overDown:function(a){R.set(a.pointerId,{target:a.target,out:a,outTarget:a.target}),u.enterOver(a),u.down(a)},touchmove:function(a){this.scrolling||(this.shouldScroll(a)?(this.scrolling=!0,this.touchcancel(a)):(a.preventDefault(),this.processTouches(a,this.moveOverOut)))},moveOverOut:function(a){var b=a,c=R.get(b.pointerId);
  818. if(c){var d=c.out,e=c.outTarget;u.move(b),d&&e!==b.target&&(d.relatedTarget=b.target,b.relatedTarget=e,
  819. d.target=e,b.target?(u.leaveOut(d),u.enterOver(b)):(
  820. b.target=e,b.relatedTarget=null,this.cancelOut(b))),c.out=b,c.outTarget=b.target}},touchend:function(a){this.dedupSynthMouse(a),this.processTouches(a,this.upOut)},upOut:function(a){this.scrolling||(u.up(a),u.leaveOut(a)),this.cleanUpPointer(a)},touchcancel:function(a){this.processTouches(a,this.cancelOut)},cancelOut:function(a){u.cancel(a),u.leaveOut(a),this.cleanUpPointer(a)},cleanUpPointer:function(a){R["delete"](a.pointerId),this.removePrimaryPointer(a)},
  821. dedupSynthMouse:function(a){var b=N.lastTouches,c=a.changedTouches[0];
  822. if(this.isPrimaryTouch(c)){
  823. var d={x:c.clientX,y:c.clientY};b.push(d);var e=function(a,b){var c=a.indexOf(b);c>-1&&a.splice(c,1)}.bind(null,b,d);setTimeout(e,S)}}};M=new c(V.elementAdded,V.elementRemoved,V.elementChanged,V);var W,X,Y,Z=u.pointermap,$=window.MSPointerEvent&&"number"==typeof window.MSPointerEvent.MSPOINTER_TYPE_MOUSE,_={events:["MSPointerDown","MSPointerMove","MSPointerUp","MSPointerOut","MSPointerOver","MSPointerCancel","MSGotPointerCapture","MSLostPointerCapture"],register:function(a){u.listen(a,this.events)},unregister:function(a){u.unlisten(a,this.events)},POINTER_TYPES:["","unavailable","touch","pen","mouse"],prepareEvent:function(a){var b=a;return $&&(b=u.cloneEvent(a),b.pointerType=this.POINTER_TYPES[a.pointerType]),b},cleanup:function(a){Z["delete"](a)},MSPointerDown:function(a){Z.set(a.pointerId,a);var b=this.prepareEvent(a);u.down(b)},MSPointerMove:function(a){var b=this.prepareEvent(a);u.move(b)},MSPointerUp:function(a){var b=this.prepareEvent(a);u.up(b),this.cleanup(a.pointerId)},MSPointerOut:function(a){var b=this.prepareEvent(a);u.leaveOut(b)},MSPointerOver:function(a){var b=this.prepareEvent(a);u.enterOver(b)},MSPointerCancel:function(a){var b=this.prepareEvent(a);u.cancel(b),this.cleanup(a.pointerId)},MSLostPointerCapture:function(a){var b=u.makeEvent("lostpointercapture",a);u.dispatchEvent(b)},MSGotPointerCapture:function(a){var b=u.makeEvent("gotpointercapture",a);u.dispatchEvent(b)}},aa=window.navigator;aa.msPointerEnabled?(W=function(a){i(a),j(this),k(a)&&(u.setCapture(a,this,!0),this.msSetPointerCapture(a))},X=function(a){i(a),u.releaseCapture(a,!0),this.msReleasePointerCapture(a)}):(W=function(a){i(a),j(this),k(a)&&u.setCapture(a,this)},X=function(a){i(a),u.releaseCapture(a)}),Y=function(a){return!!u.captureInfo[a]},g(),h(),l();var ba={dispatcher:u,Installer:c,PointerEvent:a,PointerMap:p,targetFinding:v};return ba});
  824. ///////////////////////////////////////////////
  825. ///////////////////////////////////////////////
  826. var config = {"dark_mode": false, "show_pads": true, "show_fabrication": false, "show_silkscreen": true, "highlight_pin1": "none", "redraw_on_drag": true, "board_rotation": 0, "checkboxes": "Sourced,Placed", "bom_view": "left-right", "layer_view": "FB", "offset_back_rotation": false, "kicad_text_formatting": true, "fields": ["Value", "Footprint"]}
  827. ///////////////////////////////////////////////
  828. ///////////////////////////////////////////////
  829. var pcbdata = JSON.parse(LZString.decompressFromBase64("N4IgpgJg5mDOD6AjRB7AHiAXAAlAWwEsA7DHAJgE4A6CgGmxEKIE8tsBmauhvAQzVLYAjAAYAbFSH1G/VjiEAWIZIC+0yDFhsA2qAAuzAA5g2IWGCh4wR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////////////////////////////////////
  831. ///////////////////////////////////////////////
  832. /* Utility functions */
  833. var storagePrefix = 'KiCad_HTML_BOM__' + pcbdata.metadata.title + '__' +
  834. pcbdata.metadata.revision + '__#';
  835. var storage;
  836. function initStorage(key) {
  837. try {
  838. window.localStorage.getItem("blank");
  839. storage = window.localStorage;
  840. } catch (e) {
  841. // localStorage not available
  842. }
  843. if (!storage) {
  844. try {
  845. window.sessionStorage.getItem("blank");
  846. storage = window.sessionStorage;
  847. } catch (e) {
  848. // sessionStorage also not available
  849. }
  850. }
  851. }
  852. function readStorage(key) {
  853. if (storage) {
  854. return storage.getItem(storagePrefix + key);
  855. } else {
  856. return null;
  857. }
  858. }
  859. function writeStorage(key, value) {
  860. if (storage) {
  861. storage.setItem(storagePrefix + key, value);
  862. }
  863. }
  864. function fancyDblClickHandler(el, onsingle, ondouble) {
  865. return function () {
  866. if (el.getAttribute("data-dblclick") == null) {
  867. el.setAttribute("data-dblclick", 1);
  868. setTimeout(function () {
  869. if (el.getAttribute("data-dblclick") == 1) {
  870. onsingle();
  871. }
  872. el.removeAttribute("data-dblclick");
  873. }, 200);
  874. } else {
  875. el.removeAttribute("data-dblclick");
  876. ondouble();
  877. }
  878. }
  879. }
  880. function smoothScrollToRow(rowid) {
  881. document.getElementById(rowid).scrollIntoView({
  882. behavior: "smooth",
  883. block: "center",
  884. inline: "nearest"
  885. });
  886. }
  887. function focusInputField(input) {
  888. input.scrollIntoView(false);
  889. input.focus();
  890. input.select();
  891. }
  892. function saveBomTable(output) {
  893. var text = '';
  894. for (var node of bomhead.childNodes[0].childNodes) {
  895. if (node.firstChild) {
  896. text += (output == 'csv' ? `"${node.firstChild.nodeValue}"` : node.firstChild.nodeValue);
  897. }
  898. if (node != bomhead.childNodes[0].lastChild) {
  899. text += (output == 'csv' ? ',' : '\t');
  900. }
  901. }
  902. text += '\n';
  903. for (var row of bombody.childNodes) {
  904. for (var cell of row.childNodes) {
  905. let val = '';
  906. for (var node of cell.childNodes) {
  907. if (node.nodeName == "INPUT") {
  908. if (node.checked) {
  909. val += '✓';
  910. }
  911. } else if ((node.nodeName == "MARK") || (node.nodeName == "A")) {
  912. val += node.firstChild.nodeValue;
  913. } else {
  914. val += node.nodeValue;
  915. }
  916. }
  917. if (output == 'csv') {
  918. val = val.replace(/\"/g, '\"\"'); // pair of double-quote characters
  919. if (isNumeric(val)) {
  920. val = +val; // use number
  921. } else {
  922. val = `"${val}"`; // enclosed within double-quote
  923. }
  924. }
  925. text += val;
  926. if (cell != row.lastChild) {
  927. text += (output == 'csv' ? ',' : '\t');
  928. }
  929. }
  930. text += '\n';
  931. }
  932. if (output != 'clipboard') {
  933. // To file: csv or txt
  934. var blob = new Blob([text], {
  935. type: `text/${output}`
  936. });
  937. saveFile(`${pcbdata.metadata.title}.${output}`, blob);
  938. } else {
  939. // To clipboard
  940. var textArea = document.createElement("textarea");
  941. textArea.classList.add('clipboard-temp');
  942. textArea.value = text;
  943. document.body.appendChild(textArea);
  944. textArea.focus();
  945. textArea.select();
  946. try {
  947. if (document.execCommand('copy')) {
  948. console.log('Bom copied to clipboard.');
  949. }
  950. } catch (err) {
  951. console.log('Can not copy to clipboard.');
  952. }
  953. document.body.removeChild(textArea);
  954. }
  955. }
  956. function isNumeric(str) {
  957. /* https://stackoverflow.com/a/175787 */
  958. return (typeof str != "string" ? false : !isNaN(str) && !isNaN(parseFloat(str)));
  959. }
  960. function removeGutterNode(node) {
  961. for (var i = 0; i < node.childNodes.length; i++) {
  962. if (node.childNodes[i].classList &&
  963. node.childNodes[i].classList.contains("gutter")) {
  964. node.removeChild(node.childNodes[i]);
  965. break;
  966. }
  967. }
  968. }
  969. function cleanGutters() {
  970. removeGutterNode(document.getElementById("bot"));
  971. removeGutterNode(document.getElementById("canvasdiv"));
  972. }
  973. var units = {
  974. prefixes: {
  975. giga: ["G", "g", "giga", "Giga", "GIGA"],
  976. mega: ["M", "mega", "Mega", "MEGA"],
  977. kilo: ["K", "k", "kilo", "Kilo", "KILO"],
  978. milli: ["m", "milli", "Milli", "MILLI"],
  979. micro: ["U", "u", "micro", "Micro", "MICRO", "μ", "µ"], // different utf8 μ
  980. nano: ["N", "n", "nano", "Nano", "NANO"],
  981. pico: ["P", "p", "pico", "Pico", "PICO"],
  982. },
  983. unitsShort: ["R", "r", "Ω", "F", "f", "H", "h"],
  984. unitsLong: [
  985. "OHM", "Ohm", "ohm", "ohms",
  986. "FARAD", "Farad", "farad",
  987. "HENRY", "Henry", "henry"
  988. ],
  989. getMultiplier: function (s) {
  990. if (this.prefixes.giga.includes(s)) return 1e9;
  991. if (this.prefixes.mega.includes(s)) return 1e6;
  992. if (this.prefixes.kilo.includes(s)) return 1e3;
  993. if (this.prefixes.milli.includes(s)) return 1e-3;
  994. if (this.prefixes.micro.includes(s)) return 1e-6;
  995. if (this.prefixes.nano.includes(s)) return 1e-9;
  996. if (this.prefixes.pico.includes(s)) return 1e-12;
  997. return 1;
  998. },
  999. valueRegex: null,
  1000. }
  1001. function initUtils() {
  1002. var allPrefixes = units.prefixes.giga
  1003. .concat(units.prefixes.mega)
  1004. .concat(units.prefixes.kilo)
  1005. .concat(units.prefixes.milli)
  1006. .concat(units.prefixes.micro)
  1007. .concat(units.prefixes.nano)
  1008. .concat(units.prefixes.pico);
  1009. var allUnits = units.unitsShort.concat(units.unitsLong);
  1010. units.valueRegex = new RegExp("^([0-9\.]+)" +
  1011. "\\s*(" + allPrefixes.join("|") + ")?" +
  1012. "(" + allUnits.join("|") + ")?" +
  1013. "(\\b.*)?$", "");
  1014. units.valueAltRegex = new RegExp("^([0-9]*)" +
  1015. "(" + units.unitsShort.join("|") + ")?" +
  1016. "([GgMmKkUuNnPp])?" +
  1017. "([0-9]*)" +
  1018. "(\\b.*)?$", "");
  1019. if (config.fields.includes("Value")) {
  1020. var index = config.fields.indexOf("Value");
  1021. pcbdata.bom["parsedValues"] = {};
  1022. for (var id in pcbdata.bom.fields) {
  1023. pcbdata.bom.parsedValues[id] = parseValue(pcbdata.bom.fields[id][index])
  1024. }
  1025. }
  1026. }
  1027. function parseValue(val, ref) {
  1028. var inferUnit = (unit, ref) => {
  1029. if (unit) {
  1030. unit = unit.toLowerCase();
  1031. if (unit == 'Ω' || unit == "ohm" || unit == "ohms") {
  1032. unit = 'r';
  1033. }
  1034. unit = unit[0];
  1035. } else {
  1036. ref = /^([a-z]+)\d+$/i.exec(ref);
  1037. if (ref) {
  1038. ref = ref[1].toLowerCase();
  1039. if (ref == "c") unit = 'f';
  1040. else if (ref == "l") unit = 'h';
  1041. else if (ref == "r" || ref == "rv") unit = 'r';
  1042. else unit = null;
  1043. }
  1044. }
  1045. return unit;
  1046. };
  1047. val = val.replace(/,/g, "");
  1048. var match = units.valueRegex.exec(val);
  1049. var unit;
  1050. if (match) {
  1051. val = parseFloat(match[1]);
  1052. if (match[2]) {
  1053. val = val * units.getMultiplier(match[2]);
  1054. }
  1055. unit = inferUnit(match[3], ref);
  1056. if (!unit) return null;
  1057. else return {
  1058. val: val,
  1059. unit: unit,
  1060. extra: match[4],
  1061. }
  1062. }
  1063. match = units.valueAltRegex.exec(val);
  1064. if (match && (match[1] || match[4])) {
  1065. val = parseFloat(match[1] + "." + match[4]);
  1066. if (match[3]) {
  1067. val = val * units.getMultiplier(match[3]);
  1068. }
  1069. unit = inferUnit(match[2], ref);
  1070. if (!unit) return null;
  1071. else return {
  1072. val: val,
  1073. unit: unit,
  1074. extra: match[5],
  1075. }
  1076. }
  1077. return null;
  1078. }
  1079. function valueCompare(a, b, stra, strb) {
  1080. if (a === null && b === null) {
  1081. // Failed to parse both values, compare them as strings.
  1082. if (stra != strb) return stra > strb ? 1 : -1;
  1083. else return 0;
  1084. } else if (a === null) {
  1085. return 1;
  1086. } else if (b === null) {
  1087. return -1;
  1088. } else {
  1089. if (a.unit != b.unit) return a.unit > b.unit ? 1 : -1;
  1090. else if (a.val != b.val) return a.val > b.val ? 1 : -1;
  1091. else if (a.extra != b.extra) return a.extra > b.extra ? 1 : -1;
  1092. else return 0;
  1093. }
  1094. }
  1095. function validateSaveImgDimension(element) {
  1096. var valid = false;
  1097. var intValue = 0;
  1098. if (/^[1-9]\d*$/.test(element.value)) {
  1099. intValue = parseInt(element.value);
  1100. if (intValue <= 16000) {
  1101. valid = true;
  1102. }
  1103. }
  1104. if (valid) {
  1105. element.classList.remove("invalid");
  1106. } else {
  1107. element.classList.add("invalid");
  1108. }
  1109. return intValue;
  1110. }
  1111. function saveImage(layer) {
  1112. var width = validateSaveImgDimension(document.getElementById("render-save-width"));
  1113. var height = validateSaveImgDimension(document.getElementById("render-save-height"));
  1114. var bgcolor = null;
  1115. if (!document.getElementById("render-save-transparent").checked) {
  1116. var style = getComputedStyle(topmostdiv);
  1117. bgcolor = style.getPropertyValue("background-color");
  1118. }
  1119. if (!width || !height) return;
  1120. // Prepare image
  1121. var canvas = document.createElement("canvas");
  1122. var layerdict = {
  1123. transform: {
  1124. x: 0,
  1125. y: 0,
  1126. s: 1,
  1127. panx: 0,
  1128. pany: 0,
  1129. zoom: 1,
  1130. },
  1131. bg: canvas,
  1132. fab: canvas,
  1133. silk: canvas,
  1134. highlight: canvas,
  1135. layer: layer,
  1136. }
  1137. // Do the rendering
  1138. recalcLayerScale(layerdict, width, height);
  1139. prepareLayer(layerdict);
  1140. clearCanvas(canvas, bgcolor);
  1141. drawBackground(layerdict, false);
  1142. drawHighlightsOnLayer(layerdict, false);
  1143. // Save image
  1144. var imgdata = canvas.toDataURL("image/png");
  1145. var filename = pcbdata.metadata.title;
  1146. if (pcbdata.metadata.revision) {
  1147. filename += `.${pcbdata.metadata.revision}`;
  1148. }
  1149. filename += `.${layer}.png`;
  1150. saveFile(filename, dataURLtoBlob(imgdata));
  1151. }
  1152. function saveSettings() {
  1153. var data = {
  1154. type: "InteractiveHtmlBom settings",
  1155. version: 1,
  1156. pcbmetadata: pcbdata.metadata,
  1157. settings: settings,
  1158. }
  1159. var blob = new Blob([JSON.stringify(data, null, 4)], {
  1160. type: "application/json"
  1161. });
  1162. saveFile(`${pcbdata.metadata.title}.settings.json`, blob);
  1163. }
  1164. function loadSettings() {
  1165. var input = document.createElement("input");
  1166. input.type = "file";
  1167. input.accept = ".settings.json";
  1168. input.onchange = function (e) {
  1169. var file = e.target.files[0];
  1170. var reader = new FileReader();
  1171. reader.onload = readerEvent => {
  1172. var content = readerEvent.target.result;
  1173. var newSettings;
  1174. try {
  1175. newSettings = JSON.parse(content);
  1176. } catch (e) {
  1177. alert("Selected file is not InteractiveHtmlBom settings file.");
  1178. return;
  1179. }
  1180. if (newSettings.type != "InteractiveHtmlBom settings") {
  1181. alert("Selected file is not InteractiveHtmlBom settings file.");
  1182. return;
  1183. }
  1184. var metadataMatches = newSettings.hasOwnProperty("pcbmetadata");
  1185. if (metadataMatches) {
  1186. for (var k in pcbdata.metadata) {
  1187. if (!newSettings.pcbmetadata.hasOwnProperty(k) || newSettings.pcbmetadata[k] != pcbdata.metadata[k]) {
  1188. metadataMatches = false;
  1189. }
  1190. }
  1191. }
  1192. if (!metadataMatches) {
  1193. var currentMetadata = JSON.stringify(pcbdata.metadata, null, 4);
  1194. var fileMetadata = JSON.stringify(newSettings.pcbmetadata, null, 4);
  1195. if (!confirm(
  1196. `Settins file metadata does not match current metadata.\n\n` +
  1197. `Page metadata:\n${currentMetadata}\n\n` +
  1198. `Settings file metadata:\n${fileMetadata}\n\n` +
  1199. `Press OK if you would like to import settings anyway.`)) {
  1200. return;
  1201. }
  1202. }
  1203. overwriteSettings(newSettings.settings);
  1204. }
  1205. reader.readAsText(file, 'UTF-8');
  1206. }
  1207. input.click();
  1208. }
  1209. function resetSettings() {
  1210. if (!confirm(
  1211. `This will reset all checkbox states and other settings.\n\n` +
  1212. `Press OK if you want to continue.`)) {
  1213. return;
  1214. }
  1215. if (storage) {
  1216. var keys = [];
  1217. for (var i = 0; i < storage.length; i++) {
  1218. var key = storage.key(i);
  1219. if (key.startsWith(storagePrefix)) keys.push(key);
  1220. }
  1221. for (var key of keys) storage.removeItem(key);
  1222. }
  1223. location.reload();
  1224. }
  1225. function overwriteSettings(newSettings) {
  1226. initDone = false;
  1227. Object.assign(settings, newSettings);
  1228. writeStorage("bomlayout", settings.bomlayout);
  1229. writeStorage("bommode", settings.bommode);
  1230. writeStorage("canvaslayout", settings.canvaslayout);
  1231. writeStorage("bomCheckboxes", settings.checkboxes.join(","));
  1232. document.getElementById("bomCheckboxes").value = settings.checkboxes.join(",");
  1233. for (var checkbox of settings.checkboxes) {
  1234. writeStorage("checkbox_" + checkbox, settings.checkboxStoredRefs[checkbox]);
  1235. }
  1236. writeStorage("markWhenChecked", settings.markWhenChecked);
  1237. padsVisible(settings.renderPads);
  1238. document.getElementById("padsCheckbox").checked = settings.renderPads;
  1239. fabricationVisible(settings.renderFabrication);
  1240. document.getElementById("fabricationCheckbox").checked = settings.renderFabrication;
  1241. silkscreenVisible(settings.renderSilkscreen);
  1242. document.getElementById("silkscreenCheckbox").checked = settings.renderSilkscreen;
  1243. referencesVisible(settings.renderReferences);
  1244. document.getElementById("referencesCheckbox").checked = settings.renderReferences;
  1245. valuesVisible(settings.renderValues);
  1246. document.getElementById("valuesCheckbox").checked = settings.renderValues;
  1247. tracksVisible(settings.renderTracks);
  1248. document.getElementById("tracksCheckbox").checked = settings.renderTracks;
  1249. zonesVisible(settings.renderZones);
  1250. document.getElementById("zonesCheckbox").checked = settings.renderZones;
  1251. dnpOutline(settings.renderDnpOutline);
  1252. document.getElementById("dnpOutlineCheckbox").checked = settings.renderDnpOutline;
  1253. setRedrawOnDrag(settings.redrawOnDrag);
  1254. document.getElementById("dragCheckbox").checked = settings.redrawOnDrag;
  1255. setDarkMode(settings.darkMode);
  1256. document.getElementById("darkmodeCheckbox").checked = settings.darkMode;
  1257. setHighlightPin1(settings.highlightpin1);
  1258. document.forms.highlightpin1.highlightpin1.value = settings.highlightpin1;
  1259. writeStorage("boardRotation", settings.boardRotation);
  1260. document.getElementById("boardRotation").value = settings.boardRotation / 5;
  1261. document.getElementById("rotationDegree").textContent = settings.boardRotation;
  1262. setOffsetBackRotation(settings.offsetBackRotation);
  1263. document.getElementById("offsetBackRotationCheckbox").checked = settings.offsetBackRotation;
  1264. initDone = true;
  1265. prepCheckboxes();
  1266. changeBomLayout(settings.bomlayout);
  1267. }
  1268. function saveFile(filename, blob) {
  1269. var link = document.createElement("a");
  1270. var objurl = URL.createObjectURL(blob);
  1271. link.download = filename;
  1272. link.href = objurl;
  1273. link.click();
  1274. }
  1275. function dataURLtoBlob(dataurl) {
  1276. var arr = dataurl.split(','),
  1277. mime = arr[0].match(/:(.*?);/)[1],
  1278. bstr = atob(arr[1]),
  1279. n = bstr.length,
  1280. u8arr = new Uint8Array(n);
  1281. while (n--) {
  1282. u8arr[n] = bstr.charCodeAt(n);
  1283. }
  1284. return new Blob([u8arr], {
  1285. type: mime
  1286. });
  1287. }
  1288. var settings = {
  1289. canvaslayout: "FB",
  1290. bomlayout: "left-right",
  1291. bommode: "grouped",
  1292. checkboxes: [],
  1293. checkboxStoredRefs: {},
  1294. darkMode: false,
  1295. highlightpin1: "none",
  1296. redrawOnDrag: true,
  1297. boardRotation: 0,
  1298. offsetBackRotation: false,
  1299. renderPads: true,
  1300. renderReferences: true,
  1301. renderValues: true,
  1302. renderSilkscreen: true,
  1303. renderFabrication: true,
  1304. renderDnpOutline: false,
  1305. renderTracks: true,
  1306. renderZones: true,
  1307. columnOrder: [],
  1308. hiddenColumns: [],
  1309. netColors: {},
  1310. }
  1311. function initDefaults() {
  1312. settings.bomlayout = readStorage("bomlayout");
  1313. if (settings.bomlayout === null) {
  1314. settings.bomlayout = config.bom_view;
  1315. }
  1316. if (!['bom-only', 'left-right', 'top-bottom'].includes(settings.bomlayout)) {
  1317. settings.bomlayout = config.bom_view;
  1318. }
  1319. settings.bommode = readStorage("bommode");
  1320. if (settings.bommode === null) {
  1321. settings.bommode = "grouped";
  1322. }
  1323. if (settings.bommode == "netlist" && !pcbdata.nets) {
  1324. settings.bommode = "grouped";
  1325. }
  1326. if (!["grouped", "ungrouped", "netlist"].includes(settings.bommode)) {
  1327. settings.bommode = "grouped";
  1328. }
  1329. settings.canvaslayout = readStorage("canvaslayout");
  1330. if (settings.canvaslayout === null) {
  1331. settings.canvaslayout = config.layer_view;
  1332. }
  1333. var bomCheckboxes = readStorage("bomCheckboxes");
  1334. if (bomCheckboxes === null) {
  1335. bomCheckboxes = config.checkboxes;
  1336. }
  1337. settings.checkboxes = bomCheckboxes.split(",").filter((e) => e);
  1338. document.getElementById("bomCheckboxes").value = bomCheckboxes;
  1339. var highlightpin1 = readStorage("highlightpin1") || config.highlight_pin1;
  1340. if (highlightpin1 === "false") highlightpin1 = "none";
  1341. if (highlightpin1 === "true") highlightpin1 = "all";
  1342. setHighlightPin1(highlightpin1);
  1343. document.forms.highlightpin1.highlightpin1.value = highlightpin1;
  1344. settings.markWhenChecked = readStorage("markWhenChecked") || "";
  1345. populateMarkWhenCheckedOptions();
  1346. function initBooleanSetting(storageString, def, elementId, func) {
  1347. var b = readStorage(storageString);
  1348. if (b === null) {
  1349. b = def;
  1350. } else {
  1351. b = (b == "true");
  1352. }
  1353. document.getElementById(elementId).checked = b;
  1354. func(b);
  1355. }
  1356. initBooleanSetting("padsVisible", config.show_pads, "padsCheckbox", padsVisible);
  1357. initBooleanSetting("fabricationVisible", config.show_fabrication, "fabricationCheckbox", fabricationVisible);
  1358. initBooleanSetting("silkscreenVisible", config.show_silkscreen, "silkscreenCheckbox", silkscreenVisible);
  1359. initBooleanSetting("referencesVisible", true, "referencesCheckbox", referencesVisible);
  1360. initBooleanSetting("valuesVisible", true, "valuesCheckbox", valuesVisible);
  1361. if ("tracks" in pcbdata) {
  1362. initBooleanSetting("tracksVisible", true, "tracksCheckbox", tracksVisible);
  1363. initBooleanSetting("zonesVisible", true, "zonesCheckbox", zonesVisible);
  1364. } else {
  1365. document.getElementById("tracksAndZonesCheckboxes").style.display = "none";
  1366. tracksVisible(false);
  1367. zonesVisible(false);
  1368. }
  1369. initBooleanSetting("dnpOutline", false, "dnpOutlineCheckbox", dnpOutline);
  1370. initBooleanSetting("redrawOnDrag", config.redraw_on_drag, "dragCheckbox", setRedrawOnDrag);
  1371. initBooleanSetting("darkmode", config.dark_mode, "darkmodeCheckbox", setDarkMode);
  1372. var fields = ["checkboxes", "References"].concat(config.fields).concat(["Quantity"]);
  1373. var hcols = JSON.parse(readStorage("hiddenColumns"));
  1374. if (hcols === null) {
  1375. hcols = [];
  1376. }
  1377. settings.hiddenColumns = hcols.filter(e => fields.includes(e));
  1378. var cord = JSON.parse(readStorage("columnOrder"));
  1379. if (cord === null) {
  1380. cord = fields;
  1381. } else {
  1382. cord = cord.filter(e => fields.includes(e));
  1383. if (cord.length != fields.length)
  1384. cord = fields;
  1385. }
  1386. settings.columnOrder = cord;
  1387. settings.boardRotation = readStorage("boardRotation");
  1388. if (settings.boardRotation === null) {
  1389. settings.boardRotation = config.board_rotation * 5;
  1390. } else {
  1391. settings.boardRotation = parseInt(settings.boardRotation);
  1392. }
  1393. document.getElementById("boardRotation").value = settings.boardRotation / 5;
  1394. document.getElementById("rotationDegree").textContent = settings.boardRotation;
  1395. initBooleanSetting("offsetBackRotation", config.offset_back_rotation, "offsetBackRotationCheckbox", setOffsetBackRotation);
  1396. settings.netColors = JSON.parse(readStorage("netColors")) || {};
  1397. }
  1398. // Helper classes for user js callbacks.
  1399. const IBOM_EVENT_TYPES = {
  1400. ALL: "all",
  1401. HIGHLIGHT_EVENT: "highlightEvent",
  1402. CHECKBOX_CHANGE_EVENT: "checkboxChangeEvent",
  1403. BOM_BODY_CHANGE_EVENT: "bomBodyChangeEvent",
  1404. }
  1405. const EventHandler = {
  1406. callbacks: {},
  1407. init: function () {
  1408. for (eventType of Object.values(IBOM_EVENT_TYPES))
  1409. this.callbacks[eventType] = [];
  1410. },
  1411. registerCallback: function (eventType, callback) {
  1412. this.callbacks[eventType].push(callback);
  1413. },
  1414. emitEvent: function (eventType, eventArgs) {
  1415. event = {
  1416. eventType: eventType,
  1417. args: eventArgs,
  1418. }
  1419. var callback;
  1420. for (callback of this.callbacks[eventType])
  1421. callback(event);
  1422. for (callback of this.callbacks[IBOM_EVENT_TYPES.ALL])
  1423. callback(event);
  1424. }
  1425. }
  1426. EventHandler.init();
  1427. ///////////////////////////////////////////////
  1428. ///////////////////////////////////////////////
  1429. /* PCB rendering code */
  1430. var emptyContext2d = document.createElement("canvas").getContext("2d");
  1431. function deg2rad(deg) {
  1432. return deg * Math.PI / 180;
  1433. }
  1434. function calcFontPoint(linepoint, text, offsetx, offsety, tilt) {
  1435. var point = [
  1436. linepoint[0] * text.width + offsetx,
  1437. linepoint[1] * text.height + offsety
  1438. ];
  1439. // This approximates pcbnew behavior with how text tilts depending on horizontal justification
  1440. point[0] -= (linepoint[1] + 0.5 * (1 + text.justify[0])) * text.height * tilt;
  1441. return point;
  1442. }
  1443. function drawText(ctx, text, color) {
  1444. if ("ref" in text && !settings.renderReferences) return;
  1445. if ("val" in text && !settings.renderValues) return;
  1446. ctx.save();
  1447. ctx.fillStyle = color;
  1448. ctx.strokeStyle = color;
  1449. ctx.lineCap = "round";
  1450. ctx.lineJoin = "round";
  1451. ctx.lineWidth = text.thickness;
  1452. if ("svgpath" in text) {
  1453. ctx.stroke(new Path2D(text.svgpath));
  1454. ctx.restore();
  1455. return;
  1456. }
  1457. if ("polygons" in text) {
  1458. ctx.fill(getPolygonsPath(text));
  1459. ctx.restore();
  1460. return;
  1461. }
  1462. ctx.translate(...text.pos);
  1463. ctx.translate(text.thickness * 0.5, 0);
  1464. var angle = -text.angle;
  1465. if (text.attr.includes("mirrored")) {
  1466. ctx.scale(-1, 1);
  1467. angle = -angle;
  1468. }
  1469. var tilt = 0;
  1470. if (text.attr.includes("italic")) {
  1471. tilt = 0.125;
  1472. }
  1473. var interline = text.height * 1.5 + text.thickness;
  1474. var txt = text.text.split("\n");
  1475. // KiCad ignores last empty line.
  1476. if (txt[txt.length - 1] == '') txt.pop();
  1477. ctx.rotate(deg2rad(angle));
  1478. var offsety = (1 - text.justify[1]) / 2 * text.height; // One line offset
  1479. offsety -= (txt.length - 1) * (text.justify[1] + 1) / 2 * interline; // Multiline offset
  1480. for (var i in txt) {
  1481. var lineWidth = text.thickness + interline / 2 * tilt;
  1482. for (var j = 0; j < txt[i].length; j++) {
  1483. if (txt[i][j] == '\t') {
  1484. var fourSpaces = 4 * pcbdata.font_data[' '].w * text.width;
  1485. lineWidth += fourSpaces - lineWidth % fourSpaces;
  1486. } else {
  1487. if (txt[i][j] == '~') {
  1488. j++;
  1489. if (j == txt[i].length)
  1490. break;
  1491. }
  1492. lineWidth += pcbdata.font_data[txt[i][j]].w * text.width;
  1493. }
  1494. }
  1495. var offsetx = -lineWidth * (text.justify[0] + 1) / 2;
  1496. var inOverbar = false;
  1497. for (var j = 0; j < txt[i].length; j++) {
  1498. if (config.kicad_text_formatting) {
  1499. if (txt[i][j] == '\t') {
  1500. var fourSpaces = 4 * pcbdata.font_data[' '].w * text.width;
  1501. offsetx += fourSpaces - offsetx % fourSpaces;
  1502. continue;
  1503. } else if (txt[i][j] == '~') {
  1504. j++;
  1505. if (j == txt[i].length)
  1506. break;
  1507. if (txt[i][j] != '~') {
  1508. inOverbar = !inOverbar;
  1509. }
  1510. }
  1511. }
  1512. var glyph = pcbdata.font_data[txt[i][j]];
  1513. if (inOverbar) {
  1514. var overbarStart = [offsetx, -text.height * 1.4 + offsety];
  1515. var overbarEnd = [offsetx + text.width * glyph.w, overbarStart[1]];
  1516. if (!lastHadOverbar) {
  1517. overbarStart[0] += text.height * 1.4 * tilt;
  1518. lastHadOverbar = true;
  1519. }
  1520. ctx.beginPath();
  1521. ctx.moveTo(...overbarStart);
  1522. ctx.lineTo(...overbarEnd);
  1523. ctx.stroke();
  1524. } else {
  1525. lastHadOverbar = false;
  1526. }
  1527. for (var line of glyph.l) {
  1528. ctx.beginPath();
  1529. ctx.moveTo(...calcFontPoint(line[0], text, offsetx, offsety, tilt));
  1530. for (var k = 1; k < line.length; k++) {
  1531. ctx.lineTo(...calcFontPoint(line[k], text, offsetx, offsety, tilt));
  1532. }
  1533. ctx.stroke();
  1534. }
  1535. offsetx += glyph.w * text.width;
  1536. }
  1537. offsety += interline;
  1538. }
  1539. ctx.restore();
  1540. }
  1541. function drawedge(ctx, scalefactor, edge, color) {
  1542. ctx.strokeStyle = color;
  1543. ctx.fillStyle = color;
  1544. ctx.lineWidth = Math.max(1 / scalefactor, edge.width);
  1545. ctx.lineCap = "round";
  1546. ctx.lineJoin = "round";
  1547. if ("svgpath" in edge) {
  1548. ctx.stroke(new Path2D(edge.svgpath));
  1549. } else {
  1550. ctx.beginPath();
  1551. if (edge.type == "segment") {
  1552. ctx.moveTo(...edge.start);
  1553. ctx.lineTo(...edge.end);
  1554. }
  1555. if (edge.type == "rect") {
  1556. ctx.moveTo(...edge.start);
  1557. ctx.lineTo(edge.start[0], edge.end[1]);
  1558. ctx.lineTo(...edge.end);
  1559. ctx.lineTo(edge.end[0], edge.start[1]);
  1560. ctx.lineTo(...edge.start);
  1561. }
  1562. if (edge.type == "arc") {
  1563. ctx.arc(
  1564. ...edge.start,
  1565. edge.radius,
  1566. deg2rad(edge.startangle),
  1567. deg2rad(edge.endangle));
  1568. }
  1569. if (edge.type == "circle") {
  1570. ctx.arc(
  1571. ...edge.start,
  1572. edge.radius,
  1573. 0, 2 * Math.PI);
  1574. ctx.closePath();
  1575. }
  1576. if (edge.type == "curve") {
  1577. ctx.moveTo(...edge.start);
  1578. ctx.bezierCurveTo(...edge.cpa, ...edge.cpb, ...edge.end);
  1579. }
  1580. if("filled" in edge && edge.filled)
  1581. ctx.fill();
  1582. else
  1583. ctx.stroke();
  1584. }
  1585. }
  1586. function getChamferedRectPath(size, radius, chamfpos, chamfratio) {
  1587. // chamfpos is a bitmask, left = 1, right = 2, bottom left = 4, bottom right = 8
  1588. var path = new Path2D();
  1589. var width = size[0];
  1590. var height = size[1];
  1591. var x = width * -0.5;
  1592. var y = height * -0.5;
  1593. var chamfOffset = Math.min(width, height) * chamfratio;
  1594. path.moveTo(x, 0);
  1595. if (chamfpos & 4) {
  1596. path.lineTo(x, y + height - chamfOffset);
  1597. path.lineTo(x + chamfOffset, y + height);
  1598. path.lineTo(0, y + height);
  1599. } else {
  1600. path.arcTo(x, y + height, x + width, y + height, radius);
  1601. }
  1602. if (chamfpos & 8) {
  1603. path.lineTo(x + width - chamfOffset, y + height);
  1604. path.lineTo(x + width, y + height - chamfOffset);
  1605. path.lineTo(x + width, 0);
  1606. } else {
  1607. path.arcTo(x + width, y + height, x + width, y, radius);
  1608. }
  1609. if (chamfpos & 2) {
  1610. path.lineTo(x + width, y + chamfOffset);
  1611. path.lineTo(x + width - chamfOffset, y);
  1612. path.lineTo(0, y);
  1613. } else {
  1614. path.arcTo(x + width, y, x, y, radius);
  1615. }
  1616. if (chamfpos & 1) {
  1617. path.lineTo(x + chamfOffset, y);
  1618. path.lineTo(x, y + chamfOffset);
  1619. path.lineTo(x, 0);
  1620. } else {
  1621. path.arcTo(x, y, x, y + height, radius);
  1622. }
  1623. path.closePath();
  1624. return path;
  1625. }
  1626. function getOblongPath(size) {
  1627. return getChamferedRectPath(size, Math.min(size[0], size[1]) / 2, 0, 0);
  1628. }
  1629. function getPolygonsPath(shape) {
  1630. if (shape.path2d) {
  1631. return shape.path2d;
  1632. }
  1633. if ("svgpath" in shape) {
  1634. shape.path2d = new Path2D(shape.svgpath);
  1635. } else {
  1636. var path = new Path2D();
  1637. for (var polygon of shape.polygons) {
  1638. path.moveTo(...polygon[0]);
  1639. for (var i = 1; i < polygon.length; i++) {
  1640. path.lineTo(...polygon[i]);
  1641. }
  1642. path.closePath();
  1643. }
  1644. shape.path2d = path;
  1645. }
  1646. return shape.path2d;
  1647. }
  1648. function drawPolygonShape(ctx, scalefactor, shape, color) {
  1649. ctx.save();
  1650. if (!("svgpath" in shape)) {
  1651. ctx.translate(...shape.pos);
  1652. ctx.rotate(deg2rad(-shape.angle));
  1653. }
  1654. if("filled" in shape && !shape.filled) {
  1655. ctx.strokeStyle = color;
  1656. ctx.lineWidth = Math.max(1 / scalefactor, shape.width);
  1657. ctx.lineCap = "round";
  1658. ctx.lineJoin = "round";
  1659. ctx.stroke(getPolygonsPath(shape));
  1660. } else {
  1661. ctx.fillStyle = color;
  1662. ctx.fill(getPolygonsPath(shape));
  1663. }
  1664. ctx.restore();
  1665. }
  1666. function drawDrawing(ctx, scalefactor, drawing, color) {
  1667. if (["segment", "arc", "circle", "curve", "rect"].includes(drawing.type)) {
  1668. drawedge(ctx, scalefactor, drawing, color);
  1669. } else if (drawing.type == "polygon") {
  1670. drawPolygonShape(ctx, scalefactor, drawing, color);
  1671. } else {
  1672. drawText(ctx, drawing, color);
  1673. }
  1674. }
  1675. function getCirclePath(radius) {
  1676. var path = new Path2D();
  1677. path.arc(0, 0, radius, 0, 2 * Math.PI);
  1678. path.closePath();
  1679. return path;
  1680. }
  1681. function getCachedPadPath(pad) {
  1682. if (!pad.path2d) {
  1683. // if path2d is not set, build one and cache it on pad object
  1684. if (pad.shape == "rect") {
  1685. pad.path2d = new Path2D();
  1686. pad.path2d.rect(...pad.size.map(c => -c * 0.5), ...pad.size);
  1687. } else if (pad.shape == "oval") {
  1688. pad.path2d = getOblongPath(pad.size);
  1689. } else if (pad.shape == "circle") {
  1690. pad.path2d = getCirclePath(pad.size[0] / 2);
  1691. } else if (pad.shape == "roundrect") {
  1692. pad.path2d = getChamferedRectPath(pad.size, pad.radius, 0, 0);
  1693. } else if (pad.shape == "chamfrect") {
  1694. pad.path2d = getChamferedRectPath(pad.size, pad.radius, pad.chamfpos, pad.chamfratio)
  1695. } else if (pad.shape == "custom") {
  1696. pad.path2d = getPolygonsPath(pad);
  1697. }
  1698. }
  1699. return pad.path2d;
  1700. }
  1701. function drawPad(ctx, pad, color, outline) {
  1702. ctx.save();
  1703. ctx.translate(...pad.pos);
  1704. ctx.rotate(-deg2rad(pad.angle));
  1705. if (pad.offset) {
  1706. ctx.translate(...pad.offset);
  1707. }
  1708. ctx.fillStyle = color;
  1709. ctx.strokeStyle = color;
  1710. var path = getCachedPadPath(pad);
  1711. if (outline) {
  1712. ctx.stroke(path);
  1713. } else {
  1714. ctx.fill(path);
  1715. }
  1716. ctx.restore();
  1717. }
  1718. function drawPadHole(ctx, pad, padHoleColor) {
  1719. if (pad.type != "th") return;
  1720. ctx.save();
  1721. ctx.translate(...pad.pos);
  1722. ctx.rotate(-deg2rad(pad.angle));
  1723. ctx.fillStyle = padHoleColor;
  1724. if (pad.drillshape == "oblong") {
  1725. ctx.fill(getOblongPath(pad.drillsize));
  1726. } else {
  1727. ctx.fill(getCirclePath(pad.drillsize[0] / 2));
  1728. }
  1729. ctx.restore();
  1730. }
  1731. function drawFootprint(ctx, layer, scalefactor, footprint, colors, highlight, outline) {
  1732. if (highlight) {
  1733. // draw bounding box
  1734. if (footprint.layer == layer) {
  1735. ctx.save();
  1736. ctx.globalAlpha = 0.2;
  1737. ctx.translate(...footprint.bbox.pos);
  1738. ctx.rotate(deg2rad(-footprint.bbox.angle));
  1739. ctx.translate(...footprint.bbox.relpos);
  1740. ctx.fillStyle = colors.pad;
  1741. ctx.fillRect(0, 0, ...footprint.bbox.size);
  1742. ctx.globalAlpha = 1;
  1743. ctx.strokeStyle = colors.pad;
  1744. ctx.lineWidth = 3 / scalefactor;
  1745. ctx.strokeRect(0, 0, ...footprint.bbox.size);
  1746. ctx.restore();
  1747. }
  1748. }
  1749. // draw drawings
  1750. for (var drawing of footprint.drawings) {
  1751. if (drawing.layer == layer) {
  1752. drawDrawing(ctx, scalefactor, drawing.drawing, colors.pad);
  1753. }
  1754. }
  1755. ctx.lineWidth = 3 / scalefactor;
  1756. // draw pads
  1757. if (settings.renderPads) {
  1758. for (var pad of footprint.pads) {
  1759. if (pad.layers.includes(layer)) {
  1760. drawPad(ctx, pad, colors.pad, outline);
  1761. if (pad.pin1 &&
  1762. (settings.highlightpin1 == "all" ||
  1763. settings.highlightpin1 == "selected" && highlight)) {
  1764. drawPad(ctx, pad, colors.outline, true);
  1765. }
  1766. }
  1767. }
  1768. for (var pad of footprint.pads) {
  1769. drawPadHole(ctx, pad, colors.padHole);
  1770. }
  1771. }
  1772. }
  1773. function drawEdgeCuts(canvas, scalefactor) {
  1774. var ctx = canvas.getContext("2d");
  1775. var edgecolor = getComputedStyle(topmostdiv).getPropertyValue('--pcb-edge-color');
  1776. for (var edge of pcbdata.edges) {
  1777. drawDrawing(ctx, scalefactor, edge, edgecolor);
  1778. }
  1779. }
  1780. function drawFootprints(canvas, layer, scalefactor, highlight) {
  1781. var ctx = canvas.getContext("2d");
  1782. ctx.lineWidth = 3 / scalefactor;
  1783. var style = getComputedStyle(topmostdiv);
  1784. var colors = {
  1785. pad: style.getPropertyValue('--pad-color'),
  1786. padHole: style.getPropertyValue('--pad-hole-color'),
  1787. outline: style.getPropertyValue('--pin1-outline-color'),
  1788. }
  1789. for (var i = 0; i < pcbdata.footprints.length; i++) {
  1790. var mod = pcbdata.footprints[i];
  1791. var outline = settings.renderDnpOutline && pcbdata.bom.skipped.includes(i);
  1792. var h = highlightedFootprints.includes(i);
  1793. var d = markedFootprints.has(i);
  1794. if (highlight) {
  1795. if(h && d) {
  1796. colors.pad = style.getPropertyValue('--pad-color-highlight-both');
  1797. colors.outline = style.getPropertyValue('--pin1-outline-color-highlight-both');
  1798. } else if (h) {
  1799. colors.pad = style.getPropertyValue('--pad-color-highlight');
  1800. colors.outline = style.getPropertyValue('--pin1-outline-color-highlight');
  1801. } else if (d) {
  1802. colors.pad = style.getPropertyValue('--pad-color-highlight-marked');
  1803. colors.outline = style.getPropertyValue('--pin1-outline-color-highlight-marked');
  1804. }
  1805. }
  1806. if( h || d || !highlight) {
  1807. drawFootprint(ctx, layer, scalefactor, mod, colors, highlight, outline);
  1808. }
  1809. }
  1810. }
  1811. function drawBgLayer(layername, canvas, layer, scalefactor, edgeColor, polygonColor, textColor) {
  1812. var ctx = canvas.getContext("2d");
  1813. for (var d of pcbdata.drawings[layername][layer]) {
  1814. if (["segment", "arc", "circle", "curve", "rect"].includes(d.type)) {
  1815. drawedge(ctx, scalefactor, d, edgeColor);
  1816. } else if (d.type == "polygon") {
  1817. drawPolygonShape(ctx, scalefactor, d, polygonColor);
  1818. } else {
  1819. drawText(ctx, d, textColor);
  1820. }
  1821. }
  1822. }
  1823. function drawTracks(canvas, layer, defaultColor, highlight) {
  1824. ctx = canvas.getContext("2d");
  1825. ctx.lineCap = "round";
  1826. var hasHole = (track) => (
  1827. 'drillsize' in track &&
  1828. track.start[0] == track.end[0] &&
  1829. track.start[1] == track.end[1]);
  1830. // First draw tracks and tented vias
  1831. for (var track of pcbdata.tracks[layer]) {
  1832. if (highlight && highlightedNet != track.net) continue;
  1833. if (!hasHole(track)) {
  1834. ctx.strokeStyle = highlight ? defaultColor : settings.netColors[track.net] || defaultColor;
  1835. ctx.lineWidth = track.width;
  1836. ctx.beginPath();
  1837. if ('radius' in track) {
  1838. ctx.arc(
  1839. ...track.center,
  1840. track.radius,
  1841. deg2rad(track.startangle),
  1842. deg2rad(track.endangle));
  1843. } else {
  1844. ctx.moveTo(...track.start);
  1845. ctx.lineTo(...track.end);
  1846. }
  1847. ctx.stroke();
  1848. }
  1849. }
  1850. // Second pass to draw untented vias
  1851. var style = getComputedStyle(topmostdiv);
  1852. var holeColor = style.getPropertyValue('--pad-hole-color')
  1853. for (var track of pcbdata.tracks[layer]) {
  1854. if (highlight && highlightedNet != track.net) continue;
  1855. if (hasHole(track)) {
  1856. ctx.strokeStyle = highlight ? defaultColor : settings.netColors[track.net] || defaultColor;
  1857. ctx.lineWidth = track.width;
  1858. ctx.beginPath();
  1859. ctx.moveTo(...track.start);
  1860. ctx.lineTo(...track.end);
  1861. ctx.stroke();
  1862. ctx.strokeStyle = holeColor;
  1863. ctx.lineWidth = track.drillsize;
  1864. ctx.lineTo(...track.end);
  1865. ctx.stroke();
  1866. }
  1867. }
  1868. }
  1869. function drawZones(canvas, layer, defaultColor, highlight) {
  1870. ctx = canvas.getContext("2d");
  1871. ctx.lineJoin = "round";
  1872. for (var zone of pcbdata.zones[layer]) {
  1873. if (highlight && highlightedNet != zone.net) continue;
  1874. ctx.strokeStyle = highlight ? defaultColor : settings.netColors[zone.net] || defaultColor;
  1875. ctx.fillStyle = highlight ? defaultColor : settings.netColors[zone.net] || defaultColor;
  1876. if (!zone.path2d) {
  1877. zone.path2d = getPolygonsPath(zone);
  1878. }
  1879. ctx.fill(zone.path2d, zone.fillrule || "nonzero");
  1880. if (zone.width > 0) {
  1881. ctx.lineWidth = zone.width;
  1882. ctx.stroke(zone.path2d);
  1883. }
  1884. }
  1885. }
  1886. function clearCanvas(canvas, color = null) {
  1887. var ctx = canvas.getContext("2d");
  1888. ctx.save();
  1889. ctx.setTransform(1, 0, 0, 1, 0, 0);
  1890. if (color) {
  1891. ctx.fillStyle = color;
  1892. ctx.fillRect(0, 0, canvas.width, canvas.height);
  1893. } else {
  1894. if (!window.matchMedia("print").matches)
  1895. ctx.clearRect(0, 0, canvas.width, canvas.height);
  1896. }
  1897. ctx.restore();
  1898. }
  1899. function drawNets(canvas, layer, highlight) {
  1900. var style = getComputedStyle(topmostdiv);
  1901. if (settings.renderZones) {
  1902. var zoneColor = style.getPropertyValue(highlight ? '--zone-color-highlight' : '--zone-color');
  1903. drawZones(canvas, layer, zoneColor, highlight);
  1904. }
  1905. if (settings.renderTracks) {
  1906. var trackColor = style.getPropertyValue(highlight ? '--track-color-highlight' : '--track-color');
  1907. drawTracks(canvas, layer, trackColor, highlight);
  1908. }
  1909. if (highlight && settings.renderPads) {
  1910. var padColor = style.getPropertyValue('--pad-color-highlight');
  1911. var padHoleColor = style.getPropertyValue('--pad-hole-color');
  1912. var ctx = canvas.getContext("2d");
  1913. for (var footprint of pcbdata.footprints) {
  1914. // draw pads
  1915. var padDrawn = false;
  1916. for (var pad of footprint.pads) {
  1917. if (highlightedNet != pad.net) continue;
  1918. if (pad.layers.includes(layer)) {
  1919. drawPad(ctx, pad, padColor, false);
  1920. padDrawn = true;
  1921. }
  1922. }
  1923. if (padDrawn) {
  1924. // redraw all pad holes because some pads may overlap
  1925. for (var pad of footprint.pads) {
  1926. drawPadHole(ctx, pad, padHoleColor);
  1927. }
  1928. }
  1929. }
  1930. }
  1931. }
  1932. function drawHighlightsOnLayer(canvasdict, clear = true) {
  1933. if (clear) {
  1934. clearCanvas(canvasdict.highlight);
  1935. }
  1936. if (markedFootprints.size > 0 || highlightedFootprints.length > 0) {
  1937. drawFootprints(canvasdict.highlight, canvasdict.layer,
  1938. canvasdict.transform.s * canvasdict.transform.zoom, true);
  1939. }
  1940. if (highlightedNet !== null) {
  1941. drawNets(canvasdict.highlight, canvasdict.layer, true);
  1942. }
  1943. }
  1944. function drawHighlights() {
  1945. drawHighlightsOnLayer(allcanvas.front);
  1946. drawHighlightsOnLayer(allcanvas.back);
  1947. }
  1948. function drawBackground(canvasdict, clear = true) {
  1949. if (clear) {
  1950. clearCanvas(canvasdict.bg);
  1951. clearCanvas(canvasdict.fab);
  1952. clearCanvas(canvasdict.silk);
  1953. }
  1954. drawNets(canvasdict.bg, canvasdict.layer, false);
  1955. drawFootprints(canvasdict.bg, canvasdict.layer,
  1956. canvasdict.transform.s * canvasdict.transform.zoom, false);
  1957. drawEdgeCuts(canvasdict.bg, canvasdict.transform.s * canvasdict.transform.zoom);
  1958. var style = getComputedStyle(topmostdiv);
  1959. var edgeColor = style.getPropertyValue('--silkscreen-edge-color');
  1960. var polygonColor = style.getPropertyValue('--silkscreen-polygon-color');
  1961. var textColor = style.getPropertyValue('--silkscreen-text-color');
  1962. if (settings.renderSilkscreen) {
  1963. drawBgLayer(
  1964. "silkscreen", canvasdict.silk, canvasdict.layer,
  1965. canvasdict.transform.s * canvasdict.transform.zoom,
  1966. edgeColor, polygonColor, textColor);
  1967. }
  1968. edgeColor = style.getPropertyValue('--fabrication-edge-color');
  1969. polygonColor = style.getPropertyValue('--fabrication-polygon-color');
  1970. textColor = style.getPropertyValue('--fabrication-text-color');
  1971. if (settings.renderFabrication) {
  1972. drawBgLayer(
  1973. "fabrication", canvasdict.fab, canvasdict.layer,
  1974. canvasdict.transform.s * canvasdict.transform.zoom,
  1975. edgeColor, polygonColor, textColor);
  1976. }
  1977. }
  1978. function prepareCanvas(canvas, flip, transform) {
  1979. var ctx = canvas.getContext("2d");
  1980. ctx.setTransform(1, 0, 0, 1, 0, 0);
  1981. ctx.scale(transform.zoom, transform.zoom);
  1982. ctx.translate(transform.panx, transform.pany);
  1983. if (flip) {
  1984. ctx.scale(-1, 1);
  1985. }
  1986. ctx.translate(transform.x, transform.y);
  1987. ctx.rotate(deg2rad(settings.boardRotation + (flip && settings.offsetBackRotation ? - 180 : 0)));
  1988. ctx.scale(transform.s, transform.s);
  1989. }
  1990. function prepareLayer(canvasdict) {
  1991. var flip = (canvasdict.layer === "B");
  1992. for (var c of ["bg", "fab", "silk", "highlight"]) {
  1993. prepareCanvas(canvasdict[c], flip, canvasdict.transform);
  1994. }
  1995. }
  1996. function rotateVector(v, angle) {
  1997. angle = deg2rad(angle);
  1998. return [
  1999. v[0] * Math.cos(angle) - v[1] * Math.sin(angle),
  2000. v[0] * Math.sin(angle) + v[1] * Math.cos(angle)
  2001. ];
  2002. }
  2003. function applyRotation(bbox, flip) {
  2004. var corners = [
  2005. [bbox.minx, bbox.miny],
  2006. [bbox.minx, bbox.maxy],
  2007. [bbox.maxx, bbox.miny],
  2008. [bbox.maxx, bbox.maxy],
  2009. ];
  2010. corners = corners.map((v) => rotateVector(v, settings.boardRotation + (flip && settings.offsetBackRotation ? - 180 : 0)));
  2011. return {
  2012. minx: corners.reduce((a, v) => Math.min(a, v[0]), Infinity),
  2013. miny: corners.reduce((a, v) => Math.min(a, v[1]), Infinity),
  2014. maxx: corners.reduce((a, v) => Math.max(a, v[0]), -Infinity),
  2015. maxy: corners.reduce((a, v) => Math.max(a, v[1]), -Infinity),
  2016. }
  2017. }
  2018. function recalcLayerScale(layerdict, width, height) {
  2019. var flip = (layerdict.layer === "B");
  2020. var bbox = applyRotation(pcbdata.edges_bbox, flip);
  2021. var scalefactor = 0.98 * Math.min(
  2022. width / (bbox.maxx - bbox.minx),
  2023. height / (bbox.maxy - bbox.miny)
  2024. );
  2025. if (scalefactor < 0.1) {
  2026. scalefactor = 1;
  2027. }
  2028. layerdict.transform.s = scalefactor;
  2029. if (flip) {
  2030. layerdict.transform.x = -((bbox.maxx + bbox.minx) * scalefactor + width) * 0.5;
  2031. } else {
  2032. layerdict.transform.x = -((bbox.maxx + bbox.minx) * scalefactor - width) * 0.5;
  2033. }
  2034. layerdict.transform.y = -((bbox.maxy + bbox.miny) * scalefactor - height) * 0.5;
  2035. for (var c of ["bg", "fab", "silk", "highlight"]) {
  2036. canvas = layerdict[c];
  2037. canvas.width = width;
  2038. canvas.height = height;
  2039. canvas.style.width = (width / devicePixelRatio) + "px";
  2040. canvas.style.height = (height / devicePixelRatio) + "px";
  2041. }
  2042. }
  2043. function redrawCanvas(layerdict) {
  2044. prepareLayer(layerdict);
  2045. drawBackground(layerdict);
  2046. drawHighlightsOnLayer(layerdict);
  2047. }
  2048. function resizeCanvas(layerdict) {
  2049. var canvasdivid = {
  2050. "F": "frontcanvas",
  2051. "B": "backcanvas"
  2052. } [layerdict.layer];
  2053. var width = document.getElementById(canvasdivid).clientWidth * devicePixelRatio;
  2054. var height = document.getElementById(canvasdivid).clientHeight * devicePixelRatio;
  2055. recalcLayerScale(layerdict, width, height);
  2056. redrawCanvas(layerdict);
  2057. }
  2058. function resizeAll() {
  2059. resizeCanvas(allcanvas.front);
  2060. resizeCanvas(allcanvas.back);
  2061. }
  2062. function pointWithinDistanceToSegment(x, y, x1, y1, x2, y2, d) {
  2063. var A = x - x1;
  2064. var B = y - y1;
  2065. var C = x2 - x1;
  2066. var D = y2 - y1;
  2067. var dot = A * C + B * D;
  2068. var len_sq = C * C + D * D;
  2069. var dx, dy;
  2070. if (len_sq == 0) {
  2071. // start and end of the segment coincide
  2072. dx = x - x1;
  2073. dy = y - y1;
  2074. } else {
  2075. var param = dot / len_sq;
  2076. var xx, yy;
  2077. if (param < 0) {
  2078. xx = x1;
  2079. yy = y1;
  2080. } else if (param > 1) {
  2081. xx = x2;
  2082. yy = y2;
  2083. } else {
  2084. xx = x1 + param * C;
  2085. yy = y1 + param * D;
  2086. }
  2087. dx = x - xx;
  2088. dy = y - yy;
  2089. }
  2090. return dx * dx + dy * dy <= d * d;
  2091. }
  2092. function modulo(n, mod) {
  2093. return ((n % mod) + mod) % mod;
  2094. }
  2095. function pointWithinDistanceToArc(x, y, xc, yc, radius, startangle, endangle, d) {
  2096. var dx = x - xc;
  2097. var dy = y - yc;
  2098. var r_sq = dx * dx + dy * dy;
  2099. var rmin = Math.max(0, radius - d);
  2100. var rmax = radius + d;
  2101. if (r_sq < rmin * rmin || r_sq > rmax * rmax)
  2102. return false;
  2103. var angle1 = modulo(deg2rad(startangle), 2 * Math.PI);
  2104. var dx1 = xc + radius * Math.cos(angle1) - x;
  2105. var dy1 = yc + radius * Math.sin(angle1) - y;
  2106. if (dx1 * dx1 + dy1 * dy1 <= d * d)
  2107. return true;
  2108. var angle2 = modulo(deg2rad(endangle), 2 * Math.PI);
  2109. var dx2 = xc + radius * Math.cos(angle2) - x;
  2110. var dy2 = yc + radius * Math.sin(angle2) - y;
  2111. if (dx2 * dx2 + dy2 * dy2 <= d * d)
  2112. return true;
  2113. var angle = modulo(Math.atan2(dy, dx), 2 * Math.PI);
  2114. if (angle1 > angle2)
  2115. return (angle >= angle2 || angle <= angle1);
  2116. else
  2117. return (angle >= angle1 && angle <= angle2);
  2118. }
  2119. function pointWithinPad(x, y, pad) {
  2120. var v = [x - pad.pos[0], y - pad.pos[1]];
  2121. v = rotateVector(v, pad.angle);
  2122. if (pad.offset) {
  2123. v[0] -= pad.offset[0];
  2124. v[1] -= pad.offset[1];
  2125. }
  2126. return emptyContext2d.isPointInPath(getCachedPadPath(pad), ...v);
  2127. }
  2128. function netHitScan(layer, x, y) {
  2129. // Check track segments
  2130. if (settings.renderTracks && pcbdata.tracks) {
  2131. for (var track of pcbdata.tracks[layer]) {
  2132. if ('radius' in track) {
  2133. if (pointWithinDistanceToArc(x, y, ...track.center, track.radius, track.startangle, track.endangle, track.width / 2)) {
  2134. return track.net;
  2135. }
  2136. } else {
  2137. if (pointWithinDistanceToSegment(x, y, ...track.start, ...track.end, track.width / 2)) {
  2138. return track.net;
  2139. }
  2140. }
  2141. }
  2142. }
  2143. // Check pads
  2144. if (settings.renderPads) {
  2145. for (var footprint of pcbdata.footprints) {
  2146. for (var pad of footprint.pads) {
  2147. if (pad.layers.includes(layer) && pointWithinPad(x, y, pad)) {
  2148. return pad.net;
  2149. }
  2150. }
  2151. }
  2152. }
  2153. return null;
  2154. }
  2155. function pointWithinFootprintBbox(x, y, bbox) {
  2156. var v = [x - bbox.pos[0], y - bbox.pos[1]];
  2157. v = rotateVector(v, bbox.angle);
  2158. return bbox.relpos[0] <= v[0] && v[0] <= bbox.relpos[0] + bbox.size[0] &&
  2159. bbox.relpos[1] <= v[1] && v[1] <= bbox.relpos[1] + bbox.size[1];
  2160. }
  2161. function bboxHitScan(layer, x, y) {
  2162. var result = [];
  2163. for (var i = 0; i < pcbdata.footprints.length; i++) {
  2164. var footprint = pcbdata.footprints[i];
  2165. if (footprint.layer == layer) {
  2166. if (pointWithinFootprintBbox(x, y, footprint.bbox)) {
  2167. result.push(i);
  2168. }
  2169. }
  2170. }
  2171. return result;
  2172. }
  2173. function handlePointerDown(e, layerdict) {
  2174. if (e.button != 0 && e.button != 1) {
  2175. return;
  2176. }
  2177. e.preventDefault();
  2178. e.stopPropagation();
  2179. if (!e.hasOwnProperty("offsetX")) {
  2180. // The polyfill doesn't set this properly
  2181. e.offsetX = e.pageX - e.currentTarget.offsetLeft;
  2182. e.offsetY = e.pageY - e.currentTarget.offsetTop;
  2183. }
  2184. layerdict.pointerStates[e.pointerId] = {
  2185. distanceTravelled: 0,
  2186. lastX: e.offsetX,
  2187. lastY: e.offsetY,
  2188. downTime: Date.now(),
  2189. };
  2190. }
  2191. function handleMouseClick(e, layerdict) {
  2192. if (!e.hasOwnProperty("offsetX")) {
  2193. // The polyfill doesn't set this properly
  2194. e.offsetX = e.pageX - e.currentTarget.offsetLeft;
  2195. e.offsetY = e.pageY - e.currentTarget.offsetTop;
  2196. }
  2197. var x = e.offsetX;
  2198. var y = e.offsetY;
  2199. var t = layerdict.transform;
  2200. var flip = layerdict.layer === "B";
  2201. if (flip) {
  2202. x = (devicePixelRatio * x / t.zoom - t.panx + t.x) / -t.s;
  2203. } else {
  2204. x = (devicePixelRatio * x / t.zoom - t.panx - t.x) / t.s;
  2205. }
  2206. y = (devicePixelRatio * y / t.zoom - t.y - t.pany) / t.s;
  2207. var v = rotateVector([x, y], -settings.boardRotation + (flip && settings.offsetBackRotation ? - 180 : 0));
  2208. if ("nets" in pcbdata) {
  2209. var net = netHitScan(layerdict.layer, ...v);
  2210. if (net !== highlightedNet) {
  2211. netClicked(net);
  2212. }
  2213. }
  2214. if (highlightedNet === null) {
  2215. var footprints = bboxHitScan(layerdict.layer, ...v);
  2216. if (footprints.length > 0) {
  2217. footprintsClicked(footprints);
  2218. }
  2219. }
  2220. }
  2221. function handlePointerLeave(e, layerdict) {
  2222. e.preventDefault();
  2223. e.stopPropagation();
  2224. if (!settings.redrawOnDrag) {
  2225. redrawCanvas(layerdict);
  2226. }
  2227. delete layerdict.pointerStates[e.pointerId];
  2228. }
  2229. function resetTransform(layerdict) {
  2230. layerdict.transform.panx = 0;
  2231. layerdict.transform.pany = 0;
  2232. layerdict.transform.zoom = 1;
  2233. redrawCanvas(layerdict);
  2234. }
  2235. function handlePointerUp(e, layerdict) {
  2236. if (!e.hasOwnProperty("offsetX")) {
  2237. // The polyfill doesn't set this properly
  2238. e.offsetX = e.pageX - e.currentTarget.offsetLeft;
  2239. e.offsetY = e.pageY - e.currentTarget.offsetTop;
  2240. }
  2241. e.preventDefault();
  2242. e.stopPropagation();
  2243. if (e.button == 2) {
  2244. // Reset pan and zoom on right click.
  2245. resetTransform(layerdict);
  2246. layerdict.anotherPointerTapped = false;
  2247. return;
  2248. }
  2249. // We haven't necessarily had a pointermove event since the interaction started, so make sure we update this now
  2250. var ptr = layerdict.pointerStates[e.pointerId];
  2251. ptr.distanceTravelled += Math.abs(e.offsetX - ptr.lastX) + Math.abs(e.offsetY - ptr.lastY);
  2252. if (e.button == 0 && ptr.distanceTravelled < 10 && Date.now() - ptr.downTime <= 500) {
  2253. if (Object.keys(layerdict.pointerStates).length == 1) {
  2254. if (layerdict.anotherPointerTapped) {
  2255. // This is the second pointer coming off of a two-finger tap
  2256. resetTransform(layerdict);
  2257. } else {
  2258. // This is just a regular tap
  2259. handleMouseClick(e, layerdict);
  2260. }
  2261. layerdict.anotherPointerTapped = false;
  2262. } else {
  2263. // This is the first finger coming off of what could become a two-finger tap
  2264. layerdict.anotherPointerTapped = true;
  2265. }
  2266. } else {
  2267. if (!settings.redrawOnDrag) {
  2268. redrawCanvas(layerdict);
  2269. }
  2270. layerdict.anotherPointerTapped = false;
  2271. }
  2272. delete layerdict.pointerStates[e.pointerId];
  2273. }
  2274. function handlePointerMove(e, layerdict) {
  2275. if (!layerdict.pointerStates.hasOwnProperty(e.pointerId)) {
  2276. return;
  2277. }
  2278. e.preventDefault();
  2279. e.stopPropagation();
  2280. if (!e.hasOwnProperty("offsetX")) {
  2281. // The polyfill doesn't set this properly
  2282. e.offsetX = e.pageX - e.currentTarget.offsetLeft;
  2283. e.offsetY = e.pageY - e.currentTarget.offsetTop;
  2284. }
  2285. var thisPtr = layerdict.pointerStates[e.pointerId];
  2286. var dx = e.offsetX - thisPtr.lastX;
  2287. var dy = e.offsetY - thisPtr.lastY;
  2288. // If this number is low on pointer up, we count the action as a click
  2289. thisPtr.distanceTravelled += Math.abs(dx) + Math.abs(dy);
  2290. if (Object.keys(layerdict.pointerStates).length == 1) {
  2291. // This is a simple drag
  2292. layerdict.transform.panx += devicePixelRatio * dx / layerdict.transform.zoom;
  2293. layerdict.transform.pany += devicePixelRatio * dy / layerdict.transform.zoom;
  2294. } else if (Object.keys(layerdict.pointerStates).length == 2) {
  2295. var otherPtr = Object.values(layerdict.pointerStates).filter((ptr) => ptr != thisPtr)[0];
  2296. var oldDist = Math.sqrt(Math.pow(thisPtr.lastX - otherPtr.lastX, 2) + Math.pow(thisPtr.lastY - otherPtr.lastY, 2));
  2297. var newDist = Math.sqrt(Math.pow(e.offsetX - otherPtr.lastX, 2) + Math.pow(e.offsetY - otherPtr.lastY, 2));
  2298. var scaleFactor = newDist / oldDist;
  2299. if (scaleFactor != NaN) {
  2300. layerdict.transform.zoom *= scaleFactor;
  2301. var zoomd = (1 - scaleFactor) / layerdict.transform.zoom;
  2302. layerdict.transform.panx += devicePixelRatio * otherPtr.lastX * zoomd;
  2303. layerdict.transform.pany += devicePixelRatio * otherPtr.lastY * zoomd;
  2304. }
  2305. }
  2306. thisPtr.lastX = e.offsetX;
  2307. thisPtr.lastY = e.offsetY;
  2308. if (settings.redrawOnDrag) {
  2309. redrawCanvas(layerdict);
  2310. }
  2311. }
  2312. function handleMouseWheel(e, layerdict) {
  2313. e.preventDefault();
  2314. e.stopPropagation();
  2315. var t = layerdict.transform;
  2316. var wheeldelta = e.deltaY;
  2317. if (e.deltaMode == 1) {
  2318. // FF only, scroll by lines
  2319. wheeldelta *= 30;
  2320. } else if (e.deltaMode == 2) {
  2321. wheeldelta *= 300;
  2322. }
  2323. var m = Math.pow(1.1, -wheeldelta / 40);
  2324. // Limit amount of zoom per tick.
  2325. if (m > 2) {
  2326. m = 2;
  2327. } else if (m < 0.5) {
  2328. m = 0.5;
  2329. }
  2330. t.zoom *= m;
  2331. var zoomd = (1 - m) / t.zoom;
  2332. t.panx += devicePixelRatio * e.offsetX * zoomd;
  2333. t.pany += devicePixelRatio * e.offsetY * zoomd;
  2334. redrawCanvas(layerdict);
  2335. }
  2336. function addMouseHandlers(div, layerdict) {
  2337. div.addEventListener("pointerdown", function(e) {
  2338. handlePointerDown(e, layerdict);
  2339. });
  2340. div.addEventListener("pointermove", function(e) {
  2341. handlePointerMove(e, layerdict);
  2342. });
  2343. div.addEventListener("pointerup", function(e) {
  2344. handlePointerUp(e, layerdict);
  2345. });
  2346. var pointerleave = function(e) {
  2347. handlePointerLeave(e, layerdict);
  2348. }
  2349. div.addEventListener("pointercancel", pointerleave);
  2350. div.addEventListener("pointerleave", pointerleave);
  2351. div.addEventListener("pointerout", pointerleave);
  2352. div.onwheel = function(e) {
  2353. handleMouseWheel(e, layerdict);
  2354. }
  2355. for (var element of [div, layerdict.bg, layerdict.fab, layerdict.silk, layerdict.highlight]) {
  2356. element.addEventListener("contextmenu", function(e) {
  2357. e.preventDefault();
  2358. }, false);
  2359. }
  2360. }
  2361. function setRedrawOnDrag(value) {
  2362. settings.redrawOnDrag = value;
  2363. writeStorage("redrawOnDrag", value);
  2364. }
  2365. function setBoardRotation(value) {
  2366. settings.boardRotation = value * 5;
  2367. writeStorage("boardRotation", settings.boardRotation);
  2368. document.getElementById("rotationDegree").textContent = settings.boardRotation;
  2369. resizeAll();
  2370. }
  2371. function setOffsetBackRotation(value) {
  2372. settings.offsetBackRotation = value;
  2373. writeStorage("offsetBackRotation", value);
  2374. resizeAll();
  2375. }
  2376. function initRender() {
  2377. allcanvas = {
  2378. front: {
  2379. transform: {
  2380. x: 0,
  2381. y: 0,
  2382. s: 1,
  2383. panx: 0,
  2384. pany: 0,
  2385. zoom: 1,
  2386. },
  2387. pointerStates: {},
  2388. anotherPointerTapped: false,
  2389. bg: document.getElementById("F_bg"),
  2390. fab: document.getElementById("F_fab"),
  2391. silk: document.getElementById("F_slk"),
  2392. highlight: document.getElementById("F_hl"),
  2393. layer: "F",
  2394. },
  2395. back: {
  2396. transform: {
  2397. x: 0,
  2398. y: 0,
  2399. s: 1,
  2400. panx: 0,
  2401. pany: 0,
  2402. zoom: 1,
  2403. },
  2404. pointerStates: {},
  2405. anotherPointerTapped: false,
  2406. bg: document.getElementById("B_bg"),
  2407. fab: document.getElementById("B_fab"),
  2408. silk: document.getElementById("B_slk"),
  2409. highlight: document.getElementById("B_hl"),
  2410. layer: "B",
  2411. }
  2412. };
  2413. addMouseHandlers(document.getElementById("frontcanvas"), allcanvas.front);
  2414. addMouseHandlers(document.getElementById("backcanvas"), allcanvas.back);
  2415. }
  2416. ///////////////////////////////////////////////
  2417. ///////////////////////////////////////////////
  2418. /*
  2419. * Table reordering via Drag'n'Drop
  2420. * Inspired by: https://htmldom.dev/drag-and-drop-table-column
  2421. */
  2422. function setBomHandlers() {
  2423. const bom = document.getElementById('bomtable');
  2424. let dragName;
  2425. let placeHolderElements;
  2426. let draggingElement;
  2427. let forcePopulation;
  2428. let xOffset;
  2429. let yOffset;
  2430. let wasDragged;
  2431. const mouseUpHandler = function(e) {
  2432. // Delete dragging element
  2433. draggingElement.remove();
  2434. // Make BOM selectable again
  2435. bom.style.removeProperty("userSelect");
  2436. // Remove listeners
  2437. document.removeEventListener('mousemove', mouseMoveHandler);
  2438. document.removeEventListener('mouseup', mouseUpHandler);
  2439. if (wasDragged) {
  2440. // Redraw whole BOM
  2441. populateBomTable();
  2442. }
  2443. }
  2444. const mouseMoveHandler = function(e) {
  2445. // Notice the dragging
  2446. wasDragged = true;
  2447. // Make the dragged element visible
  2448. draggingElement.style.removeProperty("display");
  2449. // Set elements position to mouse position
  2450. draggingElement.style.left = `${e.screenX - xOffset}px`;
  2451. draggingElement.style.top = `${e.screenY - yOffset}px`;
  2452. // Forced redrawing of BOM table
  2453. if (forcePopulation) {
  2454. forcePopulation = false;
  2455. // Copy array
  2456. phe = Array.from(placeHolderElements);
  2457. // populate BOM table again
  2458. populateBomHeader(dragName, phe);
  2459. populateBomBody(dragName, phe);
  2460. }
  2461. // Set up array of hidden columns
  2462. var hiddenColumns = Array.from(settings.hiddenColumns);
  2463. // In the ungrouped mode, quantity don't exist
  2464. if (settings.bommode === "ungrouped")
  2465. hiddenColumns.push("Quantity");
  2466. // If no checkbox fields can be found, we consider them hidden
  2467. if (settings.checkboxes.length == 0)
  2468. hiddenColumns.push("checkboxes");
  2469. // Get table headers and group them into checkboxes, extrafields and normal headers
  2470. const bh = document.getElementById("bomhead");
  2471. headers = Array.from(bh.querySelectorAll("th"))
  2472. headers.shift() // numCol is not part of the columnOrder
  2473. headerGroups = []
  2474. lastCompoundClass = null;
  2475. for (i = 0; i < settings.columnOrder.length; i++) {
  2476. cElem = settings.columnOrder[i];
  2477. if (hiddenColumns.includes(cElem)) {
  2478. // Hidden columns appear as a dummy element
  2479. headerGroups.push([]);
  2480. continue;
  2481. }
  2482. elem = headers.filter(e => getColumnOrderName(e) === cElem)[0];
  2483. if (elem.classList.contains("bom-checkbox")) {
  2484. if (lastCompoundClass === "bom-checkbox") {
  2485. cbGroup = headerGroups.pop();
  2486. cbGroup.push(elem);
  2487. headerGroups.push(cbGroup);
  2488. } else {
  2489. lastCompoundClass = "bom-checkbox";
  2490. headerGroups.push([elem])
  2491. }
  2492. } else {
  2493. headerGroups.push([elem])
  2494. }
  2495. }
  2496. // Copy settings.columnOrder
  2497. var columns = Array.from(settings.columnOrder)
  2498. // Set up array with indices of hidden columns
  2499. var hiddenIndices = hiddenColumns.map(e => settings.columnOrder.indexOf(e));
  2500. var dragIndex = columns.indexOf(dragName);
  2501. var swapIndex = dragIndex;
  2502. var swapDone = false;
  2503. // Check if the current dragged element is swapable with the left or right element
  2504. if (dragIndex > 0) {
  2505. // Get left headers boundingbox
  2506. swapIndex = dragIndex - 1;
  2507. while (hiddenIndices.includes(swapIndex) && swapIndex > 0)
  2508. swapIndex--;
  2509. if (!hiddenIndices.includes(swapIndex)) {
  2510. box = getBoundingClientRectFromMultiple(headerGroups[swapIndex]);
  2511. if (e.clientX < box.left + window.scrollX + (box.width / 2)) {
  2512. swapElement = columns[dragIndex];
  2513. columns.splice(dragIndex, 1);
  2514. columns.splice(swapIndex, 0, swapElement);
  2515. forcePopulation = true;
  2516. swapDone = true;
  2517. }
  2518. }
  2519. }
  2520. if ((!swapDone) && dragIndex < headerGroups.length - 1) {
  2521. // Get right headers boundingbox
  2522. swapIndex = dragIndex + 1;
  2523. while (hiddenIndices.includes(swapIndex))
  2524. swapIndex++;
  2525. if (swapIndex < headerGroups.length) {
  2526. box = getBoundingClientRectFromMultiple(headerGroups[swapIndex]);
  2527. if (e.clientX > box.left + window.scrollX + (box.width / 2)) {
  2528. swapElement = columns[dragIndex];
  2529. columns.splice(dragIndex, 1);
  2530. columns.splice(swapIndex, 0, swapElement);
  2531. forcePopulation = true;
  2532. swapDone = true;
  2533. }
  2534. }
  2535. }
  2536. // Write back change to storage
  2537. if (swapDone) {
  2538. settings.columnOrder = columns
  2539. writeStorage("columnOrder", JSON.stringify(columns));
  2540. }
  2541. }
  2542. const mouseDownHandler = function(e) {
  2543. var target = e.target;
  2544. if (target.tagName.toLowerCase() != "td")
  2545. target = target.parentElement;
  2546. // Used to check if a dragging has ever happened
  2547. wasDragged = false;
  2548. // Create new element which will be displayed as the dragged column
  2549. draggingElement = document.createElement("div")
  2550. draggingElement.classList.add("dragging");
  2551. draggingElement.style.display = "none";
  2552. draggingElement.style.position = "absolute";
  2553. draggingElement.style.overflow = "hidden";
  2554. // Get bomhead and bombody elements
  2555. const bh = document.getElementById("bomhead");
  2556. const bb = document.getElementById("bombody");
  2557. // Get all compound headers for the current column
  2558. var compoundHeaders;
  2559. if (target.classList.contains("bom-checkbox")) {
  2560. compoundHeaders = Array.from(bh.querySelectorAll("th.bom-checkbox"));
  2561. } else {
  2562. compoundHeaders = [target];
  2563. }
  2564. // Create new table which will display the column
  2565. var newTable = document.createElement("table");
  2566. newTable.classList.add("bom");
  2567. newTable.style.background = "white";
  2568. draggingElement.append(newTable);
  2569. // Create new header element
  2570. var newHeader = document.createElement("thead");
  2571. newTable.append(newHeader);
  2572. // Set up array for storing all placeholder elements
  2573. placeHolderElements = [];
  2574. // Add all compound headers to the new thead element and placeholders
  2575. compoundHeaders.forEach(function(h) {
  2576. clone = cloneElementWithDimensions(h);
  2577. newHeader.append(clone);
  2578. placeHolderElements.push(clone);
  2579. });
  2580. // Create new body element
  2581. var newBody = document.createElement("tbody");
  2582. newTable.append(newBody);
  2583. // Get indices for compound headers
  2584. var idxs = compoundHeaders.map(e => getBomTableHeaderIndex(e));
  2585. // For each row in the BOM body...
  2586. var rows = bb.querySelectorAll("tr");
  2587. rows.forEach(function(row) {
  2588. // ..get the cells for the compound column
  2589. const tds = row.querySelectorAll("td");
  2590. var copytds = idxs.map(i => tds[i]);
  2591. // Add them to the new element and the placeholders
  2592. var newRow = document.createElement("tr");
  2593. copytds.forEach(function(td) {
  2594. clone = cloneElementWithDimensions(td);
  2595. newRow.append(clone);
  2596. placeHolderElements.push(clone);
  2597. });
  2598. newBody.append(newRow);
  2599. });
  2600. // Compute width for compound header
  2601. var width = compoundHeaders.reduce((acc, x) => acc + x.clientWidth, 0);
  2602. draggingElement.style.width = `${width}px`;
  2603. // Insert the new dragging element and disable selection on BOM
  2604. bom.insertBefore(draggingElement, null);
  2605. bom.style.userSelect = "none";
  2606. // Determine the mouse position offset
  2607. xOffset = e.screenX - compoundHeaders.reduce((acc, x) => Math.min(acc, x.offsetLeft), compoundHeaders[0].offsetLeft);
  2608. yOffset = e.screenY - compoundHeaders[0].offsetTop;
  2609. // Get name for the column in settings.columnOrder
  2610. dragName = getColumnOrderName(target);
  2611. // Change text and class for placeholder elements
  2612. placeHolderElements = placeHolderElements.map(function(e) {
  2613. newElem = cloneElementWithDimensions(e);
  2614. newElem.textContent = "";
  2615. newElem.classList.add("placeholder");
  2616. return newElem;
  2617. });
  2618. // On next mouse move, the whole BOM needs to be redrawn to show the placeholders
  2619. forcePopulation = true;
  2620. // Add listeners for move and up on mouse
  2621. document.addEventListener('mousemove', mouseMoveHandler);
  2622. document.addEventListener('mouseup', mouseUpHandler);
  2623. }
  2624. // In netlist mode, there is nothing to reorder
  2625. if (settings.bommode === "netlist")
  2626. return;
  2627. // Add mouseDownHandler to every column except the numCol
  2628. bom.querySelectorAll("th")
  2629. .forEach(function(head) {
  2630. if (!head.classList.contains("numCol")) {
  2631. head.onmousedown = mouseDownHandler;
  2632. }
  2633. });
  2634. }
  2635. function getBoundingClientRectFromMultiple(elements) {
  2636. var elems = Array.from(elements);
  2637. if (elems.length == 0)
  2638. return null;
  2639. var box = elems.shift()
  2640. .getBoundingClientRect();
  2641. elems.forEach(function(elem) {
  2642. var elembox = elem.getBoundingClientRect();
  2643. box.left = Math.min(elembox.left, box.left);
  2644. box.top = Math.min(elembox.top, box.top);
  2645. box.width += elembox.width;
  2646. box.height = Math.max(elembox.height, box.height);
  2647. });
  2648. return box;
  2649. }
  2650. function cloneElementWithDimensions(elem) {
  2651. var newElem = elem.cloneNode(true);
  2652. newElem.style.height = window.getComputedStyle(elem).height;
  2653. newElem.style.width = window.getComputedStyle(elem).width;
  2654. return newElem;
  2655. }
  2656. function getBomTableHeaderIndex(elem) {
  2657. const bh = document.getElementById('bomhead');
  2658. const ths = Array.from(bh.querySelectorAll("th"));
  2659. return ths.indexOf(elem);
  2660. }
  2661. function getColumnOrderName(elem) {
  2662. var cname = elem.getAttribute("col_name");
  2663. if (cname === "bom-checkbox")
  2664. return "checkboxes";
  2665. else
  2666. return cname;
  2667. }
  2668. function resizableGrid(tablehead) {
  2669. var cols = tablehead.firstElementChild.children;
  2670. var rowWidth = tablehead.offsetWidth;
  2671. for (var i = 1; i < cols.length; i++) {
  2672. if (cols[i].classList.contains("bom-checkbox"))
  2673. continue;
  2674. cols[i].style.width = ((cols[i].clientWidth - paddingDiff(cols[i])) * 100 / rowWidth) + '%';
  2675. }
  2676. for (var i = 1; i < cols.length - 1; i++) {
  2677. var div = document.createElement('div');
  2678. div.className = "column-width-handle";
  2679. cols[i].appendChild(div);
  2680. setListeners(div);
  2681. }
  2682. function setListeners(div) {
  2683. var startX, curCol, nxtCol, curColWidth, nxtColWidth, rowWidth;
  2684. div.addEventListener('mousedown', function(e) {
  2685. e.preventDefault();
  2686. e.stopPropagation();
  2687. curCol = e.target.parentElement;
  2688. nxtCol = curCol.nextElementSibling;
  2689. startX = e.pageX;
  2690. var padding = paddingDiff(curCol);
  2691. rowWidth = curCol.parentElement.offsetWidth;
  2692. curColWidth = curCol.clientWidth - padding;
  2693. nxtColWidth = nxtCol.clientWidth - padding;
  2694. });
  2695. document.addEventListener('mousemove', function(e) {
  2696. if (startX) {
  2697. var diffX = e.pageX - startX;
  2698. diffX = -Math.min(-diffX, curColWidth - 20);
  2699. diffX = Math.min(diffX, nxtColWidth - 20);
  2700. curCol.style.width = ((curColWidth + diffX) * 100 / rowWidth) + '%';
  2701. nxtCol.style.width = ((nxtColWidth - diffX) * 100 / rowWidth) + '%';
  2702. console.log(`${curColWidth + nxtColWidth} ${(curColWidth + diffX) * 100 / rowWidth + (nxtColWidth - diffX) * 100 / rowWidth}`);
  2703. }
  2704. });
  2705. document.addEventListener('mouseup', function(e) {
  2706. curCol = undefined;
  2707. nxtCol = undefined;
  2708. startX = undefined;
  2709. nxtColWidth = undefined;
  2710. curColWidth = undefined
  2711. });
  2712. }
  2713. function paddingDiff(col) {
  2714. if (getStyleVal(col, 'box-sizing') == 'border-box') {
  2715. return 0;
  2716. }
  2717. var padLeft = getStyleVal(col, 'padding-left');
  2718. var padRight = getStyleVal(col, 'padding-right');
  2719. return (parseInt(padLeft) + parseInt(padRight));
  2720. }
  2721. function getStyleVal(elm, css) {
  2722. return (window.getComputedStyle(elm, null).getPropertyValue(css))
  2723. }
  2724. }
  2725. ///////////////////////////////////////////////
  2726. ///////////////////////////////////////////////
  2727. /* DOM manipulation and misc code */
  2728. var bomsplit;
  2729. var canvassplit;
  2730. var initDone = false;
  2731. var bomSortFunction = null;
  2732. var currentSortColumn = null;
  2733. var currentSortOrder = null;
  2734. var currentHighlightedRowId;
  2735. var highlightHandlers = [];
  2736. var footprintIndexToHandler = {};
  2737. var netsToHandler = {};
  2738. var markedFootprints = new Set();
  2739. var highlightedFootprints = [];
  2740. var highlightedNet = null;
  2741. var lastClicked;
  2742. function dbg(html) {
  2743. dbgdiv.innerHTML = html;
  2744. }
  2745. function redrawIfInitDone() {
  2746. if (initDone) {
  2747. redrawCanvas(allcanvas.front);
  2748. redrawCanvas(allcanvas.back);
  2749. }
  2750. }
  2751. function padsVisible(value) {
  2752. writeStorage("padsVisible", value);
  2753. settings.renderPads = value;
  2754. redrawIfInitDone();
  2755. }
  2756. function referencesVisible(value) {
  2757. writeStorage("referencesVisible", value);
  2758. settings.renderReferences = value;
  2759. redrawIfInitDone();
  2760. }
  2761. function valuesVisible(value) {
  2762. writeStorage("valuesVisible", value);
  2763. settings.renderValues = value;
  2764. redrawIfInitDone();
  2765. }
  2766. function tracksVisible(value) {
  2767. writeStorage("tracksVisible", value);
  2768. settings.renderTracks = value;
  2769. redrawIfInitDone();
  2770. }
  2771. function zonesVisible(value) {
  2772. writeStorage("zonesVisible", value);
  2773. settings.renderZones = value;
  2774. redrawIfInitDone();
  2775. }
  2776. function dnpOutline(value) {
  2777. writeStorage("dnpOutline", value);
  2778. settings.renderDnpOutline = value;
  2779. redrawIfInitDone();
  2780. }
  2781. function setDarkMode(value) {
  2782. if (value) {
  2783. topmostdiv.classList.add("dark");
  2784. } else {
  2785. topmostdiv.classList.remove("dark");
  2786. }
  2787. writeStorage("darkmode", value);
  2788. settings.darkMode = value;
  2789. redrawIfInitDone();
  2790. if (initDone) {
  2791. populateBomTable();
  2792. }
  2793. }
  2794. function setShowBOMColumn(field, value) {
  2795. if (field === "references") {
  2796. var rl = document.getElementById("reflookup");
  2797. rl.disabled = !value;
  2798. if (!value) {
  2799. rl.value = "";
  2800. updateRefLookup("");
  2801. }
  2802. }
  2803. var n = settings.hiddenColumns.indexOf(field);
  2804. if (value) {
  2805. if (n != -1) {
  2806. settings.hiddenColumns.splice(n, 1);
  2807. }
  2808. } else {
  2809. if (n == -1) {
  2810. settings.hiddenColumns.push(field);
  2811. }
  2812. }
  2813. writeStorage("hiddenColumns", JSON.stringify(settings.hiddenColumns));
  2814. if (initDone) {
  2815. populateBomTable();
  2816. }
  2817. redrawIfInitDone();
  2818. }
  2819. function setFullscreen(value) {
  2820. if (value) {
  2821. document.documentElement.requestFullscreen();
  2822. } else {
  2823. document.exitFullscreen();
  2824. }
  2825. }
  2826. function fabricationVisible(value) {
  2827. writeStorage("fabricationVisible", value);
  2828. settings.renderFabrication = value;
  2829. redrawIfInitDone();
  2830. }
  2831. function silkscreenVisible(value) {
  2832. writeStorage("silkscreenVisible", value);
  2833. settings.renderSilkscreen = value;
  2834. redrawIfInitDone();
  2835. }
  2836. function setHighlightPin1(value) {
  2837. writeStorage("highlightpin1", value);
  2838. settings.highlightpin1 = value;
  2839. redrawIfInitDone();
  2840. }
  2841. function getStoredCheckboxRefs(checkbox) {
  2842. function convert(ref) {
  2843. var intref = parseInt(ref);
  2844. if (isNaN(intref)) {
  2845. for (var i = 0; i < pcbdata.footprints.length; i++) {
  2846. if (pcbdata.footprints[i].ref == ref) {
  2847. return i;
  2848. }
  2849. }
  2850. return -1;
  2851. } else {
  2852. return intref;
  2853. }
  2854. }
  2855. if (!(checkbox in settings.checkboxStoredRefs)) {
  2856. var val = readStorage("checkbox_" + checkbox);
  2857. settings.checkboxStoredRefs[checkbox] = val ? val : "";
  2858. }
  2859. if (!settings.checkboxStoredRefs[checkbox]) {
  2860. return new Set();
  2861. } else {
  2862. return new Set(settings.checkboxStoredRefs[checkbox].split(",").map(r => convert(r)).filter(a => a >= 0));
  2863. }
  2864. }
  2865. function getCheckboxState(checkbox, references) {
  2866. var storedRefsSet = getStoredCheckboxRefs(checkbox);
  2867. var currentRefsSet = new Set(references.map(r => r[1]));
  2868. // Get difference of current - stored
  2869. var difference = new Set(currentRefsSet);
  2870. for (ref of storedRefsSet) {
  2871. difference.delete(ref);
  2872. }
  2873. if (difference.size == 0) {
  2874. // All the current refs are stored
  2875. return "checked";
  2876. } else if (difference.size == currentRefsSet.size) {
  2877. // None of the current refs are stored
  2878. return "unchecked";
  2879. } else {
  2880. // Some of the refs are stored
  2881. return "indeterminate";
  2882. }
  2883. }
  2884. function setBomCheckboxState(checkbox, element, references) {
  2885. var state = getCheckboxState(checkbox, references);
  2886. element.checked = (state == "checked");
  2887. element.indeterminate = (state == "indeterminate");
  2888. }
  2889. function createCheckboxChangeHandler(checkbox, references, row) {
  2890. return function () {
  2891. refsSet = getStoredCheckboxRefs(checkbox);
  2892. var markWhenChecked = settings.markWhenChecked == checkbox;
  2893. eventArgs = {
  2894. checkbox: checkbox,
  2895. refs: references,
  2896. }
  2897. if (this.checked) {
  2898. // checkbox ticked
  2899. for (var ref of references) {
  2900. refsSet.add(ref[1]);
  2901. }
  2902. if (markWhenChecked) {
  2903. row.classList.add("checked");
  2904. for (var ref of references) {
  2905. markedFootprints.add(ref[1]);
  2906. }
  2907. drawHighlights();
  2908. }
  2909. eventArgs.state = 'checked';
  2910. } else {
  2911. // checkbox unticked
  2912. for (var ref of references) {
  2913. refsSet.delete(ref[1]);
  2914. }
  2915. if (markWhenChecked) {
  2916. row.classList.remove("checked");
  2917. for (var ref of references) {
  2918. markedFootprints.delete(ref[1]);
  2919. }
  2920. drawHighlights();
  2921. }
  2922. eventArgs.state = 'unchecked';
  2923. }
  2924. settings.checkboxStoredRefs[checkbox] = [...refsSet].join(",");
  2925. writeStorage("checkbox_" + checkbox, settings.checkboxStoredRefs[checkbox]);
  2926. updateCheckboxStats(checkbox);
  2927. EventHandler.emitEvent(IBOM_EVENT_TYPES.CHECKBOX_CHANGE_EVENT, eventArgs);
  2928. }
  2929. }
  2930. function clearHighlightedFootprints() {
  2931. if (currentHighlightedRowId) {
  2932. document.getElementById(currentHighlightedRowId).classList.remove("highlighted");
  2933. currentHighlightedRowId = null;
  2934. highlightedFootprints = [];
  2935. highlightedNet = null;
  2936. }
  2937. }
  2938. function createRowHighlightHandler(rowid, refs, net) {
  2939. return function () {
  2940. if (currentHighlightedRowId) {
  2941. if (currentHighlightedRowId == rowid) {
  2942. return;
  2943. }
  2944. document.getElementById(currentHighlightedRowId).classList.remove("highlighted");
  2945. }
  2946. document.getElementById(rowid).classList.add("highlighted");
  2947. currentHighlightedRowId = rowid;
  2948. highlightedFootprints = refs ? refs.map(r => r[1]) : [];
  2949. highlightedNet = net;
  2950. drawHighlights();
  2951. EventHandler.emitEvent(
  2952. IBOM_EVENT_TYPES.HIGHLIGHT_EVENT, {
  2953. rowid: rowid,
  2954. refs: refs,
  2955. net: net
  2956. });
  2957. }
  2958. }
  2959. function updateNetColors() {
  2960. writeStorage("netColors", JSON.stringify(settings.netColors));
  2961. redrawIfInitDone();
  2962. }
  2963. function netColorChangeHandler(net) {
  2964. return (event) => {
  2965. settings.netColors[net] = event.target.value;
  2966. updateNetColors();
  2967. }
  2968. }
  2969. function netColorRightClick(net) {
  2970. return (event) => {
  2971. if (event.button == 2) {
  2972. event.preventDefault();
  2973. event.stopPropagation();
  2974. var style = getComputedStyle(topmostdiv);
  2975. var defaultNetColor = style.getPropertyValue('--track-color').trim();
  2976. event.target.value = defaultNetColor;
  2977. delete settings.netColors[net];
  2978. updateNetColors();
  2979. }
  2980. }
  2981. }
  2982. function entryMatches(entry) {
  2983. if (settings.bommode == "netlist") {
  2984. // entry is just a net name
  2985. return entry.toLowerCase().indexOf(filter) >= 0;
  2986. }
  2987. // check refs
  2988. if (!settings.hiddenColumns.includes("references")) {
  2989. for (var ref of entry) {
  2990. if (ref[0].toLowerCase().indexOf(filter) >= 0) {
  2991. return true;
  2992. }
  2993. }
  2994. }
  2995. // check fields
  2996. for (var i in config.fields) {
  2997. var f = config.fields[i];
  2998. if (!settings.hiddenColumns.includes(f)) {
  2999. for (var ref of entry) {
  3000. if (String(pcbdata.bom.fields[ref[1]][i]).toLowerCase().indexOf(filter) >= 0) {
  3001. return true;
  3002. }
  3003. }
  3004. }
  3005. }
  3006. return false;
  3007. }
  3008. function findRefInEntry(entry) {
  3009. return entry.filter(r => r[0].toLowerCase() == reflookup);
  3010. }
  3011. function highlightFilter(s) {
  3012. if (!filter) {
  3013. return s;
  3014. }
  3015. var parts = s.toLowerCase().split(filter);
  3016. if (parts.length == 1) {
  3017. return s;
  3018. }
  3019. var r = "";
  3020. var pos = 0;
  3021. for (var i in parts) {
  3022. if (i > 0) {
  3023. r += '<mark class="highlight">' +
  3024. s.substring(pos, pos + filter.length) +
  3025. '</mark>';
  3026. pos += filter.length;
  3027. }
  3028. r += s.substring(pos, pos + parts[i].length);
  3029. pos += parts[i].length;
  3030. }
  3031. return r;
  3032. }
  3033. function checkboxSetUnsetAllHandler(checkboxname) {
  3034. return function () {
  3035. var checkboxnum = 0;
  3036. while (checkboxnum < settings.checkboxes.length &&
  3037. settings.checkboxes[checkboxnum].toLowerCase() != checkboxname.toLowerCase()) {
  3038. checkboxnum++;
  3039. }
  3040. if (checkboxnum >= settings.checkboxes.length) {
  3041. return;
  3042. }
  3043. var allset = true;
  3044. var checkbox;
  3045. var row;
  3046. for (row of bombody.childNodes) {
  3047. checkbox = row.childNodes[checkboxnum + 1].childNodes[0];
  3048. if (!checkbox.checked || checkbox.indeterminate) {
  3049. allset = false;
  3050. break;
  3051. }
  3052. }
  3053. for (row of bombody.childNodes) {
  3054. checkbox = row.childNodes[checkboxnum + 1].childNodes[0];
  3055. checkbox.checked = !allset;
  3056. checkbox.indeterminate = false;
  3057. checkbox.onchange();
  3058. }
  3059. }
  3060. }
  3061. function createColumnHeader(name, cls, comparator, is_checkbox = false) {
  3062. var th = document.createElement("TH");
  3063. th.innerHTML = name;
  3064. th.classList.add(cls);
  3065. if (is_checkbox)
  3066. th.setAttribute("col_name", "bom-checkbox");
  3067. else
  3068. th.setAttribute("col_name", name);
  3069. var span = document.createElement("SPAN");
  3070. span.classList.add("sortmark");
  3071. span.classList.add("none");
  3072. th.appendChild(span);
  3073. var spacer = document.createElement("div");
  3074. spacer.className = "column-spacer";
  3075. th.appendChild(spacer);
  3076. spacer.onclick = function () {
  3077. if (currentSortColumn && th !== currentSortColumn) {
  3078. // Currently sorted by another column
  3079. currentSortColumn.childNodes[1].classList.remove(currentSortOrder);
  3080. currentSortColumn.childNodes[1].classList.add("none");
  3081. currentSortColumn = null;
  3082. currentSortOrder = null;
  3083. }
  3084. if (currentSortColumn && th === currentSortColumn) {
  3085. // Already sorted by this column
  3086. if (currentSortOrder == "asc") {
  3087. // Sort by this column, descending order
  3088. bomSortFunction = function (a, b) {
  3089. return -comparator(a, b);
  3090. }
  3091. currentSortColumn.childNodes[1].classList.remove("asc");
  3092. currentSortColumn.childNodes[1].classList.add("desc");
  3093. currentSortOrder = "desc";
  3094. } else {
  3095. // Unsort
  3096. bomSortFunction = null;
  3097. currentSortColumn.childNodes[1].classList.remove("desc");
  3098. currentSortColumn.childNodes[1].classList.add("none");
  3099. currentSortColumn = null;
  3100. currentSortOrder = null;
  3101. }
  3102. } else {
  3103. // Sort by this column, ascending order
  3104. bomSortFunction = comparator;
  3105. currentSortColumn = th;
  3106. currentSortColumn.childNodes[1].classList.remove("none");
  3107. currentSortColumn.childNodes[1].classList.add("asc");
  3108. currentSortOrder = "asc";
  3109. }
  3110. populateBomBody();
  3111. }
  3112. if (is_checkbox) {
  3113. spacer.onclick = fancyDblClickHandler(
  3114. spacer, spacer.onclick, checkboxSetUnsetAllHandler(name));
  3115. }
  3116. return th;
  3117. }
  3118. function populateBomHeader(placeHolderColumn = null, placeHolderElements = null) {
  3119. while (bomhead.firstChild) {
  3120. bomhead.removeChild(bomhead.firstChild);
  3121. }
  3122. var tr = document.createElement("TR");
  3123. var th = document.createElement("TH");
  3124. th.classList.add("numCol");
  3125. var vismenu = document.createElement("div");
  3126. vismenu.id = "vismenu";
  3127. vismenu.classList.add("menu");
  3128. var visbutton = document.createElement("div");
  3129. visbutton.classList.add("visbtn");
  3130. visbutton.classList.add("hideonprint");
  3131. var viscontent = document.createElement("div");
  3132. viscontent.classList.add("menu-content");
  3133. viscontent.id = "vismenu-content";
  3134. settings.columnOrder.forEach(column => {
  3135. if (typeof column !== "string")
  3136. return;
  3137. // Skip empty columns
  3138. if (column === "checkboxes" && settings.checkboxes.length == 0)
  3139. return;
  3140. else if (column === "Quantity" && settings.bommode == "ungrouped")
  3141. return;
  3142. var label = document.createElement("label");
  3143. label.classList.add("menu-label");
  3144. var input = document.createElement("input");
  3145. input.classList.add("visibility_checkbox");
  3146. input.type = "checkbox";
  3147. input.onchange = function (e) {
  3148. setShowBOMColumn(column, e.target.checked)
  3149. };
  3150. input.checked = !(settings.hiddenColumns.includes(column));
  3151. label.appendChild(input);
  3152. if (column.length > 0)
  3153. label.append(column[0].toUpperCase() + column.slice(1));
  3154. viscontent.appendChild(label);
  3155. });
  3156. viscontent.childNodes[0].classList.add("menu-label-top");
  3157. vismenu.appendChild(visbutton);
  3158. if (settings.bommode != "netlist") {
  3159. vismenu.appendChild(viscontent);
  3160. th.appendChild(vismenu);
  3161. }
  3162. tr.appendChild(th);
  3163. var checkboxCompareClosure = function (checkbox) {
  3164. return (a, b) => {
  3165. var stateA = getCheckboxState(checkbox, a);
  3166. var stateB = getCheckboxState(checkbox, b);
  3167. if (stateA > stateB) return -1;
  3168. if (stateA < stateB) return 1;
  3169. return 0;
  3170. }
  3171. }
  3172. var stringFieldCompareClosure = function (fieldIndex) {
  3173. return (a, b) => {
  3174. var fa = pcbdata.bom.fields[a[0][1]][fieldIndex];
  3175. var fb = pcbdata.bom.fields[b[0][1]][fieldIndex];
  3176. if (fa != fb) return fa > fb ? 1 : -1;
  3177. else return 0;
  3178. }
  3179. }
  3180. var referenceRegex = /(?<prefix>[^0-9]+)(?<number>[0-9]+)/;
  3181. var compareRefs = (a, b) => {
  3182. var ra = referenceRegex.exec(a);
  3183. var rb = referenceRegex.exec(b);
  3184. if (ra === null || rb === null) {
  3185. if (a != b) return a > b ? 1 : -1;
  3186. return 0;
  3187. } else {
  3188. if (ra.groups.prefix != rb.groups.prefix) {
  3189. return ra.groups.prefix > rb.groups.prefix ? 1 : -1;
  3190. }
  3191. if (ra.groups.number != rb.groups.number) {
  3192. return parseInt(ra.groups.number) > parseInt(rb.groups.number) ? 1 : -1;
  3193. }
  3194. return 0;
  3195. }
  3196. }
  3197. if (settings.bommode == "netlist") {
  3198. tr.appendChild(createColumnHeader("Net name", "bom-netname", (a, b) => {
  3199. if (a > b) return -1;
  3200. if (a < b) return 1;
  3201. return 0;
  3202. }));
  3203. tr.appendChild(createColumnHeader("Color", "bom-color", (a, b) => {
  3204. return 0;
  3205. }));
  3206. } else {
  3207. // Filter hidden columns
  3208. var columns = settings.columnOrder.filter(e => !settings.hiddenColumns.includes(e));
  3209. var valueIndex = config.fields.indexOf("Value");
  3210. var footprintIndex = config.fields.indexOf("Footprint");
  3211. columns.forEach((column) => {
  3212. if (column === placeHolderColumn) {
  3213. var n = 1;
  3214. if (column === "checkboxes")
  3215. n = settings.checkboxes.length;
  3216. for (i = 0; i < n; i++) {
  3217. td = placeHolderElements.shift();
  3218. tr.appendChild(td);
  3219. }
  3220. return;
  3221. } else if (column === "checkboxes") {
  3222. for (var checkbox of settings.checkboxes) {
  3223. th = createColumnHeader(
  3224. checkbox, "bom-checkbox", checkboxCompareClosure(checkbox), true);
  3225. tr.appendChild(th);
  3226. }
  3227. } else if (column === "References") {
  3228. tr.appendChild(createColumnHeader("References", "references", (a, b) => {
  3229. var i = 0;
  3230. while (i < a.length && i < b.length) {
  3231. if (a[i] != b[i]) return compareRefs(a[i][0], b[i][0]);
  3232. i++;
  3233. }
  3234. return a.length - b.length;
  3235. }));
  3236. } else if (column === "Value") {
  3237. tr.appendChild(createColumnHeader("Value", "value", (a, b) => {
  3238. var ra = a[0][1], rb = b[0][1];
  3239. return valueCompare(
  3240. pcbdata.bom.parsedValues[ra], pcbdata.bom.parsedValues[rb],
  3241. pcbdata.bom.fields[ra][valueIndex], pcbdata.bom.fields[rb][valueIndex]);
  3242. }));
  3243. return;
  3244. } else if (column === "Footprint") {
  3245. tr.appendChild(createColumnHeader(
  3246. "Footprint", "footprint", stringFieldCompareClosure(footprintIndex)));
  3247. } else if (column === "Quantity" && settings.bommode == "grouped") {
  3248. tr.appendChild(createColumnHeader("Quantity", "quantity", (a, b) => {
  3249. return a.length - b.length;
  3250. }));
  3251. } else {
  3252. // Other fields
  3253. var i = config.fields.indexOf(column);
  3254. if (i < 0)
  3255. return;
  3256. tr.appendChild(createColumnHeader(
  3257. column, `field${i + 1}`, stringFieldCompareClosure(i)));
  3258. }
  3259. });
  3260. }
  3261. bomhead.appendChild(tr);
  3262. }
  3263. function populateBomBody(placeholderColumn = null, placeHolderElements = null) {
  3264. const urlRegex = /^(https?:\/\/[^\s\/$.?#][^\s]*|file:\/\/([a-zA-Z]:|\/)[^\x00]+)$/;
  3265. while (bom.firstChild) {
  3266. bom.removeChild(bom.firstChild);
  3267. }
  3268. highlightHandlers = [];
  3269. footprintIndexToHandler = {};
  3270. netsToHandler = {};
  3271. currentHighlightedRowId = null;
  3272. var first = true;
  3273. var style = getComputedStyle(topmostdiv);
  3274. var defaultNetColor = style.getPropertyValue('--track-color').trim();
  3275. if (settings.bommode == "netlist") {
  3276. bomtable = pcbdata.nets.slice();
  3277. } else {
  3278. switch (settings.canvaslayout) {
  3279. case 'F':
  3280. bomtable = pcbdata.bom.F.slice();
  3281. break;
  3282. case 'FB':
  3283. bomtable = pcbdata.bom.both.slice();
  3284. break;
  3285. case 'B':
  3286. bomtable = pcbdata.bom.B.slice();
  3287. break;
  3288. }
  3289. if (settings.bommode == "ungrouped") {
  3290. // expand bom table
  3291. expandedTable = []
  3292. for (var bomentry of bomtable) {
  3293. for (var ref of bomentry) {
  3294. expandedTable.push([ref]);
  3295. }
  3296. }
  3297. bomtable = expandedTable;
  3298. }
  3299. }
  3300. if (bomSortFunction) {
  3301. bomtable = bomtable.sort(bomSortFunction);
  3302. }
  3303. for (var i in bomtable) {
  3304. var bomentry = bomtable[i];
  3305. if (filter && !entryMatches(bomentry)) {
  3306. continue;
  3307. }
  3308. var references = null;
  3309. var netname = null;
  3310. var tr = document.createElement("TR");
  3311. var td = document.createElement("TD");
  3312. var rownum = +i + 1;
  3313. tr.id = "bomrow" + rownum;
  3314. td.textContent = rownum;
  3315. tr.appendChild(td);
  3316. if (settings.bommode == "netlist") {
  3317. netname = bomentry;
  3318. td = document.createElement("TD");
  3319. td.innerHTML = highlightFilter(netname ? netname : "&lt;no net&gt;");
  3320. tr.appendChild(td);
  3321. var color = settings.netColors[netname] || defaultNetColor;
  3322. td = document.createElement("TD");
  3323. var colorBox = document.createElement("INPUT");
  3324. colorBox.type = "color";
  3325. colorBox.value = color;
  3326. colorBox.onchange = netColorChangeHandler(netname);
  3327. colorBox.onmouseup = netColorRightClick(netname);
  3328. colorBox.oncontextmenu = (e) => e.preventDefault();
  3329. td.appendChild(colorBox);
  3330. td.classList.add("color-column");
  3331. tr.appendChild(td);
  3332. } else {
  3333. if (reflookup) {
  3334. references = findRefInEntry(bomentry);
  3335. if (references.length == 0) {
  3336. continue;
  3337. }
  3338. } else {
  3339. references = bomentry;
  3340. }
  3341. // Filter hidden columns
  3342. var columns = settings.columnOrder.filter(e => !settings.hiddenColumns.includes(e));
  3343. columns.forEach((column) => {
  3344. if (column === placeholderColumn) {
  3345. var n = 1;
  3346. if (column === "checkboxes")
  3347. n = settings.checkboxes.length;
  3348. for (i = 0; i < n; i++) {
  3349. td = placeHolderElements.shift();
  3350. tr.appendChild(td);
  3351. }
  3352. return;
  3353. } else if (column === "checkboxes") {
  3354. for (var checkbox of settings.checkboxes) {
  3355. if (checkbox) {
  3356. td = document.createElement("TD");
  3357. var input = document.createElement("input");
  3358. input.type = "checkbox";
  3359. input.onchange = createCheckboxChangeHandler(checkbox, references, tr);
  3360. setBomCheckboxState(checkbox, input, references);
  3361. if (input.checked && settings.markWhenChecked == checkbox) {
  3362. tr.classList.add("checked");
  3363. }
  3364. td.appendChild(input);
  3365. tr.appendChild(td);
  3366. }
  3367. }
  3368. } else if (column === "References") {
  3369. td = document.createElement("TD");
  3370. td.innerHTML = highlightFilter(references.map(r => r[0]).join(", "));
  3371. tr.appendChild(td);
  3372. } else if (column === "Quantity" && settings.bommode == "grouped") {
  3373. // Quantity
  3374. td = document.createElement("TD");
  3375. td.textContent = references.length;
  3376. tr.appendChild(td);
  3377. } else {
  3378. // All the other fields
  3379. var field_index = config.fields.indexOf(column)
  3380. if (field_index < 0)
  3381. return;
  3382. var valueSet = new Set();
  3383. references.map(r => r[1]).forEach((id) => valueSet.add(pcbdata.bom.fields[id][field_index]));
  3384. td = document.createElement("TD");
  3385. var output = new Array();
  3386. for (let item of valueSet) {
  3387. const visible = highlightFilter(String(item));
  3388. if (typeof item === 'string' && item.match(urlRegex)) {
  3389. output.push(`<a href="${item}" target="_blank">${visible}</a>`);
  3390. } else {
  3391. output.push(visible);
  3392. }
  3393. }
  3394. td.innerHTML = output.join(", ");
  3395. tr.appendChild(td);
  3396. }
  3397. });
  3398. }
  3399. bom.appendChild(tr);
  3400. var handler = createRowHighlightHandler(tr.id, references, netname);
  3401. tr.onmousemove = handler;
  3402. highlightHandlers.push({
  3403. id: tr.id,
  3404. handler: handler,
  3405. });
  3406. if (references !== null) {
  3407. for (var refIndex of references.map(r => r[1])) {
  3408. footprintIndexToHandler[refIndex] = handler;
  3409. }
  3410. }
  3411. if (netname !== null) {
  3412. netsToHandler[netname] = handler;
  3413. }
  3414. if ((filter || reflookup) && first) {
  3415. handler();
  3416. first = false;
  3417. }
  3418. }
  3419. EventHandler.emitEvent(
  3420. IBOM_EVENT_TYPES.BOM_BODY_CHANGE_EVENT, {
  3421. filter: filter,
  3422. reflookup: reflookup,
  3423. checkboxes: settings.checkboxes,
  3424. bommode: settings.bommode,
  3425. });
  3426. }
  3427. function highlightPreviousRow() {
  3428. if (!currentHighlightedRowId) {
  3429. highlightHandlers[highlightHandlers.length - 1].handler();
  3430. } else {
  3431. if (highlightHandlers.length > 1 &&
  3432. highlightHandlers[0].id == currentHighlightedRowId) {
  3433. highlightHandlers[highlightHandlers.length - 1].handler();
  3434. } else {
  3435. for (var i = 0; i < highlightHandlers.length - 1; i++) {
  3436. if (highlightHandlers[i + 1].id == currentHighlightedRowId) {
  3437. highlightHandlers[i].handler();
  3438. break;
  3439. }
  3440. }
  3441. }
  3442. }
  3443. smoothScrollToRow(currentHighlightedRowId);
  3444. }
  3445. function highlightNextRow() {
  3446. if (!currentHighlightedRowId) {
  3447. highlightHandlers[0].handler();
  3448. } else {
  3449. if (highlightHandlers.length > 1 &&
  3450. highlightHandlers[highlightHandlers.length - 1].id == currentHighlightedRowId) {
  3451. highlightHandlers[0].handler();
  3452. } else {
  3453. for (var i = 1; i < highlightHandlers.length; i++) {
  3454. if (highlightHandlers[i - 1].id == currentHighlightedRowId) {
  3455. highlightHandlers[i].handler();
  3456. break;
  3457. }
  3458. }
  3459. }
  3460. }
  3461. smoothScrollToRow(currentHighlightedRowId);
  3462. }
  3463. function populateBomTable() {
  3464. populateBomHeader();
  3465. populateBomBody();
  3466. setBomHandlers();
  3467. resizableGrid(bomhead);
  3468. }
  3469. function footprintsClicked(footprintIndexes) {
  3470. var lastClickedIndex = footprintIndexes.indexOf(lastClicked);
  3471. for (var i = 1; i <= footprintIndexes.length; i++) {
  3472. var refIndex = footprintIndexes[(lastClickedIndex + i) % footprintIndexes.length];
  3473. if (refIndex in footprintIndexToHandler) {
  3474. lastClicked = refIndex;
  3475. footprintIndexToHandler[refIndex]();
  3476. smoothScrollToRow(currentHighlightedRowId);
  3477. break;
  3478. }
  3479. }
  3480. }
  3481. function netClicked(net) {
  3482. if (net in netsToHandler) {
  3483. netsToHandler[net]();
  3484. smoothScrollToRow(currentHighlightedRowId);
  3485. } else {
  3486. clearHighlightedFootprints();
  3487. highlightedNet = net;
  3488. drawHighlights();
  3489. }
  3490. }
  3491. function updateFilter(input) {
  3492. filter = input.toLowerCase();
  3493. populateBomTable();
  3494. }
  3495. function updateRefLookup(input) {
  3496. reflookup = input.toLowerCase();
  3497. populateBomTable();
  3498. }
  3499. function changeCanvasLayout(layout) {
  3500. document.getElementById("fl-btn").classList.remove("depressed");
  3501. document.getElementById("fb-btn").classList.remove("depressed");
  3502. document.getElementById("bl-btn").classList.remove("depressed");
  3503. switch (layout) {
  3504. case 'F':
  3505. document.getElementById("fl-btn").classList.add("depressed");
  3506. if (settings.bomlayout != "bom-only") {
  3507. canvassplit.collapse(1);
  3508. }
  3509. break;
  3510. case 'B':
  3511. document.getElementById("bl-btn").classList.add("depressed");
  3512. if (settings.bomlayout != "bom-only") {
  3513. canvassplit.collapse(0);
  3514. }
  3515. break;
  3516. default:
  3517. document.getElementById("fb-btn").classList.add("depressed");
  3518. if (settings.bomlayout != "bom-only") {
  3519. canvassplit.setSizes([50, 50]);
  3520. }
  3521. }
  3522. settings.canvaslayout = layout;
  3523. writeStorage("canvaslayout", layout);
  3524. resizeAll();
  3525. changeBomMode(settings.bommode);
  3526. }
  3527. function populateMetadata() {
  3528. document.getElementById("title").innerHTML = pcbdata.metadata.title;
  3529. document.getElementById("revision").innerHTML = "Rev: " + pcbdata.metadata.revision;
  3530. document.getElementById("company").innerHTML = pcbdata.metadata.company;
  3531. document.getElementById("filedate").innerHTML = pcbdata.metadata.date;
  3532. if (pcbdata.metadata.title != "") {
  3533. document.title = pcbdata.metadata.title + " BOM";
  3534. }
  3535. // Calculate board stats
  3536. var fp_f = 0,
  3537. fp_b = 0,
  3538. pads_f = 0,
  3539. pads_b = 0,
  3540. pads_th = 0;
  3541. for (var i = 0; i < pcbdata.footprints.length; i++) {
  3542. if (pcbdata.bom.skipped.includes(i)) continue;
  3543. var mod = pcbdata.footprints[i];
  3544. if (mod.layer == "F") {
  3545. fp_f++;
  3546. } else {
  3547. fp_b++;
  3548. }
  3549. for (var pad of mod.pads) {
  3550. if (pad.type == "th") {
  3551. pads_th++;
  3552. } else {
  3553. if (pad.layers.includes("F")) {
  3554. pads_f++;
  3555. }
  3556. if (pad.layers.includes("B")) {
  3557. pads_b++;
  3558. }
  3559. }
  3560. }
  3561. }
  3562. document.getElementById("stats-components-front").innerHTML = fp_f;
  3563. document.getElementById("stats-components-back").innerHTML = fp_b;
  3564. document.getElementById("stats-components-total").innerHTML = fp_f + fp_b;
  3565. document.getElementById("stats-groups-front").innerHTML = pcbdata.bom.F.length;
  3566. document.getElementById("stats-groups-back").innerHTML = pcbdata.bom.B.length;
  3567. document.getElementById("stats-groups-total").innerHTML = pcbdata.bom.both.length;
  3568. document.getElementById("stats-smd-pads-front").innerHTML = pads_f;
  3569. document.getElementById("stats-smd-pads-back").innerHTML = pads_b;
  3570. document.getElementById("stats-smd-pads-total").innerHTML = pads_f + pads_b;
  3571. document.getElementById("stats-th-pads").innerHTML = pads_th;
  3572. // Update version string
  3573. document.getElementById("github-link").innerHTML = "InteractiveHtmlBom&nbsp;" +
  3574. /^v\d+\.\d+/.exec(pcbdata.ibom_version)[0];
  3575. }
  3576. function changeBomLayout(layout) {
  3577. document.getElementById("bom-btn").classList.remove("depressed");
  3578. document.getElementById("lr-btn").classList.remove("depressed");
  3579. document.getElementById("tb-btn").classList.remove("depressed");
  3580. switch (layout) {
  3581. case 'bom-only':
  3582. document.getElementById("bom-btn").classList.add("depressed");
  3583. if (bomsplit) {
  3584. bomsplit.destroy();
  3585. bomsplit = null;
  3586. canvassplit.destroy();
  3587. canvassplit = null;
  3588. }
  3589. document.getElementById("frontcanvas").style.display = "none";
  3590. document.getElementById("backcanvas").style.display = "none";
  3591. document.getElementById("topmostdiv").style.height = "";
  3592. document.getElementById("topmostdiv").style.display = "block";
  3593. break;
  3594. case 'top-bottom':
  3595. document.getElementById("tb-btn").classList.add("depressed");
  3596. document.getElementById("frontcanvas").style.display = "";
  3597. document.getElementById("backcanvas").style.display = "";
  3598. document.getElementById("topmostdiv").style.height = "100%";
  3599. document.getElementById("topmostdiv").style.display = "flex";
  3600. document.getElementById("bomdiv").classList.remove("split-horizontal");
  3601. document.getElementById("canvasdiv").classList.remove("split-horizontal");
  3602. document.getElementById("frontcanvas").classList.add("split-horizontal");
  3603. document.getElementById("backcanvas").classList.add("split-horizontal");
  3604. if (bomsplit) {
  3605. bomsplit.destroy();
  3606. bomsplit = null;
  3607. canvassplit.destroy();
  3608. canvassplit = null;
  3609. }
  3610. bomsplit = Split(['#bomdiv', '#canvasdiv'], {
  3611. sizes: [50, 50],
  3612. onDragEnd: resizeAll,
  3613. direction: "vertical",
  3614. gutterSize: 5
  3615. });
  3616. canvassplit = Split(['#frontcanvas', '#backcanvas'], {
  3617. sizes: [50, 50],
  3618. gutterSize: 5,
  3619. onDragEnd: resizeAll
  3620. });
  3621. break;
  3622. case 'left-right':
  3623. document.getElementById("lr-btn").classList.add("depressed");
  3624. document.getElementById("frontcanvas").style.display = "";
  3625. document.getElementById("backcanvas").style.display = "";
  3626. document.getElementById("topmostdiv").style.height = "100%";
  3627. document.getElementById("topmostdiv").style.display = "flex";
  3628. document.getElementById("bomdiv").classList.add("split-horizontal");
  3629. document.getElementById("canvasdiv").classList.add("split-horizontal");
  3630. document.getElementById("frontcanvas").classList.remove("split-horizontal");
  3631. document.getElementById("backcanvas").classList.remove("split-horizontal");
  3632. if (bomsplit) {
  3633. bomsplit.destroy();
  3634. bomsplit = null;
  3635. canvassplit.destroy();
  3636. canvassplit = null;
  3637. }
  3638. bomsplit = Split(['#bomdiv', '#canvasdiv'], {
  3639. sizes: [50, 50],
  3640. onDragEnd: resizeAll,
  3641. gutterSize: 5
  3642. });
  3643. canvassplit = Split(['#frontcanvas', '#backcanvas'], {
  3644. sizes: [50, 50],
  3645. gutterSize: 5,
  3646. direction: "vertical",
  3647. onDragEnd: resizeAll
  3648. });
  3649. }
  3650. settings.bomlayout = layout;
  3651. writeStorage("bomlayout", layout);
  3652. changeCanvasLayout(settings.canvaslayout);
  3653. }
  3654. function changeBomMode(mode) {
  3655. document.getElementById("bom-grouped-btn").classList.remove("depressed");
  3656. document.getElementById("bom-ungrouped-btn").classList.remove("depressed");
  3657. document.getElementById("bom-netlist-btn").classList.remove("depressed");
  3658. var chkbxs = document.getElementsByClassName("visibility_checkbox");
  3659. switch (mode) {
  3660. case 'grouped':
  3661. document.getElementById("bom-grouped-btn").classList.add("depressed");
  3662. for (var i = 0; i < chkbxs.length; i++) {
  3663. chkbxs[i].disabled = false;
  3664. }
  3665. break;
  3666. case 'ungrouped':
  3667. document.getElementById("bom-ungrouped-btn").classList.add("depressed");
  3668. for (var i = 0; i < chkbxs.length; i++) {
  3669. chkbxs[i].disabled = false;
  3670. }
  3671. break;
  3672. case 'netlist':
  3673. document.getElementById("bom-netlist-btn").classList.add("depressed");
  3674. for (var i = 0; i < chkbxs.length; i++) {
  3675. chkbxs[i].disabled = true;
  3676. }
  3677. }
  3678. writeStorage("bommode", mode);
  3679. if (mode != settings.bommode) {
  3680. settings.bommode = mode;
  3681. bomSortFunction = null;
  3682. currentSortColumn = null;
  3683. currentSortOrder = null;
  3684. clearHighlightedFootprints();
  3685. }
  3686. populateBomTable();
  3687. }
  3688. function focusFilterField() {
  3689. focusInputField(document.getElementById("filter"));
  3690. }
  3691. function focusRefLookupField() {
  3692. focusInputField(document.getElementById("reflookup"));
  3693. }
  3694. function toggleBomCheckbox(bomrowid, checkboxnum) {
  3695. if (!bomrowid || checkboxnum > settings.checkboxes.length) {
  3696. return;
  3697. }
  3698. var bomrow = document.getElementById(bomrowid);
  3699. var checkbox = bomrow.childNodes[checkboxnum].childNodes[0];
  3700. checkbox.checked = !checkbox.checked;
  3701. checkbox.indeterminate = false;
  3702. checkbox.onchange();
  3703. }
  3704. function checkBomCheckbox(bomrowid, checkboxname) {
  3705. var checkboxnum = 0;
  3706. while (checkboxnum < settings.checkboxes.length &&
  3707. settings.checkboxes[checkboxnum].toLowerCase() != checkboxname.toLowerCase()) {
  3708. checkboxnum++;
  3709. }
  3710. if (!bomrowid || checkboxnum >= settings.checkboxes.length) {
  3711. return;
  3712. }
  3713. var bomrow = document.getElementById(bomrowid);
  3714. var checkbox = bomrow.childNodes[checkboxnum + 1].childNodes[0];
  3715. checkbox.checked = true;
  3716. checkbox.indeterminate = false;
  3717. checkbox.onchange();
  3718. }
  3719. function setBomCheckboxes(value) {
  3720. writeStorage("bomCheckboxes", value);
  3721. settings.checkboxes = value.split(",").map((e) => e.trim()).filter((e) => e);
  3722. prepCheckboxes();
  3723. populateMarkWhenCheckedOptions();
  3724. setMarkWhenChecked(settings.markWhenChecked);
  3725. }
  3726. function setMarkWhenChecked(value) {
  3727. writeStorage("markWhenChecked", value);
  3728. settings.markWhenChecked = value;
  3729. markedFootprints.clear();
  3730. for (var ref of (value ? getStoredCheckboxRefs(value) : [])) {
  3731. markedFootprints.add(ref);
  3732. }
  3733. populateBomTable();
  3734. drawHighlights();
  3735. }
  3736. function prepCheckboxes() {
  3737. var table = document.getElementById("checkbox-stats");
  3738. while (table.childElementCount > 1) {
  3739. table.removeChild(table.lastChild);
  3740. }
  3741. if (settings.checkboxes.length) {
  3742. table.style.display = "";
  3743. } else {
  3744. table.style.display = "none";
  3745. }
  3746. for (var checkbox of settings.checkboxes) {
  3747. var tr = document.createElement("TR");
  3748. var td = document.createElement("TD");
  3749. td.innerHTML = checkbox;
  3750. tr.appendChild(td);
  3751. td = document.createElement("TD");
  3752. td.id = "checkbox-stats-" + checkbox;
  3753. var progressbar = document.createElement("div");
  3754. progressbar.classList.add("bar");
  3755. td.appendChild(progressbar);
  3756. var text = document.createElement("div");
  3757. text.classList.add("text");
  3758. td.appendChild(text);
  3759. tr.appendChild(td);
  3760. table.appendChild(tr);
  3761. updateCheckboxStats(checkbox);
  3762. }
  3763. }
  3764. function populateMarkWhenCheckedOptions() {
  3765. var container = document.getElementById("markWhenCheckedContainer");
  3766. if (settings.checkboxes.length == 0) {
  3767. container.parentElement.style.display = "none";
  3768. return;
  3769. }
  3770. container.innerHTML = '';
  3771. container.parentElement.style.display = "inline-block";
  3772. function createOption(name, displayName) {
  3773. var id = "markWhenChecked-" + name;
  3774. var div = document.createElement("div");
  3775. div.classList.add("radio-container");
  3776. var input = document.createElement("input");
  3777. input.type = "radio";
  3778. input.name = "markWhenChecked";
  3779. input.value = name;
  3780. input.id = id;
  3781. input.onchange = () => setMarkWhenChecked(name);
  3782. div.appendChild(input);
  3783. // Preserve the selected element when the checkboxes change
  3784. if (name == settings.markWhenChecked) {
  3785. input.checked = true;
  3786. }
  3787. var label = document.createElement("label");
  3788. label.innerHTML = displayName;
  3789. label.htmlFor = id;
  3790. div.appendChild(label);
  3791. container.appendChild(div);
  3792. }
  3793. createOption("", "None");
  3794. for (var checkbox of settings.checkboxes) {
  3795. createOption(checkbox, checkbox);
  3796. }
  3797. }
  3798. function updateCheckboxStats(checkbox) {
  3799. var checked = getStoredCheckboxRefs(checkbox).size;
  3800. var total = pcbdata.footprints.length - pcbdata.bom.skipped.length;
  3801. var percent = checked * 100.0 / total;
  3802. var td = document.getElementById("checkbox-stats-" + checkbox);
  3803. td.firstChild.style.width = percent + "%";
  3804. td.lastChild.innerHTML = checked + "/" + total + " (" + Math.round(percent) + "%)";
  3805. }
  3806. function constrain(number, min, max) {
  3807. return Math.min(Math.max(parseInt(number), min), max);
  3808. }
  3809. document.onkeydown = function (e) {
  3810. switch (e.key) {
  3811. case "n":
  3812. if (document.activeElement.type == "text") {
  3813. return;
  3814. }
  3815. if (currentHighlightedRowId !== null) {
  3816. checkBomCheckbox(currentHighlightedRowId, "placed");
  3817. highlightNextRow();
  3818. e.preventDefault();
  3819. }
  3820. break;
  3821. case "ArrowUp":
  3822. highlightPreviousRow();
  3823. e.preventDefault();
  3824. break;
  3825. case "ArrowDown":
  3826. highlightNextRow();
  3827. e.preventDefault();
  3828. break;
  3829. case "ArrowLeft":
  3830. case "ArrowRight":
  3831. if (document.activeElement.type != "text") {
  3832. e.preventDefault();
  3833. let boardRotationElement = document.getElementById("boardRotation")
  3834. settings.boardRotation = parseInt(boardRotationElement.value); // degrees / 5
  3835. if (e.key == "ArrowLeft") {
  3836. settings.boardRotation += 3; // 15 degrees
  3837. }
  3838. else {
  3839. settings.boardRotation -= 3;
  3840. }
  3841. settings.boardRotation = constrain(settings.boardRotation, boardRotationElement.min, boardRotationElement.max);
  3842. boardRotationElement.value = settings.boardRotation
  3843. setBoardRotation(settings.boardRotation);
  3844. }
  3845. break;
  3846. default:
  3847. break;
  3848. }
  3849. if (e.altKey) {
  3850. switch (e.key) {
  3851. case "f":
  3852. focusFilterField();
  3853. e.preventDefault();
  3854. break;
  3855. case "r":
  3856. focusRefLookupField();
  3857. e.preventDefault();
  3858. break;
  3859. case "z":
  3860. changeBomLayout("bom-only");
  3861. e.preventDefault();
  3862. break;
  3863. case "x":
  3864. changeBomLayout("left-right");
  3865. e.preventDefault();
  3866. break;
  3867. case "c":
  3868. changeBomLayout("top-bottom");
  3869. e.preventDefault();
  3870. break;
  3871. case "v":
  3872. changeCanvasLayout("F");
  3873. e.preventDefault();
  3874. break;
  3875. case "b":
  3876. changeCanvasLayout("FB");
  3877. e.preventDefault();
  3878. break;
  3879. case "n":
  3880. changeCanvasLayout("B");
  3881. e.preventDefault();
  3882. break;
  3883. default:
  3884. break;
  3885. }
  3886. if (e.key >= '1' && e.key <= '9') {
  3887. toggleBomCheckbox(currentHighlightedRowId, parseInt(e.key));
  3888. e.preventDefault();
  3889. }
  3890. }
  3891. }
  3892. function hideNetlistButton() {
  3893. document.getElementById("bom-ungrouped-btn").classList.remove("middle-button");
  3894. document.getElementById("bom-ungrouped-btn").classList.add("right-most-button");
  3895. document.getElementById("bom-netlist-btn").style.display = "none";
  3896. }
  3897. function topToggle() {
  3898. var top = document.getElementById("top");
  3899. var toptoggle = document.getElementById("toptoggle");
  3900. if (top.style.display === "none") {
  3901. top.style.display = "flex";
  3902. toptoggle.classList.remove("flipped");
  3903. } else {
  3904. top.style.display = "none";
  3905. toptoggle.classList.add("flipped");
  3906. }
  3907. }
  3908. window.onload = function (e) {
  3909. initUtils();
  3910. initRender();
  3911. initStorage();
  3912. initDefaults();
  3913. cleanGutters();
  3914. populateMetadata();
  3915. dbgdiv = document.getElementById("dbg");
  3916. bom = document.getElementById("bombody");
  3917. bomhead = document.getElementById("bomhead");
  3918. filter = "";
  3919. reflookup = "";
  3920. if (!("nets" in pcbdata)) {
  3921. hideNetlistButton();
  3922. }
  3923. initDone = true;
  3924. setBomCheckboxes(document.getElementById("bomCheckboxes").value);
  3925. // Triggers render
  3926. changeBomLayout(settings.bomlayout);
  3927. // Users may leave fullscreen without touching the checkbox. Uncheck.
  3928. document.addEventListener('fullscreenchange', () => {
  3929. if (!document.fullscreenElement)
  3930. document.getElementById('fullscreenCheckbox').checked = false;
  3931. });
  3932. }
  3933. window.onresize = resizeAll;
  3934. window.matchMedia("print").addListener(resizeAll);
  3935. ///////////////////////////////////////////////
  3936. ///////////////////////////////////////////////
  3937. // EventHandler.registerCallback(IBOM_EVENT_TYPES.BOM_BODY_CHANGE_EVENT, () => {
  3938. // for(var tr of bom.childNodes) {
  3939. // tr.onclick = tr.onmousemove;
  3940. // tr.onmousemove = null;
  3941. // };
  3942. // });
  3943. ///////////////////////////////////////////////
  3944. </script>
  3945. </head>
  3946. <body>
  3947. <div id="topmostdiv" class="topmostdiv">
  3948. <div id="top">
  3949. <div id="fileinfodiv">
  3950. <table class="fileinfo">
  3951. <tbody>
  3952. <tr>
  3953. <td id="title" class="title" style="width: 70%">
  3954. Title
  3955. </td>
  3956. <td id="revision" class="title" style="width: 30%">
  3957. Revision
  3958. </td>
  3959. </tr>
  3960. <tr>
  3961. <td id="company">
  3962. Company
  3963. </td>
  3964. <td id="filedate">
  3965. Date
  3966. </td>
  3967. </tr>
  3968. </tbody>
  3969. </table>
  3970. </div>
  3971. <div id="bomcontrols">
  3972. <div class="hideonprint menu">
  3973. <button class="menubtn"></button>
  3974. <div class="menu-content">
  3975. <label class="menu-label menu-label-top" style="width: calc(50% - 18px)">
  3976. <input id="darkmodeCheckbox" type="checkbox" onchange="setDarkMode(this.checked)">
  3977. Dark mode
  3978. </label><!-- This comment eats space! All of it!
  3979. --><label class="menu-label menu-label-top" style="width: calc(50% - 17px); border-left: 0;">
  3980. <input id="fullscreenCheckbox" type="checkbox" onchange="setFullscreen(this.checked)">
  3981. Full Screen
  3982. </label>
  3983. <label class="menu-label" style="width: calc(50% - 18px)">
  3984. <input id="fabricationCheckbox" type="checkbox" checked onchange="fabricationVisible(this.checked)">
  3985. Fab layer
  3986. </label><!-- This comment eats space! All of it!
  3987. --><label class="menu-label" style="width: calc(50% - 17px); border-left: 0;">
  3988. <input id="silkscreenCheckbox" type="checkbox" checked onchange="silkscreenVisible(this.checked)">
  3989. Silkscreen
  3990. </label>
  3991. <label class="menu-label" style="width: calc(50% - 18px)">
  3992. <input id="referencesCheckbox" type="checkbox" checked onchange="referencesVisible(this.checked)">
  3993. References
  3994. </label><!-- This comment eats space! All of it!
  3995. --><label class="menu-label" style="width: calc(50% - 17px); border-left: 0;">
  3996. <input id="valuesCheckbox" type="checkbox" checked onchange="valuesVisible(this.checked)">
  3997. Values
  3998. </label>
  3999. <div id="tracksAndZonesCheckboxes">
  4000. <label class="menu-label" style="width: calc(50% - 18px)">
  4001. <input id="tracksCheckbox" type="checkbox" checked onchange="tracksVisible(this.checked)">
  4002. Tracks
  4003. </label><!-- This comment eats space! All of it!
  4004. --><label class="menu-label" style="width: calc(50% - 17px); border-left: 0;">
  4005. <input id="zonesCheckbox" type="checkbox" checked onchange="zonesVisible(this.checked)">
  4006. Zones
  4007. </label>
  4008. </div>
  4009. <label class="menu-label" style="width: calc(50% - 18px)">
  4010. <input id="padsCheckbox" type="checkbox" checked onchange="padsVisible(this.checked)">
  4011. Pads
  4012. </label><!-- This comment eats space! All of it!
  4013. --><label class="menu-label" style="width: calc(50% - 17px); border-left: 0;">
  4014. <input id="dnpOutlineCheckbox" type="checkbox" checked onchange="dnpOutline(this.checked)">
  4015. DNP outlined
  4016. </label>
  4017. <label class="menu-label">
  4018. <input id="dragCheckbox" type="checkbox" checked onchange="setRedrawOnDrag(this.checked)">
  4019. Continuous redraw on drag
  4020. </label>
  4021. <label class="menu-label">
  4022. Highlight first pin
  4023. <form id="highlightpin1">
  4024. <div class="flexbox">
  4025. <label>
  4026. <input type="radio" name="highlightpin1" value="none" onchange="setHighlightPin1('none')">
  4027. None
  4028. </label>
  4029. <label>
  4030. <input type="radio" name="highlightpin1" value="all" onchange="setHighlightPin1('all')">
  4031. All
  4032. </label>
  4033. <label>
  4034. <input type="radio" name="highlightpin1" value="selected" onchange="setHighlightPin1('selected')">
  4035. Selected
  4036. </label>
  4037. </div>
  4038. </form>
  4039. </label>
  4040. <label class="menu-label">
  4041. <span>Board rotation</span>
  4042. <span style="float: right"><span id="rotationDegree">0</span>&#176;</span>
  4043. <input id="boardRotation" type="range" min="-36" max="36" value="0" class="slider" oninput="setBoardRotation(this.value)">
  4044. </label>
  4045. <label class="menu-label">
  4046. <input id="offsetBackRotationCheckbox" type="checkbox" onchange="setOffsetBackRotation(this.checked)">
  4047. Offset back rotation
  4048. </label>
  4049. <label class="menu-label">
  4050. <div style="margin-left: 5px">Bom checkboxes</div>
  4051. <input id="bomCheckboxes" class="menu-textbox" type=text
  4052. oninput="setBomCheckboxes(this.value)">
  4053. </label>
  4054. <label class="menu-label">
  4055. <div style="margin-left: 5px">Mark when checked</div>
  4056. <div id="markWhenCheckedContainer"></div>
  4057. </label>
  4058. <label class="menu-label">
  4059. <span class="shameless-plug">
  4060. <span>Created using</span>
  4061. <a id="github-link" target="blank" href="https://github.com/openscopeproject/InteractiveHtmlBom">InteractiveHtmlBom</a>
  4062. <a target="blank" title="Mouse and keyboard help" href="https://github.com/openscopeproject/InteractiveHtmlBom/wiki/Usage#bom-page-mouse-actions" style="text-decoration: none;"><label class="help-link">?</label></a>
  4063. </span>
  4064. </label>
  4065. </div>
  4066. </div>
  4067. <div class="button-container hideonprint">
  4068. <button id="fl-btn" class="left-most-button" onclick="changeCanvasLayout('F')"
  4069. title="Front only">F
  4070. </button>
  4071. <button id="fb-btn" class="middle-button" onclick="changeCanvasLayout('FB')"
  4072. title="Front and Back">FB
  4073. </button>
  4074. <button id="bl-btn" class="right-most-button" onclick="changeCanvasLayout('B')"
  4075. title="Back only">B
  4076. </button>
  4077. </div>
  4078. <div class="button-container hideonprint">
  4079. <button id="bom-btn" class="left-most-button" onclick="changeBomLayout('bom-only')"
  4080. title="BOM only"></button>
  4081. <button id="lr-btn" class="middle-button" onclick="changeBomLayout('left-right')"
  4082. title="BOM left, drawings right"></button>
  4083. <button id="tb-btn" class="right-most-button" onclick="changeBomLayout('top-bottom')"
  4084. title="BOM top, drawings bot"></button>
  4085. </div>
  4086. <div class="button-container hideonprint">
  4087. <button id="bom-grouped-btn" class="left-most-button" onclick="changeBomMode('grouped')"
  4088. title="Grouped BOM"></button>
  4089. <button id="bom-ungrouped-btn" class="middle-button" onclick="changeBomMode('ungrouped')"
  4090. title="Ungrouped BOM"></button>
  4091. <button id="bom-netlist-btn" class="right-most-button" onclick="changeBomMode('netlist')"
  4092. title="Netlist"></button>
  4093. </div>
  4094. <div class="hideonprint menu">
  4095. <button class="statsbtn"></button>
  4096. <div class="menu-content">
  4097. <table class="stats">
  4098. <tbody>
  4099. <tr>
  4100. <td width="40%">Board stats</td>
  4101. <td>Front</td>
  4102. <td>Back</td>
  4103. <td>Total</td>
  4104. </tr>
  4105. <tr>
  4106. <td>Components</td>
  4107. <td id="stats-components-front">~</td>
  4108. <td id="stats-components-back">~</td>
  4109. <td id="stats-components-total">~</td>
  4110. </tr>
  4111. <tr>
  4112. <td>Groups</td>
  4113. <td id="stats-groups-front">~</td>
  4114. <td id="stats-groups-back">~</td>
  4115. <td id="stats-groups-total">~</td>
  4116. </tr>
  4117. <tr>
  4118. <td>SMD pads</td>
  4119. <td id="stats-smd-pads-front">~</td>
  4120. <td id="stats-smd-pads-back">~</td>
  4121. <td id="stats-smd-pads-total">~</td>
  4122. </tr>
  4123. <tr>
  4124. <td>TH pads</td>
  4125. <td colspan=3 id="stats-th-pads">~</td>
  4126. </tr>
  4127. </tbody>
  4128. </table>
  4129. <table class="stats">
  4130. <col width="40%"/><col />
  4131. <tbody id="checkbox-stats">
  4132. <tr>
  4133. <td colspan=2 style="border-top: 0">Checkboxes</td>
  4134. </tr>
  4135. </tbody>
  4136. </table>
  4137. </div>
  4138. </div>
  4139. <div class="hideonprint menu">
  4140. <button class="iobtn"></button>
  4141. <div class="menu-content">
  4142. <div class="menu-label menu-label-top">
  4143. <div style="margin-left: 5px;">Save board image</div>
  4144. <div class="flexbox">
  4145. <input id="render-save-width" class="menu-textbox" type="text" value="1000" placeholder="Width"
  4146. style="flex-grow: 1; width: 50px;" oninput="validateSaveImgDimension(this)">
  4147. <span>X</span>
  4148. <input id="render-save-height" class="menu-textbox" type="text" value="1000" placeholder="Height"
  4149. style="flex-grow: 1; width: 50px;" oninput="validateSaveImgDimension(this)">
  4150. </div>
  4151. <label>
  4152. <input id="render-save-transparent" type="checkbox">
  4153. Transparent background
  4154. </label>
  4155. <div class="flexbox">
  4156. <button class="savebtn" onclick="saveImage('F')">Front</button>
  4157. <button class="savebtn" onclick="saveImage('B')">Back</button>
  4158. </div>
  4159. </div>
  4160. <div class="menu-label">
  4161. <span style="margin-left: 5px;">Config and checkbox state</span>
  4162. <div class="flexbox">
  4163. <button class="savebtn" onclick="saveSettings()">Export</button>
  4164. <button class="savebtn" onclick="loadSettings()">Import</button>
  4165. <button class="savebtn" onclick="resetSettings()">Reset</button>
  4166. </div>
  4167. </div>
  4168. <div class="menu-label">
  4169. <span style="margin-left: 5px;">Save bom table as</span>
  4170. <div class="flexbox">
  4171. <button class="savebtn" onclick="saveBomTable('csv')">csv</button>
  4172. <button class="savebtn" onclick="saveBomTable('txt')">txt</button>
  4173. </div>
  4174. </div>
  4175. </div>
  4176. </div>
  4177. </div>
  4178. </div>
  4179. <div id="topdivider">
  4180. <div class="hideonprint">
  4181. <div id="toptoggle" onclick="topToggle()">︽</div>
  4182. </div>
  4183. </div>
  4184. <div id="bot" class="split" style="flex: 1 1">
  4185. <div id="bomdiv" class="split split-horizontal">
  4186. <div style="width: 100%">
  4187. <input id="reflookup" class="textbox searchbox reflookup hideonprint" type="text" placeholder="Ref lookup"
  4188. oninput="updateRefLookup(this.value)">
  4189. <input id="filter" class="textbox searchbox filter hideonprint" type="text" placeholder="Filter"
  4190. oninput="updateFilter(this.value)">
  4191. <div class="button-container hideonprint" style="float: left; margin: 0;">
  4192. <button id="copy" title="Copy bom table to clipboard"
  4193. onclick="saveBomTable('clipboard')"></button>
  4194. </div>
  4195. </div>
  4196. <div id="dbg"></div>
  4197. <table class="bom" id="bomtable">
  4198. <thead id="bomhead">
  4199. </thead>
  4200. <tbody id="bombody">
  4201. </tbody>
  4202. </table>
  4203. </div>
  4204. <div id="canvasdiv" class="split split-horizontal">
  4205. <div id="frontcanvas" class="split" touch-action="none" style="overflow: hidden">
  4206. <div style="position: relative; width: 100%; height: 100%;">
  4207. <canvas id="F_bg" style="position: absolute; left: 0; top: 0; z-index: 0;"></canvas>
  4208. <canvas id="F_fab" style="position: absolute; left: 0; top: 0; z-index: 1;"></canvas>
  4209. <canvas id="F_slk" style="position: absolute; left: 0; top: 0; z-index: 2;"></canvas>
  4210. <canvas id="F_hl" style="position: absolute; left: 0; top: 0; z-index: 3;"></canvas>
  4211. </div>
  4212. </div>
  4213. <div id="backcanvas" class="split" touch-action="none" style="overflow: hidden">
  4214. <div style="position: relative; width: 100%; height: 100%;">
  4215. <canvas id="B_bg" style="position: absolute; left: 0; top: 0; z-index: 0;"></canvas>
  4216. <canvas id="B_fab" style="position: absolute; left: 0; top: 0; z-index: 1;"></canvas>
  4217. <canvas id="B_slk" style="position: absolute; left: 0; top: 0; z-index: 2;"></canvas>
  4218. <canvas id="B_hl" style="position: absolute; left: 0; top: 0; z-index: 3;"></canvas>
  4219. </div>
  4220. </div>
  4221. </div>
  4222. </div>
  4223. </div>
  4224. </body>
  4225. </html>