| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713271427152716271727182719272027212722272327242725272627272728272927302731273227332734273527362737273827392740274127422743274427452746274727482749275027512752275327542755275627572758275927602761276227632764276527662767276827692770277127722773277427752776277727782779278027812782278327842785278627872788278927902791279227932794279527962797279827992800280128022803280428052806280728082809281028112812281328142815281628172818281928202821282228232824282528262827282828292830283128322833283428352836283728382839284028412842284328442845284628472848284928502851285228532854285528562857285828592860286128622863286428652866286728682869287028712872287328742875287628772878287928802881288228832884288528862887288828892890289128922893289428952896289728982899290029012902290329042905290629072908290929102911291229132914291529162917291829192920292129222923292429252926292729282929293029312932293329342935293629372938293929402941294229432944294529462947294829492950295129522953295429552956295729582959296029612962296329642965296629672968296929702971297229732974297529762977297829792980298129822983298429852986298729882989299029912992299329942995299629972998299930003001300230033004300530063007300830093010301130123013301430153016301730183019302030213022302330243025302630273028302930303031303230333034303530363037303830393040304130423043304430453046304730483049305030513052305330543055305630573058305930603061306230633064306530663067306830693070307130723073307430753076307730783079308030813082308330843085308630873088308930903091309230933094309530963097309830993100310131023103310431053106310731083109311031113112311331143115311631173118311931203121312231233124312531263127312831293130313131323133313431353136313731383139314031413142314331443145314631473148314931503151315231533154315531563157315831593160316131623163316431653166316731683169317031713172317331743175317631773178317931803181318231833184318531863187318831893190319131923193319431953196319731983199320032013202320332043205320632073208320932103211321232133214321532163217321832193220322132223223322432253226322732283229323032313232323332343235323632373238323932403241324232433244324532463247324832493250325132523253325432553256325732583259326032613262326332643265326632673268326932703271327232733274327532763277327832793280328132823283328432853286328732883289329032913292329332943295329632973298329933003301330233033304330533063307330833093310331133123313331433153316331733183319332033213322332333243325332633273328332933303331333233333334333533363337333833393340334133423343334433453346334733483349335033513352335333543355335633573358335933603361336233633364336533663367336833693370337133723373337433753376337733783379338033813382338333843385338633873388338933903391339233933394339533963397339833993400340134023403340434053406340734083409341034113412341334143415341634173418341934203421342234233424342534263427342834293430343134323433343434353436343734383439344034413442344334443445344634473448344934503451345234533454345534563457345834593460346134623463346434653466346734683469347034713472347334743475347634773478347934803481348234833484348534863487348834893490349134923493349434953496349734983499350035013502350335043505350635073508350935103511351235133514351535163517351835193520352135223523352435253526352735283529353035313532353335343535353635373538353935403541354235433544354535463547354835493550355135523553355435553556355735583559356035613562356335643565356635673568356935703571357235733574357535763577357835793580358135823583358435853586358735883589359035913592359335943595359635973598359936003601360236033604360536063607360836093610361136123613361436153616361736183619362036213622362336243625362636273628362936303631363236333634363536363637363836393640364136423643364436453646364736483649365036513652365336543655365636573658365936603661366236633664366536663667366836693670367136723673367436753676367736783679368036813682368336843685368636873688368936903691369236933694369536963697369836993700370137023703370437053706370737083709371037113712371337143715371637173718371937203721372237233724372537263727372837293730373137323733373437353736373737383739374037413742374337443745374637473748374937503751375237533754375537563757375837593760376137623763376437653766376737683769377037713772377337743775377637773778377937803781378237833784378537863787378837893790379137923793379437953796379737983799380038013802380338043805380638073808380938103811381238133814381538163817381838193820382138223823382438253826382738283829383038313832383338343835383638373838383938403841384238433844384538463847384838493850385138523853385438553856385738583859386038613862386338643865386638673868386938703871387238733874387538763877387838793880388138823883388438853886388738883889389038913892389338943895389638973898389939003901390239033904390539063907390839093910391139123913391439153916391739183919392039213922392339243925392639273928392939303931393239333934393539363937393839393940394139423943394439453946394739483949395039513952395339543955395639573958395939603961396239633964396539663967396839693970397139723973397439753976397739783979398039813982398339843985398639873988398939903991399239933994399539963997399839994000400140024003400440054006400740084009401040114012401340144015401640174018401940204021402240234024402540264027402840294030403140324033403440354036403740384039404040414042404340444045404640474048404940504051405240534054405540564057405840594060406140624063406440654066406740684069407040714072407340744075407640774078407940804081408240834084408540864087408840894090409140924093409440954096409740984099410041014102410341044105410641074108410941104111411241134114411541164117411841194120412141224123412441254126412741284129413041314132413341344135413641374138413941404141414241434144414541464147414841494150415141524153415441554156415741584159416041614162416341644165416641674168416941704171417241734174417541764177417841794180418141824183418441854186418741884189419041914192419341944195419641974198419942004201420242034204420542064207420842094210421142124213421442154216421742184219422042214222422342244225422642274228422942304231423242334234423542364237423842394240424142424243424442454246424742484249425042514252425342544255425642574258425942604261426242634264426542664267426842694270427142724273427442754276427742784279428042814282428342844285428642874288428942904291429242934294429542964297429842994300430143024303430443054306430743084309431043114312431343144315431643174318431943204321432243234324432543264327432843294330433143324333433443354336433743384339434043414342434343444345434643474348434943504351435243534354435543564357435843594360436143624363436443654366436743684369437043714372437343744375437643774378437943804381438243834384438543864387438843894390439143924393439443954396439743984399440044014402440344044405440644074408440944104411441244134414441544164417441844194420442144224423442444254426442744284429443044314432443344344435443644374438443944404441444244434444444544464447444844494450445144524453445444554456445744584459446044614462446344644465446644674468446944704471447244734474447544764477447844794480448144824483448444854486448744884489449044914492449344944495449644974498449945004501450245034504450545064507450845094510451145124513451445154516451745184519452045214522452345244525452645274528452945304531453245334534453545364537453845394540454145424543454445454546454745484549455045514552455345544555455645574558455945604561456245634564456545664567456845694570457145724573457445754576457745784579458045814582458345844585458645874588458945904591459245934594459545964597459845994600460146024603460446054606460746084609461046114612461346144615461646174618461946204621462246234624462546264627462846294630463146324633463446354636463746384639464046414642464346444645464646474648464946504651465246534654465546564657465846594660466146624663466446654666466746684669467046714672467346744675467646774678467946804681468246834684468546864687468846894690469146924693469446954696469746984699470047014702470347044705470647074708470947104711471247134714471547164717471847194720472147224723472447254726472747284729473047314732473347344735473647374738473947404741474247434744474547464747474847494750475147524753475447554756475747584759476047614762476347644765476647674768476947704771477247734774477547764777477847794780478147824783478447854786478747884789479047914792479347944795479647974798479948004801480248034804480548064807480848094810481148124813481448154816481748184819482048214822482348244825482648274828482948304831483248334834483548364837483848394840484148424843484448454846484748484849485048514852485348544855485648574858485948604861486248634864486548664867486848694870487148724873487448754876487748784879488048814882488348844885488648874888488948904891489248934894489548964897489848994900490149024903490449054906490749084909491049114912491349144915491649174918491949204921492249234924492549264927492849294930493149324933493449354936493749384939494049414942494349444945494649474948494949504951495249534954495549564957495849594960496149624963496449654966496749684969497049714972497349744975497649774978497949804981498249834984498549864987498849894990499149924993499449954996499749984999500050015002500350045005500650075008500950105011501250135014501550165017501850195020502150225023502450255026502750285029503050315032503350345035503650375038503950405041504250435044504550465047504850495050505150525053505450555056505750585059506050615062506350645065506650675068506950705071507250735074507550765077507850795080508150825083508450855086508750885089509050915092509350945095509650975098509951005101510251035104510551065107510851095110511151125113511451155116511751185119512051215122512351245125512651275128512951305131513251335134513551365137513851395140514151425143514451455146514751485149515051515152515351545155515651575158515951605161516251635164516551665167516851695170517151725173517451755176517751785179518051815182518351845185518651875188518951905191519251935194519551965197519851995200520152025203520452055206520752085209521052115212521352145215521652175218521952205221522252235224522552265227522852295230523152325233523452355236523752385239524052415242524352445245524652475248524952505251525252535254525552565257525852595260526152625263526452655266526752685269527052715272527352745275527652775278527952805281528252835284528552865287528852895290529152925293529452955296529752985299530053015302530353045305530653075308530953105311531253135314531553165317531853195320532153225323532453255326532753285329533053315332533353345335533653375338533953405341534253435344534553465347534853495350535153525353535453555356535753585359536053615362536353645365536653675368536953705371537253735374537553765377537853795380538153825383538453855386538753885389539053915392539353945395539653975398539954005401540254035404540554065407540854095410541154125413541454155416541754185419542054215422542354245425542654275428542954305431543254335434543554365437543854395440544154425443544454455446544754485449545054515452545354545455545654575458545954605461546254635464546554665467546854695470547154725473547454755476547754785479548054815482548354845485548654875488548954905491549254935494549554965497549854995500550155025503550455055506550755085509551055115512551355145515551655175518551955205521552255235524552555265527552855295530553155325533553455355536553755385539554055415542554355445545554655475548554955505551555255535554555555565557555855595560556155625563556455655566556755685569557055715572557355745575557655775578557955805581558255835584558555865587558855895590559155925593559455955596559755985599560056015602560356045605560656075608560956105611561256135614561556165617561856195620562156225623562456255626562756285629563056315632563356345635563656375638563956405641564256435644564556465647564856495650565156525653565456555656565756585659566056615662566356645665566656675668566956705671567256735674567556765677567856795680568156825683568456855686568756885689569056915692569356945695569656975698569957005701570257035704570557065707570857095710571157125713571457155716571757185719572057215722572357245725572657275728572957305731573257335734573557365737573857395740574157425743574457455746574757485749575057515752575357545755575657575758575957605761576257635764576557665767576857695770577157725773577457755776577757785779578057815782578357845785578657875788578957905791579257935794579557965797579857995800580158025803580458055806580758085809581058115812581358145815581658175818581958205821582258235824582558265827582858295830583158325833583458355836583758385839584058415842584358445845584658475848584958505851585258535854585558565857585858595860586158625863586458655866586758685869587058715872587358745875587658775878587958805881588258835884588558865887588858895890589158925893589458955896589758985899590059015902590359045905590659075908590959105911591259135914591559165917591859195920592159225923592459255926592759285929593059315932593359345935593659375938593959405941594259435944594559465947594859495950595159525953595459555956595759585959596059615962596359645965596659675968596959705971597259735974597559765977597859795980598159825983598459855986598759885989599059915992599359945995599659975998599960006001600260036004600560066007600860096010601160126013601460156016601760186019602060216022602360246025602660276028602960306031603260336034603560366037603860396040604160426043604460456046604760486049605060516052605360546055605660576058605960606061606260636064606560666067606860696070607160726073607460756076607760786079608060816082608360846085608660876088608960906091609260936094609560966097609860996100610161026103610461056106610761086109611061116112611361146115611661176118611961206121612261236124612561266127612861296130613161326133613461356136613761386139614061416142614361446145614661476148614961506151615261536154615561566157615861596160616161626163616461656166616761686169617061716172617361746175617661776178617961806181618261836184618561866187618861896190619161926193619461956196619761986199620062016202620362046205620662076208620962106211621262136214621562166217621862196220622162226223622462256226622762286229623062316232623362346235623662376238623962406241624262436244624562466247624862496250625162526253625462556256625762586259626062616262626362646265626662676268626962706271627262736274627562766277627862796280628162826283628462856286628762886289629062916292629362946295629662976298629963006301630263036304630563066307630863096310631163126313631463156316631763186319632063216322632363246325632663276328632963306331633263336334633563366337633863396340634163426343634463456346634763486349635063516352635363546355635663576358635963606361636263636364636563666367636863696370637163726373637463756376637763786379638063816382638363846385638663876388638963906391639263936394639563966397639863996400640164026403640464056406640764086409641064116412641364146415641664176418641964206421642264236424642564266427642864296430643164326433643464356436643764386439644064416442644364446445644664476448644964506451645264536454645564566457645864596460646164626463646464656466646764686469647064716472647364746475647664776478647964806481648264836484648564866487648864896490649164926493649464956496649764986499650065016502650365046505650665076508650965106511651265136514651565166517651865196520652165226523652465256526652765286529653065316532653365346535653665376538653965406541654265436544654565466547654865496550655165526553655465556556655765586559656065616562656365646565656665676568656965706571657265736574657565766577657865796580658165826583658465856586658765886589659065916592659365946595659665976598659966006601660266036604660566066607660866096610661166126613661466156616661766186619662066216622662366246625662666276628662966306631663266336634663566366637663866396640664166426643664466456646664766486649665066516652665366546655665666576658665966606661666266636664666566666667666866696670667166726673667466756676667766786679668066816682668366846685668666876688668966906691669266936694669566966697669866996700670167026703670467056706670767086709671067116712671367146715671667176718671967206721672267236724672567266727672867296730673167326733673467356736673767386739674067416742674367446745674667476748674967506751675267536754675567566757675867596760676167626763676467656766676767686769677067716772677367746775677667776778677967806781678267836784678567866787678867896790679167926793679467956796679767986799680068016802680368046805680668076808680968106811681268136814681568166817681868196820682168226823682468256826682768286829683068316832683368346835683668376838683968406841684268436844684568466847684868496850685168526853685468556856685768586859686068616862686368646865686668676868686968706871687268736874687568766877687868796880688168826883688468856886688768886889689068916892689368946895689668976898689969006901690269036904690569066907690869096910691169126913691469156916691769186919692069216922692369246925692669276928692969306931693269336934693569366937693869396940694169426943694469456946694769486949695069516952695369546955695669576958695969606961696269636964696569666967696869696970697169726973697469756976697769786979698069816982698369846985698669876988698969906991699269936994699569966997699869997000700170027003700470057006700770087009701070117012701370147015701670177018701970207021702270237024702570267027702870297030703170327033703470357036703770387039704070417042704370447045704670477048704970507051705270537054705570567057705870597060706170627063706470657066706770687069707070717072707370747075707670777078707970807081708270837084708570867087708870897090709170927093709470957096709770987099710071017102710371047105710671077108710971107111711271137114711571167117711871197120712171227123712471257126712771287129713071317132713371347135713671377138713971407141714271437144714571467147714871497150715171527153715471557156715771587159716071617162716371647165716671677168716971707171717271737174717571767177717871797180718171827183718471857186718771887189719071917192719371947195719671977198719972007201720272037204720572067207720872097210721172127213721472157216721772187219722072217222722372247225722672277228722972307231723272337234723572367237723872397240724172427243724472457246724772487249725072517252725372547255725672577258725972607261726272637264726572667267726872697270727172727273727472757276727772787279728072817282728372847285728672877288728972907291729272937294729572967297729872997300730173027303730473057306730773087309731073117312731373147315731673177318731973207321732273237324732573267327732873297330733173327333733473357336733773387339734073417342734373447345734673477348734973507351735273537354735573567357735873597360736173627363736473657366736773687369737073717372737373747375737673777378737973807381738273837384738573867387738873897390739173927393739473957396739773987399740074017402740374047405740674077408740974107411741274137414741574167417741874197420742174227423742474257426742774287429743074317432743374347435743674377438743974407441744274437444744574467447744874497450745174527453745474557456745774587459746074617462746374647465746674677468746974707471747274737474747574767477747874797480748174827483748474857486748774887489749074917492749374947495749674977498749975007501750275037504750575067507750875097510751175127513751475157516751775187519752075217522752375247525752675277528752975307531753275337534753575367537753875397540754175427543754475457546754775487549755075517552755375547555755675577558755975607561756275637564756575667567756875697570757175727573757475757576757775787579758075817582758375847585758675877588758975907591759275937594759575967597759875997600760176027603760476057606760776087609761076117612761376147615761676177618761976207621762276237624762576267627762876297630763176327633763476357636763776387639764076417642764376447645764676477648764976507651765276537654765576567657765876597660766176627663766476657666766776687669767076717672767376747675767676777678767976807681768276837684768576867687768876897690769176927693769476957696769776987699770077017702770377047705770677077708770977107711771277137714771577167717771877197720772177227723772477257726772777287729773077317732773377347735773677377738773977407741774277437744774577467747774877497750775177527753775477557756775777587759776077617762776377647765776677677768776977707771777277737774777577767777777877797780778177827783778477857786778777887789779077917792779377947795779677977798779978007801780278037804780578067807780878097810781178127813781478157816781778187819782078217822782378247825782678277828782978307831783278337834783578367837783878397840784178427843784478457846784778487849785078517852785378547855785678577858785978607861786278637864786578667867786878697870787178727873787478757876787778787879788078817882788378847885788678877888788978907891789278937894789578967897789878997900790179027903790479057906790779087909791079117912791379147915791679177918791979207921792279237924792579267927792879297930793179327933793479357936793779387939794079417942794379447945794679477948794979507951795279537954795579567957795879597960796179627963796479657966796779687969797079717972797379747975797679777978797979807981798279837984798579867987798879897990799179927993799479957996799779987999800080018002800380048005800680078008800980108011801280138014801580168017801880198020802180228023802480258026802780288029803080318032803380348035803680378038803980408041804280438044804580468047804880498050805180528053805480558056805780588059806080618062806380648065806680678068806980708071807280738074807580768077807880798080808180828083808480858086808780888089809080918092809380948095809680978098809981008101810281038104810581068107810881098110811181128113811481158116811781188119812081218122812381248125812681278128812981308131813281338134813581368137813881398140814181428143814481458146814781488149815081518152815381548155815681578158815981608161816281638164816581668167816881698170817181728173817481758176817781788179818081818182818381848185818681878188818981908191819281938194819581968197819881998200820182028203820482058206820782088209821082118212821382148215821682178218821982208221822282238224822582268227822882298230823182328233823482358236823782388239824082418242824382448245824682478248824982508251825282538254825582568257825882598260826182628263826482658266826782688269827082718272827382748275827682778278827982808281828282838284828582868287828882898290829182928293829482958296829782988299830083018302830383048305830683078308830983108311831283138314831583168317831883198320832183228323832483258326832783288329833083318332833383348335833683378338833983408341834283438344834583468347834883498350835183528353835483558356835783588359836083618362836383648365836683678368836983708371837283738374837583768377837883798380838183828383838483858386838783888389839083918392839383948395839683978398839984008401840284038404840584068407840884098410841184128413841484158416841784188419842084218422842384248425842684278428842984308431843284338434843584368437843884398440844184428443844484458446844784488449845084518452845384548455845684578458845984608461846284638464846584668467846884698470847184728473847484758476847784788479848084818482848384848485848684878488848984908491849284938494849584968497849884998500850185028503850485058506850785088509851085118512851385148515851685178518851985208521852285238524852585268527852885298530853185328533853485358536853785388539854085418542854385448545854685478548854985508551855285538554855585568557855885598560856185628563856485658566856785688569857085718572857385748575857685778578857985808581858285838584858585868587858885898590859185928593859485958596859785988599860086018602860386048605860686078608860986108611861286138614861586168617861886198620862186228623862486258626862786288629863086318632863386348635863686378638863986408641864286438644864586468647864886498650865186528653865486558656865786588659866086618662866386648665866686678668866986708671867286738674867586768677867886798680868186828683868486858686868786888689869086918692869386948695869686978698869987008701870287038704870587068707870887098710871187128713871487158716871787188719872087218722872387248725872687278728872987308731873287338734873587368737873887398740874187428743874487458746874787488749875087518752875387548755875687578758875987608761876287638764876587668767876887698770877187728773877487758776877787788779878087818782878387848785878687878788878987908791879287938794879587968797879887998800880188028803880488058806880788088809881088118812881388148815881688178818881988208821882288238824882588268827882888298830883188328833883488358836883788388839884088418842884388448845884688478848884988508851885288538854885588568857885888598860886188628863886488658866886788688869887088718872887388748875887688778878887988808881888288838884888588868887888888898890889188928893889488958896889788988899890089018902890389048905890689078908890989108911891289138914891589168917891889198920892189228923892489258926892789288929893089318932893389348935893689378938893989408941894289438944894589468947894889498950895189528953895489558956895789588959896089618962896389648965896689678968896989708971897289738974897589768977897889798980898189828983898489858986898789888989899089918992899389948995899689978998899990009001900290039004900590069007900890099010901190129013901490159016901790189019902090219022902390249025902690279028902990309031903290339034903590369037903890399040904190429043904490459046904790489049905090519052905390549055905690579058905990609061906290639064906590669067906890699070907190729073907490759076907790789079908090819082908390849085908690879088908990909091909290939094909590969097909890999100910191029103910491059106910791089109911091119112911391149115911691179118911991209121912291239124912591269127912891299130913191329133913491359136913791389139914091419142914391449145914691479148914991509151915291539154915591569157915891599160916191629163916491659166916791689169917091719172917391749175917691779178917991809181918291839184918591869187918891899190919191929193919491959196919791989199920092019202920392049205920692079208920992109211921292139214921592169217921892199220922192229223922492259226922792289229923092319232923392349235923692379238923992409241924292439244924592469247924892499250925192529253925492559256925792589259926092619262926392649265926692679268926992709271927292739274927592769277927892799280928192829283928492859286928792889289929092919292929392949295929692979298929993009301930293039304930593069307930893099310931193129313931493159316931793189319932093219322932393249325932693279328932993309331933293339334933593369337933893399340934193429343934493459346934793489349935093519352935393549355935693579358935993609361936293639364936593669367936893699370937193729373937493759376937793789379938093819382938393849385938693879388938993909391939293939394939593969397939893999400940194029403940494059406940794089409941094119412941394149415941694179418941994209421942294239424942594269427942894299430943194329433943494359436943794389439944094419442944394449445944694479448944994509451945294539454945594569457945894599460946194629463946494659466946794689469947094719472947394749475947694779478947994809481948294839484948594869487948894899490949194929493949494959496949794989499950095019502950395049505950695079508950995109511951295139514951595169517951895199520952195229523952495259526952795289529953095319532953395349535953695379538953995409541954295439544954595469547954895499550955195529553955495559556955795589559956095619562956395649565956695679568956995709571957295739574957595769577957895799580958195829583958495859586958795889589959095919592959395949595959695979598959996009601960296039604960596069607960896099610961196129613961496159616961796189619962096219622962396249625962696279628962996309631963296339634963596369637963896399640964196429643964496459646964796489649965096519652965396549655965696579658965996609661966296639664966596669667966896699670967196729673967496759676967796789679968096819682968396849685968696879688968996909691969296939694969596969697969896999700970197029703970497059706970797089709971097119712971397149715971697179718971997209721972297239724972597269727972897299730973197329733973497359736973797389739974097419742974397449745974697479748974997509751975297539754975597569757975897599760976197629763976497659766976797689769977097719772977397749775977697779778977997809781978297839784978597869787978897899790979197929793979497959796979797989799980098019802980398049805980698079808980998109811981298139814981598169817981898199820982198229823982498259826982798289829983098319832983398349835983698379838983998409841984298439844984598469847984898499850985198529853985498559856985798589859986098619862986398649865986698679868986998709871987298739874987598769877987898799880988198829883988498859886988798889889989098919892989398949895989698979898989999009901990299039904990599069907990899099910991199129913991499159916991799189919992099219922992399249925992699279928992999309931993299339934993599369937993899399940994199429943994499459946994799489949995099519952995399549955995699579958995999609961996299639964996599669967996899699970997199729973997499759976997799789979998099819982998399849985998699879988998999909991999299939994999599969997999899991000010001100021000310004100051000610007100081000910010100111001210013100141001510016100171001810019100201002110022100231002410025100261002710028100291003010031100321003310034100351003610037100381003910040100411004210043100441004510046100471004810049100501005110052100531005410055100561005710058100591006010061100621006310064100651006610067100681006910070100711007210073100741007510076100771007810079100801008110082100831008410085100861008710088100891009010091100921009310094100951009610097100981009910100101011010210103101041010510106101071010810109101101011110112101131011410115101161011710118101191012010121101221012310124101251012610127101281012910130101311013210133101341013510136101371013810139101401014110142101431014410145101461014710148101491015010151101521015310154101551015610157101581015910160101611016210163101641016510166101671016810169101701017110172101731017410175101761017710178101791018010181101821018310184101851018610187101881018910190101911019210193101941019510196101971019810199102001020110202102031020410205102061020710208102091021010211102121021310214102151021610217102181021910220102211022210223102241022510226102271022810229102301023110232102331023410235102361023710238102391024010241102421024310244102451024610247102481024910250102511025210253102541025510256102571025810259102601026110262102631026410265102661026710268102691027010271102721027310274102751027610277102781027910280102811028210283102841028510286102871028810289102901029110292102931029410295102961029710298102991030010301103021030310304103051030610307103081030910310103111031210313103141031510316103171031810319103201032110322103231032410325103261032710328103291033010331103321033310334103351033610337103381033910340103411034210343103441034510346103471034810349103501035110352103531035410355103561035710358103591036010361103621036310364103651036610367103681036910370103711037210373103741037510376103771037810379103801038110382103831038410385103861038710388103891039010391103921039310394103951039610397103981039910400104011040210403104041040510406104071040810409104101041110412104131041410415104161041710418104191042010421104221042310424104251042610427104281042910430104311043210433104341043510436104371043810439104401044110442104431044410445104461044710448104491045010451104521045310454104551045610457104581045910460104611046210463104641046510466104671046810469104701047110472104731047410475104761047710478104791048010481104821048310484104851048610487104881048910490104911049210493104941049510496104971049810499105001050110502105031050410505105061050710508105091051010511105121051310514105151051610517105181051910520105211052210523105241052510526105271052810529105301053110532105331053410535105361053710538105391054010541105421054310544105451054610547105481054910550105511055210553105541055510556105571055810559105601056110562105631056410565105661056710568105691057010571105721057310574105751057610577105781057910580105811058210583105841058510586105871058810589105901059110592105931059410595105961059710598105991060010601106021060310604106051060610607106081060910610106111061210613106141061510616106171061810619106201062110622106231062410625106261062710628106291063010631106321063310634106351063610637106381063910640106411064210643106441064510646106471064810649106501065110652106531065410655106561065710658106591066010661106621066310664106651066610667106681066910670106711067210673106741067510676106771067810679106801068110682106831068410685106861068710688106891069010691106921069310694106951069610697106981069910700107011070210703107041070510706107071070810709107101071110712107131071410715107161071710718107191072010721107221072310724107251072610727107281072910730107311073210733107341073510736107371073810739107401074110742107431074410745107461074710748107491075010751107521075310754107551075610757107581075910760107611076210763107641076510766107671076810769107701077110772107731077410775107761077710778107791078010781107821078310784107851078610787107881078910790107911079210793107941079510796107971079810799108001080110802108031080410805108061080710808108091081010811108121081310814108151081610817108181081910820108211082210823108241082510826108271082810829108301083110832108331083410835108361083710838108391084010841108421084310844108451084610847108481084910850108511085210853108541085510856108571085810859108601086110862108631086410865108661086710868108691087010871108721087310874108751087610877108781087910880108811088210883108841088510886108871088810889108901089110892108931089410895108961089710898108991090010901109021090310904109051090610907109081090910910109111091210913109141091510916109171091810919109201092110922109231092410925109261092710928109291093010931109321093310934109351093610937109381093910940109411094210943109441094510946109471094810949109501095110952109531095410955109561095710958109591096010961109621096310964109651096610967109681096910970109711097210973109741097510976109771097810979109801098110982109831098410985109861098710988109891099010991109921099310994109951099610997109981099911000110011100211003110041100511006110071100811009110101101111012110131101411015110161101711018110191102011021110221102311024110251102611027110281102911030110311103211033110341103511036110371103811039110401104111042110431104411045110461104711048110491105011051110521105311054110551105611057110581105911060110611106211063110641106511066110671106811069110701107111072110731107411075110761107711078110791108011081110821108311084110851108611087110881108911090110911109211093110941109511096110971109811099111001110111102111031110411105111061110711108111091111011111111121111311114111151111611117111181111911120111211112211123111241112511126111271112811129111301113111132111331113411135111361113711138111391114011141111421114311144111451114611147111481114911150111511115211153111541115511156111571115811159111601116111162111631116411165111661116711168111691117011171111721117311174111751117611177111781117911180111811118211183111841118511186111871118811189111901119111192111931119411195111961119711198111991120011201112021120311204112051120611207112081120911210112111121211213112141121511216112171121811219112201122111222112231122411225112261122711228112291123011231112321123311234112351123611237112381123911240112411124211243112441124511246112471124811249112501125111252112531125411255112561125711258112591126011261112621126311264112651126611267112681126911270112711127211273112741127511276112771127811279112801128111282112831128411285112861128711288112891129011291112921129311294112951129611297112981129911300113011130211303113041130511306113071130811309113101131111312113131131411315113161131711318113191132011321113221132311324113251132611327113281132911330113311133211333113341133511336113371133811339113401134111342113431134411345113461134711348113491135011351113521135311354113551135611357113581135911360113611136211363113641136511366113671136811369113701137111372113731137411375113761137711378113791138011381113821138311384113851138611387113881138911390113911139211393113941139511396113971139811399114001140111402114031140411405114061140711408114091141011411114121141311414114151141611417114181141911420114211142211423114241142511426114271142811429114301143111432114331143411435114361143711438114391144011441114421144311444114451144611447114481144911450114511145211453114541145511456114571145811459114601146111462114631146411465114661146711468114691147011471114721147311474114751147611477114781147911480114811148211483114841148511486114871148811489114901149111492114931149411495114961149711498114991150011501115021150311504115051150611507115081150911510115111151211513115141151511516115171151811519115201152111522115231152411525115261152711528115291153011531115321153311534115351153611537115381153911540115411154211543115441154511546115471154811549115501155111552115531155411555115561155711558115591156011561115621156311564115651156611567115681156911570115711157211573115741157511576115771157811579115801158111582115831158411585115861158711588115891159011591115921159311594115951159611597115981159911600116011160211603116041160511606116071160811609116101161111612116131161411615116161161711618116191162011621116221162311624116251162611627116281162911630116311163211633116341163511636116371163811639116401164111642116431164411645116461164711648116491165011651116521165311654116551165611657116581165911660116611166211663116641166511666116671166811669116701167111672116731167411675116761167711678116791168011681116821168311684116851168611687116881168911690116911169211693116941169511696116971169811699117001170111702117031170411705117061170711708117091171011711117121171311714117151171611717117181171911720117211172211723117241172511726117271172811729117301173111732117331173411735117361173711738117391174011741117421174311744117451174611747117481174911750117511175211753117541175511756117571175811759117601176111762117631176411765117661176711768117691177011771117721177311774117751177611777117781177911780117811178211783117841178511786117871178811789117901179111792117931179411795117961179711798117991180011801118021180311804118051180611807118081180911810118111181211813118141181511816118171181811819118201182111822118231182411825118261182711828118291183011831118321183311834118351183611837118381183911840118411184211843118441184511846118471184811849118501185111852118531185411855118561185711858118591186011861118621186311864118651186611867118681186911870118711187211873118741187511876118771187811879118801188111882118831188411885118861188711888118891189011891118921189311894118951189611897118981189911900119011190211903119041190511906119071190811909119101191111912119131191411915119161191711918119191192011921119221192311924119251192611927119281192911930119311193211933119341193511936119371193811939119401194111942119431194411945119461194711948119491195011951119521195311954119551195611957119581195911960119611196211963119641196511966119671196811969119701197111972119731197411975119761197711978119791198011981119821198311984119851198611987119881198911990119911199211993119941199511996119971199811999120001200112002120031200412005120061200712008120091201012011120121201312014120151201612017120181201912020120211202212023120241202512026120271202812029120301203112032120331203412035120361203712038120391204012041120421204312044120451204612047120481204912050120511205212053120541205512056120571205812059120601206112062120631206412065120661206712068120691207012071120721207312074120751207612077120781207912080120811208212083120841208512086120871208812089120901209112092120931209412095120961209712098120991210012101121021210312104121051210612107121081210912110121111211212113121141211512116121171211812119121201212112122121231212412125121261212712128121291213012131121321213312134121351213612137121381213912140121411214212143121441214512146121471214812149121501215112152121531215412155121561215712158121591216012161121621216312164121651216612167121681216912170121711217212173121741217512176121771217812179121801218112182121831218412185121861218712188121891219012191121921219312194121951219612197121981219912200122011220212203122041220512206122071220812209122101221112212122131221412215122161221712218122191222012221122221222312224122251222612227122281222912230122311223212233122341223512236122371223812239122401224112242122431224412245122461224712248122491225012251122521225312254122551225612257122581225912260122611226212263122641226512266122671226812269122701227112272122731227412275122761227712278122791228012281122821228312284122851228612287122881228912290122911229212293122941229512296122971229812299123001230112302123031230412305123061230712308123091231012311123121231312314123151231612317123181231912320123211232212323123241232512326123271232812329123301233112332123331233412335123361233712338123391234012341123421234312344123451234612347123481234912350123511235212353123541235512356123571235812359123601236112362123631236412365123661236712368123691237012371123721237312374123751237612377123781237912380123811238212383123841238512386123871238812389123901239112392123931239412395123961239712398123991240012401124021240312404124051240612407124081240912410124111241212413124141241512416124171241812419124201242112422124231242412425124261242712428124291243012431124321243312434124351243612437124381243912440124411244212443124441244512446124471244812449124501245112452124531245412455124561245712458124591246012461124621246312464124651246612467124681246912470124711247212473124741247512476124771247812479124801248112482124831248412485124861248712488124891249012491124921249312494124951249612497124981249912500125011250212503125041250512506125071250812509125101251112512125131251412515125161251712518125191252012521125221252312524125251252612527125281252912530125311253212533125341253512536125371253812539125401254112542125431254412545125461254712548125491255012551125521255312554125551255612557125581255912560125611256212563125641256512566125671256812569125701257112572125731257412575125761257712578125791258012581125821258312584125851258612587125881258912590125911259212593125941259512596125971259812599126001260112602126031260412605126061260712608126091261012611126121261312614126151261612617126181261912620126211262212623126241262512626126271262812629126301263112632126331263412635126361263712638126391264012641126421264312644126451264612647126481264912650126511265212653126541265512656126571265812659126601266112662126631266412665126661266712668126691267012671126721267312674126751267612677126781267912680126811268212683126841268512686126871268812689126901269112692126931269412695126961269712698126991270012701127021270312704127051270612707127081270912710127111271212713127141271512716127171271812719127201272112722127231272412725127261272712728127291273012731127321273312734127351273612737127381273912740127411274212743127441274512746127471274812749127501275112752127531275412755127561275712758127591276012761127621276312764127651276612767127681276912770127711277212773127741277512776127771277812779127801278112782127831278412785127861278712788127891279012791127921279312794127951279612797127981279912800128011280212803128041280512806128071280812809128101281112812128131281412815128161281712818128191282012821128221282312824128251282612827128281282912830128311283212833128341283512836128371283812839128401284112842128431284412845128461284712848128491285012851128521285312854128551285612857128581285912860128611286212863128641286512866128671286812869128701287112872128731287412875128761287712878128791288012881128821288312884128851288612887128881288912890128911289212893128941289512896128971289812899129001290112902129031290412905129061290712908129091291012911129121291312914129151291612917129181291912920129211292212923129241292512926129271292812929129301293112932129331293412935129361293712938129391294012941129421294312944129451294612947129481294912950129511295212953129541295512956129571295812959129601296112962129631296412965129661296712968129691297012971129721297312974129751297612977129781297912980129811298212983129841298512986129871298812989129901299112992129931299412995129961299712998129991300013001130021300313004130051300613007130081300913010130111301213013130141301513016130171301813019130201302113022130231302413025130261302713028130291303013031130321303313034130351303613037130381303913040130411304213043130441304513046130471304813049130501305113052130531305413055130561305713058130591306013061130621306313064130651306613067130681306913070130711307213073130741307513076130771307813079130801308113082130831308413085130861308713088130891309013091130921309313094130951309613097130981309913100131011310213103131041310513106131071310813109131101311113112131131311413115131161311713118131191312013121131221312313124131251312613127131281312913130131311313213133131341313513136131371313813139131401314113142131431314413145131461314713148131491315013151131521315313154131551315613157131581315913160131611316213163131641316513166131671316813169131701317113172131731317413175131761317713178131791318013181131821318313184131851318613187131881318913190131911319213193131941319513196131971319813199132001320113202132031320413205132061320713208132091321013211132121321313214132151321613217132181321913220132211322213223132241322513226132271322813229132301323113232132331323413235132361323713238132391324013241132421324313244132451324613247132481324913250132511325213253132541325513256132571325813259132601326113262132631326413265132661326713268132691327013271132721327313274132751327613277132781327913280132811328213283132841328513286132871328813289132901329113292132931329413295132961329713298132991330013301133021330313304133051330613307133081330913310133111331213313133141331513316133171331813319133201332113322133231332413325133261332713328133291333013331133321333313334133351333613337133381333913340133411334213343133441334513346133471334813349133501335113352133531335413355133561335713358133591336013361133621336313364133651336613367133681336913370133711337213373133741337513376133771337813379133801338113382133831338413385133861338713388133891339013391133921339313394133951339613397133981339913400134011340213403134041340513406134071340813409134101341113412134131341413415134161341713418134191342013421134221342313424134251342613427134281342913430134311343213433134341343513436134371343813439134401344113442134431344413445134461344713448134491345013451134521345313454134551345613457134581345913460134611346213463134641346513466134671346813469134701347113472134731347413475134761347713478134791348013481134821348313484134851348613487134881348913490134911349213493134941349513496134971349813499135001350113502135031350413505135061350713508135091351013511135121351313514135151351613517135181351913520135211352213523135241352513526135271352813529135301353113532135331353413535135361353713538135391354013541135421354313544135451354613547135481354913550135511355213553135541355513556135571355813559135601356113562135631356413565135661356713568135691357013571135721357313574135751357613577135781357913580135811358213583135841358513586135871358813589135901359113592135931359413595135961359713598135991360013601136021360313604136051360613607136081360913610136111361213613136141361513616136171361813619136201362113622136231362413625136261362713628136291363013631136321363313634136351363613637136381363913640136411364213643136441364513646136471364813649136501365113652136531365413655136561365713658136591366013661136621366313664136651366613667136681366913670136711367213673136741367513676136771367813679136801368113682136831368413685136861368713688136891369013691136921369313694136951369613697136981369913700137011370213703137041370513706137071370813709137101371113712137131371413715137161371713718137191372013721137221372313724137251372613727137281372913730137311373213733137341373513736137371373813739137401374113742137431374413745137461374713748137491375013751137521375313754137551375613757137581375913760137611376213763137641376513766137671376813769137701377113772137731377413775137761377713778137791378013781137821378313784137851378613787137881378913790137911379213793137941379513796137971379813799138001380113802138031380413805138061380713808138091381013811138121381313814138151381613817138181381913820138211382213823138241382513826138271382813829138301383113832138331383413835138361383713838138391384013841138421384313844138451384613847138481384913850138511385213853138541385513856138571385813859138601386113862138631386413865138661386713868138691387013871138721387313874138751387613877138781387913880138811388213883138841388513886138871388813889138901389113892138931389413895138961389713898138991390013901139021390313904139051390613907139081390913910139111391213913139141391513916139171391813919139201392113922139231392413925139261392713928139291393013931139321393313934139351393613937139381393913940139411394213943139441394513946139471394813949139501395113952139531395413955139561395713958139591396013961139621396313964139651396613967139681396913970139711397213973139741397513976139771397813979139801398113982139831398413985139861398713988139891399013991139921399313994139951399613997139981399914000140011400214003140041400514006140071400814009140101401114012140131401414015140161401714018140191402014021140221402314024140251402614027140281402914030140311403214033140341403514036140371403814039140401404114042140431404414045140461404714048140491405014051140521405314054140551405614057140581405914060140611406214063140641406514066140671406814069140701407114072140731407414075140761407714078140791408014081140821408314084140851408614087140881408914090140911409214093140941409514096140971409814099141001410114102141031410414105141061410714108141091411014111141121411314114141151411614117141181411914120141211412214123141241412514126141271412814129141301413114132141331413414135141361413714138141391414014141141421414314144141451414614147141481414914150141511415214153141541415514156141571415814159141601416114162141631416414165141661416714168141691417014171141721417314174141751417614177141781417914180141811418214183141841418514186141871418814189141901419114192141931419414195141961419714198141991420014201142021420314204142051420614207142081420914210142111421214213142141421514216142171421814219142201422114222142231422414225142261422714228142291423014231142321423314234142351423614237142381423914240142411424214243142441424514246142471424814249142501425114252142531425414255142561425714258142591426014261142621426314264142651426614267142681426914270142711427214273142741427514276142771427814279142801428114282142831428414285142861428714288142891429014291142921429314294142951429614297142981429914300143011430214303143041430514306143071430814309143101431114312143131431414315143161431714318143191432014321143221432314324143251432614327143281432914330143311433214333143341433514336143371433814339143401434114342143431434414345143461434714348143491435014351143521435314354143551435614357143581435914360143611436214363143641436514366143671436814369143701437114372143731437414375143761437714378143791438014381143821438314384143851438614387143881438914390143911439214393143941439514396143971439814399144001440114402144031440414405144061440714408144091441014411144121441314414144151441614417144181441914420144211442214423144241442514426144271442814429144301443114432144331443414435144361443714438144391444014441144421444314444144451444614447144481444914450144511445214453144541445514456144571445814459144601446114462144631446414465144661446714468144691447014471144721447314474144751447614477144781447914480144811448214483144841448514486144871448814489144901449114492144931449414495144961449714498144991450014501145021450314504145051450614507145081450914510145111451214513145141451514516145171451814519145201452114522145231452414525145261452714528145291453014531145321453314534145351453614537145381453914540145411454214543145441454514546145471454814549145501455114552145531455414555145561455714558145591456014561145621456314564145651456614567145681456914570145711457214573145741457514576145771457814579145801458114582145831458414585145861458714588145891459014591145921459314594145951459614597145981459914600146011460214603146041460514606146071460814609146101461114612146131461414615146161461714618146191462014621146221462314624146251462614627146281462914630146311463214633146341463514636146371463814639146401464114642146431464414645146461464714648146491465014651146521465314654146551465614657146581465914660146611466214663146641466514666146671466814669146701467114672146731467414675146761467714678146791468014681146821468314684146851468614687146881468914690146911469214693146941469514696146971469814699147001470114702147031470414705147061470714708147091471014711147121471314714147151471614717147181471914720147211472214723147241472514726147271472814729147301473114732147331473414735147361473714738147391474014741147421474314744147451474614747147481474914750147511475214753147541475514756147571475814759147601476114762147631476414765147661476714768147691477014771147721477314774147751477614777147781477914780147811478214783147841478514786147871478814789147901479114792147931479414795147961479714798147991480014801148021480314804148051480614807148081480914810148111481214813148141481514816148171481814819148201482114822148231482414825148261482714828148291483014831148321483314834148351483614837148381483914840148411484214843148441484514846148471484814849148501485114852148531485414855148561485714858148591486014861148621486314864148651486614867148681486914870148711487214873148741487514876148771487814879148801488114882148831488414885148861488714888148891489014891148921489314894148951489614897148981489914900149011490214903149041490514906149071490814909149101491114912149131491414915149161491714918149191492014921149221492314924149251492614927149281492914930149311493214933149341493514936149371493814939149401494114942149431494414945149461494714948149491495014951149521495314954149551495614957149581495914960149611496214963149641496514966149671496814969149701497114972149731497414975149761497714978149791498014981149821498314984149851498614987149881498914990149911499214993149941499514996149971499814999150001500115002150031500415005150061500715008150091501015011150121501315014150151501615017150181501915020150211502215023150241502515026150271502815029150301503115032150331503415035150361503715038150391504015041150421504315044150451504615047150481504915050150511505215053150541505515056150571505815059150601506115062150631506415065150661506715068150691507015071150721507315074150751507615077150781507915080150811508215083150841508515086150871508815089150901509115092150931509415095150961509715098150991510015101151021510315104151051510615107151081510915110151111511215113151141511515116151171511815119151201512115122151231512415125151261512715128151291513015131151321513315134151351513615137151381513915140151411514215143151441514515146151471514815149151501515115152151531515415155151561515715158151591516015161151621516315164151651516615167151681516915170151711517215173151741517515176151771517815179151801518115182151831518415185151861518715188151891519015191151921519315194151951519615197151981519915200152011520215203152041520515206152071520815209152101521115212152131521415215152161521715218152191522015221152221522315224152251522615227152281522915230152311523215233152341523515236152371523815239152401524115242152431524415245152461524715248152491525015251152521525315254152551525615257152581525915260152611526215263152641526515266152671526815269152701527115272152731527415275152761527715278152791528015281152821528315284152851528615287152881528915290152911529215293152941529515296152971529815299153001530115302153031530415305153061530715308153091531015311153121531315314153151531615317153181531915320153211532215323153241532515326153271532815329153301533115332153331533415335153361533715338153391534015341153421534315344153451534615347153481534915350153511535215353153541535515356153571535815359153601536115362153631536415365153661536715368153691537015371153721537315374153751537615377153781537915380153811538215383153841538515386153871538815389153901539115392153931539415395153961539715398153991540015401154021540315404154051540615407154081540915410154111541215413154141541515416154171541815419154201542115422154231542415425154261542715428154291543015431154321543315434154351543615437154381543915440154411544215443154441544515446154471544815449154501545115452154531545415455154561545715458154591546015461154621546315464154651546615467154681546915470154711547215473154741547515476154771547815479154801548115482154831548415485154861548715488154891549015491154921549315494154951549615497154981549915500155011550215503155041550515506155071550815509155101551115512155131551415515155161551715518155191552015521155221552315524155251552615527155281552915530155311553215533155341553515536155371553815539155401554115542155431554415545155461554715548155491555015551155521555315554155551555615557155581555915560155611556215563155641556515566155671556815569155701557115572155731557415575155761557715578155791558015581155821558315584155851558615587155881558915590155911559215593155941559515596155971559815599156001560115602156031560415605156061560715608156091561015611156121561315614156151561615617156181561915620156211562215623156241562515626156271562815629156301563115632156331563415635156361563715638156391564015641156421564315644156451564615647156481564915650156511565215653156541565515656156571565815659156601566115662156631566415665156661566715668156691567015671156721567315674156751567615677156781567915680156811568215683156841568515686156871568815689156901569115692156931569415695156961569715698156991570015701157021570315704157051570615707157081570915710157111571215713157141571515716157171571815719157201572115722157231572415725157261572715728157291573015731157321573315734157351573615737157381573915740157411574215743157441574515746157471574815749157501575115752157531575415755157561575715758157591576015761157621576315764157651576615767157681576915770157711577215773157741577515776157771577815779157801578115782157831578415785157861578715788157891579015791157921579315794157951579615797157981579915800158011580215803158041580515806158071580815809158101581115812158131581415815158161581715818158191582015821158221582315824158251582615827158281582915830158311583215833158341583515836158371583815839158401584115842158431584415845158461584715848158491585015851158521585315854158551585615857158581585915860158611586215863158641586515866158671586815869158701587115872158731587415875158761587715878158791588015881158821588315884158851588615887158881588915890158911589215893158941589515896158971589815899159001590115902159031590415905159061590715908159091591015911159121591315914159151591615917159181591915920159211592215923159241592515926159271592815929159301593115932159331593415935159361593715938159391594015941159421594315944159451594615947159481594915950159511595215953159541595515956159571595815959159601596115962159631596415965159661596715968159691597015971159721597315974159751597615977159781597915980159811598215983159841598515986159871598815989159901599115992159931599415995159961599715998159991600016001160021600316004160051600616007160081600916010160111601216013160141601516016160171601816019160201602116022160231602416025160261602716028160291603016031160321603316034160351603616037160381603916040160411604216043160441604516046160471604816049160501605116052160531605416055160561605716058160591606016061160621606316064160651606616067160681606916070160711607216073160741607516076160771607816079160801608116082160831608416085160861608716088160891609016091160921609316094160951609616097160981609916100161011610216103161041610516106161071610816109161101611116112161131611416115161161611716118161191612016121161221612316124161251612616127161281612916130161311613216133161341613516136161371613816139161401614116142161431614416145161461614716148161491615016151161521615316154161551615616157161581615916160161611616216163161641616516166161671616816169161701617116172161731617416175161761617716178161791618016181161821618316184161851618616187161881618916190161911619216193161941619516196161971619816199162001620116202162031620416205162061620716208162091621016211162121621316214162151621616217162181621916220162211622216223162241622516226162271622816229162301623116232162331623416235162361623716238162391624016241162421624316244162451624616247162481624916250162511625216253162541625516256162571625816259162601626116262162631626416265162661626716268162691627016271162721627316274162751627616277162781627916280162811628216283162841628516286162871628816289162901629116292162931629416295162961629716298162991630016301163021630316304163051630616307163081630916310163111631216313163141631516316163171631816319163201632116322163231632416325163261632716328163291633016331163321633316334163351633616337163381633916340163411634216343163441634516346163471634816349163501635116352163531635416355163561635716358163591636016361163621636316364163651636616367163681636916370163711637216373163741637516376163771637816379163801638116382163831638416385163861638716388163891639016391163921639316394163951639616397163981639916400164011640216403164041640516406164071640816409164101641116412164131641416415164161641716418164191642016421164221642316424164251642616427164281642916430164311643216433164341643516436164371643816439164401644116442164431644416445164461644716448164491645016451164521645316454164551645616457164581645916460164611646216463164641646516466164671646816469164701647116472164731647416475164761647716478164791648016481164821648316484164851648616487164881648916490164911649216493164941649516496164971649816499165001650116502165031650416505165061650716508165091651016511165121651316514165151651616517165181651916520165211652216523165241652516526165271652816529165301653116532165331653416535165361653716538165391654016541165421654316544165451654616547165481654916550165511655216553165541655516556165571655816559165601656116562165631656416565165661656716568165691657016571165721657316574165751657616577165781657916580165811658216583165841658516586165871658816589165901659116592165931659416595165961659716598165991660016601166021660316604166051660616607166081660916610166111661216613166141661516616166171661816619166201662116622166231662416625166261662716628166291663016631166321663316634166351663616637166381663916640166411664216643166441664516646166471664816649166501665116652166531665416655166561665716658166591666016661166621666316664166651666616667166681666916670166711667216673166741667516676166771667816679166801668116682166831668416685166861668716688166891669016691166921669316694166951669616697166981669916700167011670216703167041670516706167071670816709167101671116712167131671416715167161671716718167191672016721167221672316724167251672616727167281672916730167311673216733167341673516736167371673816739167401674116742167431674416745167461674716748167491675016751167521675316754167551675616757167581675916760167611676216763167641676516766167671676816769167701677116772167731677416775167761677716778167791678016781167821678316784167851678616787167881678916790167911679216793167941679516796167971679816799168001680116802168031680416805168061680716808168091681016811168121681316814168151681616817168181681916820168211682216823168241682516826168271682816829168301683116832168331683416835168361683716838168391684016841168421684316844168451684616847168481684916850168511685216853168541685516856168571685816859168601686116862168631686416865168661686716868168691687016871168721687316874168751687616877168781687916880168811688216883168841688516886168871688816889168901689116892168931689416895168961689716898168991690016901169021690316904169051690616907169081690916910169111691216913169141691516916169171691816919169201692116922169231692416925169261692716928169291693016931169321693316934169351693616937169381693916940169411694216943169441694516946169471694816949169501695116952169531695416955169561695716958169591696016961169621696316964169651696616967169681696916970169711697216973169741697516976169771697816979169801698116982169831698416985169861698716988169891699016991169921699316994169951699616997169981699917000170011700217003170041700517006170071700817009170101701117012170131701417015170161701717018170191702017021170221702317024170251702617027170281702917030170311703217033170341703517036170371703817039170401704117042170431704417045170461704717048170491705017051170521705317054170551705617057170581705917060170611706217063170641706517066170671706817069170701707117072170731707417075170761707717078170791708017081170821708317084170851708617087170881708917090170911709217093170941709517096170971709817099171001710117102171031710417105171061710717108171091711017111171121711317114171151711617117171181711917120171211712217123171241712517126171271712817129171301713117132171331713417135171361713717138171391714017141171421714317144171451714617147171481714917150171511715217153171541715517156171571715817159171601716117162171631716417165171661716717168171691717017171171721717317174171751717617177171781717917180171811718217183171841718517186171871718817189171901719117192171931719417195171961719717198171991720017201172021720317204172051720617207172081720917210172111721217213172141721517216172171721817219172201722117222172231722417225172261722717228172291723017231172321723317234172351723617237172381723917240172411724217243172441724517246172471724817249172501725117252172531725417255172561725717258172591726017261172621726317264172651726617267172681726917270172711727217273172741727517276172771727817279172801728117282172831728417285172861728717288172891729017291172921729317294172951729617297172981729917300173011730217303173041730517306173071730817309173101731117312173131731417315173161731717318173191732017321173221732317324173251732617327173281732917330173311733217333173341733517336173371733817339173401734117342173431734417345173461734717348173491735017351173521735317354173551735617357173581735917360173611736217363173641736517366173671736817369173701737117372173731737417375173761737717378173791738017381173821738317384173851738617387173881738917390173911739217393173941739517396173971739817399174001740117402174031740417405174061740717408174091741017411174121741317414174151741617417174181741917420174211742217423174241742517426174271742817429174301743117432174331743417435174361743717438174391744017441174421744317444174451744617447174481744917450174511745217453174541745517456174571745817459174601746117462174631746417465174661746717468174691747017471174721747317474174751747617477174781747917480174811748217483174841748517486174871748817489174901749117492174931749417495174961749717498174991750017501175021750317504175051750617507175081750917510175111751217513175141751517516175171751817519175201752117522175231752417525175261752717528175291753017531175321753317534175351753617537175381753917540175411754217543175441754517546175471754817549175501755117552175531755417555175561755717558175591756017561175621756317564175651756617567175681756917570175711757217573175741757517576175771757817579175801758117582175831758417585175861758717588175891759017591175921759317594175951759617597175981759917600176011760217603176041760517606176071760817609176101761117612176131761417615176161761717618176191762017621176221762317624176251762617627176281762917630176311763217633176341763517636176371763817639176401764117642176431764417645176461764717648176491765017651176521765317654176551765617657176581765917660176611766217663176641766517666176671766817669176701767117672176731767417675176761767717678176791768017681176821768317684176851768617687176881768917690176911769217693176941769517696176971769817699177001770117702177031770417705177061770717708177091771017711177121771317714177151771617717177181771917720177211772217723177241772517726177271772817729177301773117732177331773417735177361773717738177391774017741177421774317744177451774617747177481774917750177511775217753177541775517756177571775817759177601776117762177631776417765177661776717768177691777017771177721777317774177751777617777177781777917780177811778217783177841778517786177871778817789177901779117792177931779417795177961779717798177991780017801178021780317804178051780617807178081780917810178111781217813178141781517816178171781817819178201782117822178231782417825178261782717828178291783017831178321783317834178351783617837178381783917840178411784217843178441784517846178471784817849178501785117852178531785417855178561785717858178591786017861178621786317864178651786617867178681786917870178711787217873178741787517876178771787817879178801788117882178831788417885178861788717888178891789017891178921789317894178951789617897178981789917900179011790217903179041790517906179071790817909179101791117912179131791417915179161791717918179191792017921179221792317924179251792617927179281792917930179311793217933179341793517936179371793817939179401794117942179431794417945179461794717948179491795017951179521795317954179551795617957179581795917960179611796217963179641796517966179671796817969179701797117972179731797417975179761797717978179791798017981179821798317984179851798617987179881798917990179911799217993179941799517996179971799817999180001800118002180031800418005180061800718008180091801018011180121801318014180151801618017180181801918020180211802218023180241802518026180271802818029180301803118032180331803418035180361803718038180391804018041180421804318044180451804618047180481804918050180511805218053180541805518056180571805818059180601806118062180631806418065180661806718068180691807018071180721807318074180751807618077180781807918080180811808218083180841808518086180871808818089180901809118092180931809418095180961809718098180991810018101181021810318104181051810618107181081810918110181111811218113181141811518116181171811818119181201812118122181231812418125181261812718128181291813018131181321813318134181351813618137181381813918140181411814218143181441814518146181471814818149181501815118152181531815418155181561815718158181591816018161181621816318164181651816618167181681816918170181711817218173181741817518176181771817818179181801818118182181831818418185181861818718188181891819018191181921819318194181951819618197181981819918200182011820218203182041820518206182071820818209182101821118212182131821418215182161821718218182191822018221182221822318224182251822618227182281822918230182311823218233182341823518236182371823818239182401824118242182431824418245182461824718248182491825018251182521825318254182551825618257182581825918260182611826218263182641826518266182671826818269182701827118272182731827418275182761827718278182791828018281182821828318284182851828618287182881828918290182911829218293182941829518296182971829818299183001830118302183031830418305183061830718308183091831018311183121831318314183151831618317183181831918320183211832218323183241832518326183271832818329183301833118332183331833418335183361833718338183391834018341183421834318344183451834618347183481834918350183511835218353183541835518356183571835818359183601836118362183631836418365183661836718368183691837018371183721837318374183751837618377183781837918380183811838218383183841838518386183871838818389183901839118392183931839418395183961839718398183991840018401184021840318404184051840618407184081840918410184111841218413184141841518416184171841818419184201842118422184231842418425184261842718428184291843018431184321843318434184351843618437184381843918440184411844218443184441844518446184471844818449184501845118452184531845418455184561845718458184591846018461184621846318464184651846618467184681846918470184711847218473184741847518476184771847818479184801848118482184831848418485184861848718488184891849018491184921849318494184951849618497184981849918500185011850218503185041850518506185071850818509185101851118512185131851418515185161851718518185191852018521185221852318524185251852618527185281852918530185311853218533185341853518536185371853818539185401854118542185431854418545185461854718548185491855018551185521855318554185551855618557185581855918560185611856218563185641856518566185671856818569185701857118572185731857418575185761857718578185791858018581185821858318584185851858618587185881858918590185911859218593185941859518596185971859818599186001860118602186031860418605186061860718608186091861018611186121861318614186151861618617186181861918620186211862218623186241862518626186271862818629186301863118632186331863418635186361863718638186391864018641186421864318644186451864618647186481864918650186511865218653186541865518656186571865818659186601866118662186631866418665186661866718668186691867018671186721867318674186751867618677186781867918680186811868218683186841868518686186871868818689186901869118692186931869418695186961869718698186991870018701187021870318704187051870618707187081870918710187111871218713187141871518716187171871818719187201872118722187231872418725187261872718728187291873018731187321873318734187351873618737187381873918740187411874218743187441874518746187471874818749187501875118752187531875418755187561875718758187591876018761187621876318764187651876618767187681876918770187711877218773187741877518776187771877818779187801878118782187831878418785187861878718788187891879018791187921879318794187951879618797187981879918800188011880218803188041880518806188071880818809188101881118812188131881418815188161881718818188191882018821188221882318824188251882618827188281882918830188311883218833188341883518836188371883818839188401884118842188431884418845188461884718848188491885018851188521885318854188551885618857188581885918860188611886218863188641886518866188671886818869188701887118872188731887418875188761887718878188791888018881188821888318884188851888618887188881888918890188911889218893188941889518896188971889818899189001890118902189031890418905189061890718908189091891018911189121891318914189151891618917189181891918920189211892218923189241892518926189271892818929189301893118932189331893418935189361893718938189391894018941189421894318944189451894618947189481894918950189511895218953189541895518956189571895818959189601896118962189631896418965189661896718968189691897018971189721897318974189751897618977189781897918980189811898218983189841898518986189871898818989189901899118992189931899418995189961899718998189991900019001190021900319004190051900619007190081900919010190111901219013190141901519016190171901819019190201902119022190231902419025190261902719028190291903019031190321903319034190351903619037190381903919040190411904219043190441904519046190471904819049190501905119052190531905419055190561905719058190591906019061190621906319064190651906619067190681906919070190711907219073190741907519076190771907819079190801908119082190831908419085190861908719088190891909019091190921909319094190951909619097190981909919100191011910219103191041910519106191071910819109191101911119112191131911419115191161911719118191191912019121191221912319124191251912619127191281912919130191311913219133191341913519136191371913819139191401914119142191431914419145191461914719148191491915019151191521915319154191551915619157191581915919160191611916219163191641916519166191671916819169191701917119172191731917419175191761917719178191791918019181191821918319184191851918619187191881918919190191911919219193191941919519196191971919819199192001920119202192031920419205192061920719208192091921019211192121921319214192151921619217192181921919220192211922219223192241922519226192271922819229192301923119232192331923419235192361923719238192391924019241192421924319244192451924619247192481924919250192511925219253192541925519256192571925819259192601926119262192631926419265192661926719268192691927019271192721927319274192751927619277192781927919280192811928219283192841928519286192871928819289192901929119292192931929419295192961929719298192991930019301193021930319304193051930619307193081930919310193111931219313193141931519316193171931819319193201932119322193231932419325193261932719328193291933019331193321933319334193351933619337193381933919340193411934219343193441934519346193471934819349193501935119352193531935419355193561935719358193591936019361193621936319364193651936619367193681936919370193711937219373193741937519376193771937819379193801938119382193831938419385193861938719388193891939019391193921939319394193951939619397193981939919400194011940219403194041940519406194071940819409194101941119412194131941419415194161941719418194191942019421194221942319424194251942619427194281942919430194311943219433194341943519436194371943819439194401944119442194431944419445194461944719448194491945019451194521945319454194551945619457194581945919460194611946219463194641946519466194671946819469194701947119472194731947419475194761947719478194791948019481194821948319484194851948619487194881948919490194911949219493194941949519496194971949819499195001950119502195031950419505195061950719508195091951019511195121951319514195151951619517195181951919520195211952219523195241952519526195271952819529195301953119532195331953419535195361953719538195391954019541195421954319544195451954619547195481954919550195511955219553195541955519556195571955819559195601956119562195631956419565195661956719568195691957019571195721957319574195751957619577195781957919580195811958219583195841958519586195871958819589195901959119592195931959419595195961959719598195991960019601196021960319604196051960619607196081960919610196111961219613196141961519616196171961819619196201962119622196231962419625196261962719628196291963019631196321963319634196351963619637196381963919640196411964219643196441964519646196471964819649196501965119652196531965419655196561965719658196591966019661196621966319664196651966619667196681966919670196711967219673196741967519676196771967819679196801968119682196831968419685196861968719688196891969019691196921969319694196951969619697196981969919700197011970219703197041970519706197071970819709197101971119712197131971419715197161971719718197191972019721197221972319724197251972619727197281972919730197311973219733197341973519736197371973819739197401974119742197431974419745197461974719748197491975019751197521975319754197551975619757197581975919760197611976219763197641976519766197671976819769197701977119772197731977419775197761977719778197791978019781197821978319784197851978619787197881978919790197911979219793197941979519796197971979819799198001980119802198031980419805198061980719808198091981019811198121981319814198151981619817198181981919820198211982219823198241982519826198271982819829198301983119832198331983419835198361983719838198391984019841198421984319844198451984619847198481984919850198511985219853198541985519856198571985819859198601986119862198631986419865198661986719868198691987019871198721987319874198751987619877198781987919880198811988219883198841988519886198871988819889198901989119892198931989419895198961989719898198991990019901199021990319904199051990619907199081990919910199111991219913199141991519916199171991819919199201992119922199231992419925199261992719928199291993019931199321993319934199351993619937199381993919940199411994219943199441994519946199471994819949199501995119952199531995419955199561995719958199591996019961199621996319964199651996619967199681996919970199711997219973199741997519976199771997819979199801998119982199831998419985199861998719988199891999019991199921999319994199951999619997199981999920000200012000220003200042000520006200072000820009200102001120012200132001420015200162001720018200192002020021200222002320024200252002620027200282002920030200312003220033200342003520036200372003820039200402004120042200432004420045200462004720048200492005020051200522005320054200552005620057200582005920060200612006220063200642006520066200672006820069200702007120072200732007420075200762007720078200792008020081200822008320084200852008620087200882008920090200912009220093200942009520096200972009820099201002010120102201032010420105201062010720108201092011020111201122011320114201152011620117201182011920120201212012220123201242012520126201272012820129201302013120132201332013420135201362013720138201392014020141201422014320144201452014620147201482014920150201512015220153201542015520156201572015820159201602016120162201632016420165201662016720168201692017020171201722017320174201752017620177201782017920180201812018220183201842018520186201872018820189201902019120192201932019420195201962019720198201992020020201202022020320204202052020620207202082020920210202112021220213202142021520216202172021820219202202022120222202232022420225202262022720228202292023020231202322023320234202352023620237202382023920240202412024220243202442024520246202472024820249202502025120252202532025420255202562025720258202592026020261202622026320264202652026620267202682026920270202712027220273202742027520276202772027820279202802028120282202832028420285202862028720288202892029020291202922029320294202952029620297202982029920300203012030220303203042030520306203072030820309203102031120312203132031420315203162031720318203192032020321203222032320324203252032620327203282032920330203312033220333203342033520336203372033820339203402034120342203432034420345203462034720348203492035020351203522035320354203552035620357203582035920360203612036220363203642036520366203672036820369203702037120372203732037420375203762037720378203792038020381203822038320384203852038620387203882038920390203912039220393203942039520396203972039820399204002040120402204032040420405204062040720408204092041020411204122041320414204152041620417204182041920420204212042220423204242042520426204272042820429204302043120432204332043420435204362043720438204392044020441204422044320444204452044620447204482044920450204512045220453204542045520456204572045820459204602046120462204632046420465204662046720468204692047020471204722047320474204752047620477204782047920480204812048220483204842048520486204872048820489204902049120492204932049420495204962049720498204992050020501205022050320504205052050620507205082050920510205112051220513205142051520516205172051820519205202052120522205232052420525205262052720528205292053020531205322053320534205352053620537205382053920540205412054220543205442054520546205472054820549205502055120552205532055420555205562055720558205592056020561205622056320564205652056620567205682056920570205712057220573205742057520576205772057820579205802058120582205832058420585205862058720588205892059020591205922059320594205952059620597205982059920600206012060220603206042060520606206072060820609206102061120612206132061420615206162061720618206192062020621206222062320624206252062620627206282062920630206312063220633206342063520636206372063820639206402064120642206432064420645206462064720648206492065020651206522065320654206552065620657206582065920660206612066220663206642066520666206672066820669206702067120672206732067420675206762067720678206792068020681206822068320684206852068620687206882068920690206912069220693206942069520696206972069820699207002070120702207032070420705207062070720708207092071020711207122071320714207152071620717207182071920720207212072220723207242072520726207272072820729207302073120732207332073420735207362073720738207392074020741207422074320744207452074620747207482074920750207512075220753207542075520756207572075820759207602076120762207632076420765207662076720768207692077020771207722077320774207752077620777207782077920780207812078220783207842078520786207872078820789207902079120792207932079420795207962079720798207992080020801208022080320804208052080620807208082080920810208112081220813208142081520816208172081820819208202082120822208232082420825208262082720828208292083020831208322083320834208352083620837208382083920840208412084220843208442084520846208472084820849208502085120852208532085420855208562085720858208592086020861208622086320864208652086620867208682086920870208712087220873208742087520876208772087820879208802088120882208832088420885208862088720888208892089020891208922089320894208952089620897208982089920900209012090220903209042090520906209072090820909209102091120912209132091420915209162091720918209192092020921209222092320924209252092620927209282092920930209312093220933209342093520936209372093820939209402094120942209432094420945209462094720948209492095020951209522095320954209552095620957209582095920960209612096220963209642096520966209672096820969209702097120972209732097420975209762097720978209792098020981209822098320984209852098620987209882098920990209912099220993209942099520996209972099820999210002100121002210032100421005210062100721008210092101021011210122101321014210152101621017210182101921020210212102221023210242102521026210272102821029210302103121032210332103421035210362103721038210392104021041210422104321044210452104621047210482104921050210512105221053210542105521056210572105821059210602106121062210632106421065210662106721068210692107021071210722107321074210752107621077210782107921080210812108221083210842108521086210872108821089210902109121092210932109421095210962109721098210992110021101211022110321104211052110621107211082110921110211112111221113211142111521116211172111821119211202112121122211232112421125211262112721128211292113021131211322113321134211352113621137211382113921140211412114221143211442114521146211472114821149211502115121152211532115421155211562115721158211592116021161211622116321164211652116621167211682116921170211712117221173211742117521176211772117821179211802118121182211832118421185211862118721188211892119021191211922119321194211952119621197211982119921200212012120221203212042120521206212072120821209212102121121212212132121421215212162121721218212192122021221212222122321224212252122621227212282122921230212312123221233212342123521236212372123821239212402124121242212432124421245212462124721248212492125021251212522125321254212552125621257212582125921260212612126221263212642126521266212672126821269212702127121272212732127421275212762127721278212792128021281212822128321284212852128621287212882128921290212912129221293212942129521296212972129821299213002130121302213032130421305213062130721308213092131021311213122131321314213152131621317213182131921320213212132221323213242132521326213272132821329213302133121332213332133421335213362133721338213392134021341213422134321344213452134621347213482134921350213512135221353213542135521356213572135821359213602136121362213632136421365213662136721368213692137021371213722137321374213752137621377213782137921380213812138221383213842138521386213872138821389213902139121392213932139421395213962139721398213992140021401214022140321404214052140621407214082140921410214112141221413214142141521416214172141821419214202142121422214232142421425214262142721428214292143021431214322143321434214352143621437214382143921440214412144221443214442144521446214472144821449214502145121452214532145421455214562145721458214592146021461214622146321464214652146621467214682146921470214712147221473214742147521476214772147821479214802148121482214832148421485214862148721488214892149021491214922149321494214952149621497214982149921500215012150221503215042150521506215072150821509215102151121512215132151421515215162151721518215192152021521215222152321524215252152621527215282152921530215312153221533215342153521536215372153821539215402154121542215432154421545215462154721548215492155021551215522155321554215552155621557215582155921560215612156221563215642156521566215672156821569215702157121572215732157421575215762157721578215792158021581215822158321584215852158621587215882158921590215912159221593215942159521596215972159821599216002160121602216032160421605216062160721608216092161021611216122161321614216152161621617216182161921620216212162221623216242162521626216272162821629216302163121632216332163421635216362163721638216392164021641216422164321644216452164621647216482164921650216512165221653216542165521656216572165821659216602166121662216632166421665216662166721668216692167021671216722167321674216752167621677216782167921680216812168221683216842168521686216872168821689216902169121692216932169421695216962169721698216992170021701217022170321704217052170621707217082170921710217112171221713217142171521716217172171821719217202172121722217232172421725217262172721728217292173021731217322173321734217352173621737217382173921740217412174221743217442174521746217472174821749217502175121752217532175421755217562175721758217592176021761217622176321764217652176621767217682176921770217712177221773217742177521776217772177821779217802178121782217832178421785217862178721788217892179021791217922179321794217952179621797217982179921800218012180221803218042180521806218072180821809218102181121812218132181421815218162181721818218192182021821218222182321824218252182621827218282182921830218312183221833218342183521836218372183821839218402184121842218432184421845218462184721848218492185021851218522185321854218552185621857218582185921860218612186221863218642186521866218672186821869218702187121872218732187421875218762187721878218792188021881218822188321884218852188621887218882188921890218912189221893218942189521896218972189821899219002190121902219032190421905219062190721908219092191021911219122191321914219152191621917219182191921920219212192221923219242192521926219272192821929219302193121932219332193421935219362193721938219392194021941219422194321944219452194621947219482194921950219512195221953219542195521956219572195821959219602196121962219632196421965219662196721968219692197021971219722197321974219752197621977219782197921980219812198221983219842198521986219872198821989219902199121992219932199421995219962199721998219992200022001220022200322004220052200622007220082200922010220112201222013220142201522016220172201822019220202202122022220232202422025220262202722028220292203022031220322203322034220352203622037220382203922040220412204222043220442204522046220472204822049220502205122052220532205422055220562205722058220592206022061220622206322064220652206622067220682206922070220712207222073220742207522076220772207822079220802208122082220832208422085220862208722088220892209022091220922209322094220952209622097220982209922100221012210222103221042210522106221072210822109221102211122112221132211422115221162211722118221192212022121221222212322124221252212622127221282212922130221312213222133221342213522136221372213822139221402214122142221432214422145221462214722148221492215022151221522215322154221552215622157221582215922160221612216222163221642216522166221672216822169221702217122172221732217422175221762217722178221792218022181221822218322184221852218622187221882218922190221912219222193221942219522196221972219822199222002220122202222032220422205222062220722208222092221022211222122221322214222152221622217222182221922220222212222222223222242222522226222272222822229222302223122232222332223422235222362223722238222392224022241222422224322244222452224622247222482224922250222512225222253222542225522256222572225822259222602226122262222632226422265222662226722268222692227022271222722227322274222752227622277222782227922280222812228222283222842228522286222872228822289222902229122292222932229422295222962229722298222992230022301223022230322304223052230622307223082230922310223112231222313223142231522316223172231822319223202232122322223232232422325223262232722328223292233022331223322233322334223352233622337223382233922340223412234222343223442234522346223472234822349223502235122352223532235422355223562235722358223592236022361223622236322364223652236622367223682236922370223712237222373223742237522376223772237822379223802238122382223832238422385223862238722388223892239022391223922239322394223952239622397223982239922400224012240222403224042240522406224072240822409224102241122412224132241422415224162241722418224192242022421224222242322424224252242622427224282242922430224312243222433224342243522436224372243822439224402244122442224432244422445224462244722448224492245022451224522245322454224552245622457224582245922460224612246222463224642246522466224672246822469224702247122472224732247422475224762247722478224792248022481224822248322484224852248622487224882248922490224912249222493224942249522496224972249822499225002250122502225032250422505225062250722508225092251022511225122251322514225152251622517225182251922520225212252222523225242252522526225272252822529225302253122532225332253422535225362253722538225392254022541225422254322544225452254622547225482254922550225512255222553225542255522556225572255822559225602256122562225632256422565225662256722568225692257022571 |
- /*!
- * DevExpress Diagram (dx-diagram)
- * Version: 0.0.30
- * Build date: Tue Jul 23 2019
- *
- * Copyright (c) 2012 - 2019 Developer Express Inc. ALL RIGHTS RESERVED
- * Read about DevExpress licensing here: https://www.devexpress.com/Support/EULAs
- */
- (function webpackUniversalModuleDefinition(root, factory) {
- if(typeof exports === 'object' && typeof module === 'object')
- module.exports = factory();
- else if(typeof define === 'function' && define.amd)
- define([], factory);
- else if(typeof exports === 'object')
- exports["diagram"] = factory();
- else
- root["DevExpress"] = root["DevExpress"] || {}, root["DevExpress"]["diagram"] = factory();
- })(window, function() {
- return /******/ (function(modules) { // webpackBootstrap
- /******/ // The module cache
- /******/ var installedModules = {};
- /******/
- /******/ // The require function
- /******/ function __webpack_require__(moduleId) {
- /******/
- /******/ // Check if module is in cache
- /******/ if(installedModules[moduleId]) {
- /******/ return installedModules[moduleId].exports;
- /******/ }
- /******/ // Create a new module (and put it into the cache)
- /******/ var module = installedModules[moduleId] = {
- /******/ i: moduleId,
- /******/ l: false,
- /******/ exports: {}
- /******/ };
- /******/
- /******/ // Execute the module function
- /******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
- /******/
- /******/ // Flag the module as loaded
- /******/ module.l = true;
- /******/
- /******/ // Return the exports of the module
- /******/ return module.exports;
- /******/ }
- /******/
- /******/
- /******/ // expose the modules object (__webpack_modules__)
- /******/ __webpack_require__.m = modules;
- /******/
- /******/ // expose the module cache
- /******/ __webpack_require__.c = installedModules;
- /******/
- /******/ // define getter function for harmony exports
- /******/ __webpack_require__.d = function(exports, name, getter) {
- /******/ if(!__webpack_require__.o(exports, name)) {
- /******/ Object.defineProperty(exports, name, { enumerable: true, get: getter });
- /******/ }
- /******/ };
- /******/
- /******/ // define __esModule on exports
- /******/ __webpack_require__.r = function(exports) {
- /******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
- /******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
- /******/ }
- /******/ Object.defineProperty(exports, '__esModule', { value: true });
- /******/ };
- /******/
- /******/ // create a fake namespace object
- /******/ // mode & 1: value is a module id, require it
- /******/ // mode & 2: merge all properties of value into the ns
- /******/ // mode & 4: return value when already ns object
- /******/ // mode & 8|1: behave like require
- /******/ __webpack_require__.t = function(value, mode) {
- /******/ if(mode & 1) value = __webpack_require__(value);
- /******/ if(mode & 8) return value;
- /******/ if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;
- /******/ var ns = Object.create(null);
- /******/ __webpack_require__.r(ns);
- /******/ Object.defineProperty(ns, 'default', { enumerable: true, value: value });
- /******/ if(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));
- /******/ return ns;
- /******/ };
- /******/
- /******/ // getDefaultExport function for compatibility with non-harmony modules
- /******/ __webpack_require__.n = function(module) {
- /******/ var getter = module && module.__esModule ?
- /******/ function getDefault() { return module['default']; } :
- /******/ function getModuleExports() { return module; };
- /******/ __webpack_require__.d(getter, 'a', getter);
- /******/ return getter;
- /******/ };
- /******/
- /******/ // Object.prototype.hasOwnProperty.call
- /******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
- /******/
- /******/ // __webpack_public_path__
- /******/ __webpack_require__.p = "";
- /******/
- /******/
- /******/ // Load entry module and return exports
- /******/ return __webpack_require__(__webpack_require__.s = 46);
- /******/ })
- /************************************************************************/
- /******/ ([
- /* 0 */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- Object.defineProperty(exports, "__esModule", { value: true });
- var Size = /** @class */ (function () {
- function Size(width, height) {
- this.width = width;
- this.height = height;
- }
- Size.prototype.clone = function () { return new Size(this.width, this.height); };
- Size.prototype.toString = function () { return JSON.stringify(this); };
- Size.prototype.offset = function (offsetX, offsetY) {
- if (offsetX === void 0) { offsetX = 0; }
- if (offsetY === void 0) { offsetY = 0; }
- return new Size(Math.max(0, this.width + offsetX), Math.max(0, this.height + offsetY));
- };
- Size.prototype.multiply = function (multiplierW, multiplierH) {
- if (multiplierW === void 0) { multiplierW = 1; }
- if (multiplierH === void 0) { multiplierH = multiplierW; }
- return new Size(this.width * multiplierW, this.height * multiplierH);
- };
- Size.prototype.equals = function (size) {
- return size.width === this.width && size.height === this.height;
- };
- return Size;
- }());
- exports.Size = Size;
- var Point = /** @class */ (function () {
- function Point(x, y) {
- this.x = x;
- this.y = y;
- }
- Point.prototype.clone = function () { return new Point(this.x, this.y); };
- Point.prototype.toString = function () { return JSON.stringify(this); };
- Point.prototype.offset = function (offsetX, offsetY) {
- if (offsetX === void 0) { offsetX = 0; }
- if (offsetY === void 0) { offsetY = 0; }
- return new Point(this.x + offsetX, this.y + offsetY);
- };
- Point.prototype.multiply = function (multiplierX, multiplierY) {
- if (multiplierX === void 0) { multiplierX = 1; }
- if (multiplierY === void 0) { multiplierY = multiplierX; }
- return new Point(this.x * multiplierX, this.y * multiplierY);
- };
- Point.prototype.equals = function (pt) {
- return pt.x === this.x && pt.y === this.y;
- };
- Point.empty = function () {
- return new Point(-1, -1);
- };
- Point.plus = function (a, b) {
- return new Point(a.x + b.x, a.y + b.y);
- };
- Point.minus = function (a, b) {
- return new Point(a.x - b.x, a.y - b.y);
- };
- return Point;
- }());
- exports.Point = Point;
- var Offset = /** @class */ (function () {
- function Offset(left, top, right, bottom) {
- this.left = left;
- this.top = top;
- this.right = right;
- this.bottom = bottom;
- }
- Offset.prototype.clone = function () { return new Offset(this.left, this.top, this.right, this.bottom); };
- return Offset;
- }());
- exports.Offset = Offset;
- var Rectangle = /** @class */ (function () {
- function Rectangle(position, size) {
- this.position = position;
- this.size = size;
- }
- Object.defineProperty(Rectangle.prototype, "left", {
- get: function () {
- return this.position.x;
- },
- enumerable: true,
- configurable: true
- });
- Object.defineProperty(Rectangle.prototype, "top", {
- get: function () {
- return this.position.y;
- },
- enumerable: true,
- configurable: true
- });
- Object.defineProperty(Rectangle.prototype, "right", {
- get: function () {
- return this.position.x + this.size.width;
- },
- enumerable: true,
- configurable: true
- });
- Object.defineProperty(Rectangle.prototype, "bottom", {
- get: function () {
- return this.position.y + this.size.height;
- },
- enumerable: true,
- configurable: true
- });
- Object.defineProperty(Rectangle.prototype, "center", {
- get: function () {
- return new Point(this.position.x + this.size.width / 2, this.position.y + this.size.height / 2);
- },
- enumerable: true,
- configurable: true
- });
- Object.defineProperty(Rectangle.prototype, "width", {
- get: function () {
- return this.size.width;
- },
- enumerable: true,
- configurable: true
- });
- Object.defineProperty(Rectangle.prototype, "height", {
- get: function () {
- return this.size.height;
- },
- enumerable: true,
- configurable: true
- });
- Rectangle.prototype.clone = function () { return new Rectangle(this.position.clone(), this.size.clone()); };
- Rectangle.prototype.toString = function () { return JSON.stringify(this); };
- Rectangle.prototype.contains = function (point) {
- return this.left <= point.x && point.x <= this.right &&
- this.top <= point.y && point.y <= this.bottom;
- };
- Rectangle.prototype.intersectX = function (rect) {
- if (this.left > rect.right || rect.left > this.right)
- return false;
- return true;
- };
- Rectangle.prototype.intersectY = function (rect) {
- if (this.top > rect.bottom || rect.top > this.bottom)
- return false;
- return true;
- };
- Rectangle.prototype.intersect = function (rect) {
- return this.intersectX(rect) && this.intersectY(rect);
- };
- Rectangle.prototype.inflate = function (deltaX, deltaY) {
- deltaY = deltaY === undefined ? deltaX : deltaY;
- return new Rectangle(this.position.offset(-deltaX, -deltaY), this.size.offset(2 * deltaX, 2 * deltaY));
- };
- Rectangle.prototype.resize = function (deltaX, deltaY) {
- return new Rectangle(this.position, this.size.offset(deltaX, deltaY));
- };
- Rectangle.prototype.offset = function (offsetX, offsetY) {
- return new Rectangle(this.position.offset(offsetX, offsetY), this.size);
- };
- Rectangle.prototype.multiply = function (multiplier) {
- return new Rectangle(this.position.multiply(multiplier), this.size.multiply(multiplier));
- };
- Rectangle.create = function (x, y, width, height) {
- return new Rectangle(new Point(x, y), new Size(width, height));
- };
- Rectangle.createByPoints = function (point1, point2) {
- return Rectangle.createByPositions(point1.x, point1.y, point2.x, point2.y);
- };
- Rectangle.createByPositions = function (x1, y1, x2, y2) {
- var x = Math.min(x1, x2);
- var y = Math.min(y1, y2);
- var width = Math.abs(x2 - x1);
- var height = Math.abs(y2 - y1);
- return Rectangle.create(x, y, width, height);
- };
- return Rectangle;
- }());
- exports.Rectangle = Rectangle;
- var Segment = /** @class */ (function () {
- function Segment(startPoint, endPoint) {
- this.startPoint = startPoint;
- this.endPoint = endPoint;
- }
- Object.defineProperty(Segment.prototype, "distance", {
- get: function () {
- return GeometryUtils.getDistance(this.startPoint, this.endPoint);
- },
- enumerable: true,
- configurable: true
- });
- Segment.prototype.intersect = function (segment) {
- if (this.startPoint.equals(segment.startPoint) || this.endPoint.equals(segment.startPoint) ||
- this.startPoint.equals(segment.endPoint) || this.endPoint.equals(segment.endPoint))
- return true;
- return this.intersectCore(segment) && segment.intersectCore(this);
- };
- Segment.prototype.intersectRect = function (rectangle) {
- var ltPt = rectangle.position, lbPt = new Point(rectangle.left, rectangle.bottom), rtPt = new Point(rectangle.right, rectangle.top), rbPt = new Point(rectangle.right, rectangle.bottom);
- return rectangle.contains(this.startPoint) || rectangle.contains(this.endPoint) ||
- this.intersect(new Segment(ltPt, lbPt)) || this.intersect(new Segment(lbPt, rbPt)) ||
- this.intersect(new Segment(rbPt, rtPt)) || this.intersect(new Segment(rtPt, ltPt));
- };
- Segment.prototype.intersectCore = function (segment) {
- if (this.startPoint.x === this.endPoint.x) {
- if (this.startPoint.x - segment.endPoint.x !== 0)
- return (this.startPoint.x - segment.startPoint.x) / (this.startPoint.x - segment.endPoint.x) <= 0;
- if (segment.endPoint.y - this.endPoint.y !== 0)
- return (segment.endPoint.y - this.startPoint.y) / (segment.endPoint.y - this.endPoint.y) <= 0;
- }
- if (this.startPoint.y === this.endPoint.y) {
- if (this.startPoint.y - segment.endPoint.y !== 0)
- return (this.startPoint.y - segment.startPoint.y) / (this.startPoint.y - segment.endPoint.y) <= 0;
- if (segment.endPoint.x - this.endPoint.x !== 0)
- return (segment.endPoint.x - this.startPoint.x) / (segment.endPoint.x - this.endPoint.x) <= 0;
- }
- var tg = (this.endPoint.y - this.startPoint.y) / (this.endPoint.x - this.startPoint.x);
- var y1 = this.startPoint.y + (segment.startPoint.x - this.startPoint.x) * tg;
- var y2 = this.startPoint.y + (segment.endPoint.x - this.startPoint.x) * tg;
- var dy1 = segment.startPoint.y - y1;
- var dy2 = segment.endPoint.y - y2;
- if (dy1 === 0 && dy2 === 0) {
- return (this.startPoint.y - y1) / (this.endPoint.y - y1) <= 0 ||
- (this.startPoint.y - y2) / (this.endPoint.y - y2) <= 0;
- }
- return dy1 === 0 || dy2 === 0 || dy1 / dy2 < 0;
- };
- Segment.create = function (x1, y1, x2, y2) {
- return new Segment(new Point(x1, y1), new Point(x2, y2));
- };
- Segment.createByPoints = function (point1, point2) {
- return Segment.create(point1.x, point1.y, point2.x, point2.y);
- };
- return Segment;
- }());
- exports.Segment = Segment;
- var EventDispatcher = /** @class */ (function () {
- function EventDispatcher() {
- this.listeners = [];
- }
- EventDispatcher.prototype.add = function (listener) {
- if (!listener)
- throw new Error("Not Implemented");
- if (!this.hasEventListener(listener))
- this.listeners.push(listener);
- };
- EventDispatcher.prototype.remove = function (listener) {
- for (var i = 0, currentListener; currentListener = this.listeners[i]; i++) {
- if (currentListener === listener) {
- this.listeners.splice(i, 1);
- break;
- }
- }
- };
- EventDispatcher.prototype.raise = function (funcName) {
- var args = [];
- for (var _i = 1; _i < arguments.length; _i++) {
- args[_i - 1] = arguments[_i];
- }
- for (var i = 0, listener; listener = this.listeners[i]; i++) {
- listener[funcName].apply(listener, args);
- }
- };
- EventDispatcher.prototype.raise1 = function (action) {
- for (var i = 0, listener; listener = this.listeners[i]; i++) {
- action(listener);
- }
- };
- EventDispatcher.prototype.hasEventListener = function (listener) {
- for (var i = 0, l = this.listeners.length; i < l; i++)
- if (this.listeners[i] === listener)
- return true;
- return false;
- };
- return EventDispatcher;
- }());
- exports.EventDispatcher = EventDispatcher;
- var Utils = /** @class */ (function () {
- function Utils() {
- }
- //http://workservices01/OpenWiki/ow.asp?ASPxRichEdit_BinarySearch#preview
- // BINARY INDEX
- // Input array [4, 8, 10]
- // find binaryIndexOf normedBinaryIndexOf
- // (-inf, 3] -1 -1
- // 4 0 0
- // [5, 7] -2 0
- // 8 1 1
- // 9 -3 1
- // 10 2 2
- // [11, +inf) -4 2
- // case array.length == 0, then return -1
- // don't touch default value = -2! In some case binaryIndexOf call as ([], ()=>.., 0, [].length - 1)
- Utils.binaryIndexOf = function (array, comparer, minIndex, maxIndex) {
- if (minIndex === void 0) { minIndex = 0; }
- if (maxIndex === void 0) { maxIndex = -2; }
- var findFromZeroPosition = minIndex == 0;
- if (maxIndex == -2)
- maxIndex = array.length - 1;
- while (minIndex <= maxIndex) {
- var currentIndex = (minIndex + ((maxIndex - minIndex) >> 1));
- var compare = comparer(array[currentIndex]);
- if (compare < 0)
- minIndex = currentIndex + 1;
- else if (compare > 0)
- maxIndex = currentIndex - 1;
- else
- return currentIndex;
- }
- return findFromZeroPosition ? ~minIndex : -1;
- };
- Utils.normedBinaryIndexOf = function (array, comparer, minIndex, maxIndex) {
- if (minIndex === void 0) { minIndex = 0; }
- if (maxIndex === void 0) { maxIndex = -2; }
- var index = Utils.binaryIndexOf(array, comparer, minIndex, maxIndex);
- return Utils.binaryIndexNormalizator(index);
- };
- Utils.binaryIndexNormalizator = function (index) {
- return index < 0 ? ~index - 1 : index;
- };
- return Utils;
- }());
- exports.Utils = Utils;
- var GeometryUtils = /** @class */ (function () {
- function GeometryUtils() {
- }
- GeometryUtils.getCommonRectangle = function (rects) {
- if (!rects.length)
- return Rectangle.create(0, 0, 0, 0);
- var minX = Number.MAX_VALUE;
- var maxX = -Number.MAX_VALUE;
- var minY = Number.MAX_VALUE;
- var maxY = -Number.MAX_VALUE;
- rects.forEach(function (rect) {
- minX = Math.min(minX, rect.left);
- maxX = Math.max(maxX, rect.right);
- minY = Math.min(minY, rect.top);
- maxY = Math.max(maxY, rect.bottom);
- });
- return Rectangle.create(minX, minY, maxX - minX, maxY - minY);
- };
- GeometryUtils.findFreeSpace = function (rects, size, exact) {
- var xs = [0], xshash;
- var ys = [0];
- rects.forEach(function (r) {
- xs.push(r.left);
- xs.push(r.right);
- ys.push(r.top);
- ys.push(r.bottom);
- });
- xs = xs.sort(function (a, b) { return a - b; }).reduce(function (acc, v, index) { return (xs[index - 1] !== v && acc.push(v) && acc) || acc; }, []); // magic for distinct
- ys = ys.sort(function (a, b) { return a - b; }).reduce(function (acc, v, index) { return (ys[index - 1] !== v && acc.push(v) && acc) || acc; }, []);
- var matrix = ys.map(function (y) { return xs.map(function (x, i) { return xs[i + 1] - x; }); });
- var _loop_1 = function (i, rect) {
- var xi0 = Utils.binaryIndexOf(xs, function (a) { return a - rect.left; });
- var xi1 = Utils.binaryIndexOf(xs, function (a) { return a - rect.right; });
- var yi0 = Utils.binaryIndexOf(ys, function (a) { return a - rect.top; });
- var yi1 = Utils.binaryIndexOf(ys, function (a) { return a - rect.bottom; });
- for (var y = yi0; y < yi1; y++)
- for (var x = xi0; x < xi1; x++)
- matrix[y][x] *= -1;
- };
- for (var i = 0, rect = void 0; rect = rects[i]; i++) {
- _loop_1(i, rect);
- }
- for (var yi = 0; yi < ys.length; yi++) {
- for (var xi = 0; xi < xs.length - 1; xi++) {
- var checkResult = this.checkRect(matrix, ys, xs, yi, xi, size, exact);
- if (checkResult > 0)
- xi = checkResult;
- else if (checkResult === 0)
- return new Point(xs[xi], ys[yi]);
- }
- }
- return null;
- };
- GeometryUtils.checkRect = function (matrix, ys, xs, yimin, ximin, size, exact) {
- var height = 0;
- var width = 0;
- var ximax = xs.length - 2;
- for (var yi = yimin; yi < ys.length; yi++) {
- height = ys[yi + 1] - ys[yimin];
- for (var xi = ximin; xi <= ximax; xi++) {
- if (matrix[yi][xi] < 0)
- return xi === 0 ? -1 : xi; // move left?
- width = xs[xi + 1] - xs[ximin];
- if (size.width <= width || (!exact && xi === xs.length - 2 && size.width / 2 <= width)) {
- if (size.height <= height || (!exact && yi === ys.length - 2 && size.height / 2 <= height))
- return 0;
- ximax = xi;
- }
- }
- }
- };
- GeometryUtils.getArrowPoints = function (point, directionPoint, arrowHeight, arrowWidth) {
- if (point.x === directionPoint.x && point.y === directionPoint.y)
- return { point1: point.clone(), point2: point.clone() };
- var catX = directionPoint.x - point.x;
- var catY = directionPoint.y - point.y;
- var hypotenuse = Math.sqrt(Math.pow(catX, 2) + Math.pow(catY, 2));
- var cos = catX / hypotenuse;
- var sin = catY / hypotenuse;
- var x1 = point.x + arrowHeight * cos + arrowWidth * sin;
- var y1 = point.y + arrowHeight * sin - arrowWidth * cos;
- var x2 = point.x + arrowHeight * cos - arrowWidth * sin;
- var y2 = point.y + arrowHeight * sin + arrowWidth * cos;
- return { point1: new Point(x1, y1), point2: new Point(x2, y2) };
- };
- GeometryUtils.removeUnnecessaryLinePoints = function (points, removeCallback, checkCallback) {
- if (checkCallback === void 0) { checkCallback = (function (pt) { return pt !== undefined; }); }
- this.removeDuplicatedPoints(points, removeCallback, checkCallback);
- this.removeOneLinePoints(points, removeCallback, checkCallback);
- this.removeBackwardPoints(points, removeCallback, checkCallback);
- };
- GeometryUtils.removeBackwardPoints = function (points, removeCallback, checkCallback) {
- if (checkCallback === void 0) { checkCallback = (function (pt) { return pt !== undefined; }); }
- var index = 0;
- var point;
- while (point = points[index]) {
- if (points.length <= 2)
- break;
- var nextPoint = this.getNextPoint(points, index, true, checkCallback);
- var prevPoint = this.getNextPoint(points, index, false, checkCallback);
- if (prevPoint && nextPoint) {
- if (point.x == prevPoint.x && point.x == nextPoint.x) {
- if ((point.y > prevPoint.y && point.y > nextPoint.y) ||
- (point.y < prevPoint.y && point.y < nextPoint.y)) {
- if (removeCallback(points[index], index))
- continue;
- }
- }
- if (point.y == prevPoint.y && point.y == nextPoint.y) {
- if ((point.x > prevPoint.x && point.x > nextPoint.x) ||
- (point.x < prevPoint.x && point.x < nextPoint.x)) {
- if (removeCallback(points[index], index))
- continue;
- }
- }
- }
- index++;
- }
- };
- GeometryUtils.removeOneLinePoints = function (points, removeCallback, checkCallback) {
- if (checkCallback === void 0) { checkCallback = (function (pt) { return pt !== undefined; }); }
- var index = 0;
- var point;
- while (point = points[index]) {
- if (points.length <= 2)
- break;
- var nextPoint = this.getNextPoint(points, index, true, checkCallback);
- var prevPoint = this.getNextPoint(points, index, false, checkCallback);
- if (prevPoint && nextPoint) {
- if ((point.x == prevPoint.x && point.x == nextPoint.x) ||
- (point.y == prevPoint.y && point.y == nextPoint.y)) {
- if (removeCallback(points[index], index))
- continue;
- }
- var tg = (nextPoint.y - prevPoint.y) / (nextPoint.x - prevPoint.x);
- if (nextPoint.y - points[index].y == (nextPoint.x - points[index].x) * tg) {
- if (removeCallback(points[index], index))
- continue;
- }
- }
- index++;
- }
- };
- GeometryUtils.removeDuplicatedPoints = function (points, removeCallback, checkCallback) {
- if (checkCallback === void 0) { checkCallback = (function (pt) { return pt !== undefined; }); }
- var index = 0;
- var point;
- while (point = points[index]) {
- if (points.length <= 2)
- break;
- var nextPoint = this.getNextPoint(points, index, true, checkCallback);
- if (nextPoint) {
- if (point.x == nextPoint.x && point.y == nextPoint.y) {
- var indexToRemove = index + 1;
- if (indexToRemove === points.length - 1)
- indexToRemove--;
- if (removeCallback(points[indexToRemove], indexToRemove))
- continue;
- }
- }
- index++;
- }
- };
- GeometryUtils.getNextPoint = function (points, index, direction, checkCallback) {
- var result;
- var newIndex = index + (direction ? 1 : -1);
- while (result = points[newIndex]) {
- if (checkCallback(result))
- return result;
- newIndex = newIndex + (direction ? 1 : -1);
- }
- };
- GeometryUtils.getDistance = function (a, b) {
- return Math.sqrt(Math.pow(a.x - b.x, 2) + Math.pow(a.y - b.y, 2));
- };
- GeometryUtils.getPathLength = function (points) {
- var length = 0;
- var prevPt;
- points.forEach(function (pt) {
- if (prevPt !== undefined) {
- var lineLength = GeometryUtils.getDistance(pt, prevPt);
- length += lineLength;
- }
- prevPt = pt;
- });
- return length;
- };
- GeometryUtils.getPathPointByPosition = function (points, relativePosition) {
- if (!points.length)
- throw new Error("Invalid points");
- if (0 > relativePosition || relativePosition > 1)
- throw new Error("Invalid relative position");
- var length = this.getPathLength(points);
- if (points.length <= 2 && length === 0)
- return points[0];
- var targetLength = length * relativePosition;
- var currentLength = 0;
- for (var i = 1; i < points.length; i++) {
- var lineLength = GeometryUtils.getDistance(points[i], points[i - 1]);
- if (currentLength + lineLength >= targetLength) {
- var delta = targetLength - currentLength;
- var cos = (points[i].x - points[i - 1].x) / lineLength;
- var sin = (points[i].y - points[i - 1].y) / lineLength;
- return new Point(points[i - 1].x + cos * delta, points[i - 1].y + sin * delta);
- }
- currentLength += lineLength;
- }
- ;
- return points[points.length - 1];
- };
- GeometryUtils.getLineAngle = function (beginPoint, endPoint) {
- return Math.atan2(endPoint.y - beginPoint.y, endPoint.x - beginPoint.x);
- };
- GeometryUtils.getTriangleBeginAngle = function (beginPoint, endPoint, point) {
- var lineAngle = this.getLineAngle(beginPoint, endPoint);
- var beginPointAngle = this.getLineAngle(beginPoint, point);
- return Math.abs(beginPointAngle - lineAngle);
- };
- GeometryUtils.getTriangleEndAngle = function (beginPoint, endPoint, point) {
- var lineAngle = this.getLineAngle(beginPoint, endPoint);
- var endPointAngle = this.getLineAngle(point, endPoint);
- return Math.abs(lineAngle - endPointAngle);
- };
- GeometryUtils.getPathPointByPoint = function (points, point) {
- if (!points.length)
- throw new Error("Invalid points");
- if (points.length === 1)
- return points[0];
- var distance = Number.MAX_VALUE;
- var result;
- for (var i = 1; i < points.length; i++) {
- var beginPoint = points[i - 1];
- var endPoint = points[i];
- if (point.equals(beginPoint)) {
- result = beginPoint.clone();
- break;
- }
- if (point.equals(endPoint)) {
- result = endPoint.clone();
- break;
- }
- var beginAngle = this.getTriangleBeginAngle(beginPoint, endPoint, point);
- var endAngle = this.getTriangleEndAngle(beginPoint, endPoint, point);
- var beginDistance = GeometryUtils.getDistance(point, beginPoint);
- var endDistance = GeometryUtils.getDistance(point, endPoint);
- var orthOffset = beginDistance * Math.sin(beginAngle);
- var currentDistance = void 0;
- if (Math.PI / 2 <= beginAngle && beginAngle <= Math.PI * 3 / 2)
- currentDistance = beginDistance;
- else if (Math.PI / 2 <= endAngle && endAngle <= Math.PI * 3 / 2)
- currentDistance = endDistance;
- else
- currentDistance = Math.abs(orthOffset);
- if (currentDistance < distance) {
- distance = currentDistance;
- if (Math.PI / 2 <= beginAngle && beginAngle <= Math.PI * 3 / 2)
- result = beginPoint.clone();
- else if (Math.PI / 2 <= endAngle && endAngle <= Math.PI * 3 / 2)
- result = endPoint.clone();
- else {
- var lineAngle = this.getLineAngle(beginPoint, endPoint);
- var offsetX = Math.fround(Math.abs(orthOffset * Math.sin(lineAngle)));
- var offsetY = Math.fround(Math.abs(orthOffset * Math.cos(lineAngle)));
- var isAbove = point.y - beginPoint.y < Math.fround((point.x - beginPoint.x) * Math.tan(lineAngle));
- if (0 <= lineAngle && lineAngle <= Math.PI / 2) {
- offsetX *= isAbove ? -1 : 1;
- offsetY *= isAbove ? 1 : -1;
- }
- else if (Math.PI / 2 <= lineAngle && lineAngle <= Math.PI) {
- offsetX *= isAbove ? 1 : -1;
- offsetY *= isAbove ? 1 : -1;
- }
- else if (0 >= lineAngle && lineAngle >= -Math.PI / 2) {
- offsetX *= isAbove ? 1 : -1;
- offsetY *= isAbove ? 1 : -1;
- }
- else if (-Math.PI / 2 >= lineAngle && lineAngle >= -Math.PI) {
- offsetX *= isAbove ? -1 : 1;
- offsetY *= isAbove ? 1 : -1;
- }
- result = point.offset(offsetX, offsetY);
- }
- }
- }
- ;
- return result;
- };
- GeometryUtils.getPathPositionByPoint = function (points, point, maxPositionCount) {
- if (maxPositionCount === void 0) { maxPositionCount = 100; }
- point = this.getPathPointByPoint(points, point);
- var length = this.getPathLength(points);
- var currentLength = 0;
- for (var i = 1; i < points.length; i++) {
- var beginPoint = points[i - 1];
- var endPoint = points[i];
- var lineLength = GeometryUtils.getDistance(endPoint, beginPoint);
- var angle = Math.atan((endPoint.y - beginPoint.y) / (endPoint.x - beginPoint.x));
- if ((point.x === endPoint.x && point.x === beginPoint.x) || (point.y === endPoint.y && point.y === beginPoint.y) ||
- Math.fround(point.y - beginPoint.y) === Math.fround((point.x - beginPoint.x) * Math.tan(angle))) {
- if (Math.sin(angle) !== 0)
- currentLength += Math.abs((point.y - beginPoint.y) / Math.sin(angle));
- else
- currentLength += Math.abs(point.x - beginPoint.x);
- return Math.round(currentLength * maxPositionCount / length) / maxPositionCount;
- }
- currentLength += lineLength;
- }
- ;
- return 1;
- };
- GeometryUtils.arePointsEqual = function (points1, points2) {
- var count1 = points1.length;
- var count2 = points2.length;
- if (count1 != count2)
- return false;
- for (var i = 0; i < count1; i++)
- if (!points1[i].equals(points2[i]))
- return false;
- return true;
- };
- return GeometryUtils;
- }());
- exports.GeometryUtils = GeometryUtils;
- /***/ }),
- /* 1 */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- Object.defineProperty(exports, "__esModule", { value: true });
- var ShapeCategory;
- (function (ShapeCategory) {
- ShapeCategory[ShapeCategory["Undefined"] = 0] = "Undefined";
- ShapeCategory[ShapeCategory["General"] = 1] = "General";
- ShapeCategory[ShapeCategory["Flowchart"] = 2] = "Flowchart";
- ShapeCategory[ShapeCategory["Custom"] = 3] = "Custom";
- })(ShapeCategory = exports.ShapeCategory || (exports.ShapeCategory = {}));
- var ShapeType;
- (function (ShapeType) {
- // Standard
- ShapeType[ShapeType["Text"] = 0] = "Text";
- ShapeType[ShapeType["Rectangle"] = 1] = "Rectangle";
- ShapeType[ShapeType["Ellipsis"] = 2] = "Ellipsis";
- ShapeType[ShapeType["Cross"] = 3] = "Cross";
- ShapeType[ShapeType["Triangle"] = 4] = "Triangle";
- ShapeType[ShapeType["Diamond"] = 5] = "Diamond";
- ShapeType[ShapeType["Heart"] = 6] = "Heart";
- ShapeType[ShapeType["Pentagon"] = 7] = "Pentagon";
- ShapeType[ShapeType["Hexagon"] = 8] = "Hexagon";
- ShapeType[ShapeType["Octagon"] = 9] = "Octagon";
- ShapeType[ShapeType["Star"] = 10] = "Star";
- ShapeType[ShapeType["ArrowLeft"] = 11] = "ArrowLeft";
- ShapeType[ShapeType["ArrowTop"] = 12] = "ArrowTop";
- ShapeType[ShapeType["ArrowRight"] = 13] = "ArrowRight";
- ShapeType[ShapeType["ArrowBottom"] = 14] = "ArrowBottom";
- ShapeType[ShapeType["ArrowNorthSouth"] = 15] = "ArrowNorthSouth";
- ShapeType[ShapeType["ArrowEastWest"] = 16] = "ArrowEastWest";
- // Flowchart
- ShapeType[ShapeType["Process"] = 17] = "Process";
- ShapeType[ShapeType["Decision"] = 18] = "Decision";
- ShapeType[ShapeType["Terminator"] = 19] = "Terminator";
- ShapeType[ShapeType["PredefinedProcess"] = 20] = "PredefinedProcess";
- ShapeType[ShapeType["Document"] = 21] = "Document";
- ShapeType[ShapeType["MultipleDocuments"] = 22] = "MultipleDocuments";
- ShapeType[ShapeType["ManualInput"] = 23] = "ManualInput";
- ShapeType[ShapeType["Preparation"] = 24] = "Preparation";
- ShapeType[ShapeType["Data"] = 25] = "Data";
- ShapeType[ShapeType["Database"] = 26] = "Database";
- ShapeType[ShapeType["HardDisk"] = 27] = "HardDisk";
- ShapeType[ShapeType["InternalStorage"] = 28] = "InternalStorage";
- ShapeType[ShapeType["PaperTape"] = 29] = "PaperTape";
- ShapeType[ShapeType["ManualOperation"] = 30] = "ManualOperation";
- ShapeType[ShapeType["Delay"] = 31] = "Delay";
- ShapeType[ShapeType["StoredData"] = 32] = "StoredData";
- ShapeType[ShapeType["Display"] = 33] = "Display";
- ShapeType[ShapeType["Merge"] = 34] = "Merge";
- ShapeType[ShapeType["Or"] = 35] = "Or";
- ShapeType[ShapeType["SummingJunction"] = 36] = "SummingJunction";
- // Custom (must be last)
- ShapeType[ShapeType["Custom"] = 37] = "Custom";
- })(ShapeType = exports.ShapeType || (exports.ShapeType = {}));
- /***/ }),
- /* 2 */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- var __extends = (this && this.__extends) || (function () {
- var extendStatics = function (d, b) {
- extendStatics = Object.setPrototypeOf ||
- ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
- function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
- return extendStatics(d, b);
- };
- return function (d, b) {
- extendStatics(d, b);
- function __() { this.constructor = d; }
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
- };
- })();
- Object.defineProperty(exports, "__esModule", { value: true });
- var UnitConverter_1 = __webpack_require__(13);
- var RenderManager_1 = __webpack_require__(10);
- var Primitive_1 = __webpack_require__(15);
- var PathPrimitive = /** @class */ (function (_super) {
- __extends(PathPrimitive, _super);
- function PathPrimitive(commands, style, className, clipPathId, onApplyProperties) {
- var _this = _super.call(this, style, className, clipPathId, onApplyProperties) || this;
- _this.commands = commands;
- return _this;
- }
- PathPrimitive.prototype.createMainElement = function () {
- return document.createElementNS(RenderManager_1.svgNS, "path");
- };
- PathPrimitive.prototype.applyElementProperties = function (element) {
- element.setAttribute("d", this.commands.map(function (c) { return c.toString(); }).join(" "));
- _super.prototype.applyElementProperties.call(this, element);
- };
- return PathPrimitive;
- }(Primitive_1.SvgPrimitive));
- exports.PathPrimitive = PathPrimitive;
- var PathPrimitiveCommand = /** @class */ (function () {
- function PathPrimitiveCommand() {
- }
- PathPrimitiveCommand.prototype.getUnitVaue = function (value) {
- return typeof value === "number" ? UnitConverter_1.UnitConverter.twipsToPixels(value).toString() : value;
- };
- return PathPrimitiveCommand;
- }());
- exports.PathPrimitiveCommand = PathPrimitiveCommand;
- var PathPrimitiveMoveToCommand = /** @class */ (function (_super) {
- __extends(PathPrimitiveMoveToCommand, _super);
- function PathPrimitiveMoveToCommand(x, y) {
- var _this = _super.call(this) || this;
- _this.x = x;
- _this.y = y;
- return _this;
- }
- PathPrimitiveMoveToCommand.prototype.toString = function () {
- return "M " + this.getUnitVaue(this.x) + " " + this.getUnitVaue(this.y);
- };
- return PathPrimitiveMoveToCommand;
- }(PathPrimitiveCommand));
- exports.PathPrimitiveMoveToCommand = PathPrimitiveMoveToCommand;
- var PathPrimitiveLineToCommand = /** @class */ (function (_super) {
- __extends(PathPrimitiveLineToCommand, _super);
- function PathPrimitiveLineToCommand(x, y) {
- var _this = _super.call(this) || this;
- _this.x = x;
- _this.y = y;
- return _this;
- }
- PathPrimitiveLineToCommand.prototype.toString = function () {
- return "L " + this.getUnitVaue(this.x) + " " + this.getUnitVaue(this.y);
- };
- return PathPrimitiveLineToCommand;
- }(PathPrimitiveCommand));
- exports.PathPrimitiveLineToCommand = PathPrimitiveLineToCommand;
- var PathPrimitiveCubicCurveToCommand = /** @class */ (function (_super) {
- __extends(PathPrimitiveCubicCurveToCommand, _super);
- function PathPrimitiveCubicCurveToCommand(x1, y1, x2, y2, x3, y3) {
- var _this = _super.call(this) || this;
- _this.x1 = x1;
- _this.y1 = y1;
- _this.x2 = x2;
- _this.y2 = y2;
- _this.x3 = x3;
- _this.y3 = y3;
- return _this;
- }
- PathPrimitiveCubicCurveToCommand.prototype.toString = function () {
- return "C " + this.getUnitVaue(this.x1) + " " + this.getUnitVaue(this.y1) + "," +
- this.getUnitVaue(this.x2) + " " + this.getUnitVaue(this.y2) + "," +
- this.getUnitVaue(this.x3) + " " + this.getUnitVaue(this.y3);
- };
- return PathPrimitiveCubicCurveToCommand;
- }(PathPrimitiveCommand));
- exports.PathPrimitiveCubicCurveToCommand = PathPrimitiveCubicCurveToCommand;
- var PathPrimitiveQuadraticCurveToCommand = /** @class */ (function (_super) {
- __extends(PathPrimitiveQuadraticCurveToCommand, _super);
- function PathPrimitiveQuadraticCurveToCommand(x1, y1, x2, y2) {
- var _this = _super.call(this) || this;
- _this.x1 = x1;
- _this.y1 = y1;
- _this.x2 = x2;
- _this.y2 = y2;
- return _this;
- }
- PathPrimitiveQuadraticCurveToCommand.prototype.toString = function () {
- return "Q " + this.getUnitVaue(this.x1) + " " + this.getUnitVaue(this.y1) + "," +
- this.getUnitVaue(this.x2) + " " + this.getUnitVaue(this.y2);
- };
- return PathPrimitiveQuadraticCurveToCommand;
- }(PathPrimitiveCommand));
- exports.PathPrimitiveQuadraticCurveToCommand = PathPrimitiveQuadraticCurveToCommand;
- var PathPrimitiveArcToCommand = /** @class */ (function (_super) {
- __extends(PathPrimitiveArcToCommand, _super);
- function PathPrimitiveArcToCommand(rx, ry, xAxisRotation, largeArcFlag, sweepFag, x, y) {
- var _this = _super.call(this) || this;
- _this.rx = rx;
- _this.ry = ry;
- _this.xAxisRotation = xAxisRotation;
- _this.largeArcFlag = largeArcFlag;
- _this.sweepFag = sweepFag;
- _this.x = x;
- _this.y = y;
- return _this;
- }
- PathPrimitiveArcToCommand.prototype.toString = function () {
- return "A " + this.getUnitVaue(this.rx) + " " + this.getUnitVaue(this.ry) + " " +
- this.getUnitVaue(this.xAxisRotation) + " " +
- (this.largeArcFlag ? "1" : "0") + " " + (this.sweepFag ? "1" : "0") +
- this.getUnitVaue(this.x) + "," + this.getUnitVaue(this.y);
- };
- return PathPrimitiveArcToCommand;
- }(PathPrimitiveCommand));
- exports.PathPrimitiveArcToCommand = PathPrimitiveArcToCommand;
- var PathPrimitiveClosePathCommand = /** @class */ (function (_super) {
- __extends(PathPrimitiveClosePathCommand, _super);
- function PathPrimitiveClosePathCommand() {
- return _super.call(this) || this;
- }
- PathPrimitiveClosePathCommand.prototype.toString = function () {
- return "z";
- };
- return PathPrimitiveClosePathCommand;
- }(PathPrimitiveCommand));
- exports.PathPrimitiveClosePathCommand = PathPrimitiveClosePathCommand;
- /***/ }),
- /* 3 */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- Object.defineProperty(exports, "__esModule", { value: true });
- var Utils_1 = __webpack_require__(0);
- var Style_1 = __webpack_require__(47);
- var ConnectionPointSide;
- (function (ConnectionPointSide) {
- ConnectionPointSide[ConnectionPointSide["Undefined"] = -1] = "Undefined";
- ConnectionPointSide[ConnectionPointSide["North"] = 0] = "North";
- ConnectionPointSide[ConnectionPointSide["East"] = 1] = "East";
- ConnectionPointSide[ConnectionPointSide["South"] = 2] = "South";
- ConnectionPointSide[ConnectionPointSide["West"] = 3] = "West";
- })(ConnectionPointSide = exports.ConnectionPointSide || (exports.ConnectionPointSide = {}));
- ;
- var DiagramItem = /** @class */ (function () {
- function DiagramItem() {
- this.key = undefined;
- this.dataKey = undefined;
- this.attachedConnectors = [];
- this.zIndex = 0;
- this.locked = false;
- this.style = new Style_1.Style();
- this.styleText = new Style_1.StyleText();
- }
- DiagramItem.prototype.assign = function (item) {
- item.key = this.key;
- item.dataKey = this.dataKey;
- item.locked = this.locked;
- item.attachedConnectors = this.attachedConnectors.slice();
- item.style = this.style.clone();
- item.styleText = this.styleText.clone();
- item.zIndex = this.zIndex;
- };
- DiagramItem.prototype.invalidatePrimitives = function () {
- delete this.primitives;
- delete this.selectorPrimitives;
- };
- DiagramItem.prototype.getPrimitives = function () {
- if (!this.primitives)
- this.primitives = this.createPrimitives();
- return this.primitives;
- };
- DiagramItem.prototype.getSelectorPrimitives = function () {
- if (!this.selectorPrimitives)
- this.selectorPrimitives = this.createSelectorPrimitives();
- return this.selectorPrimitives;
- };
- DiagramItem.prototype.getConnectionPoint = function (index, targetPoint) {
- return this.getConnectionPointCore(index, targetPoint).toPoint();
- };
- DiagramItem.prototype.getConnectionPointCore = function (index, targetPoint) {
- if (index < 0 && targetPoint)
- index = this.getNearestConnectionPoint(targetPoint);
- return this.getConnectionPoints()[index];
- };
- DiagramItem.prototype.getNearestConnectionPoint = function (targetPoint) {
- var distance = Number.MAX_VALUE;
- var result;
- this.getConnectionPoints().forEach(function (pt, index) {
- var ptDistance = Utils_1.GeometryUtils.getDistance(pt, targetPoint);
- if (ptDistance < distance) {
- distance = ptDistance;
- result = index;
- }
- });
- return result;
- };
- DiagramItem.prototype.getConnectionPointIndex = function (side) {
- var points = this.getConnectionPoints();
- return points.reduce(function (prevIndex, pt, index) {
- if (side === ConnectionPointSide.North && pt.y < points[prevIndex].y)
- return index;
- if (side === ConnectionPointSide.South && pt.y > points[prevIndex].y)
- return index;
- if (side === ConnectionPointSide.West && pt.x < points[prevIndex].x)
- return index;
- if (side === ConnectionPointSide.East && pt.x > points[prevIndex].x)
- return index;
- return prevIndex;
- }, 0);
- };
- Object.defineProperty(DiagramItem.prototype, "isVisible", {
- get: function () { return true; },
- enumerable: true,
- configurable: true
- });
- Object.defineProperty(DiagramItem.prototype, "allowHasText", {
- get: function () { return true; },
- enumerable: true,
- configurable: true
- });
- DiagramItem.prototype.intersectedByRect = function (rect) {
- return this.rectangle.intersect(rect);
- };
- return DiagramItem;
- }());
- exports.DiagramItem = DiagramItem;
- /***/ }),
- /* 4 */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- var __extends = (this && this.__extends) || (function () {
- var extendStatics = function (d, b) {
- extendStatics = Object.setPrototypeOf ||
- ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
- function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
- return extendStatics(d, b);
- };
- return function (d, b) {
- extendStatics(d, b);
- function __() { this.constructor = d; }
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
- };
- })();
- Object.defineProperty(exports, "__esModule", { value: true });
- var HistoryItem = /** @class */ (function () {
- function HistoryItem() {
- this.uniqueId = -1;
- }
- HistoryItem.prototype.changeModified = function () {
- return true;
- };
- HistoryItem.prototype.getName = function () {
- return this.constructor.name;
- };
- return HistoryItem;
- }());
- exports.HistoryItem = HistoryItem;
- var CompositionHistoryItem = /** @class */ (function (_super) {
- __extends(CompositionHistoryItem, _super);
- function CompositionHistoryItem() {
- var _this = _super !== null && _super.apply(this, arguments) || this;
- _this.historyItems = [];
- return _this;
- }
- CompositionHistoryItem.prototype.changeModified = function () {
- var item;
- for (var i = 0; item = this.historyItems[i]; i++) {
- if (item.changeModified())
- return true;
- }
- return false;
- };
- CompositionHistoryItem.prototype.redo = function (manipulator) {
- var item;
- for (var i = 0; item = this.historyItems[i]; i++)
- item.redo(manipulator);
- };
- CompositionHistoryItem.prototype.undo = function (manipulator) {
- var item;
- for (var i = this.historyItems.length - 1; item = this.historyItems[i]; i--)
- item.undo(manipulator);
- };
- CompositionHistoryItem.prototype.add = function (historyItem) {
- if (historyItem == null)
- throw new Error("cannot be null");
- this.historyItems.push(historyItem);
- };
- return CompositionHistoryItem;
- }(HistoryItem));
- exports.CompositionHistoryItem = CompositionHistoryItem;
- /***/ }),
- /* 5 */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- var __extends = (this && this.__extends) || (function () {
- var extendStatics = function (d, b) {
- extendStatics = Object.setPrototypeOf ||
- ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
- function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
- return extendStatics(d, b);
- };
- return function (d, b) {
- extendStatics(d, b);
- function __() { this.constructor = d; }
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
- };
- })();
- Object.defineProperty(exports, "__esModule", { value: true });
- var DiagramItem_1 = __webpack_require__(3);
- var Utils_1 = __webpack_require__(0);
- var UnitConverter_1 = __webpack_require__(13);
- var LinePrimitive_1 = __webpack_require__(69);
- var ConnectorPointsCalculator_1 = __webpack_require__(105);
- var ConnectorPointsOrthogonalCalculator_1 = __webpack_require__(106);
- var ConnectorProperties_1 = __webpack_require__(28);
- var ConnectorTexts_1 = __webpack_require__(112);
- var TextPrimitive_1 = __webpack_require__(50);
- var TextFilterPrimitive_1 = __webpack_require__(72);
- var Event_1 = __webpack_require__(14);
- var Utils_2 = __webpack_require__(26);
- var ConnectorPosition;
- (function (ConnectorPosition) {
- ConnectorPosition[ConnectorPosition["Begin"] = 0] = "Begin";
- ConnectorPosition[ConnectorPosition["End"] = 1] = "End";
- })(ConnectorPosition = exports.ConnectorPosition || (exports.ConnectorPosition = {}));
- var Connector = /** @class */ (function (_super) {
- __extends(Connector, _super);
- function Connector(points) {
- var _this = _super.call(this) || this;
- _this.beginConnectionPointIndex = -1;
- _this.endConnectionPointIndex = -1;
- _this.properties = new ConnectorProperties_1.ConnectorProperties();
- _this.points = points.map(function (pt) { return pt.clone(); });
- if (points.length < 2)
- throw Error("Points count should be greater than 1");
- _this.texts = new ConnectorTexts_1.ConnectorTexts();
- return _this;
- }
- Connector.prototype.assign = function (item) {
- _super.prototype.assign.call(this, item);
- item.beginItem = this.beginItem;
- item.beginConnectionPointIndex = this.beginConnectionPointIndex;
- item.endItem = this.endItem;
- item.endConnectionPointIndex = this.endConnectionPointIndex;
- item.properties = this.properties.clone();
- item.texts = this.texts.clone();
- };
- Connector.prototype.clone = function () {
- var clone = new Connector(this.points);
- this.assign(clone);
- return clone;
- };
- Connector.prototype.getRenderPoints = function (keepSkipped) {
- if (keepSkipped === void 0) { keepSkipped = false; }
- if (this.renderPoints === undefined) {
- this.renderPoints = this.getCalculator().getPoints();
- this.renderPointsWithoutSkipped = this.renderPoints.filter(function (pt) { return !pt.skipped; });
- }
- return keepSkipped ? this.renderPoints : this.renderPointsWithoutSkipped;
- };
- Connector.prototype.getText = function (position) {
- var textObj = this.texts.get(position);
- return textObj ? textObj.value : "";
- };
- Connector.prototype.setText = function (position, text) {
- if (!text || text === "")
- this.texts.remove(position);
- else
- this.texts.set(position, new ConnectorTexts_1.ConnectorText(position, text));
- };
- Connector.prototype.getTextPoint = function (position) {
- var points = this.getRenderPoints();
- return Utils_1.GeometryUtils.getPathPointByPosition(points, position);
- };
- Connector.prototype.getTextPositionByPoint = function (point) {
- var points = this.getRenderPoints();
- var length = Utils_1.GeometryUtils.getPathLength(points);
- var pos = Utils_1.GeometryUtils.getPathPositionByPoint(points, point);
- var minTextHeight = UnitConverter_1.UnitConverter.pointsToTwips(parseInt(this.styleText["font-size"]));
- if (minTextHeight > pos * length)
- return minTextHeight / length;
- if (minTextHeight > length - pos * length)
- return (length - minTextHeight) / length;
- return pos;
- };
- Connector.prototype.getTextRectangle = function (position) {
- return new Utils_1.Rectangle(this.getTextPoint(position), new Utils_1.Size(0, 0));
- };
- Connector.prototype.getCalculator = function () {
- return (this.properties.lineOption === ConnectorProperties_1.ConnectorLineOption.Straight) ?
- new ConnectorPointsCalculator_1.ConnectorPointsCalculator(this) :
- new ConnectorPointsOrthogonalCalculator_1.ConnectorPointsOrthogonalCalculator(this);
- };
- Connector.prototype.invalidateRenderPoints = function () {
- delete this.renderPoints;
- delete this.renderPointsWithoutSkipped;
- };
- Connector.prototype.createPrimitives = function () {
- var _this = this;
- var result = [];
- var points = this.getRenderPoints();
- points.forEach(function (pt, index) {
- if (index > 0)
- result.push(_this.createSegmentPrimitive(points[index - 1], pt, _this.style, null));
- });
- if (points.length > 1) {
- if (this.properties.startLineEnding !== ConnectorProperties_1.ConnectorLineEnding.None)
- result = result.concat(this.createLineEndingPrimitives(points[0], points[1]));
- if (this.properties.endLineEnding !== ConnectorProperties_1.ConnectorLineEnding.None)
- result = result.concat(this.createLineEndingPrimitives(points[points.length - 1], points[points.length - 2]));
- }
- return result.concat(this.createTextPrimitives());
- };
- Connector.prototype.createSelectorPrimitives = function () {
- var _this = this;
- var result = [];
- var points = this.getRenderPoints();
- points.forEach(function (pt, index) {
- if (index > 0)
- result.push(_this.createSegmentPrimitive(points[index - 1], pt, null, "selector"));
- });
- return result;
- };
- Connector.prototype.createTextPrimitives = function () {
- var _this = this;
- if (!this.allowHasText)
- return [];
- var result = [];
- this.texts.forEach(function (textObj) {
- var text = _this.getText(textObj.position);
- if (text && text !== "") {
- var pt = _this.getTextPoint(textObj.position);
- var filterId = "filter" + _this.key;
- result = result.concat([
- new TextPrimitive_1.TextPrimitive(pt.x, pt.y, text, undefined, _this.styleText, true, null, filterId, function (el) {
- Utils_2.RenderUtils.setElementEventData(el, Event_1.MouseEventElementType.ConnectorText, _this.key, textObj.position);
- }),
- new TextFilterPrimitive_1.TextFilterPrimitive(filterId)
- ]);
- }
- });
- return result;
- };
- Connector.prototype.createSegmentPrimitive = function (point1, point2, style, className) {
- return new LinePrimitive_1.LinePrimitive(point1.x, point1.y, point2.x, point2.y, style, className);
- };
- Connector.prototype.createLineEndingPrimitives = function (point, directionPoint) {
- var arrowHeight = Connector.arrowHeight;
- if (point.x === directionPoint.x) {
- var distance = Math.abs(point.y - directionPoint.y);
- if (distance < arrowHeight)
- arrowHeight = distance;
- }
- if (point.y === directionPoint.y) {
- var distance = Math.abs(point.x - directionPoint.x);
- if (distance < arrowHeight)
- arrowHeight = distance;
- }
- var arrowPoints = Utils_1.GeometryUtils.getArrowPoints(point, directionPoint, arrowHeight, Connector.arrowWidth);
- return [
- new LinePrimitive_1.LinePrimitive(arrowPoints.point1.x, arrowPoints.point1.y, point.x, point.y, this.style),
- new LinePrimitive_1.LinePrimitive(arrowPoints.point2.x, arrowPoints.point2.y, point.x, point.y, this.style)
- ];
- };
- Connector.prototype.getExtremeItem = function (position) {
- if (position === ConnectorPosition.Begin)
- return this.beginItem;
- if (position === ConnectorPosition.End)
- return this.endItem;
- return null;
- };
- Connector.prototype.getExtremeConnectionPointIndex = function (position) {
- if (position === ConnectorPosition.Begin)
- return this.beginConnectionPointIndex;
- if (position === ConnectorPosition.End)
- return this.endConnectionPointIndex;
- return -1;
- };
- Object.defineProperty(Connector.prototype, "rectangle", {
- get: function () {
- var points = this.getRenderPoints();
- var xarr = points.map(function (p) { return p.x; });
- var yarr = points.map(function (p) { return p.y; });
- var minX = xarr.reduce(function (prev, cur) { return Math.min(prev, cur); }, Number.MAX_VALUE);
- var maxX = xarr.reduce(function (prev, cur) { return Math.max(prev, cur); }, -Number.MAX_VALUE);
- var minY = yarr.reduce(function (prev, cur) { return Math.min(prev, cur); }, Number.MAX_VALUE);
- var maxY = yarr.reduce(function (prev, cur) { return Math.max(prev, cur); }, -Number.MAX_VALUE);
- return Utils_1.Rectangle.create(minX, minY, maxX - minX, maxY - minY);
- },
- enumerable: true,
- configurable: true
- });
- Connector.prototype.getConnectionPoints = function () {
- return [];
- };
- Connector.prototype.getConnectionPointsForSelection = function () {
- return [];
- };
- Connector.prototype.getConnectionPointSide = function (index, targetPoint) {
- return DiagramItem_1.ConnectionPointSide.Undefined;
- };
- Connector.prototype.getConnectionPointForSelectionSide = function (index) {
- return DiagramItem_1.ConnectionPointSide.Undefined;
- };
- Connector.prototype.getSegments = function () {
- var points = this.getRenderPoints();
- var result = [];
- points.forEach(function (pt, index) {
- if (index > 0)
- result.push(Utils_1.Segment.createByPoints(points[index - 1], pt));
- });
- return result;
- };
- Connector.prototype.intersectedByRect = function (rect) {
- var result = false;
- this.getSegments().forEach(function (s) {
- if (s.intersectRect(rect)) {
- result = true;
- return;
- }
- });
- return result;
- };
- Connector.arrowHeight = UnitConverter_1.UnitConverter.pixelsToTwips(8);
- Connector.arrowWidth = UnitConverter_1.UnitConverter.pixelsToTwips(2);
- Connector.minOffset = UnitConverter_1.UnitConverter.pixelsToTwips(18);
- Connector.minTextHeight = UnitConverter_1.UnitConverter.pixelsToTwips(12);
- return Connector;
- }(DiagramItem_1.DiagramItem));
- exports.Connector = Connector;
- /***/ }),
- /* 6 */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- Object.defineProperty(exports, "__esModule", { value: true });
- var SimpleCommandState = /** @class */ (function () {
- function SimpleCommandState(enabled, value, items) {
- this.visible = true;
- this.denyUpdateValue = false;
- this.enabled = enabled;
- this.value = value;
- this.items = items;
- }
- return SimpleCommandState;
- }());
- exports.SimpleCommandState = SimpleCommandState;
- /***/ }),
- /* 7 */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- Object.defineProperty(exports, "__esModule", { value: true });
- var CommandBase = /** @class */ (function () {
- function CommandBase(control) {
- this.control = control;
- }
- CommandBase.prototype.execute = function (parameter) {
- var state = this.getState();
- if (!state.enabled)
- return false;
- this.control.beginUpdate();
- var executed = this.executeCore(state, parameter);
- this.control.endUpdate();
- return executed;
- };
- CommandBase.prototype.updateControlState = function () {
- if (!this.lockUIUpdating()) {
- this.control.barManager.updateItemsState();
- }
- };
- CommandBase.prototype.lockUIUpdating = function () {
- return false;
- };
- CommandBase.prototype.isEnabled = function () {
- return true;
- };
- return CommandBase;
- }());
- exports.CommandBase = CommandBase;
- /***/ }),
- /* 8 */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- Object.defineProperty(exports, "__esModule", { value: true });
- var MoveShapeHistoryItem_1 = __webpack_require__(101);
- var AddConnectionHistoryItem_1 = __webpack_require__(35);
- var MoveConnectorPointHistoryItem_1 = __webpack_require__(36);
- var ModelResizeHistoryItem_1 = __webpack_require__(114);
- var UpdatePositionsOnPageResizeHistoryItem_1 = __webpack_require__(115);
- var Connector_1 = __webpack_require__(5);
- var DiagramItem_1 = __webpack_require__(3);
- var Utils_1 = __webpack_require__(0);
- var DeleteConnectorPointHistoryItem_1 = __webpack_require__(116);
- var ResizeShapeHistoryItem_1 = __webpack_require__(117);
- var DeleteConnectionHistoryItem_1 = __webpack_require__(73);
- var DeleteShapeHistoryItem_1 = __webpack_require__(74);
- var DeleteConnectorHistoryItem_1 = __webpack_require__(118);
- var SetSelectionHistoryItem_1 = __webpack_require__(29);
- var Shape_1 = __webpack_require__(9);
- var ConnectorProperties_1 = __webpack_require__(28);
- var UnitConverter_1 = __webpack_require__(13);
- var DataSource_1 = __webpack_require__(37);
- var AddShapeHistoryItem_1 = __webpack_require__(51);
- var AddConnectorHistoryItem_1 = __webpack_require__(58);
- var LayoutUtils_1 = __webpack_require__(59);
- var Graph_1 = __webpack_require__(34);
- var WideTree_1 = __webpack_require__(61);
- var Sugiyama_1 = __webpack_require__(40);
- var LayoutSettings_1 = __webpack_require__(18);
- var Base_1 = __webpack_require__(19);
- var CloneShapeHistoryItem_1 = __webpack_require__(154);
- var CloneConnectorHistoryItem_1 = __webpack_require__(155);
- var ModelUtils = /** @class */ (function () {
- function ModelUtils() {
- }
- ModelUtils.setShapePosition = function (history, model, shapeKey, newPosition, redoMethod) {
- var shape = model.findShape(shapeKey);
- if (!shape.position.equals(newPosition))
- redoMethod.call(history, new MoveShapeHistoryItem_1.MoveShapeHistoryItem(shapeKey, newPosition));
- };
- ModelUtils.setShapeSize = function (history, model, shapeKey, newPosition, newSize, redoMethod) {
- var shape = model.findShape(shapeKey);
- if (!shape.size.equals(newSize) || !shape.position.equals(newPosition))
- redoMethod.call(history, new ResizeShapeHistoryItem_1.ResizeShapeHistoryItem(shapeKey, newPosition, newSize));
- };
- ModelUtils.setConnectorPoint = function (history, model, connectorKey, pointIndex, newPosition, redoMethod) {
- var connector = model.findConnector(connectorKey);
- if (!connector.points[pointIndex].equals(newPosition))
- redoMethod.call(history, new MoveConnectorPointHistoryItem_1.MoveConnectorPointHistoryItem(connectorKey, pointIndex, newPosition));
- };
- ModelUtils.getSymmetricDifference = function (nodeKeyMap, allItems) {
- return allItems.filter(function (i) {
- if (i instanceof Connector_1.Connector)
- return (!i.beginItem || !nodeKeyMap[i.beginItem.key]) && (!i.endItem || !nodeKeyMap[i.endItem.key]);
- return !nodeKeyMap[i.key];
- });
- };
- ModelUtils.offsetLayoutToFreeSpace = function (layout, occupiedRectangles) {
- var graphItemRect = layout.getRectangle(true);
- var freePoint = Utils_1.GeometryUtils.findFreeSpace(occupiedRectangles, graphItemRect.size.offset(this.spacing, this.spacing), false);
- if (freePoint)
- return layout.offsetNodes(freePoint.x + this.spacing, freePoint.y + this.spacing);
- var maxX = occupiedRectangles.reduce(function (max, rect) { return rect.right > max ? rect.right : max; }, -1);
- return layout.offsetNodes(maxX + this.spacing, graphItemRect.top === 0 ? this.spacing : 0);
- };
- ModelUtils.applyLayoutToNodes = function (history, model, layout, connectors) {
- var connectorsSet = connectors.reduce(function (acc, c) { return acc[c.key] = true && acc; }, {});
- layout.forEachNode(function (nl, nk) {
- var shape = model.findShape(nk);
- var delta = nl.position.offset(-shape.position.x, -shape.position.y);
- ModelUtils.setShapePosition(history, model, nk, nl.position, history.addAndRedo);
- if (delta.x && delta.y) {
- shape.attachedConnectors
- .filter(function (c) { return !connectorsSet[c.key]; })
- .forEach(function (connector) {
- ModelUtils.updateConnectorAttachedPoints(history, connector, history.addOrModifyAndRedo);
- var beginPointIndex = connector.beginItem ? 1 : 0;
- var endPointIndex = connector.endItem ? (connector.points.length - 2) : (connector.points.length - 1);
- for (var i = beginPointIndex; i <= endPointIndex; i++)
- history.addAndRedo(new MoveConnectorPointHistoryItem_1.MoveConnectorPointHistoryItem(connector.key, i, connector.points[i].offset(delta.x, delta.y)));
- });
- }
- });
- };
- ModelUtils.applyLayoutToConnectors = function (history, layout, connectors) {
- var _this = this;
- connectors.filter(function (c) { return c.beginItem && c.endItem; }).forEach(function (connector) {
- var edgeLayout = layout.edgeToPosition[connector.key];
- if (edgeLayout) {
- if (edgeLayout.beginIndex !== connector.beginConnectionPointIndex)
- history.addAndRedo(new AddConnectionHistoryItem_1.SetConnectionPointIndexHistoryItem(connector, edgeLayout.beginIndex, Connector_1.ConnectorPosition.Begin));
- if (edgeLayout.endIndex !== connector.endConnectionPointIndex)
- history.addAndRedo(new AddConnectionHistoryItem_1.SetConnectionPointIndexHistoryItem(connector, edgeLayout.endIndex, Connector_1.ConnectorPosition.End));
- }
- _this.updateConnectorAttachedPoints(history, connector, history.addAndRedo);
- if (edgeLayout) {
- while (connector.points.length > 2)
- history.addAndRedo(new DeleteConnectorPointHistoryItem_1.DeleteConnectorPointHistoryItem(connector.key, 1));
- }
- });
- };
- ModelUtils.adjustLayoutToSnapGrid = function (model, layout) {
- var _this = this;
- layout.nodeKeys.forEach(function (key) {
- layout.nodeToLayout[key].position.x = _this.getSnappedPos(model, layout.nodeToLayout[key].position.x);
- layout.nodeToLayout[key].position.y = _this.getSnappedPos(model, layout.nodeToLayout[key].position.y);
- });
- };
- ModelUtils.updateConnectorAttachedPoints = function (history, connector, redoMethod) {
- if (connector.beginItem) {
- var pt = connector.beginItem.getConnectionPoint(connector.beginConnectionPointIndex, connector.points[1]);
- if (!connector.points[0].equals(pt))
- redoMethod.call(history, new MoveConnectorPointHistoryItem_1.MoveConnectorPointHistoryItem(connector.key, 0, pt));
- }
- if (connector.endItem) {
- var pt = connector.endItem.getConnectionPoint(connector.endConnectionPointIndex, connector.points[connector.points.length - 2]);
- if (!connector.points[connector.points.length - 1].equals(pt))
- redoMethod.call(history, new MoveConnectorPointHistoryItem_1.MoveConnectorPointHistoryItem(connector.key, connector.points.length - 1, pt));
- }
- };
- ModelUtils.removeUnnecessaryConnectorPoints = function (history, connector, exceptPoints, removeCallback) {
- Utils_1.GeometryUtils.removeUnnecessaryLinePoints(connector.points, function (pt, index) {
- var needRemove = true;
- if (exceptPoints) {
- exceptPoints.forEach(function (ept) {
- if (ept && ept.equals(pt)) {
- needRemove = false;
- return;
- }
- });
- }
- if (needRemove) {
- history.addOrModifyAndRedo(new DeleteConnectorPointHistoryItem_1.DeleteConnectorPointHistoryItem(connector.key, index));
- if (removeCallback !== undefined)
- removeCallback(index);
- return true;
- }
- });
- };
- ModelUtils.removeConnectorIntermediatePoints = function (history, connector) {
- if (connector.properties.lineOption !== ConnectorProperties_1.ConnectorLineOption.Orthogonal || connector.points.length <= 2)
- return;
- var removePoints = false;
- if (this.isShapeIntersectConnectorPointsLine(connector.beginItem, connector))
- removePoints = true;
- if (this.isShapeIntersectConnectorPointsLine(connector.endItem, connector))
- removePoints = true;
- if (removePoints) {
- while (connector.points.length > 2) {
- history.addOrModifyAndRedo(new DeleteConnectorPointHistoryItem_1.DeleteConnectorPointHistoryItem(connector.key, 1));
- }
- }
- };
- ModelUtils.isShapeIntersectConnectorPointsLine = function (shape, connector) {
- if (shape === undefined)
- return false;
- var offset = Connector_1.Connector.minOffset - UnitConverter_1.UnitConverter.pixelsToTwips(1);
- var rect = shape.rectangle.inflate(offset, offset);
- var prevPt;
- for (var i = 1; i < connector.points.length - 1; i++) {
- if (prevPt !== undefined) {
- if (prevPt.x === connector.points[i].x) {
- if (rect.left <= prevPt.x && prevPt.x <= rect.right)
- return true;
- }
- if (prevPt.y === connector.points[i].y) {
- if (rect.top <= prevPt.y && prevPt.y <= rect.bottom)
- return true;
- }
- }
- prevPt = connector.points[i];
- }
- return false;
- };
- ModelUtils.getSnappedPos = function (model, pos) {
- return Math.round(pos / model.gridSize) * model.gridSize;
- };
- ModelUtils.tryUpdateModelSize = function (history, model, processPoints) {
- var pageSizeOffset = this.getRequiredPageSizeChanges(model);
- if (pageSizeOffset.bottom || pageSizeOffset.left || pageSizeOffset.right || pageSizeOffset.top) {
- history.addOrModifyAndRedo(new ModelResizeHistoryItem_1.ModelResizeHistoryItem(pageSizeOffset));
- if (pageSizeOffset.left || pageSizeOffset.top) {
- history.addOrModifyAndRedo(new UpdatePositionsOnPageResizeHistoryItem_1.UpdatePositionsOnPageResizeHistoryItem(pageSizeOffset.left, pageSizeOffset.top));
- if (processPoints !== undefined)
- processPoints(pageSizeOffset.left, pageSizeOffset.top);
- }
- }
- };
- ModelUtils.deleteItems = function (history, model, selection, items) {
- history.beginTransaction();
- items.forEach(function (item) {
- if (item instanceof Shape_1.Shape) {
- var shape = item;
- while (shape.attachedConnectors.length > 0) {
- var connector = shape.attachedConnectors[0];
- history.addAndRedo(new DeleteConnectionHistoryItem_1.DeleteConnectionHistoryItem(connector, connector.beginItem === shape ? Connector_1.ConnectorPosition.Begin : Connector_1.ConnectorPosition.End));
- }
- history.addAndRedo(new DeleteShapeHistoryItem_1.DeleteShapeHistoryItem(shape.key));
- }
- if (item instanceof Connector_1.Connector) {
- var connector = item;
- if (connector.beginItem)
- history.addAndRedo(new DeleteConnectionHistoryItem_1.DeleteConnectionHistoryItem(connector, Connector_1.ConnectorPosition.Begin));
- if (connector.endItem)
- history.addAndRedo(new DeleteConnectionHistoryItem_1.DeleteConnectionHistoryItem(connector, Connector_1.ConnectorPosition.End));
- history.addAndRedo(new DeleteConnectorHistoryItem_1.DeleteConnectorHistoryItem(connector.key));
- }
- });
- this.tryUpdateModelSize(history, model);
- history.addAndRedo(new SetSelectionHistoryItem_1.SetSelectionHistoryItem(selection, []));
- history.endTransaction();
- };
- ModelUtils.deleteAllItems = function (history, model, selection) {
- this.deleteItems(history, model, selection, model.items.slice());
- };
- ModelUtils.deleteSelection = function (history, model, selection) {
- this.deleteItems(history, model, selection, selection.getSelectedItems());
- };
- ModelUtils.cloneSelectionToOffset = function (history, model, selection, dx, dy) {
- history.beginTransaction();
- var shapes = selection.getSelectedShapes();
- var newShapesHash = {};
- var ids = [];
- shapes.forEach(function (shape, index) {
- var newShape = shape.clone();
- newShape.position = newShape.position.offset(dx, dy);
- history.addOrModifyAndRedo(new CloneShapeHistoryItem_1.CloneShapeHistoryItem(newShape));
- newShapesHash[shape.key] = newShape;
- ids.push(newShape.key);
- });
- var connectors = selection.getSelectedConnectors();
- connectors.forEach(function (connector, index) {
- var newConnector = connector.clone();
- newConnector.points.forEach(function (point) {
- point.x += dx;
- point.y += dy;
- });
- history.addOrModifyAndRedo(new CloneConnectorHistoryItem_1.CloneConnectorHistoryItem(newConnector, connector.beginItem ? newShapesHash[connector.beginItem.key] : null, connector.endItem ? newShapesHash[connector.endItem.key] : null));
- ids.push(newConnector.key);
- });
- history.addOrModifyAndRedo(new SetSelectionHistoryItem_1.SetSelectionHistoryItem(selection, ids));
- ModelUtils.tryUpdateModelSize(history, model);
- history.endTransaction();
- };
- ModelUtils.createItemsByDataSource = function (history, model, selection, dataSource, layoutType, setDataKeys) {
- var DEFAULT_STEP = 2000;
- var rowIndex = 0;
- var colIndex = 0;
- var externalToInnerMap = {};
- var shapes = [];
- var connectors = [];
- history.beginTransaction();
- dataSource.nodes.forEach(function (node) {
- var point = new Utils_1.Point(colIndex++ * DEFAULT_STEP, rowIndex * DEFAULT_STEP);
- var dataKey = setDataKeys ? node.key : undefined;
- var insert = new AddShapeHistoryItem_1.AddShapeHistoryItem(node.type, point, node.text, dataKey);
- history.addAndRedo(insert);
- if (node.key !== undefined)
- externalToInnerMap[node.key] = insert.shapeKey;
- if (colIndex > 4) {
- colIndex = 0;
- rowIndex++;
- }
- shapes.push(model.findShape(insert.shapeKey));
- });
- dataSource.edges.forEach(function (edge) {
- var shape = model.findShape(externalToInnerMap[edge.to]);
- var parentShape = model.findShape(externalToInnerMap[edge.from]);
- if (shape && parentShape !== undefined) {
- var dataKey = setDataKeys ? edge.key : undefined;
- var insert = new AddConnectorHistoryItem_1.AddConnectorHistoryItem([shape.position.clone(), parentShape.position.clone()], dataKey);
- history.addAndRedo(insert);
- var connector = model.findConnector(insert.connectorKey);
- history.addAndRedo(new AddConnectionHistoryItem_1.AddConnectionHistoryItem(connector, parentShape, 0, Connector_1.ConnectorPosition.Begin));
- history.addAndRedo(new AddConnectionHistoryItem_1.AddConnectionHistoryItem(connector, shape, 0, Connector_1.ConnectorPosition.End));
- connectors.push(model.findConnector(insert.connectorKey));
- }
- });
- var graph = Graph_1.Graph.create(shapes, connectors).cast(LayoutUtils_1.LayoutUtils.shapeToLayout);
- var layout = layoutType === DataSource_1.DataLayoutType.Tree ?
- new WideTree_1.TreeLayoutBuilder(new LayoutSettings_1.TreeLayoutSettings(), graph).build() :
- new Sugiyama_1.SugiyamaLayoutBuilder(new LayoutSettings_1.LayoutSettings(), graph).build();
- var nonGraphItems = ModelUtils.getSymmetricDifference(layout.nodeToLayout, model.items);
- layout = ModelUtils.offsetLayoutToFreeSpace(layout, nonGraphItems.map(function (i) { return i.rectangle; }));
- ModelUtils.applyLayoutToNodes(history, model, layout, connectors);
- ModelUtils.applyLayoutToConnectors(history, layout, connectors);
- var items = connectors.map(function (c) { return c.key; }).concat(shapes.map(function (s) { return s.key; }));
- history.addAndRedo(new SetSelectionHistoryItem_1.SetSelectionHistoryItem(selection, items));
- ModelUtils.tryUpdateModelSize(history, model);
- history.endTransaction();
- };
- ModelUtils.getRequiredPageSizeChanges = function (model) {
- var rectangle = model.getRectangle();
- var leftPageOffset = -Math.floor(rectangle.left / model.pageWidth);
- var topPageOffset = -Math.floor(rectangle.top / model.pageHeight);
- var rightPageOffset = -Math.floor((model.size.width - rectangle.right) / model.pageWidth);
- var bottomPageOffset = -Math.floor((model.size.height - rectangle.bottom) / model.pageHeight);
- return new Utils_1.Offset(leftPageOffset * model.pageWidth, topPageOffset * model.pageHeight, rightPageOffset * model.pageWidth, bottomPageOffset * model.pageHeight);
- };
- ModelUtils.getPositionByDirection = function (isStart, hor, vert) {
- vert = vert * (isStart ? 1 : -1);
- hor = hor * (isStart ? 1 : -1);
- if (vert > 0)
- return DiagramItem_1.ConnectionPointSide.South;
- else if (vert < 0)
- return DiagramItem_1.ConnectionPointSide.North;
- else {
- if (hor > 0)
- return DiagramItem_1.ConnectionPointSide.East;
- else if (hor < 0)
- return DiagramItem_1.ConnectionPointSide.West;
- }
- return DiagramItem_1.ConnectionPointSide.Undefined;
- };
- ModelUtils.getNextItemKey = function (keys, checkKey, baseKey) {
- if (!keys.length && baseKey === undefined)
- return "0";
- for (var i = keys.length - 1; i >= 0; i--) {
- baseKey = baseKey || keys[i];
- if (baseKey !== undefined && baseKey !== null)
- break;
- }
- var key = this.generateNextItemKey(baseKey || "0");
- while (!checkKey(key)) {
- key = this.generateNextItemKey(key);
- }
- return key;
- };
- ModelUtils.generateNextItemKey = function (key) {
- for (var i = key.length - 1; i >= 0; i--) {
- if (!this.isDigit(key[i])) {
- if (i === key.length - 1)
- key = key + "0";
- break;
- }
- var code = key.charCodeAt(i);
- var char = String.fromCharCode(code + 1);
- if (char > "9") {
- char = "0";
- if (i === 0 || !this.isDigit(key[i - 1]))
- char = "1" + char;
- }
- key = key.substr(0, i) + char + key.substr(i + 1);
- if (char !== "0" && char !== "10")
- break;
- else if (char === "10")
- i--;
- }
- return key;
- };
- ModelUtils.isDigit = function (char) {
- return "0" <= char && char <= "9";
- };
- ModelUtils.getGuidItemKey = function () {
- return Base_1.CreateGuid();
- };
- ModelUtils.spacing = 200;
- return ModelUtils;
- }());
- exports.ModelUtils = ModelUtils;
- /***/ }),
- /* 9 */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- var __extends = (this && this.__extends) || (function () {
- var extendStatics = function (d, b) {
- extendStatics = Object.setPrototypeOf ||
- ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
- function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
- return extendStatics(d, b);
- };
- return function (d, b) {
- extendStatics(d, b);
- function __() { this.constructor = d; }
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
- };
- })();
- Object.defineProperty(exports, "__esModule", { value: true });
- var Utils_1 = __webpack_require__(0);
- var ShapeParameters_1 = __webpack_require__(25);
- var UnitConverter_1 = __webpack_require__(13);
- var DiagramItem_1 = __webpack_require__(3);
- var ConnectionPoint_1 = __webpack_require__(32);
- var Shape = /** @class */ (function (_super) {
- __extends(Shape, _super);
- function Shape(description, position) {
- var _this = _super.call(this) || this;
- _this.description = description;
- _this.position = position.clone();
- _this.size = description.defaultSize.clone();
- _this.text = description.defualtText;
- _this.parameters = new ShapeParameters_1.ShapeParameters();
- description.createParameters(_this.parameters);
- return _this;
- }
- Shape.prototype.assign = function (item) {
- _super.prototype.assign.call(this, item);
- item.size = this.size.clone();
- item.text = this.text;
- item.parameters = this.parameters.clone();
- };
- Shape.prototype.clone = function () {
- var clone = new Shape(this.description, this.position.clone());
- this.assign(clone);
- return clone;
- };
- Object.defineProperty(Shape.prototype, "allowHasText", {
- get: function () { return this.description.allowHasText; },
- enumerable: true,
- configurable: true
- });
- Shape.prototype.createPrimitives = function () {
- return this.description.createPrimitives(this);
- };
- Shape.prototype.createSelectorPrimitives = function () {
- return this.description.createSelectorPrimitives(this);
- };
- Shape.prototype.normalizeX = function (x) {
- return Math.max(this.position.x, Math.min(x, this.position.x + this.size.width));
- };
- Shape.prototype.normalizeY = function (y) {
- return Math.max(this.position.y, Math.min(y, this.position.y + this.size.height));
- };
- Shape.prototype.getConnectionPoints = function () {
- var _this = this;
- var result = this.description.getConnectionPoints().map(function (pt, index) {
- var point = new ConnectionPoint_1.ConnectionPoint(_this.position.x + pt.x * _this.size.width, _this.position.y + pt.y * _this.size.height, pt.side);
- _this.description.processConnectionPoint(_this, point, index);
- return point;
- });
- return result;
- };
- Shape.prototype.getConnectionPointsForSelection = function () {
- var _this = this;
- var result = this.description.getConnectionPointsForSelection().map(function (pt, index) {
- var point = new ConnectionPoint_1.ConnectionPoint(_this.position.x + pt.x * _this.size.width, _this.position.y + pt.y * _this.size.height, pt.side);
- return point;
- });
- return result;
- };
- Shape.prototype.getConnectionPointSide = function (index, targetPoint) {
- var point = this.getConnectionPointCore(index, targetPoint);
- if (point.side !== DiagramItem_1.ConnectionPointSide.Undefined)
- return point.side;
- return this.getConnectionPointSideByGeometry(point);
- };
- Shape.prototype.getConnectionPointForSelectionSide = function (index) {
- var point = this.getConnectionPointsForSelection()[index];
- if (point.side !== DiagramItem_1.ConnectionPointSide.Undefined)
- return point.side;
- return this.getConnectionPointSideByGeometry(point);
- };
- Shape.prototype.getConnectionPointSideByGeometry = function (point) {
- var pt = point.offset(-this.position.x, -this.position.y).multiply(1 / this.size.width, 1 / this.size.height);
- if (pt.x >= pt.y && (pt.x > 0 || pt.y > 0)) {
- if (pt.x < 0.5 || (1 - pt.x) >= pt.y)
- return DiagramItem_1.ConnectionPointSide.North;
- return DiagramItem_1.ConnectionPointSide.East;
- }
- else {
- if (pt.x > 0.5 || (1 - pt.x) <= pt.y)
- return DiagramItem_1.ConnectionPointSide.South;
- return DiagramItem_1.ConnectionPointSide.West;
- }
- };
- Object.defineProperty(Shape.prototype, "rectangle", {
- get: function () {
- return new Utils_1.Rectangle(this.position, this.size);
- },
- enumerable: true,
- configurable: true
- });
- Object.defineProperty(Shape.prototype, "textRectangle", {
- get: function () {
- return this.description.getTextRectangle(this.rectangle);
- },
- enumerable: true,
- configurable: true
- });
- Shape.lineWidth = UnitConverter_1.UnitConverter.pixelsToTwips(2);
- return Shape;
- }(DiagramItem_1.DiagramItem));
- exports.Shape = Shape;
- /***/ }),
- /* 10 */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- Object.defineProperty(exports, "__esModule", { value: true });
- var ModelChange_1 = __webpack_require__(48);
- var Event_1 = __webpack_require__(14);
- var Evt_1 = __webpack_require__(49);
- var Utils_1 = __webpack_require__(0);
- var Base_1 = __webpack_require__(19);
- var UnitConverter_1 = __webpack_require__(13);
- var KeyCode_1 = __webpack_require__(16);
- var Browser_1 = __webpack_require__(20);
- var Shape_1 = __webpack_require__(9);
- var Connector_1 = __webpack_require__(5);
- var Utils_2 = __webpack_require__(26);
- var TouchUIHelper_1 = __webpack_require__(70);
- exports.svgNS = "http://www.w3.org/2000/svg";
- var RenderManager = /** @class */ (function () {
- function RenderManager(parent, eventManager) {
- this.scrollYVisible = false;
- this.scrollXVisible = false;
- this.scrollTimer = -1;
- this.allowChangeScrolling = false;
- this.zoomLevel = 1;
- this.moveLocked = false;
- this.focusLocked = false;
- this.focused = false;
- this.eventManager = eventManager;
- this.createElements(parent);
- window.addEventListener("resize", this.onWindowResize.bind(this));
- }
- RenderManager.prototype.createElements = function (parent) {
- if (this.mainElement)
- return;
- var element = document.createElement("DIV");
- element.setAttribute("class", "dxdi-control");
- element.addEventListener(TouchUIHelper_1.TouchUIHelper.touchMouseDownEventName, this.onMouseDown.bind(this));
- document.addEventListener(TouchUIHelper_1.TouchUIHelper.touchMouseMoveEventName, this.onMouseMove.bind(this));
- element.addEventListener(TouchUIHelper_1.TouchUIHelper.touchMouseUpEventName, this.onMouseUp.bind(this));
- element.addEventListener("mouseenter", this.onMouseEnter.bind(this));
- element.addEventListener("mouseleave", this.onMouseLeave.bind(this));
- element.addEventListener("dblclick", this.onDblClick.bind(this));
- document.addEventListener("paste", this.onPaste.bind(this));
- parent.appendChild(element);
- this.mainElement = element;
- element = document.createElement("DIV");
- element.setAttribute("class", "dxdi-canvas-container");
- this.mainElement.appendChild(element);
- this.containerElement = element;
- var svgElement = RenderManager.createSvgElement();
- this.containerElement.appendChild(svgElement);
- this.svgElement = svgElement;
- this.updateMainElementSize();
- this.createInputElement(this.mainElement);
- this.createClipboardInputElement(this.mainElement);
- this.setInputElementFocusHandlerMode();
- };
- RenderManager.createSvgElement = function (forExport) {
- if (forExport === void 0) { forExport = false; }
- var svgElement = document.createElementNS(exports.svgNS, "svg");
- svgElement.className.baseVal = "dxdi-canvas" + (forExport ? " export" : "");
- return svgElement;
- };
- RenderManager.prototype.createInputElement = function (parent) {
- this.inputElementContainer = document.createElement("div");
- parent.appendChild(this.inputElementContainer);
- this.inputElement = document.createElement("div");
- this.inputElement.setAttribute("contenteditable", "true");
- this.inputElementContainer.appendChild(this.inputElement);
- this.inputElement.addEventListener("blur", this.onInputBlur.bind(this));
- this.inputElement.addEventListener("focus", this.onInputFocus.bind(this));
- this.inputElement.addEventListener("keydown", this.onKeyDown.bind(this));
- };
- RenderManager.prototype.createClipboardInputElement = function (parent) {
- this.clipboardInputElement = document.createElement("textarea");
- this.clipboardInputElement.setAttribute("class", "dxdi-clipboard-input");
- parent.appendChild(this.clipboardInputElement);
- };
- RenderManager.prototype.setInputElementFocusHandlerMode = function () {
- this.inputElementContainer.setAttribute("class", "dxdi-input focus");
- };
- RenderManager.prototype.setInputElementTextInputMode = function (text, position, size, style, className) {
- this.inputElementContainer.setAttribute("class", "dxdi-input " + className);
- this.inputElement.innerText = text;
- this.setTextInputElementBounds(position, size);
- this.setTextInputElementStyle(style);
- this.captureFocus(true);
- };
- RenderManager.prototype.setTextInputElementBounds = function (position, size) {
- var left = Base_1.GetAbsolutePositionX(this.svgElement) + (UnitConverter_1.UnitConverter.twipsToPixels(position.x) * this.zoomLevel);
- Base_1.SetAbsoluteX(this.inputElementContainer, left);
- var top = Base_1.GetAbsolutePositionY(this.svgElement) + (UnitConverter_1.UnitConverter.twipsToPixels(position.y) * this.zoomLevel);
- Base_1.SetAbsoluteY(this.inputElementContainer, top);
- this.inputElementContainer.style.width = (size !== undefined) ? UnitConverter_1.UnitConverter.twipsToPixels(size.width) + "px" : "0px";
- this.inputElementContainer.style.height = (size !== undefined) ? UnitConverter_1.UnitConverter.twipsToPixels(size.height) + "px" : "0px";
- this.inputElementContainer.style.transform = "scale(" + this.zoomLevel + ")";
- this.inputElement.style.width = (size !== undefined) ? UnitConverter_1.UnitConverter.twipsToPixels(size.width) + "px" : "";
- this.inputElement.style.height = (size !== undefined) ? UnitConverter_1.UnitConverter.twipsToPixels(size.height) + "px" : "auto";
- };
- RenderManager.prototype.setTextInputElementStyle = function (style) {
- Utils_2.RenderUtils.applyStyleToElement(style, this.inputElement);
- };
- RenderManager.prototype.applyPageChange = function (change) {
- var zoomChange = this.zoomLevel !== change.model.zoomLevel;
- this.zoomLevel = change.model.zoomLevel;
- this.updateSvgElementSize(change.model.size);
- this.initializeSvgPositionProperties(change.type === ModelChange_1.PageChangeType.Create || zoomChange);
- if (change.offset !== undefined)
- this.changeSvgPositionProperties(change.offset);
- this.updateSvgElementPosition();
- this.normalizeSvgElementPosition();
- };
- RenderManager.prototype.setClipboardData = function (data) {
- this.clipboardInputElement.value = data;
- this.clipboardInputElement.focus();
- this.clipboardInputElement.select();
- document.execCommand('copy');
- this.captureFocus();
- };
- RenderManager.prototype.getClipboardData = function (callback) {
- var _this = this;
- if (navigator && navigator["clipboard"]) {
- navigator["clipboard"].readText().then(function (clipText) {
- callback(clipText);
- _this.captureFocus();
- }).catch(function () {
- callback("");
- _this.captureFocus();
- });
- }
- else {
- this.clipboardInputElement.value = "";
- this.clipboardInputElement.focus();
- this.clipboardInputElement.select();
- document.execCommand('Paste');
- callback(this.clipboardInputElement.value);
- this.captureFocus();
- }
- };
- RenderManager.prototype.initializeSvgPositionProperties = function (recreate) {
- var svgWidth = parseInt(this.svgElement.style.width);
- var svgHeight = parseInt(this.svgElement.style.height);
- if (recreate || this.svgPositionProperties === undefined) {
- var paddingLeft = Math.max((this.mainElement.clientWidth - svgWidth) / 2, RenderManager.minPadding);
- var paddingTop = Math.max((this.mainElement.clientHeight - svgHeight) / 2, RenderManager.minPadding);
- this.svgPositionProperties = {
- width: svgWidth,
- height: svgHeight,
- containerPaddingLeft: paddingLeft,
- containerPaddingTop: paddingTop,
- containerPaddingRight: paddingLeft,
- containerPaddingBottom: paddingTop,
- containerScrollLeft: this.mainElement.scrollLeft,
- containerScrollTop: this.mainElement.scrollTop
- };
- }
- else {
- this.svgPositionProperties.width = svgWidth;
- this.svgPositionProperties.height = svgHeight;
- this.svgPositionProperties.containerScrollLeft = this.mainElement.scrollLeft;
- this.svgPositionProperties.containerScrollTop = this.mainElement.scrollTop;
- }
- };
- RenderManager.prototype.changeSvgPositionProperties = function (offset) {
- var leftChange = UnitConverter_1.UnitConverter.twipsToPixels(offset.left) * this.zoomLevel;
- if (leftChange < 0) {
- if (this.svgPositionProperties.containerScrollLeft > -leftChange)
- this.svgPositionProperties.containerScrollLeft += leftChange;
- else
- this.svgPositionProperties.containerPaddingLeft -= leftChange;
- }
- else if (leftChange > 0) {
- this.svgPositionProperties.containerScrollLeft += leftChange;
- }
- var rightChange = UnitConverter_1.UnitConverter.twipsToPixels(offset.right) * this.zoomLevel;
- if (rightChange < 0) {
- this.svgPositionProperties.containerPaddingRight -= rightChange;
- if (this.svgPositionProperties.containerScrollLeft > this.svgPositionProperties.containerPaddingRight) {
- }
- }
- else if (rightChange > 0) {
- this.svgPositionProperties.containerPaddingRight = this.svgPositionProperties.containerPaddingLeft;
- if (this.svgPositionProperties.containerScrollLeft > this.svgPositionProperties.containerPaddingLeft) {
- this.svgPositionProperties.containerScrollLeft -= this.svgPositionProperties.containerPaddingLeft - RenderManager.minPadding;
- this.svgPositionProperties.containerPaddingLeft = RenderManager.minPadding;
- }
- }
- var topChange = UnitConverter_1.UnitConverter.twipsToPixels(offset.top) * this.zoomLevel;
- if (offset.top < 0) {
- if (this.svgPositionProperties.containerScrollTop > -topChange)
- this.svgPositionProperties.containerScrollTop += topChange;
- else
- this.svgPositionProperties.containerPaddingTop -= topChange;
- }
- if (topChange > 0) {
- this.svgPositionProperties.containerScrollTop += topChange;
- }
- var bottomChange = UnitConverter_1.UnitConverter.twipsToPixels(offset.bottom) * this.zoomLevel;
- if (bottomChange < 0) {
- this.svgPositionProperties.containerPaddingBottom -= bottomChange;
- }
- else if (bottomChange > 0) {
- this.svgPositionProperties.containerPaddingBottom = this.svgPositionProperties.containerPaddingTop;
- if (this.svgPositionProperties.containerScrollTop > this.svgPositionProperties.containerPaddingTop) {
- this.svgPositionProperties.containerScrollTop -= this.svgPositionProperties.containerPaddingTop - RenderManager.minPadding;
- this.svgPositionProperties.containerPaddingTop = RenderManager.minPadding;
- }
- }
- };
- RenderManager.prototype.updateMainElementSize = function () {
- var parentElement = this.mainElement.parentNode;
- this.mainElement.style.width = "0px";
- this.mainElement.style.width = parentElement.offsetWidth + "px";
- this.mainElement.style.height = "0px";
- this.mainElement.style.height = parentElement.offsetHeight + "px";
- };
- RenderManager.prototype.updateSvgElementSize = function (modelSize) {
- var width = UnitConverter_1.UnitConverter.twipsToPixels(modelSize.width) * this.zoomLevel;
- var height = UnitConverter_1.UnitConverter.twipsToPixels(modelSize.height) * this.zoomLevel;
- Utils_2.RenderUtils.updateSvgElementSize(this.svgElement, width, height);
- };
- RenderManager.prototype.getSvgContainerWidth = function () {
- return this.svgPositionProperties.width +
- this.svgPositionProperties.containerPaddingLeft +
- this.svgPositionProperties.containerPaddingRight;
- };
- RenderManager.prototype.getSvgContainerHeight = function () {
- return this.svgPositionProperties.height +
- this.svgPositionProperties.containerPaddingTop +
- this.svgPositionProperties.containerPaddingBottom;
- };
- RenderManager.prototype.updateSvgElementPosition = function () {
- this.containerElement.style.paddingLeft = this.svgPositionProperties.containerPaddingLeft + "px";
- this.containerElement.style.paddingRight = this.svgPositionProperties.containerPaddingRight + "px";
- this.containerElement.style.paddingTop = this.svgPositionProperties.containerPaddingTop + "px";
- this.containerElement.style.paddingBottom = this.svgPositionProperties.containerPaddingBottom + "px";
- this.containerElement.style.width = this.getSvgContainerWidth() + "px";
- this.containerElement.style.height = this.getSvgContainerHeight() + "px";
- this.mainElement.scrollLeft = this.svgPositionProperties.containerScrollLeft;
- this.mainElement.scrollTop = this.svgPositionProperties.containerScrollTop;
- };
- RenderManager.prototype.normalizeSvgElementPosition = function () {
- var xCorr = this.mainElement.scrollWidth - this.mainElement.offsetWidth - this.mainElement.scrollLeft;
- if (xCorr > 0) {
- var padding = this.svgPositionProperties.containerPaddingRight - xCorr;
- this.svgPositionProperties.containerPaddingRight = Math.max(padding, RenderManager.minPadding);
- this.containerElement.style.paddingRight = this.svgPositionProperties.containerPaddingRight + "px";
- this.containerElement.style.width = this.getSvgContainerWidth() + "px";
- }
- var yCorr = this.mainElement.scrollHeight - this.mainElement.offsetHeight - this.mainElement.scrollTop;
- if (yCorr > 0) {
- var padding = this.svgPositionProperties.containerPaddingBottom - yCorr;
- this.svgPositionProperties.containerPaddingBottom = Math.max(padding, RenderManager.minPadding);
- this.containerElement.style.paddingBottom = this.svgPositionProperties.containerPaddingBottom + "px";
- this.containerElement.style.height = this.getSvgContainerHeight() + "px";
- }
- };
- RenderManager.prototype.changeScrollPosition = function (evt, raiseMouseMove) {
- var x = evt.pageX - Base_1.GetAbsolutePositionX(this.mainElement);
- var y = evt.pageY - Base_1.GetAbsolutePositionY(this.mainElement);
- var width = this.mainElement.offsetWidth;
- if (this.mainElement.offsetWidth < this.mainElement.scrollWidth)
- width -= RenderManager.scrollBarWidth;
- var height = this.mainElement.offsetHeight;
- if (this.mainElement.offsetHeight < this.mainElement.scrollHeight)
- height -= RenderManager.scrollBarWidth;
- var changed = false;
- if (x <= RenderManager.scrollEdge) {
- this.mainElement.scrollLeft -= this.getScrollingOffset(x);
- changed = true;
- }
- else if (width - RenderManager.scrollEdge <= x) {
- this.mainElement.scrollLeft += this.getScrollingOffset(width - x);
- changed = true;
- }
- if (y <= RenderManager.scrollEdge) {
- this.mainElement.scrollTop -= this.getScrollingOffset(y);
- changed = true;
- }
- else if (height - RenderManager.scrollEdge <= y) {
- this.mainElement.scrollTop += this.getScrollingOffset(height - y);
- changed = true;
- }
- if (changed) {
- this.scrollTimer = window.setTimeout(function () { this.changeScrollPosition(evt, true); }.bind(this), RenderManager.scrollDelay);
- }
- if (raiseMouseMove)
- this.onMouseMoveCore(evt);
- };
- RenderManager.prototype.clearScrollTimer = function () {
- if (this.scrollTimer > -1) {
- window.clearTimeout(this.scrollTimer);
- this.scrollTimer = -1;
- }
- };
- RenderManager.prototype.getScrollingOffset = function (edgeOffset) {
- var offset = Math.pow((RenderManager.scrollEdge - edgeOffset) / RenderManager.scrollRatio, 2);
- return Math.min(offset, RenderManager.scrollMaxOffset);
- };
- RenderManager.prototype.captureFocus = function (selectAll) {
- if (selectAll === void 0) { selectAll = false; }
- this.inputElement.focus();
- if (selectAll) {
- var element = this.inputElement;
- window.setTimeout(function () {
- var selection = window.getSelection();
- var range = document.createRange();
- range.selectNodeContents(element);
- selection.removeAllRanges();
- selection.addRange(range);
- }, 100);
- }
- };
- RenderManager.prototype.updateLayout = function () {
- this.updateMainElementSize();
- this.initializeSvgPositionProperties(true);
- this.updateSvgElementPosition();
- };
- RenderManager.prototype.isFocused = function () {
- return this.focused;
- };
- // Notifications
- RenderManager.prototype.NotifyTextInputStart = function (item, text, position, size) {
- var className = "";
- if (item instanceof Shape_1.Shape)
- className = "shape-text";
- else if (item instanceof Connector_1.Connector)
- className = "connector-text";
- this.setInputElementTextInputMode(text, position, size, item.styleText, className);
- };
- RenderManager.prototype.NotifyTextInputEnd = function (item) {
- this.setInputElementFocusHandlerMode();
- };
- RenderManager.prototype.NotifyModelChanged = function (changes) {
- for (var i = 0, change = void 0; change = changes[i]; i++) {
- if (change instanceof ModelChange_1.PageChange)
- this.applyPageChange(change);
- }
- };
- // Window handlers
- RenderManager.prototype.onWindowResize = function (evt) {
- this.updateLayout();
- };
- // Mouse handlers
- RenderManager.prototype.onMouseDown = function (evt) {
- var _this = this;
- this.lockMouseMove();
- this.lockFocus();
- this.allowChangeScrolling = true;
- this.raiseEvent(evt, this.getDiagramMouseEvent(evt), function (e) { return _this.eventManager.onMouseDown(e); });
- this.captureFocus();
- };
- RenderManager.prototype.onMouseMove = function (evt) {
- if (this.moveLocked)
- return;
- this.clearScrollTimer();
- if (!Evt_1.Evt.IsLeftButtonPressed(evt))
- this.allowChangeScrolling = false;
- if (this.allowChangeScrolling)
- this.changeScrollPosition(evt, false);
- this.onMouseMoveCore(evt);
- };
- RenderManager.prototype.onMouseMoveCore = function (evt) {
- var _this = this;
- this.raiseEvent(evt, this.getDiagramMouseEvent(evt), function (e) { return _this.eventManager.onMouseMove(e); });
- };
- RenderManager.prototype.onMouseUp = function (evt) {
- var _this = this;
- this.lockMouseMove();
- this.clearScrollTimer();
- this.raiseEvent(evt, this.getDiagramMouseEvent(evt), function (e) { return _this.eventManager.onMouseUp(e); });
- this.allowChangeScrolling = false;
- this.captureFocus();
- };
- RenderManager.prototype.onMouseEnter = function (evt) {
- var _this = this;
- if (Evt_1.Evt.IsLeftButtonPressed(evt)) {
- setTimeout(function () {
- _this.allowChangeScrolling = true;
- }, 500);
- }
- this.raiseEvent(evt, this.getDiagramEvent(evt), function (e) { return _this.eventManager.onMouseEnter(e); });
- };
- RenderManager.prototype.onMouseLeave = function (evt) {
- var _this = this;
- this.raiseEvent(evt, this.getDiagramEvent(evt), function (e) { return _this.eventManager.onMouseLeave(e); });
- };
- RenderManager.prototype.onDblClick = function (evt) {
- var _this = this;
- this.raiseEvent(evt, this.getDiagramMouseEvent(evt), function (e) { return _this.eventManager.onDblClick(e); });
- };
- RenderManager.prototype.onKeyDown = function (evt) {
- var _this = this;
- this.raiseEvent(evt, this.getDiagramKeyboardEvent(evt), function (e) { return _this.eventManager.onKeyDown(e); });
- };
- RenderManager.prototype.onInputBlur = function (evt) {
- var _this = this;
- if (!this.focusLocked) {
- this.focused = false;
- Base_1.RemoveClassNameFromElement(this.mainElement, "focused");
- }
- this.raiseEvent(evt, this.getDiagramInputEvent(evt), function (e) { return _this.eventManager.onInputBlur(e); });
- };
- RenderManager.prototype.onInputFocus = function (evt) {
- var _this = this;
- this.focused = true;
- this.focusLocked = false;
- Base_1.AddClassNameToElement(this.mainElement, "focused");
- this.raiseEvent(evt, this.getDiagramEvent(evt), function (e) { return _this.eventManager.onInputFocus(e); });
- };
- RenderManager.prototype.onPaste = function (evt) {
- var _this = this;
- this.raiseEvent(evt, this.getDiagramClipboardEvent(evt), function (e) { return _this.eventManager.onPaste(e); });
- };
- RenderManager.prototype.raiseEvent = function (evt, _evt, raiseFunc) {
- raiseFunc(_evt);
- if (_evt.preventDefault)
- evt.preventDefault();
- };
- RenderManager.prototype.getDiagramEvent = function (evt) {
- return new Event_1.DiagramEvent(this.getKeyModifiers(evt));
- };
- RenderManager.prototype.getDiagramInputEvent = function (evt) {
- return new Event_1.DiagramInputEvent(this.getKeyModifiers(evt), evt.srcElement.innerText);
- };
- RenderManager.prototype.getDiagramMouseEvent = function (evt) {
- var modifiers = this.getKeyModifiers(evt);
- var button = this.isLeftButtonPressed(evt) ? Event_1.MouseButton.Left : Event_1.MouseButton.Right;
- return new Event_1.DiagramMouseEvent(modifiers, button, this.getLayoutPoint(evt, true), this.getEventSource(evt));
- };
- RenderManager.prototype.getDiagramKeyboardEvent = function (evt) {
- return new Event_1.DiagramKeyboardEvent(this.getKeyModifiers(evt), Evt_1.Evt.GetKeyCode(evt), evt.srcElement.innerText); // TODO: check it
- };
- RenderManager.prototype.getDiagramClipboardEvent = function (evt) {
- var clipboardData;
- if (evt.clipboardData !== undefined)
- clipboardData = evt.clipboardData.getData('text/plain');
- else
- clipboardData = window["clipboardData"].getData('Text');
- return new Event_1.DiagramClipboardEvent(this.getKeyModifiers(evt), clipboardData);
- };
- RenderManager.prototype.isLeftButtonPressed = function (evt) {
- return !Browser_1.Browser.MSTouchUI ? Evt_1.Evt.IsLeftButtonPressed(evt) : evt.button != 2;
- };
- RenderManager.prototype.getKeyModifiers = function (evt) {
- var result = 0;
- if (evt.altKey)
- result |= KeyCode_1.ModifierKey.Alt;
- if (evt.ctrlKey)
- result |= KeyCode_1.ModifierKey.Ctrl;
- if (evt.shiftKey)
- result |= KeyCode_1.ModifierKey.Shift;
- if (evt.metaKey)
- result |= KeyCode_1.ModifierKey.Meta;
- return result;
- };
- RenderManager.prototype.getEventSource = function (evt) {
- var element = evt.srcElement;
- while (element && !this.isDocumentContainer(element)) {
- var src_1 = Utils_2.RenderUtils.getElementEventData(element);
- if (src_1 !== undefined)
- return src_1;
- element = element.parentNode;
- }
- var src = new Event_1.MouseEventSource();
- if (element && this.isDocumentContainer(element))
- src.type = Event_1.MouseEventElementType.Document;
- return src;
- };
- RenderManager.prototype.isDocumentContainer = function (element) {
- return Base_1.ElementHasCssClass(element, "dxdi-control") || Base_1.ElementHasCssClass(element, "dxdi-canvas");
- };
- RenderManager.prototype.lockMouseMove = function () {
- var _this = this;
- this.moveLocked = true;
- setTimeout(function () { return _this.moveLocked = false; }, 10); // because chrome raises 2 events on click: buttonDown and move.
- };
- RenderManager.prototype.lockFocus = function () {
- var _this = this;
- this.focusLocked = true;
- setTimeout(function () { return _this.focusLocked = false; }, 10);
- };
- RenderManager.prototype.getLayoutPoint = function (evt, checkScroll) {
- var clientX = Evt_1.Evt.GetEventX(evt);
- var clientY = Evt_1.Evt.GetEventY(evt);
- var canvasX = Base_1.GetAbsolutePositionX(this.svgElement);
- var canvasY = Base_1.GetAbsolutePositionY(this.svgElement);
- if (checkScroll) {
- if (this.scrollYVisible && canvasX + this.mainElement.offsetWidth - clientX < 0)
- return Utils_1.Point.empty();
- if (this.scrollXVisible && canvasY + this.mainElement.offsetHeight - clientY < 0)
- return Utils_1.Point.empty();
- }
- return new Utils_1.Point(UnitConverter_1.UnitConverter.pixelsToTwipsF(clientX - canvasX) / this.zoomLevel, UnitConverter_1.UnitConverter.pixelsToTwipsF(clientY - canvasY) / this.zoomLevel);
- };
- RenderManager.minPadding = 8;
- RenderManager.scrollEdge = 40;
- RenderManager.scrollRatio = 5;
- RenderManager.scrollMaxOffset = 60;
- RenderManager.scrollDelay = 100;
- RenderManager.scrollBarWidth = 16;
- return RenderManager;
- }());
- exports.RenderManager = RenderManager;
- /***/ }),
- /* 11 */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- Object.defineProperty(exports, "__esModule", { value: true });
- var Utils_1 = __webpack_require__(0);
- var TextPrimitive_1 = __webpack_require__(50);
- var ClipPathPrimitive_1 = __webpack_require__(52);
- var RectaglePrimitive_1 = __webpack_require__(53);
- var DiagramItem_1 = __webpack_require__(3);
- var UnitConverter_1 = __webpack_require__(13);
- var Utils_2 = __webpack_require__(26);
- var ConnectionPoint_1 = __webpack_require__(32);
- exports.ShapeDefaultDimension = 1440;
- exports.ShapeDefaultSize = new Utils_1.Size(exports.ShapeDefaultDimension, exports.ShapeDefaultDimension);
- var ShapeDescription = /** @class */ (function () {
- function ShapeDescription(title, defualtText, defaultSize) {
- if (defaultSize === void 0) { defaultSize = exports.ShapeDefaultSize.clone(); }
- this.title = title;
- this.defualtText = defualtText;
- this.defaultSize = defaultSize;
- this.connectionPoints = this.createConnectionPoints();
- this.connectionPointsWhileSelected = this.createConnectionPointsForSelection();
- }
- Object.defineProperty(ShapeDescription.prototype, "allowHasText", {
- get: function () { return true; },
- enumerable: true,
- configurable: true
- });
- ShapeDescription.prototype.getConnectionPoints = function () {
- return this.connectionPoints;
- };
- ShapeDescription.prototype.createConnectionPoints = function () {
- return [
- new ConnectionPoint_1.ConnectionPoint(0.5, 0, DiagramItem_1.ConnectionPointSide.North),
- new ConnectionPoint_1.ConnectionPoint(1, 0.5, DiagramItem_1.ConnectionPointSide.East),
- new ConnectionPoint_1.ConnectionPoint(0.5, 1, DiagramItem_1.ConnectionPointSide.South),
- new ConnectionPoint_1.ConnectionPoint(0, 0.5, DiagramItem_1.ConnectionPointSide.West)
- ];
- };
- ShapeDescription.prototype.getConnectionPointsForSelection = function () {
- return this.connectionPointsWhileSelected;
- };
- ShapeDescription.prototype.createConnectionPointsForSelection = function () {
- return [
- new ConnectionPoint_1.ConnectionPoint(0.5, 0, DiagramItem_1.ConnectionPointSide.North),
- new ConnectionPoint_1.ConnectionPoint(1, 0.5, DiagramItem_1.ConnectionPointSide.East),
- new ConnectionPoint_1.ConnectionPoint(0.5, 1, DiagramItem_1.ConnectionPointSide.South),
- new ConnectionPoint_1.ConnectionPoint(0, 0.5, DiagramItem_1.ConnectionPointSide.West)
- ];
- };
- ShapeDescription.prototype.processConnectionPoint = function (shape, point, index) {
- };
- ShapeDescription.prototype.createParameters = function (parameters) {
- };
- ShapeDescription.prototype.normalizeParameters = function (shape, parameters) {
- };
- ShapeDescription.prototype.modifyParameters = function (shape, parameters, deltaX, deltaY) {
- throw Error("Not implemented");
- };
- ShapeDescription.prototype.changeParameterValue = function (parameters, key, change) {
- var p = parameters.get(key);
- p.value = change(p);
- };
- ShapeDescription.prototype.getParameterPoints = function (shape) {
- return [];
- };
- ShapeDescription.prototype.createTextPrimitives = function (shape, preventClipping) {
- if (!this.allowHasText || shape.text === undefined || shape.text === "")
- return [];
- var rect = this.getTextRectangle(shape.rectangle);
- var clipPathId = !preventClipping && Utils_2.RenderUtils.generateSvgElementId("clipText");
- var textPoint = this.getTextPosition(rect, shape.styleText["text-anchor"]);
- return [
- new TextPrimitive_1.TextPrimitive(textPoint.x, textPoint.y, shape.text, rect.width, shape.styleText, false, clipPathId),
- new ClipPathPrimitive_1.ClipPathPrimitive(clipPathId, [new RectaglePrimitive_1.RectanglePrimitive(rect.left, rect.top, rect.width, rect.height)]),
- ];
- };
- ShapeDescription.prototype.getTextRectangle = function (rect) {
- return rect;
- };
- ShapeDescription.prototype.createSelectorPrimitives = function (shape) {
- return [
- new RectaglePrimitive_1.RectanglePrimitive(shape.position.x, shape.position.y, shape.size.width, shape.size.height, null, "selector")
- ];
- };
- ShapeDescription.prototype.getTextPosition = function (rect, textAnchor) {
- var result = new Utils_1.Point(rect.left, rect.top + rect.height / 2);
- if (!textAnchor || textAnchor === "middle")
- result.x = rect.left + rect.width / 2;
- else if (textAnchor === "end")
- result.x = rect.left + rect.width - ShapeDescription.textSpacing;
- else if (textAnchor === "start")
- result.x = rect.left + ShapeDescription.textSpacing;
- return result;
- };
- ShapeDescription.textSpacing = UnitConverter_1.UnitConverter.pixelsToTwips(2);
- return ShapeDescription;
- }());
- exports.ShapeDescription = ShapeDescription;
- /***/ }),
- /* 12 */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- var __extends = (this && this.__extends) || (function () {
- var extendStatics = function (d, b) {
- extendStatics = Object.setPrototypeOf ||
- ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
- function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
- return extendStatics(d, b);
- };
- return function (d, b) {
- extendStatics(d, b);
- function __() { this.constructor = d; }
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
- };
- })();
- Object.defineProperty(exports, "__esModule", { value: true });
- var ShapeDescription_1 = __webpack_require__(11);
- var Utils_1 = __webpack_require__(0);
- var RectaglePrimitive_1 = __webpack_require__(53);
- var ShapeType_1 = __webpack_require__(1);
- var RectangleShapeDescription = /** @class */ (function (_super) {
- __extends(RectangleShapeDescription, _super);
- function RectangleShapeDescription(title, defaultText, defaultSize) {
- if (title === void 0) { title = "Rectangle"; }
- if (defaultText === void 0) { defaultText = ""; }
- if (defaultSize === void 0) { defaultSize = new Utils_1.Size(ShapeDescription_1.ShapeDefaultDimension, ShapeDescription_1.ShapeDefaultDimension * 0.75); }
- return _super.call(this, title, defaultText, defaultSize) || this;
- }
- Object.defineProperty(RectangleShapeDescription.prototype, "key", {
- get: function () { return ShapeType_1.ShapeType.Rectangle; },
- enumerable: true,
- configurable: true
- });
- Object.defineProperty(RectangleShapeDescription.prototype, "category", {
- get: function () { return ShapeType_1.ShapeCategory.General; },
- enumerable: true,
- configurable: true
- });
- RectangleShapeDescription.prototype.createPrimitives = function (shape) {
- var _a = shape.rectangle, left = _a.left, top = _a.top, width = _a.width, height = _a.height;
- var primitives = [];
- return primitives.concat([
- new RectaglePrimitive_1.RectanglePrimitive(left, top, width, height, shape.style),
- ])
- .concat(this.createTextPrimitives(shape));
- };
- return RectangleShapeDescription;
- }(ShapeDescription_1.ShapeDescription));
- exports.RectangleShapeDescription = RectangleShapeDescription;
- /***/ }),
- /* 13 */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- var __extends = (this && this.__extends) || (function () {
- var extendStatics = function (d, b) {
- extendStatics = Object.setPrototypeOf ||
- ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
- function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
- return extendStatics(d, b);
- };
- return function (d, b) {
- extendStatics(d, b);
- function __() { this.constructor = d; }
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
- };
- })();
- Object.defineProperty(exports, "__esModule", { value: true });
- var RichEditUnit;
- (function (RichEditUnit) {
- RichEditUnit[RichEditUnit["Centimeter"] = 0] = "Centimeter";
- RichEditUnit[RichEditUnit["Inch"] = 1] = "Inch";
- })(RichEditUnit = exports.RichEditUnit || (exports.RichEditUnit = {}));
- var UnitConverter = /** @class */ (function () {
- function UnitConverter() {
- }
- UnitConverter.getConverter = function (unit) {
- switch (unit) {
- case RichEditUnit.Centimeter: return new UIUnitConverterCentimeter();
- case RichEditUnit.Inch: return new UIUnitConverterInch();
- default: throw new Error();
- }
- };
- // LAYOUT - PIXELS
- // MODEL - TWIPS
- // FORMS - CENTIMETERS / INCHES
- // FONT - POINTS
- // BORDER WIDTH ON UI - POINTS
- // TO TWIPS (round and no round version)
- UnitConverter.pixelsToTwips = function (value) {
- return Math.round(UnitConverter.pixelsToTwipsF(value));
- };
- UnitConverter.inchesToTwips = function (value) {
- return Math.round(UnitConverter.inchesToTwipsF(value));
- };
- UnitConverter.pointsToTwips = function (value) {
- return Math.round(UnitConverter.pointsToTwipsF(value));
- };
- UnitConverter.picasToTwips = function (value) {
- return Math.round(value * 1440 / UnitConverter.PICAS_PER_INCH);
- };
- UnitConverter.centimetersToTwips = function (value) {
- return Math.round(UnitConverter.centimetersToTwipsF(value));
- };
- UnitConverter.pixelsToTwipsF = function (value) {
- return value * 1440 / UnitConverter.DPI;
- };
- UnitConverter.inchesToTwipsF = function (value) {
- return value * 1440;
- };
- UnitConverter.pointsToTwipsF = function (value) {
- return value * 20;
- };
- UnitConverter.centimetersToTwipsF = function (value) {
- return value * 1440 / UnitConverter.CENTIMETERS_PER_INCH;
- };
- UnitConverter.modelUnitsToDegrees = function (value) {
- return value / 60000;
- };
- UnitConverter.modelUnitsToRadians = function (value) {
- return value / 60000 * Math.PI / 180;
- };
- UnitConverter.degreesToModelUnits = function (value) {
- return value * 60000;
- };
- UnitConverter.radiansToModelUnits = function (value) {
- return value * 60000 / Math.PI * 180;
- };
- UnitConverter.radiansToDegrees = function (value) {
- return value / Math.PI * 180;
- };
- UnitConverter.fdToModelUnits = function (value) {
- return Math.round(value * 1875 / 2048);
- };
- UnitConverter.emuToTwips = function (val) {
- return val / 635;
- };
- // TO PIXELS (round)
- UnitConverter.twipsToPixels = function (value) {
- return Math.round(UnitConverter.twipsToPixelsF(value));
- };
- UnitConverter.inchesToPixels = function (value) {
- return Math.round(UnitConverter.DPI * value);
- };
- UnitConverter.centimeterToPixel = function (value) {
- return Math.round(value / (UnitConverter.CENTIMETERS_PER_INCH / UnitConverter.DPI));
- };
- UnitConverter.pointsToPixels = function (value) {
- return Math.round(value * UnitConverter.DPI / 72);
- };
- // TO PIXELS (no round)
- UnitConverter.pointsToPixelsF = function (value) {
- return value * UnitConverter.DPI / 72;
- };
- UnitConverter.twipsToPixelsF = function (value) {
- return value * UnitConverter.DPI / 1440;
- };
- // TO POINTS (round)
- UnitConverter.pixelsToPoints = function (value) {
- return Math.round(value * 72 / UnitConverter.DPI);
- };
- UnitConverter.twipsToPoints = function (value) {
- return Math.round(this.twipsToPointsF(value));
- };
- // TO POINTS (no round)
- UnitConverter.twipsToPointsF = function (value) {
- return value / 20;
- };
- // TO INCHES (no round)
- UnitConverter.twipsToInches = function (value) {
- return value / 1440;
- };
- UnitConverter.pixelsToInches = function (value) {
- return value / UnitConverter.DPI;
- };
- // TO CENTIMETERS (no round)
- UnitConverter.twipsToCentimeters = function (value) {
- return value * UnitConverter.CENTIMETERS_PER_INCH / 1440;
- };
- UnitConverter.pixelToCentimeters = function (value) {
- return value * UnitConverter.CENTIMETERS_PER_INCH / UnitConverter.DPI;
- };
- // ANOTHER
- UnitConverter.hundredthsOfMillimeterToModelUnits = function (value) {
- return 15 * value / 127;
- };
- UnitConverter.twipsToEmu = function (val) {
- return val * 635;
- };
- UnitConverter.twipsToDegree = function (value) {
- return value / 60000;
- };
- UnitConverter.DPI = 96;
- UnitConverter.CENTIMETERS_PER_INCH = 2.54;
- UnitConverter.PICAS_PER_INCH = 6;
- return UnitConverter;
- }());
- exports.UnitConverter = UnitConverter;
- var UIUnitConverterCentimeter = /** @class */ (function (_super) {
- __extends(UIUnitConverterCentimeter, _super);
- function UIUnitConverterCentimeter() {
- return _super !== null && _super.apply(this, arguments) || this;
- }
- UIUnitConverterCentimeter.prototype.getUnits = function () {
- return RichEditUnit.Centimeter;
- };
- UIUnitConverterCentimeter.prototype.twipsToUI = function (value) {
- return UnitConverter.twipsToCentimeters(value);
- };
- UIUnitConverterCentimeter.prototype.UIToTwips = function (value) {
- return UnitConverter.centimetersToTwips(value);
- };
- return UIUnitConverterCentimeter;
- }(UnitConverter));
- exports.UIUnitConverterCentimeter = UIUnitConverterCentimeter;
- var UIUnitConverterInch = /** @class */ (function (_super) {
- __extends(UIUnitConverterInch, _super);
- function UIUnitConverterInch() {
- return _super !== null && _super.apply(this, arguments) || this;
- }
- UIUnitConverterInch.prototype.getUnits = function () {
- return RichEditUnit.Inch;
- };
- UIUnitConverterInch.prototype.twipsToUI = function (value) {
- return UnitConverter.twipsToInches(value);
- };
- UIUnitConverterInch.prototype.UIToTwips = function (value) {
- return UnitConverter.inchesToTwips(value);
- };
- return UIUnitConverterInch;
- }(UnitConverter));
- exports.UIUnitConverterInch = UIUnitConverterInch;
- /***/ }),
- /* 14 */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- var __extends = (this && this.__extends) || (function () {
- var extendStatics = function (d, b) {
- extendStatics = Object.setPrototypeOf ||
- ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
- function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
- return extendStatics(d, b);
- };
- return function (d, b) {
- extendStatics(d, b);
- function __() { this.constructor = d; }
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
- };
- })();
- Object.defineProperty(exports, "__esModule", { value: true });
- var MouseButton;
- (function (MouseButton) {
- MouseButton[MouseButton["None"] = 0] = "None";
- MouseButton[MouseButton["Left"] = 1] = "Left";
- MouseButton[MouseButton["Right"] = 2] = "Right";
- MouseButton[MouseButton["Middle"] = 4] = "Middle";
- })(MouseButton = exports.MouseButton || (exports.MouseButton = {}));
- var MouseEventElementType;
- (function (MouseEventElementType) {
- MouseEventElementType[MouseEventElementType["Undefined"] = 0] = "Undefined";
- MouseEventElementType[MouseEventElementType["Connector"] = 1] = "Connector";
- MouseEventElementType[MouseEventElementType["ConnectorPoint"] = 2] = "ConnectorPoint";
- MouseEventElementType[MouseEventElementType["ConnectorSide"] = 3] = "ConnectorSide";
- MouseEventElementType[MouseEventElementType["ConnectorOrthogonalSide"] = 4] = "ConnectorOrthogonalSide";
- MouseEventElementType[MouseEventElementType["ConnectorText"] = 5] = "ConnectorText";
- MouseEventElementType[MouseEventElementType["Shape"] = 6] = "Shape";
- MouseEventElementType[MouseEventElementType["ShapeResizeBox"] = 7] = "ShapeResizeBox";
- MouseEventElementType[MouseEventElementType["ShapeParameterBox"] = 8] = "ShapeParameterBox";
- MouseEventElementType[MouseEventElementType["SelectionRect"] = 9] = "SelectionRect";
- MouseEventElementType[MouseEventElementType["ShapeConnectionPoint"] = 10] = "ShapeConnectionPoint";
- MouseEventElementType[MouseEventElementType["ShapeConnection"] = 11] = "ShapeConnection";
- MouseEventElementType[MouseEventElementType["Document"] = 12] = "Document";
- })(MouseEventElementType = exports.MouseEventElementType || (exports.MouseEventElementType = {}));
- var MouseEventSource = /** @class */ (function () {
- function MouseEventSource(type, key, value) {
- this.type = type;
- this.key = key;
- this.value = value;
- }
- return MouseEventSource;
- }());
- exports.MouseEventSource = MouseEventSource;
- var ResizeEventSource;
- (function (ResizeEventSource) {
- ResizeEventSource[ResizeEventSource["Undefined"] = 0] = "Undefined";
- ResizeEventSource[ResizeEventSource["ResizeBox_NW"] = 1] = "ResizeBox_NW";
- ResizeEventSource[ResizeEventSource["ResizeBox_NE"] = 2] = "ResizeBox_NE";
- ResizeEventSource[ResizeEventSource["ResizeBox_SE"] = 3] = "ResizeBox_SE";
- ResizeEventSource[ResizeEventSource["ResizeBox_SW"] = 4] = "ResizeBox_SW";
- ResizeEventSource[ResizeEventSource["ResizeBox_N"] = 5] = "ResizeBox_N";
- ResizeEventSource[ResizeEventSource["ResizeBox_E"] = 6] = "ResizeBox_E";
- ResizeEventSource[ResizeEventSource["ResizeBox_S"] = 7] = "ResizeBox_S";
- ResizeEventSource[ResizeEventSource["ResizeBox_W"] = 8] = "ResizeBox_W";
- })(ResizeEventSource = exports.ResizeEventSource || (exports.ResizeEventSource = {}));
- var DiagramEvent = /** @class */ (function () {
- function DiagramEvent(modifiers) {
- this.modifiers = modifiers;
- }
- return DiagramEvent;
- }());
- exports.DiagramEvent = DiagramEvent;
- var DiagramInputEvent = /** @class */ (function (_super) {
- __extends(DiagramInputEvent, _super);
- function DiagramInputEvent(modifiers, inputText) {
- var _this = _super.call(this, modifiers) || this;
- _this.inputText = inputText;
- return _this;
- }
- return DiagramInputEvent;
- }(DiagramEvent));
- exports.DiagramInputEvent = DiagramInputEvent;
- var DiagramMouseEvent = /** @class */ (function (_super) {
- __extends(DiagramMouseEvent, _super);
- function DiagramMouseEvent(modifiers, button, layoutPoint, source) {
- var _this = _super.call(this, modifiers) || this;
- _this.button = button;
- _this.layoutPoint = layoutPoint;
- _this.source = source;
- _this.scrollX = 0;
- _this.scrollY = 0;
- return _this;
- }
- return DiagramMouseEvent;
- }(DiagramEvent));
- exports.DiagramMouseEvent = DiagramMouseEvent;
- var DiagramKeyboardEvent = /** @class */ (function (_super) {
- __extends(DiagramKeyboardEvent, _super);
- function DiagramKeyboardEvent(modifiers, keyCode, inputText) {
- var _this = _super.call(this, modifiers, inputText) || this;
- _this.keyCode = keyCode;
- return _this;
- }
- DiagramKeyboardEvent.prototype.getShortcutCode = function () {
- return this.modifiers | this.keyCode;
- };
- return DiagramKeyboardEvent;
- }(DiagramInputEvent));
- exports.DiagramKeyboardEvent = DiagramKeyboardEvent;
- var DiagramClipboardEvent = /** @class */ (function (_super) {
- __extends(DiagramClipboardEvent, _super);
- function DiagramClipboardEvent(modifiers, clipboardData) {
- var _this = _super.call(this, modifiers) || this;
- _this.clipboardData = clipboardData;
- return _this;
- }
- return DiagramClipboardEvent;
- }(DiagramEvent));
- exports.DiagramClipboardEvent = DiagramClipboardEvent;
- /***/ }),
- /* 15 */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- Object.defineProperty(exports, "__esModule", { value: true });
- var UnitConverter_1 = __webpack_require__(13);
- var Utils_1 = __webpack_require__(26);
- var SvgPrimitive = /** @class */ (function () {
- function SvgPrimitive(style, className, clipPathId, onApplyProperties) {
- this.style = style;
- this.className = className;
- this.clipPathId = clipPathId;
- this.onApplyProperties = onApplyProperties;
- this.children = [];
- }
- SvgPrimitive.prototype.createElement = function () {
- var el = this.createMainElement();
- this.createChildElements(el);
- return el;
- };
- SvgPrimitive.prototype.createChildElements = function (parent) {
- for (var i = 0; i < this.children.length; i++)
- parent.appendChild(this.children[i].createElement());
- };
- SvgPrimitive.prototype.applyElementProperties = function (element) {
- this.applyElementStyleProperties(element);
- if (this.className)
- element.setAttribute("class", this.className);
- if (this.clipPathId)
- element.setAttribute("clip-path", "url(#" + this.clipPathId + ")");
- if (this.onApplyProperties)
- this.onApplyProperties(element);
- this.applyChildrenProperties(element);
- };
- SvgPrimitive.prototype.applyChildrenProperties = function (element) {
- for (var i = 0; i < this.children.length; i++)
- this.children[i].applyElementProperties(element.childNodes[i]);
- };
- SvgPrimitive.prototype.applyElementStyleProperties = function (element) {
- this.applyElementStylePropertiesCore(element);
- };
- SvgPrimitive.prototype.applyElementStylePropertiesCore = function (element, reverseTextAnchor) {
- if (reverseTextAnchor === void 0) { reverseTextAnchor = false; }
- if (this.style)
- Utils_1.RenderUtils.applyStyleToElement(this.style, element, reverseTextAnchor);
- };
- SvgPrimitive.prototype.setUnitAttribute = function (element, key, value) {
- if (value === undefined || value === null)
- return;
- var valueStr = typeof value === "number" ? UnitConverter_1.UnitConverter.twipsToPixels(value).toString() : value;
- element.setAttribute(key, valueStr);
- };
- return SvgPrimitive;
- }());
- exports.SvgPrimitive = SvgPrimitive;
- /***/ }),
- /* 16 */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- Object.defineProperty(exports, "__esModule", { value: true });
- var ModifierKey;
- (function (ModifierKey) {
- ModifierKey[ModifierKey["None"] = 0] = "None";
- ModifierKey[ModifierKey["Ctrl"] = 65536] = "Ctrl";
- ModifierKey[ModifierKey["Shift"] = 262144] = "Shift";
- ModifierKey[ModifierKey["Alt"] = 1048576] = "Alt";
- ModifierKey[ModifierKey["Meta"] = 16777216] = "Meta";
- })(ModifierKey = exports.ModifierKey || (exports.ModifierKey = {}));
- var KeyCode;
- (function (KeyCode) {
- KeyCode[KeyCode["Backspace"] = 8] = "Backspace";
- KeyCode[KeyCode["Tab"] = 9] = "Tab";
- KeyCode[KeyCode["Enter"] = 13] = "Enter";
- KeyCode[KeyCode["Pause"] = 19] = "Pause";
- KeyCode[KeyCode["CapsLock"] = 20] = "CapsLock";
- KeyCode[KeyCode["Esc"] = 27] = "Esc";
- KeyCode[KeyCode["Space"] = 32] = "Space";
- KeyCode[KeyCode["PageUp"] = 33] = "PageUp";
- KeyCode[KeyCode["PageDown"] = 34] = "PageDown";
- KeyCode[KeyCode["End"] = 35] = "End";
- KeyCode[KeyCode["Home"] = 36] = "Home";
- KeyCode[KeyCode["Left"] = 37] = "Left";
- KeyCode[KeyCode["Up"] = 38] = "Up";
- KeyCode[KeyCode["Right"] = 39] = "Right";
- KeyCode[KeyCode["Down"] = 40] = "Down";
- KeyCode[KeyCode["Insert"] = 45] = "Insert";
- KeyCode[KeyCode["Delete"] = 46] = "Delete";
- KeyCode[KeyCode["Key_0"] = 48] = "Key_0";
- KeyCode[KeyCode["Key_1"] = 49] = "Key_1";
- KeyCode[KeyCode["Key_2"] = 50] = "Key_2";
- KeyCode[KeyCode["Key_3"] = 51] = "Key_3";
- KeyCode[KeyCode["Key_4"] = 52] = "Key_4";
- KeyCode[KeyCode["Key_5"] = 53] = "Key_5";
- KeyCode[KeyCode["Key_6"] = 54] = "Key_6";
- KeyCode[KeyCode["Key_7"] = 55] = "Key_7";
- KeyCode[KeyCode["Key_8"] = 56] = "Key_8";
- KeyCode[KeyCode["Key_9"] = 57] = "Key_9";
- KeyCode[KeyCode["Key_a"] = 65] = "Key_a";
- KeyCode[KeyCode["Key_b"] = 66] = "Key_b";
- KeyCode[KeyCode["Key_c"] = 67] = "Key_c";
- KeyCode[KeyCode["Key_d"] = 68] = "Key_d";
- KeyCode[KeyCode["Key_e"] = 69] = "Key_e";
- KeyCode[KeyCode["Key_f"] = 70] = "Key_f";
- KeyCode[KeyCode["Key_g"] = 71] = "Key_g";
- KeyCode[KeyCode["Key_h"] = 72] = "Key_h";
- KeyCode[KeyCode["Key_i"] = 73] = "Key_i";
- KeyCode[KeyCode["Key_j"] = 74] = "Key_j";
- KeyCode[KeyCode["Key_k"] = 75] = "Key_k";
- KeyCode[KeyCode["Key_l"] = 76] = "Key_l";
- KeyCode[KeyCode["Key_m"] = 77] = "Key_m";
- KeyCode[KeyCode["Key_n"] = 78] = "Key_n";
- KeyCode[KeyCode["Key_o"] = 79] = "Key_o";
- KeyCode[KeyCode["Key_p"] = 80] = "Key_p";
- KeyCode[KeyCode["Key_q"] = 81] = "Key_q";
- KeyCode[KeyCode["Key_r"] = 82] = "Key_r";
- KeyCode[KeyCode["Key_s"] = 83] = "Key_s";
- KeyCode[KeyCode["Key_t"] = 84] = "Key_t";
- KeyCode[KeyCode["Key_u"] = 85] = "Key_u";
- KeyCode[KeyCode["Key_v"] = 86] = "Key_v";
- KeyCode[KeyCode["Key_w"] = 87] = "Key_w";
- KeyCode[KeyCode["Key_x"] = 88] = "Key_x";
- KeyCode[KeyCode["Key_y"] = 89] = "Key_y";
- KeyCode[KeyCode["Key_z"] = 90] = "Key_z";
- KeyCode[KeyCode["Windows"] = 91] = "Windows";
- KeyCode[KeyCode["ContextMenu"] = 93] = "ContextMenu";
- KeyCode[KeyCode["Numpad_0"] = 96] = "Numpad_0";
- KeyCode[KeyCode["Numpad_1"] = 97] = "Numpad_1";
- KeyCode[KeyCode["Numpad_2"] = 98] = "Numpad_2";
- KeyCode[KeyCode["Numpad_3"] = 99] = "Numpad_3";
- KeyCode[KeyCode["Numpad_4"] = 100] = "Numpad_4";
- KeyCode[KeyCode["Numpad_5"] = 101] = "Numpad_5";
- KeyCode[KeyCode["Numpad_6"] = 102] = "Numpad_6";
- KeyCode[KeyCode["Numpad_7"] = 103] = "Numpad_7";
- KeyCode[KeyCode["Numpad_8"] = 104] = "Numpad_8";
- KeyCode[KeyCode["Numpad_9"] = 105] = "Numpad_9";
- KeyCode[KeyCode["Multiply"] = 106] = "Multiply";
- KeyCode[KeyCode["Add"] = 107] = "Add";
- KeyCode[KeyCode["Subtract"] = 109] = "Subtract";
- KeyCode[KeyCode["Decimal"] = 110] = "Decimal";
- KeyCode[KeyCode["Divide"] = 111] = "Divide";
- KeyCode[KeyCode["F1"] = 112] = "F1";
- KeyCode[KeyCode["F2"] = 113] = "F2";
- KeyCode[KeyCode["F3"] = 114] = "F3";
- KeyCode[KeyCode["F4"] = 115] = "F4";
- KeyCode[KeyCode["F5"] = 116] = "F5";
- KeyCode[KeyCode["F6"] = 117] = "F6";
- KeyCode[KeyCode["F7"] = 118] = "F7";
- KeyCode[KeyCode["F8"] = 119] = "F8";
- KeyCode[KeyCode["F9"] = 120] = "F9";
- KeyCode[KeyCode["F10"] = 121] = "F10";
- KeyCode[KeyCode["F11"] = 122] = "F11";
- KeyCode[KeyCode["F12"] = 123] = "F12";
- KeyCode[KeyCode["NumLock"] = 144] = "NumLock";
- KeyCode[KeyCode["ScrollLock"] = 145] = "ScrollLock";
- KeyCode[KeyCode["Semicolon"] = 186] = "Semicolon";
- KeyCode[KeyCode["Equals"] = 187] = "Equals";
- KeyCode[KeyCode["Comma"] = 188] = "Comma";
- KeyCode[KeyCode["Dash"] = 189] = "Dash";
- KeyCode[KeyCode["Period"] = 190] = "Period";
- KeyCode[KeyCode["ForwardSlash"] = 191] = "ForwardSlash";
- KeyCode[KeyCode["GraveAccent"] = 192] = "GraveAccent";
- KeyCode[KeyCode["OpenBracket"] = 219] = "OpenBracket";
- KeyCode[KeyCode["BackSlash"] = 220] = "BackSlash";
- KeyCode[KeyCode["CloseBracket"] = 221] = "CloseBracket";
- KeyCode[KeyCode["SingleQuote"] = 222] = "SingleQuote";
- })(KeyCode = exports.KeyCode || (exports.KeyCode = {}));
- /***/ }),
- /* 17 */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- Object.defineProperty(exports, "__esModule", { value: true });
- var ShapeParameterPoint = /** @class */ (function () {
- function ShapeParameterPoint(key, point) {
- this.key = key;
- this.point = point;
- }
- return ShapeParameterPoint;
- }());
- exports.ShapeParameterPoint = ShapeParameterPoint;
- /***/ }),
- /* 18 */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- var __extends = (this && this.__extends) || (function () {
- var extendStatics = function (d, b) {
- extendStatics = Object.setPrototypeOf ||
- ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
- function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
- return extendStatics(d, b);
- };
- return function (d, b) {
- extendStatics(d, b);
- function __() { this.constructor = d; }
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
- };
- })();
- Object.defineProperty(exports, "__esModule", { value: true });
- var Connector_1 = __webpack_require__(5);
- var LayoutSettings = /** @class */ (function () {
- function LayoutSettings(gridSize) {
- this.orientation = OrientationKind.Vertical;
- this.direction = LogicalDirectionKind.Forward;
- this.componentSpacing = (gridSize && gridSize * 2 > 800) ? gridSize * 2 : 800;
- var offset = (gridSize && gridSize > Connector_1.Connector.minOffset) ? gridSize : Connector_1.Connector.minOffset;
- this.layerSpacing = offset * 2;
- this.columnSpacing = offset;
- }
- return LayoutSettings;
- }());
- exports.LayoutSettings = LayoutSettings;
- var TreeLayoutSettings = /** @class */ (function (_super) {
- __extends(TreeLayoutSettings, _super);
- function TreeLayoutSettings(gridSize) {
- var _this = _super.call(this, gridSize) || this;
- _this.alignment = Alignment.Center;
- _this.subTreeColumnSpacing = _this.componentSpacing / 2;
- return _this;
- }
- return TreeLayoutSettings;
- }(LayoutSettings));
- exports.TreeLayoutSettings = TreeLayoutSettings;
- var LogicalDirectionKind;
- (function (LogicalDirectionKind) {
- LogicalDirectionKind[LogicalDirectionKind["Backward"] = 0] = "Backward";
- LogicalDirectionKind[LogicalDirectionKind["Forward"] = 1] = "Forward";
- })(LogicalDirectionKind = exports.LogicalDirectionKind || (exports.LogicalDirectionKind = {}));
- var OrientationKind;
- (function (OrientationKind) {
- OrientationKind[OrientationKind["Horizontal"] = 0] = "Horizontal";
- OrientationKind[OrientationKind["Vertical"] = 1] = "Vertical";
- })(OrientationKind = exports.OrientationKind || (exports.OrientationKind = {}));
- var Alignment;
- (function (Alignment) {
- Alignment[Alignment["Left"] = 0] = "Left";
- Alignment[Alignment["Center"] = 1] = "Center";
- })(Alignment = exports.Alignment || (exports.Alignment = {}));
- /***/ }),
- /* 19 */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- Object.defineProperty(exports, "__esModule", { value: true });
- var Browser_1 = __webpack_require__(20);
- var Data_1 = __webpack_require__(102);
- var Str_1 = __webpack_require__(103);
- var Attr_1 = __webpack_require__(104);
- var KeyCode_1 = __webpack_require__(16);
- var Evt_1 = __webpack_require__(49);
- function IsExists(obj) {
- return (typeof (obj) != "undefined") && (obj != null);
- }
- exports.IsExists = IsExists;
- function IsNumber(str) {
- return !isNaN(parseFloat(str)) && isFinite(str);
- }
- exports.IsNumber = IsNumber;
- ;
- function SetStyles(element, styles, makeImportant) {
- if (IsExists(styles.cssText))
- element.style.cssText = styles.cssText;
- if (IsExists(styles.className))
- element.className = styles.className;
- for (var property in styles) {
- if (!styles.hasOwnProperty(property))
- continue;
- var value = styles[property];
- switch (property) {
- case "cssText":
- case "className":
- break;
- case "float":
- SetElementFloat(element, value);
- break;
- case "opacity":
- SetElementOpacity(element, value);
- break;
- case "zIndex":
- SetStylesCore(element, property, value, makeImportant);
- break;
- /*jshint -W086 */
- case "fontWeight":
- if (Browser_1.Browser.IE && Browser_1.Browser.Version < 9 && typeof (styles[property]) == "number")
- value = styles[property].toString();
- default:
- SetStylesCore(element, property, value + (typeof (value) == "number" ? "px" : ""), makeImportant);
- /*jshint +W086 */
- }
- }
- }
- exports.SetStyles = SetStyles;
- ;
- function SetStylesCore(element, property, value, makeImportant) {
- if (makeImportant) {
- var index = property.search("[A-Z]");
- if (index != -1)
- property = property.replace(property.charAt(index), "-" + property.charAt(index).toLowerCase());
- if (element.style.setProperty)
- element.style.setProperty(property, value, "important");
- else
- element.style.cssText += ";" + property + ":" + value + "!important";
- }
- else
- element.style[property] = value;
- }
- exports.SetStylesCore = SetStylesCore;
- function GetDocumentScrollTop() {
- var isScrollBodyIE = Browser_1.Browser.IE && GetCurrentStyle(document.body).overflow == "hidden" && document.body.scrollTop > 0;
- if (Browser_1.Browser.WebKitFamily || Browser_1.Browser.Edge || isScrollBodyIE) {
- if (Browser_1.Browser.MacOSMobilePlatform) //B157267
- return window.pageYOffset;
- if (Browser_1.Browser.WebKitFamily)
- return document.documentElement.scrollTop || document.body.scrollTop;
- return document.body.scrollTop;
- }
- else
- return document.documentElement.scrollTop;
- }
- exports.GetDocumentScrollTop = GetDocumentScrollTop;
- function CloneObject(srcObject) {
- if (typeof (srcObject) != 'object' || srcObject == null)
- return srcObject;
- var newObject = {};
- /* jshint ignore:start */
- for (var i in srcObject)
- newObject[i] = srcObject[i];
- /* jshint ignore:end */
- return newObject;
- }
- exports.CloneObject = CloneObject;
- function GetCurrentStyle(element) {
- if (element.currentStyle)
- return element.currentStyle;
- else if (document.defaultView && document.defaultView.getComputedStyle) {
- var result = document.defaultView.getComputedStyle(element, null);
- if (!result && Browser_1.Browser.Firefox && window.frameElement) {
- var changes = [];
- var curElement = window.frameElement;
- while (!(result = document.defaultView.getComputedStyle(element, null))) {
- changes.push([curElement, curElement.style.display]);
- SetStylesCore(curElement, "display", "block", true);
- curElement = curElement.tagName == "BODY" ? curElement.ownerDocument.defaultView.frameElement : curElement.parentNode;
- }
- result = CloneObject(result);
- for (var ch, i = 0; ch = changes[i]; i++)
- SetStylesCore(ch[0], "display", ch[1], false);
- document.body.offsetWidth; //T334387
- }
- return result;
- }
- return window.getComputedStyle(element, null);
- }
- exports.GetCurrentStyle = GetCurrentStyle;
- function GetDocumentScrollLeft() {
- var isScrollBodyIE = Browser_1.Browser.IE && GetCurrentStyle(document.body).overflow == "hidden" && document.body.scrollLeft > 0;
- if (Browser_1.Browser.Edge || isScrollBodyIE)
- return document.body ? document.body.scrollLeft : document.documentElement.scrollLeft;
- if (Browser_1.Browser.WebKitFamily)
- return document.documentElement.scrollLeft || document.body.scrollLeft;
- return document.documentElement.scrollLeft;
- }
- exports.GetDocumentScrollLeft = GetDocumentScrollLeft;
- exports.focusedElement = null;
- function GetFocusedElement() {
- var activeElement = GetActiveElement();
- return activeElement ? activeElement : exports.focusedElement;
- }
- exports.GetFocusedElement = GetFocusedElement;
- function GetActiveElement() {
- try {
- return document.activeElement;
- }
- catch (e) {
- return null;
- }
- }
- exports.GetActiveElement = GetActiveElement;
- ;
- function focusCore(element, selectAction) {
- try {
- element.focus();
- if (Browser_1.Browser.IE && document.activeElement != element)
- element.focus();
- // Q339238
- if (selectAction) {
- var currentSelection = Selection.GetInfo(element);
- // apply selection only if there is no selection present already
- if (currentSelection.startPos == currentSelection.endPos) {
- switch (selectAction) {
- case "start":
- Selection.SetCaretPosition(element, 0);
- break;
- case "all":
- Selection.Set(element);
- break;
- }
- }
- }
- }
- catch (e) {
- }
- }
- function SetFocus(element, selectAction) {
- if (Browser_1.Browser.MacOSMobilePlatform) // Q471191
- focusCore(element, selectAction);
- else {
- window.setTimeout(function () {
- focusCore(element, selectAction);
- }, 100);
- }
- }
- exports.SetFocus = SetFocus;
- function GetIsParent(parentElement, element) {
- if (!parentElement || !element)
- return false;
- while (element) {
- if (element === parentElement)
- return true;
- if (element.tagName === "BODY")
- return false;
- element = element.parentNode;
- }
- return false;
- }
- exports.GetIsParent = GetIsParent;
- function ElementContainsCssClass(element, className) {
- //B187659
- try {
- if (!element.className)
- return false;
- return element.className.indexOf(className) != -1;
- }
- catch (e) {
- return false;
- }
- }
- exports.ElementContainsCssClass = ElementContainsCssClass;
- function AddClassNameToElement(element, className) {
- if (!element || typeof (className) !== "string")
- return;
- className = className.trim();
- if (!ElementHasCssClass(element, className) && className !== "")
- element.className = (element.className === "") ? className : element.className + " " + className;
- }
- exports.AddClassNameToElement = AddClassNameToElement;
- function ElementHasCssClass(element, className) {
- //B220674
- try {
- var elementClasses;
- var classList = element.classList;
- if (!classList) {
- if (!element.className)
- return false;
- elementClasses = element.className.split(" ");
- }
- var classNames = className.split(" ");
- for (var i = classNames.length - 1; i >= 0; i--) {
- if (classList) {
- if (!classList.contains(classNames[i]))
- return false;
- continue;
- }
- if (Data_1.Data.ArrayIndexOf(elementClasses, classNames[i]) < 0)
- return false;
- }
- return true;
- }
- catch (e) {
- return false;
- }
- }
- exports.ElementHasCssClass = ElementHasCssClass;
- function RemoveClassNameFromElement(element, className) {
- if (!element)
- return;
- var updClassName = " " + element.className + " ";
- var newClassName = updClassName.replace(" " + className + " ", " ");
- if (updClassName.length != newClassName.length)
- element.className = Str_1.Str.Trim(newClassName);
- }
- exports.RemoveClassNameFromElement = RemoveClassNameFromElement;
- function GetAbsolutePositionY(element) {
- if (Browser_1.Browser.IE)
- return getAbsolutePositionY_IE(element);
- else if (Browser_1.Browser.Firefox && Browser_1.Browser.Version >= 3)
- return getAbsolutePositionY_FF3(element);
- else if (Browser_1.Browser.Opera)
- return getAbsolutePositionY_Opera(element);
- else if (Browser_1.Browser.NetscapeFamily && (!Browser_1.Browser.Firefox || Browser_1.Browser.Version < 3))
- return getAbsolutePositionY_NS(element);
- else if (Browser_1.Browser.WebKitFamily || Browser_1.Browser.Edge)
- return getAbsolutePositionY_FF3(element);
- else
- return getAbsolutePositionY_Other(element);
- }
- exports.GetAbsolutePositionY = GetAbsolutePositionY;
- function getAbsolutePositionY_Opera(curEl) {
- var isFirstCycle = true;
- if (curEl && curEl.tagName == "TR" && curEl.cells.length > 0)
- curEl = curEl.cells[0];
- var pos = getAbsoluteScrollOffset_OperaFF(curEl, false);
- while (curEl != null) {
- pos += curEl.offsetTop;
- if (!isFirstCycle)
- pos -= curEl.scrollTop;
- curEl = curEl.offsetParent;
- isFirstCycle = false;
- }
- pos += document.body.scrollTop;
- return pos;
- }
- function getAbsolutePositionY_IE(element) {
- if (element == null || Browser_1.Browser.IE && element.parentNode == null)
- return 0; // B96664
- return element.getBoundingClientRect().top + GetDocumentScrollTop();
- }
- function getAbsolutePositionY_FF3(element) {
- if (element == null)
- return 0;
- var y = element.getBoundingClientRect().top + GetDocumentScrollTop();
- return Math.round(y);
- }
- function getAbsolutePositionY_NS(curEl) {
- var pos = getAbsoluteScrollOffset_OperaFF(curEl, false);
- var isFirstCycle = true;
- while (curEl != null) {
- pos += curEl.offsetTop;
- if (!isFirstCycle && curEl.offsetParent != null)
- pos -= curEl.scrollTop;
- if (!isFirstCycle && Browser_1.Browser.Firefox) {
- var style = GetCurrentStyle(curEl);
- if (curEl.tagName == "DIV" && style.overflow != "visible")
- pos += PxToInt(style.borderTopWidth);
- }
- isFirstCycle = false;
- curEl = curEl.offsetParent;
- }
- return pos;
- }
- function getAbsolutePositionY_Other(curEl) {
- var pos = 0;
- var isFirstCycle = true;
- while (curEl != null) {
- pos += curEl.offsetTop;
- if (!isFirstCycle && curEl.offsetParent != null)
- pos -= curEl.scrollTop;
- isFirstCycle = false;
- curEl = curEl.offsetParent;
- }
- return pos;
- }
- function getAbsoluteScrollOffset_OperaFF(curEl, isX) {
- var pos = 0;
- var isFirstCycle = true;
- while (curEl != null) {
- if (curEl.tagName == "BODY")
- break;
- var style = GetCurrentStyle(curEl);
- if (style.position == "absolute")
- break;
- if (!isFirstCycle && curEl.tagName == "DIV" && (style.position == "" || style.position == "static"))
- pos -= isX ? curEl.scrollLeft : curEl.scrollTop;
- curEl = curEl.parentNode;
- isFirstCycle = false;
- }
- return pos;
- }
- function PxToInt(px) {
- return pxToNumber(px, parseInt);
- }
- exports.PxToInt = PxToInt;
- ;
- function PxToFloat(px) {
- return pxToNumber(px, parseFloat);
- }
- exports.PxToFloat = PxToFloat;
- ;
- function pxToNumber(px, parseFunction) {
- var result = 0;
- if (px != null && px != "") {
- try {
- var indexOfPx = px.indexOf("px");
- if (indexOfPx > -1)
- result = parseFunction(px.substr(0, indexOfPx));
- }
- catch (e) { }
- }
- return result;
- }
- //function GetAbsolutePositionX(element: HTMLElement): number;
- function GetAbsolutePositionX(element) {
- if (Browser_1.Browser.IE)
- return getAbsolutePositionX_IE(element);
- else if (Browser_1.Browser.Firefox && Browser_1.Browser.Version >= 3)
- return getAbsolutePositionX_FF3(element);
- else if (Browser_1.Browser.Opera)
- return getAbsolutePositionX_Opera(element);
- else if (Browser_1.Browser.NetscapeFamily && (!Browser_1.Browser.Firefox || Browser_1.Browser.Version < 3))
- return getAbsolutePositionX_NS(element);
- else if (Browser_1.Browser.WebKitFamily || Browser_1.Browser.Edge)
- return getAbsolutePositionX_FF3(element);
- else
- return getAbsolutePositionX_Other(element);
- }
- exports.GetAbsolutePositionX = GetAbsolutePositionX;
- function getAbsolutePositionX_Opera(curEl) {
- var isFirstCycle = true;
- var pos = getAbsoluteScrollOffset_OperaFF(curEl, true);
- while (curEl != null) {
- pos += curEl.offsetLeft;
- if (!isFirstCycle)
- pos -= curEl.scrollLeft;
- curEl = curEl.offsetParent;
- isFirstCycle = false;
- }
- pos += document.body.scrollLeft;
- return pos;
- }
- function getAbsolutePositionX_IE(element) {
- if (element == null || Browser_1.Browser.IE && element.parentNode == null)
- return 0; // B96664
- return element.getBoundingClientRect().left + GetDocumentScrollLeft();
- }
- function getAbsolutePositionX_FF3(element) {
- if (element == null)
- return 0;
- var x = element.getBoundingClientRect().left + GetDocumentScrollLeft();
- return Math.round(x);
- }
- function getAbsolutePositionX_NS(curEl) {
- var pos = getAbsoluteScrollOffset_OperaFF(curEl, true);
- var isFirstCycle = true;
- while (curEl != null) {
- pos += curEl.offsetLeft;
- if (!isFirstCycle && curEl.offsetParent != null)
- pos -= curEl.scrollLeft;
- if (!isFirstCycle && Browser_1.Browser.Firefox) {
- var style = GetCurrentStyle(curEl);
- if (curEl.tagName == "DIV" && style.overflow != "visible")
- pos += PxToInt(style.borderLeftWidth);
- }
- isFirstCycle = false;
- curEl = curEl.offsetParent;
- }
- return pos;
- }
- function getAbsolutePositionX_Other(curEl) {
- var pos = 0;
- var isFirstCycle = true;
- while (curEl != null) {
- pos += curEl.offsetLeft;
- if (!isFirstCycle && curEl.offsetParent != null)
- pos -= curEl.scrollLeft;
- isFirstCycle = false;
- curEl = curEl.offsetParent;
- }
- return pos;
- }
- function SetAbsoluteX(element, x) {
- element.style.left = prepareClientPosForElement(x, element, true) + "px";
- }
- exports.SetAbsoluteX = SetAbsoluteX;
- ;
- function SetAbsoluteY(element, y) {
- element.style.top = prepareClientPosForElement(y, element, false) + "px";
- }
- exports.SetAbsoluteY = SetAbsoluteY;
- ;
- function prepareClientPosForElement(pos, element, isX) {
- pos -= getPositionElementOffset(element, isX);
- return pos;
- }
- ;
- function getPositionElementOffset(element, isX) {
- var div = createElementMock(element);
- if (div.style.position == "static")
- div.style.position = "absolute";
- element.parentNode.appendChild(div);
- var realPos = isX ? GetAbsolutePositionX(div) : GetAbsolutePositionY(div);
- element.parentNode.removeChild(div);
- return Math.round(realPos);
- }
- ;
- function createElementMock(element) {
- var div = document.createElement('DIV');
- div.style.top = "0px";
- div.style.left = "0px";
- div.style.visibility = "hidden";
- div.style.position = GetCurrentStyle(element).position;
- return div;
- }
- function IsPercentageSize(size) {
- return size && size.indexOf('%') != -1;
- }
- exports.IsPercentageSize = IsPercentageSize;
- ;
- function GetChildNodes(parent, predicate) {
- return RetrieveByPredicate(parent.childNodes, predicate);
- }
- exports.GetChildNodes = GetChildNodes;
- ;
- function GetNodes(parent, predicate) {
- var c = parent.all || parent.getElementsByTagName('*');
- return RetrieveByPredicate(c, predicate);
- }
- exports.GetNodes = GetNodes;
- ;
- function RetrieveByPredicate(scourceCollection, predicate) {
- var result = [];
- for (var i = 0; i < scourceCollection.length; i++) {
- var element = scourceCollection[i];
- if (!predicate || predicate(element))
- result.push(element);
- }
- return result;
- }
- exports.RetrieveByPredicate = RetrieveByPredicate;
- ;
- function GetChildNodesByClassName(parent, className) {
- if (!parent)
- return [];
- if (parent.querySelectorAll) {
- var children = parent.querySelectorAll('.' + className);
- return nodeListToArray(children, function (element) {
- return element.parentNode === parent;
- });
- }
- return GetChildNodes(parent, function (elem) { return elem.className && ElementHasCssClass(elem, className); });
- }
- exports.GetChildNodesByClassName = GetChildNodesByClassName;
- function nodeListToArray(nodeList, filter) {
- var result = [];
- for (var i = 0, element; element = nodeList[i]; i++) {
- if (filter && !filter(element))
- continue;
- result.push(element);
- }
- return result;
- }
- function GetNodesByClassName(parent, className) {
- if (parent.querySelectorAll) {
- var children = parent.querySelectorAll('.' + className);
- return nodeListToArray(children, null);
- }
- return GetNodes(parent, function (elem) { return elem.className && ElementHasCssClass(elem, className); });
- }
- exports.GetNodesByClassName = GetNodesByClassName;
- function GetParentByClassName(element, className) {
- while (element != null) {
- if (element.tagName == "BODY" || element.nodeName == "#document")
- return null;
- if (ElementContainsCssClass(element, className))
- return element;
- element = element.parentNode;
- }
- return null;
- }
- exports.GetParentByClassName = GetParentByClassName;
- function GetParentByTagName(element, tagName) {
- tagName = tagName.toUpperCase();
- while (element) {
- if (element.tagName === "BODY")
- return null;
- if (element.tagName === tagName)
- return element;
- element = element.parentNode;
- }
- return null;
- }
- exports.GetParentByTagName = GetParentByTagName;
- var html2PlainTextFilter = null;
- function setInnerHtmlInternal(el, trustedHtmlString) {
- el.innerHTML = trustedHtmlString;
- }
- exports.setInnerHtmlInternal = setInnerHtmlInternal;
- function SetElementDisplay(element, value, checkCurrentStyle, makeInline) {
- if (!element)
- return;
- if (typeof (value) === "string")
- element.style.display = value;
- else if (!value)
- element.style.display = "none";
- else {
- element.style.display = "";
- if (checkCurrentStyle && GetCurrentStyle(element).display === "none") {
- var displayAddon = makeInline ? "inline-" : "";
- switch (element.tagName) {
- case "TABLE": {
- element.style.display = displayAddon + "table";
- break;
- }
- default: {
- element.style.display = displayAddon + "block";
- break;
- }
- }
- }
- }
- }
- exports.SetElementDisplay = SetElementDisplay;
- function GetInnerText(container) {
- if (Browser_1.Browser.Safari && Browser_1.Browser.MajorVersion <= 5) {
- var filter = getHtml2PlainTextFilter();
- setInnerHtmlInternal(filter, container.innerHTML);
- SetElementDisplay(filter, true, false, false);
- var innerText = filter.innerText;
- SetElementDisplay(filter, false, false, false);
- return innerText;
- }
- else if (Browser_1.Browser.NetscapeFamily || Browser_1.Browser.WebKitFamily || (Browser_1.Browser.IE && Browser_1.Browser.Version >= 9) || Browser_1.Browser.Edge) {
- return container.textContent;
- }
- else
- return container.innerText;
- }
- exports.GetInnerText = GetInnerText;
- function getHtml2PlainTextFilter() {
- if (html2PlainTextFilter == null) {
- html2PlainTextFilter = document.createElement("DIV");
- html2PlainTextFilter.style.width = "0";
- html2PlainTextFilter.style.height = "0";
- html2PlainTextFilter.style.overflow = "visible";
- SetElementDisplay(html2PlainTextFilter, false, false, false);
- document.body.appendChild(html2PlainTextFilter);
- }
- return html2PlainTextFilter;
- }
- var verticalScrollBarWidth;
- function GetVerticalScrollBarWidth() {
- if (typeof (verticalScrollBarWidth) == "undefined") {
- var container = document.createElement("DIV");
- container.style.cssText = "position: absolute; top: 0px; left: 0px; visibility: hidden; width: 200px; height: 150px; overflow: hidden; box-sizing: content-box";
- document.body.appendChild(container);
- var child = document.createElement("P");
- container.appendChild(child);
- child.style.cssText = "width: 100%; height: 200px;";
- var widthWithoutScrollBar = child.offsetWidth;
- container.style.overflow = "scroll";
- var widthWithScrollBar = child.offsetWidth;
- if (widthWithoutScrollBar == widthWithScrollBar)
- widthWithScrollBar = container.clientWidth;
- verticalScrollBarWidth = widthWithoutScrollBar - widthWithScrollBar;
- document.body.removeChild(container);
- }
- return verticalScrollBarWidth;
- }
- exports.GetVerticalScrollBarWidth = GetVerticalScrollBarWidth;
- function GetHorizontalBordersWidth(element, style) {
- if (!IsExists(style))
- style = (Browser_1.Browser.IE && window.getComputedStyle) ? window.getComputedStyle(element) : GetCurrentStyle(element);
- var res = 0;
- if (style.borderLeftStyle != "none")
- res += PxToFloat(style.borderLeftWidth);
- if (style.borderRightStyle != "none")
- res += PxToFloat(style.borderRightWidth);
- return res;
- }
- exports.GetHorizontalBordersWidth = GetHorizontalBordersWidth;
- function GetVerticalBordersWidth(element, style) {
- if (!IsExists(style))
- style = (Browser_1.Browser.IE && Browser_1.Browser.MajorVersion != 9 && window.getComputedStyle) ? window.getComputedStyle(element) : GetCurrentStyle(element);
- var res = 0;
- if (style.borderTopStyle != "none")
- res += PxToFloat(style.borderTopWidth);
- if (style.borderBottomStyle != "none")
- res += PxToFloat(style.borderBottomWidth);
- return res;
- }
- exports.GetVerticalBordersWidth = GetVerticalBordersWidth;
- function SetElementVisibility(element, value) {
- if (!element)
- return;
- if (typeof (value) === "string")
- element.style.visibility = value;
- else
- element.style.visibility = value ? "visible" : "hidden";
- }
- exports.SetElementVisibility = SetElementVisibility;
- ;
- function SetElementFloat(element, value) {
- if (IsExists(element.style.cssFloat))
- element.style.cssFloat = value;
- else if (IsExists(element.style.styleFloat))
- element.style.styleFloat = value;
- else
- Attr_1.Attr.SetAttribute(element.style, "float", value);
- }
- exports.SetElementFloat = SetElementFloat;
- ;
- function SetElementOpacity(element, value) {
- var useOpacityStyle = !Browser_1.Browser.IE || Browser_1.Browser.Version > 8;
- if (useOpacityStyle) {
- element.style.opacity = value;
- }
- else {
- if (typeof (element.filters) === "object" && element.filters["DXImageTransform.Microsoft.Alpha"])
- element.filters.item("DXImageTransform.Microsoft.Alpha").Opacity = value * 100;
- else
- element.style.filter = "alpha(opacity=" + (value * 100) + ")";
- }
- }
- exports.SetElementOpacity = SetElementOpacity;
- function CreateGuid() {
- return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function (c) {
- var r = Math.random() * 16 | 0; // trunc fractional part
- var v = c == 'x' ? r : r & 0x3 | 0x8;
- return v.toString(16);
- });
- }
- exports.CreateGuid = CreateGuid;
- function IsUrlContainsClientScript(url) {
- return url.toLowerCase().indexOf("javascript:") !== -1;
- }
- exports.IsUrlContainsClientScript = IsUrlContainsClientScript;
- function IsExistsElement(element) {
- return element && IsValidElement(element);
- }
- exports.IsExistsElement = IsExistsElement;
- function IsValidElement(element) {
- if (!element)
- return false;
- if (!(Browser_1.Browser.Firefox && Browser_1.Browser.Version < 4)) {
- if (element.ownerDocument && element.ownerDocument.body && element.ownerDocument.body.compareDocumentPosition)
- return element.ownerDocument.body.compareDocumentPosition(element) % 2 === 0;
- }
- if (!Browser_1.Browser.Opera && !(Browser_1.Browser.IE && Browser_1.Browser.Version < 9) && element.offsetParent && element.parentNode.tagName)
- return true;
- while (element != null) {
- if (element.tagName == "BODY")
- return true;
- element = element.parentNode;
- }
- return false;
- }
- exports.IsValidElement = IsValidElement;
- function IsInteractiveControl(element) {
- return Data_1.Data.ArrayIndexOf(["A", "INPUT", "SELECT", "OPTION", "TEXTAREA", "BUTTON", "IFRAME"], element.tagName) > -1;
- }
- exports.IsInteractiveControl = IsInteractiveControl;
- function IsActionElement(element) {
- if (!IsExistsElement(element))
- return false;
- var tabIndex = parseInt(Attr_1.Attr.GetAttribute(element, Attr_1.Attr.GetTabIndexAttributeName()));
- var hasTabIndex = !isNaN(tabIndex);
- var hasNonNegativeTabIndex = hasTabIndex && tabIndex > -1;
- var hasNegativeTabIndex = hasTabIndex && tabIndex < 0;
- var tagName = element.tagName;
- var focusableElementTags = ["BUTTON", "SELECT", "TEXTAREA", "OPTION", "IFRAME"];
- var isFocusableCore = IsFocusable(element);
- var isFocusableTag = focusableElementTags.indexOf(tagName) !== -1;
- var isFocusableLink = tagName === "A" && (!!element.href || hasNonNegativeTabIndex);
- var isFocusableInput = tagName === "INPUT" && element.type.toLowerCase() !== "hidden";
- var isFocusableByTabIndex = tagName !== "INPUT" && hasNonNegativeTabIndex;
- var isEditableDiv = tagName == "DIV" && element.contentEditable === "true";
- return isFocusableCore && !hasNegativeTabIndex && (isFocusableTag || isFocusableLink || isFocusableInput || isFocusableByTabIndex || isEditableDiv);
- }
- exports.IsActionElement = IsActionElement;
- function IsFocusable(element, skipContainerVisibilityCheck) {
- if (skipContainerVisibilityCheck === void 0) { skipContainerVisibilityCheck = function () { return false; }; }
- var current = element;
- while (current && current.nodeType == 1) {
- if (current == element || !skipContainerVisibilityCheck(current)) {
- var tagName = current.tagName.toUpperCase();
- if (tagName == "BODY")
- return true;
- var disabledElementTags = ["INPUT", "BUTTON", "TEXTAREA", "SELECT", "OPTION"];
- if (disabledElementTags.indexOf(tagName) !== -1 && current.disabled || !GetElementDisplay(current, false) || !GetElementVisibility(current, false))
- return false;
- }
- current = current.parentNode;
- }
- return true;
- }
- exports.IsFocusable = IsFocusable;
- function GetElementDisplay(element, isCurrentStyle) {
- if (isCurrentStyle)
- return GetCurrentStyle(element).display != "none";
- return element.style.display != "none";
- }
- exports.GetElementDisplay = GetElementDisplay;
- function GetElementVisibility(element, isCurrentStyle) {
- if (isCurrentStyle)
- return GetCurrentStyle(element).visibility != "hidden";
- return element.style.visibility != "hidden";
- }
- exports.GetElementVisibility = GetElementVisibility;
- function GetClearClientHeight(element) {
- return element.offsetHeight - GetTopBottomBordersAndPaddingsSummaryValue(element);
- }
- exports.GetClearClientHeight = GetClearClientHeight;
- function GetTopBottomBordersAndPaddingsSummaryValue(element, currentStyle) {
- return GetTopBottomPaddings(element, currentStyle) + GetVerticalBordersWidth(element, currentStyle);
- }
- exports.GetTopBottomBordersAndPaddingsSummaryValue = GetTopBottomBordersAndPaddingsSummaryValue;
- ;
- function GetTopBottomPaddings(element, style) {
- var currentStyle = style ? style : GetCurrentStyle(element);
- return PxToInt(currentStyle.paddingTop) + PxToInt(currentStyle.paddingBottom);
- }
- exports.GetTopBottomPaddings = GetTopBottomPaddings;
- ;
- function ParseShortcutString(shortcutString) {
- if (!shortcutString)
- return 0;
- var isCtrlKey = false;
- var isShiftKey = false;
- var isAltKey = false;
- var isMetaKey = false;
- var keyCode = null;
- var shcKeys = shortcutString.toString().split("+");
- if (shcKeys.length > 0) {
- for (var i = 0; i < shcKeys.length; i++) {
- var key = Str_1.Str.Trim(shcKeys[i].toUpperCase());
- switch (key) {
- case "CONTROL":
- case "CONTROLKEY":
- case "CTRL":
- isCtrlKey = true;
- break;
- case "SHIFT":
- case "SHIFTKEY":
- isShiftKey = true;
- break;
- case "ALT":
- isAltKey = true;
- break;
- case "CMD":
- isMetaKey = true;
- break;
- case "F1":
- keyCode = KeyCode_1.KeyCode.F1;
- break;
- case "F2":
- keyCode = KeyCode_1.KeyCode.F2;
- break;
- case "F3":
- keyCode = KeyCode_1.KeyCode.F3;
- break;
- case "F4":
- keyCode = KeyCode_1.KeyCode.F4;
- break;
- case "F5":
- keyCode = KeyCode_1.KeyCode.F5;
- break;
- case "F6":
- keyCode = KeyCode_1.KeyCode.F6;
- break;
- case "F7":
- keyCode = KeyCode_1.KeyCode.F7;
- break;
- case "F8":
- keyCode = KeyCode_1.KeyCode.F8;
- break;
- case "F9":
- keyCode = KeyCode_1.KeyCode.F9;
- break;
- case "F10":
- keyCode = KeyCode_1.KeyCode.F10;
- break;
- case "F11":
- keyCode = KeyCode_1.KeyCode.F11;
- break;
- case "F12":
- keyCode = KeyCode_1.KeyCode.F12;
- break;
- case "RETURN":
- case "ENTER":
- keyCode = KeyCode_1.KeyCode.Enter;
- break;
- case "HOME":
- keyCode = KeyCode_1.KeyCode.Home;
- break;
- case "END":
- keyCode = KeyCode_1.KeyCode.End;
- break;
- case "LEFT":
- keyCode = KeyCode_1.KeyCode.Left;
- break;
- case "RIGHT":
- keyCode = KeyCode_1.KeyCode.Right;
- break;
- case "UP":
- keyCode = KeyCode_1.KeyCode.Up;
- break;
- case "DOWN":
- keyCode = KeyCode_1.KeyCode.Down;
- break;
- case "PAGEUP":
- keyCode = KeyCode_1.KeyCode.PageUp;
- break;
- case "PAGEDOWN":
- keyCode = KeyCode_1.KeyCode.PageDown;
- break;
- case "SPACE":
- keyCode = KeyCode_1.KeyCode.Space;
- break;
- case "TAB":
- keyCode = KeyCode_1.KeyCode.Tab;
- break;
- case "BACKSPACE":
- case "BACK":
- keyCode = KeyCode_1.KeyCode.Backspace;
- break;
- case "CONTEXT":
- keyCode = KeyCode_1.KeyCode.ContextMenu;
- break;
- case "ESCAPE":
- case "ESC":
- keyCode = KeyCode_1.KeyCode.Esc;
- break;
- case "DELETE":
- case "DEL":
- keyCode = KeyCode_1.KeyCode.Delete;
- break;
- case "INSERT":
- case "INS":
- keyCode = KeyCode_1.KeyCode.Insert;
- break;
- case "PLUS":
- keyCode = "+".charCodeAt(0);
- break;
- default:
- keyCode = key.charCodeAt(0);
- break;
- }
- }
- }
- else
- ShowErrorAlert("Invalid shortcut");
- return GetShortcutCode(keyCode, isCtrlKey, isShiftKey, isAltKey, isMetaKey);
- }
- exports.ParseShortcutString = ParseShortcutString;
- function ShowErrorAlert(message) {
- message = Str_1.Str.DecodeHtmlViaTextArea(message);
- if (IsExists(message) && message !== "")
- alert(message);
- }
- exports.ShowErrorAlert = ShowErrorAlert;
- ;
- function GetShortcutCode(keyCode, isCtrlKey, isShiftKey, isAltKey, isMetaKey) {
- var value = keyCode;
- value |= isCtrlKey ? KeyCode_1.ModifierKey.Ctrl : 0;
- value |= isShiftKey ? KeyCode_1.ModifierKey.Shift : 0;
- value |= isAltKey ? KeyCode_1.ModifierKey.Alt : 0;
- value |= isMetaKey ? KeyCode_1.ModifierKey.Meta : 0;
- return value;
- }
- exports.GetShortcutCode = GetShortcutCode;
- ;
- function GetShortcutCodeByEvent(evt) {
- return GetShortcutCode(Evt_1.Evt.GetKeyCode(evt), evt.ctrlKey, evt.shiftKey, evt.altKey, Browser_1.Browser.MacOSPlatform ? evt.metaKey : false);
- }
- exports.GetShortcutCodeByEvent = GetShortcutCodeByEvent;
- ;
- /***/ }),
- /* 20 */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- Object.defineProperty(exports, "__esModule", { value: true });
- var Browser = /** @class */ (function () {
- function Browser() {
- }
- Browser.IdentUserAgent = function (userAgent, ignoreDocumentMode) {
- if (ignoreDocumentMode === void 0) { ignoreDocumentMode = false; }
- var browserTypesOrderedList = ["Mozilla", "IE", "Firefox", "Netscape", "Safari", "Chrome", "Opera", "Opera10", "Edge"];
- var defaultBrowserType = "IE";
- var defaultPlatform = "Win";
- var defaultVersions = { Safari: 2, Chrome: 0.1, Mozilla: 1.9, Netscape: 8, Firefox: 2, Opera: 9, IE: 6, Edge: 12 };
- if (!userAgent || userAgent.length == 0) {
- Browser.fillUserAgentInfo(browserTypesOrderedList, defaultBrowserType, defaultVersions[defaultBrowserType], defaultPlatform);
- return;
- }
- userAgent = userAgent.toLowerCase();
- Browser.indentPlatformMajorVersion(userAgent);
- try {
- var platformIdentStrings = {
- "Windows": "Win",
- "Macintosh": "Mac",
- "Mac OS": "Mac",
- "Mac_PowerPC": "Mac",
- "cpu os": "MacMobile",
- "cpu iphone os": "MacMobile",
- "Android": "Android",
- "!Windows Phone": "WinPhone",
- "!WPDesktop": "WinPhone",
- "!ZuneWP": "WinPhone"
- };
- var optSlashOrSpace = "(?:/|\\s*)?";
- var versionString = "(\\d+)(?:\\.((?:\\d+?[1-9])|\\d)0*?)?";
- var optVersion = "(?:" + versionString + ")?";
- var patterns = {
- Safari: "applewebkit(?:.*?(?:version/" + versionString + "[\\.\\w\\d]*?(?:\\s+mobile\/\\S*)?\\s+safari))?",
- Chrome: "(?:chrome|crios)(?!frame)" + optSlashOrSpace + optVersion,
- Mozilla: "mozilla(?:.*rv:" + optVersion + ".*Gecko)?",
- Netscape: "(?:netscape|navigator)\\d*/?\\s*" + optVersion,
- Firefox: "firefox" + optSlashOrSpace + optVersion,
- Opera: "(?:opera|\sopr)" + optSlashOrSpace + optVersion,
- Opera10: "opera.*\\s*version" + optSlashOrSpace + optVersion,
- IE: "msie\\s*" + optVersion,
- Edge: "edge" + optSlashOrSpace + optVersion
- };
- var browserType;
- var version = -1;
- for (var i = 0; i < browserTypesOrderedList.length; i++) {
- var browserTypeCandidate = browserTypesOrderedList[i];
- var regExp = new RegExp(patterns[browserTypeCandidate], "i");
- if (regExp.compile)
- regExp.compile(patterns[browserTypeCandidate], "i");
- var matches = regExp.exec(userAgent);
- if (matches && matches.index >= 0) {
- if (browserType == "IE" && version >= 11 && browserTypeCandidate == "Safari") // WinPhone8.1 update
- continue;
- browserType = browserTypeCandidate;
- if (browserType == "Opera10")
- browserType = "Opera";
- var tridentPattern = "trident" + optSlashOrSpace + optVersion;
- version = Browser.GetBrowserVersion(userAgent, matches, tridentPattern, Browser.getIECompatibleVersionString());
- if (browserType == "Mozilla" && version >= 11)
- browserType = "IE";
- }
- }
- if (!browserType)
- browserType = defaultBrowserType;
- var browserVersionDetected = version != -1;
- if (!browserVersionDetected)
- version = defaultVersions[browserType];
- var platform;
- var minOccurenceIndex = Number.MAX_VALUE;
- for (var identStr in platformIdentStrings) {
- if (!platformIdentStrings.hasOwnProperty(identStr))
- continue;
- var importantIdent = identStr.substr(0, 1) == "!";
- var occurenceIndex = userAgent.indexOf((importantIdent ? identStr.substr(1) : identStr).toLowerCase());
- if (occurenceIndex >= 0 && (occurenceIndex < minOccurenceIndex || importantIdent)) {
- minOccurenceIndex = importantIdent ? 0 : occurenceIndex;
- platform = platformIdentStrings[identStr];
- }
- }
- var samsungPattern = "SM-[A-Z]";
- var m = userAgent.toUpperCase().match(samsungPattern);
- var isSamsungAndroidDevice = m && m.length > 0;
- if (platform == "WinPhone" && version < 9)
- version = Math.floor(Browser.getVersionFromTrident(userAgent, "trident" + optSlashOrSpace + optVersion));
- if (!ignoreDocumentMode && browserType == "IE" && version > 7 && document.documentMode < version)
- version = document.documentMode;
- if (platform == "WinPhone")
- version = Math.max(9, version);
- if (!platform)
- platform = defaultPlatform;
- if (platform == platformIdentStrings["cpu os"] && !browserVersionDetected) // Terra browser
- version = 4;
- Browser.fillUserAgentInfo(browserTypesOrderedList, browserType, version, platform, isSamsungAndroidDevice);
- }
- catch (e) {
- Browser.fillUserAgentInfo(browserTypesOrderedList, defaultBrowserType, defaultVersions[defaultBrowserType], defaultPlatform);
- }
- };
- Browser.GetBrowserVersion = function (userAgent, matches, tridentPattern, ieCompatibleVersionString) {
- var version = Browser.getVersionFromMatches(matches);
- if (ieCompatibleVersionString) {
- var versionFromTrident = Browser.getVersionFromTrident(userAgent, tridentPattern);
- if (ieCompatibleVersionString === "edge" || parseInt(ieCompatibleVersionString) === versionFromTrident)
- return versionFromTrident;
- }
- return version;
- };
- Browser.getIECompatibleVersionString = function () {
- if (document.compatible) {
- for (var i = 0; i < document.compatible.length; i++)
- if (document.compatible[i].userAgent === "IE" && document.compatible[i].version)
- return document.compatible[i].version.toLowerCase();
- }
- return "";
- };
- Browser.fillUserAgentInfo = function (browserTypesOrderedList, browserType, version, platform, isSamsungAndroidDevice) {
- if (isSamsungAndroidDevice === void 0) { isSamsungAndroidDevice = false; }
- for (var i = 0; i < browserTypesOrderedList.length; i++) {
- var type = browserTypesOrderedList[i];
- Browser[type] = type == browserType;
- }
- Browser.Version = Math.floor(10.0 * version) / 10.0;
- Browser.MajorVersion = Math.floor(Browser.Version);
- Browser.WindowsPlatform = platform == "Win" || platform == "WinPhone";
- Browser.MacOSPlatform = platform == "Mac";
- Browser.MacOSMobilePlatform = platform == "MacMobile";
- Browser.AndroidMobilePlatform = platform == "Android";
- Browser.WindowsPhonePlatform = platform == "WinPhone";
- Browser.WebKitFamily = Browser.Safari || Browser.Chrome || Browser.Opera && Browser.MajorVersion >= 15;
- Browser.NetscapeFamily = Browser.Netscape || Browser.Mozilla || Browser.Firefox;
- Browser.HardwareAcceleration = (Browser.IE && Browser.MajorVersion >= 9) || (Browser.Firefox && Browser.MajorVersion >= 4) ||
- (Browser.AndroidMobilePlatform && Browser.Chrome) || (Browser.Chrome && Browser.MajorVersion >= 37) ||
- (Browser.Safari && !Browser.WindowsPlatform) || Browser.Edge || (Browser.Opera && Browser.MajorVersion >= 46);
- Browser.WebKitTouchUI = Browser.MacOSMobilePlatform || Browser.AndroidMobilePlatform;
- var isIETouchUI = Browser.IE && Browser.MajorVersion > 9 && Browser.WindowsPlatform && Browser.UserAgent.toLowerCase().indexOf("touch") >= 0;
- Browser.MSTouchUI = isIETouchUI || (Browser.Edge && !!window.navigator.maxTouchPoints);
- Browser.TouchUI = Browser.WebKitTouchUI || Browser.MSTouchUI;
- Browser.MobileUI = Browser.WebKitTouchUI || Browser.WindowsPhonePlatform;
- Browser.AndroidDefaultBrowser = Browser.AndroidMobilePlatform && !Browser.Chrome;
- Browser.AndroidChromeBrowser = Browser.AndroidMobilePlatform && Browser.Chrome;
- if (isSamsungAndroidDevice)
- Browser.SamsungAndroidDevice = isSamsungAndroidDevice;
- if (Browser.MSTouchUI) {
- var isARMArchitecture = Browser.UserAgent.toLowerCase().indexOf("arm;") > -1;
- Browser.VirtualKeyboardSupported = isARMArchitecture || Browser.WindowsPhonePlatform;
- }
- else {
- Browser.VirtualKeyboardSupported = Browser.WebKitTouchUI;
- }
- Browser.fillDocumentElementBrowserTypeClassNames(browserTypesOrderedList);
- };
- Browser.indentPlatformMajorVersion = function (userAgent) {
- var regex = /(?:(?:windows nt|macintosh|mac os|cpu os|cpu iphone os|android|windows phone|linux) )(\d+)(?:[-0-9_.])*/;
- var matches = regex.exec(userAgent);
- if (matches)
- Browser.PlaformMajorVersion = matches[1];
- };
- Browser.prototype.GetBrowserVersion = function (userAgent, matches, tridentPattern, ieCompatibleVersionString) {
- var version = Browser.getVersionFromMatches(matches);
- if (ieCompatibleVersionString) {
- var versionFromTrident = Browser.getVersionFromTrident(userAgent, tridentPattern);
- if (ieCompatibleVersionString === "edge" || parseInt(ieCompatibleVersionString) === versionFromTrident)
- return versionFromTrident;
- }
- return version;
- };
- Browser.getVersionFromMatches = function (matches) {
- var result = -1;
- var versionStr = "";
- if (matches[1]) {
- versionStr += matches[1];
- if (matches[2])
- versionStr += "." + matches[2];
- }
- if (versionStr != "") {
- result = parseFloat(versionStr);
- if (isNaN(result))
- result = -1;
- }
- return result;
- };
- Browser.getVersionFromTrident = function (userAgent, tridentPattern) {
- var tridentDiffFromVersion = 4;
- var matches = new RegExp(tridentPattern, "i").exec(userAgent);
- return Browser.getVersionFromMatches(matches) + tridentDiffFromVersion;
- };
- Browser.fillDocumentElementBrowserTypeClassNames = function (browserTypesOrderedList) {
- var documentElementClassName = "";
- var browserTypeslist = browserTypesOrderedList.concat(["WindowsPlatform", "MacOSPlatform", "MacOSMobilePlatform", "AndroidMobilePlatform",
- "WindowsPhonePlatform", "WebKitFamily", "WebKitTouchUI", "MSTouchUI", "TouchUI", "AndroidDefaultBrowser"]);
- for (var i = 0; i < browserTypeslist.length; i++) {
- var type = browserTypeslist[i];
- if (Browser[type])
- documentElementClassName += "dx" + type + " ";
- }
- documentElementClassName += "dxBrowserVersion-" + Browser.MajorVersion;
- if (document && document.documentElement) {
- if (document.documentElement.className != "")
- documentElementClassName = " " + documentElementClassName;
- document.documentElement.className += documentElementClassName;
- Browser.Info = documentElementClassName;
- }
- };
- Browser.UserAgent = window.navigator.userAgent.toLowerCase();
- Browser._foo = Browser.IdentUserAgent(Browser.UserAgent); // to init
- return Browser;
- }());
- exports.Browser = Browser;
- /***/ }),
- /* 21 */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- Object.defineProperty(exports, "__esModule", { value: true });
- var Shape_1 = __webpack_require__(9);
- var Connector_1 = __webpack_require__(5);
- var Utils_1 = __webpack_require__(0);
- var UnitConverter_1 = __webpack_require__(13);
- var ModelUtils_1 = __webpack_require__(8);
- var DiagramUnit;
- (function (DiagramUnit) {
- DiagramUnit[DiagramUnit["In"] = 0] = "In";
- DiagramUnit[DiagramUnit["Cm"] = 1] = "Cm";
- DiagramUnit[DiagramUnit["Px"] = 2] = "Px";
- })(DiagramUnit = exports.DiagramUnit || (exports.DiagramUnit = {}));
- var DiagramModel = /** @class */ (function () {
- function DiagramModel() {
- this.items = [];
- this.itemIndexByKey = {};
- this.pageSize = new Utils_1.Size(8391, 11906);
- this.pageLandscape = false;
- this.pageColor = DiagramModel.defaultPageColor;
- this.gridSize = 180;
- this.showGrid = true;
- this.snapToGrid = true;
- this.units = DiagramUnit.Cm;
- this.zoomLevel = 1;
- this.size = this.pageSize.clone();
- }
- Object.defineProperty(DiagramModel.prototype, "pageWidth", {
- get: function () {
- return this.pageLandscape ? this.pageSize.height : this.pageSize.width;
- },
- enumerable: true,
- configurable: true
- });
- Object.defineProperty(DiagramModel.prototype, "pageHeight", {
- get: function () {
- return this.pageLandscape ? this.pageSize.width : this.pageSize.height;
- },
- enumerable: true,
- configurable: true
- });
- DiagramModel.prototype.getRectangle = function () {
- return DiagramModel.getRectangle(this.items);
- };
- DiagramModel.getRectangle = function (items) {
- return Utils_1.GeometryUtils.getCommonRectangle(items.map(function (i) { return i.rectangle; }));
- };
- DiagramModel.prototype.pushItem = function (item) {
- var index = this.items.push(item);
- this.itemIndexByKey[item.key] = index - 1;
- };
- DiagramModel.prototype.removeItem = function (item) {
- var index = this.getItemIndex(item);
- delete this.itemIndexByKey[item.key];
- this.items.splice(index, 1);
- this.updateIndicesHash(index);
- };
- DiagramModel.prototype.reorderItem = function (item, newIndex) {
- var oldIndex = this.getItemIndex(item);
- this.items.splice(oldIndex, 1);
- this.items.splice(newIndex, 0, item);
- this.updateIndicesHash(Math.min(oldIndex, newIndex));
- };
- DiagramModel.prototype.updateIndicesHash = function (startIndex) {
- for (var i = startIndex; i < this.items.length; i++)
- this.itemIndexByKey[this.items[i].key] = i;
- };
- DiagramModel.prototype.getItemIndex = function (item) {
- return this.itemIndexByKey[item.key];
- };
- DiagramModel.prototype.findShape = function (key) {
- var shape = this.findItem(key);
- return shape instanceof Shape_1.Shape ? shape : undefined;
- };
- DiagramModel.prototype.findShapeCore = function (callback) {
- var shape;
- this.items.forEach(function (item) {
- if (item instanceof Shape_1.Shape) {
- if (callback(item)) {
- shape = item;
- return;
- }
- }
- });
- return shape;
- };
- DiagramModel.prototype.findShapeAtPosition = function (position) {
- return this.findShapeCore(function (shape) { return shape.position.equals(position); });
- };
- DiagramModel.prototype.findShapeByDataKey = function (key) {
- return this.findShapeCore(function (shape) { return shape.dataKey === key; });
- };
- DiagramModel.prototype.findConnector = function (key) {
- var connector = this.findItem(key);
- return connector instanceof Connector_1.Connector ? connector : undefined;
- };
- DiagramModel.prototype.findConnectorCore = function (callback) {
- var connector;
- this.items.forEach(function (item) {
- if (item instanceof Connector_1.Connector) {
- if (callback(item)) {
- connector = item;
- return;
- }
- }
- });
- return connector;
- };
- DiagramModel.prototype.findConnectorAtPoints = function (points) {
- return this.findConnectorCore(function (connector) { return Utils_1.GeometryUtils.arePointsEqual(connector.points, points); });
- };
- DiagramModel.prototype.findConnectorByDataKey = function (key) {
- return this.findConnectorCore(function (connector) { return connector.dataKey === key; });
- };
- DiagramModel.prototype.findItem = function (key) {
- return this.items[this.itemIndexByKey[key]];
- };
- DiagramModel.isIntersectedItems = function (item1, item2) {
- var result = false;
- if (item1 instanceof Shape_1.Shape)
- result = item2.intersectedByRect(item1.rectangle);
- else if (item1 instanceof Connector_1.Connector) {
- item1.getSegments().forEach(function (s1) {
- if (item2 instanceof Shape_1.Shape)
- result = result || s1.intersectRect(item2.rectangle);
- else if (item2 instanceof Connector_1.Connector) {
- item2.getSegments().forEach(function (s2) {
- result = result || s1.intersect(s2);
- });
- }
- });
- }
- return result;
- };
- DiagramModel.prototype.getIntersectItems = function (item) {
- var result = [];
- this.items.forEach(function (i) {
- if (item !== i && (!(i instanceof Connector_1.Connector) || item.attachedConnectors.indexOf(i) === -1) &&
- DiagramModel.isIntersectedItems(i, item))
- result.push(i);
- });
- return result;
- };
- DiagramModel.prototype.getIntersectItemsMinZIndex = function (item) {
- var items = this.getIntersectItems(item);
- return items.map(function (i) { return i.zIndex; }).reduce(function (prev, cur) { return Math.min(prev, cur); }, Number.MAX_VALUE);
- };
- DiagramModel.prototype.getIntersectItemsMaxZIndex = function (item) {
- var items = this.getIntersectItems(item);
- return items.map(function (i) { return i.zIndex; }).reduce(function (prev, cur) { return Math.max(prev, cur); }, -Number.MAX_VALUE);
- };
- DiagramModel.prototype.iterateItems = function (callback) {
- this.items.forEach(callback);
- };
- DiagramModel.prototype.invalidateItems = function () {
- this.iterateItems(function (item) {
- item.invalidatePrimitives();
- if (item instanceof Connector_1.Connector)
- item.invalidateRenderPoints();
- });
- };
- DiagramModel.prototype.getNextKey = function (baseKey) {
- var _this = this;
- return ModelUtils_1.ModelUtils.getNextItemKey(this.items.map(function (item) { return item.key; }), function (key) { return _this.itemIndexByKey[key] === undefined; }, baseKey);
- };
- DiagramModel.prototype.getModelUnit = function (twipsValue) {
- switch (this.units) {
- case DiagramUnit.Cm:
- return UnitConverter_1.UnitConverter.twipsToCentimeters(twipsValue);
- case DiagramUnit.In:
- return UnitConverter_1.UnitConverter.twipsToInches(twipsValue);
- case DiagramUnit.Px:
- return UnitConverter_1.UnitConverter.twipsToPixels(twipsValue);
- }
- };
- DiagramModel.prototype.getModelUnitText = function (twipsValue, fractionDigits) {
- if (fractionDigits === void 0) { fractionDigits = 2; }
- switch (this.units) {
- case DiagramUnit.Cm:
- return +this.getModelUnit(twipsValue).toFixed(fractionDigits) + " cm";
- case DiagramUnit.In:
- return +this.getModelUnit(twipsValue).toFixed(fractionDigits) + " in";
- case DiagramUnit.Px:
- return this.getModelUnit(twipsValue).toFixed(0) + " px";
- }
- };
- DiagramModel.prototype.getTwipsUnit = function (value) {
- switch (this.units) {
- case DiagramUnit.Cm:
- return UnitConverter_1.UnitConverter.centimetersToTwips(value);
- case DiagramUnit.In:
- return UnitConverter_1.UnitConverter.inchesToTwips(value);
- case DiagramUnit.Px:
- return UnitConverter_1.UnitConverter.pixelsToTwips(value);
- }
- };
- DiagramModel.defaultPageColor = "white";
- return DiagramModel;
- }());
- exports.DiagramModel = DiagramModel;
- /***/ }),
- /* 22 */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- Object.defineProperty(exports, "__esModule", { value: true });
- var Edge = /** @class */ (function () {
- function Edge(key, from, to, weight) {
- if (weight === void 0) { weight = 1; }
- this.weight = weight;
- this.key = key;
- this.from = from;
- this.to = to;
- }
- Edge.prototype.getHashKey = function () {
- return this.from + "_" + this.to;
- };
- Edge.prototype.reverse = function () {
- return new Edge(this.key, this.to, this.from, this.weight);
- };
- return Edge;
- }());
- exports.Edge = Edge;
- var PositionInfo = /** @class */ (function () {
- function PositionInfo(item, position) {
- this.item = item;
- this.position = position;
- }
- return PositionInfo;
- }());
- exports.PositionInfo = PositionInfo;
- var ConnectionMode;
- (function (ConnectionMode) {
- ConnectionMode[ConnectionMode["Outgoing"] = 1] = "Outgoing";
- ConnectionMode[ConnectionMode["Incoming"] = 2] = "Incoming";
- ConnectionMode[ConnectionMode["OutgoingAndIncoming"] = 3] = "OutgoingAndIncoming";
- })(ConnectionMode = exports.ConnectionMode || (exports.ConnectionMode = {}));
- /***/ }),
- /* 23 */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- var __extends = (this && this.__extends) || (function () {
- var extendStatics = function (d, b) {
- extendStatics = Object.setPrototypeOf ||
- ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
- function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
- return extendStatics(d, b);
- };
- return function (d, b) {
- extendStatics(d, b);
- function __() { this.constructor = d; }
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
- };
- })();
- Object.defineProperty(exports, "__esModule", { value: true });
- var CommandBase_1 = __webpack_require__(7);
- var CommandStates_1 = __webpack_require__(6);
- var ChangePagePropertyHistoryItem_1 = __webpack_require__(175);
- var ModelUtils_1 = __webpack_require__(8);
- var ChangePagePropertyCommand = /** @class */ (function (_super) {
- __extends(ChangePagePropertyCommand, _super);
- function ChangePagePropertyCommand() {
- return _super !== null && _super.apply(this, arguments) || this;
- }
- ChangePagePropertyCommand.prototype.getState = function () {
- return new CommandStates_1.SimpleCommandState(true, this.control.model[this.getPropertyName()], this.getPropertyOptions());
- };
- ChangePagePropertyCommand.prototype.executeCore = function (state, parameter) {
- var _this = this;
- this.control.history.beginTransaction();
- var propertyName = this.getPropertyName();
- var items = this.createHistoryItems(propertyName, parameter);
- items.forEach(function (item) { _this.control.history.addAndRedo(item); });
- ModelUtils_1.ModelUtils.tryUpdateModelSize(this.control.history, this.control.model);
- this.control.history.endTransaction();
- return true;
- };
- ChangePagePropertyCommand.prototype.createHistoryItems = function (propertyName, parameter) {
- return [new ChangePagePropertyHistoryItem_1.ChangePagePropertyHistoryItem(propertyName, parameter)];
- };
- ChangePagePropertyCommand.prototype.getPropertyOptions = function () {
- return null;
- };
- return ChangePagePropertyCommand;
- }(CommandBase_1.CommandBase));
- exports.ChangePagePropertyCommand = ChangePagePropertyCommand;
- /***/ }),
- /* 24 */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- var __extends = (this && this.__extends) || (function () {
- var extendStatics = function (d, b) {
- extendStatics = Object.setPrototypeOf ||
- ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
- function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
- return extendStatics(d, b);
- };
- return function (d, b) {
- extendStatics(d, b);
- function __() { this.constructor = d; }
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
- };
- })();
- Object.defineProperty(exports, "__esModule", { value: true });
- var MouseHandlerStateBase_1 = __webpack_require__(45);
- var Event_1 = __webpack_require__(14);
- var MouseHandlerDraggingState = /** @class */ (function (_super) {
- __extends(MouseHandlerDraggingState, _super);
- function MouseHandlerDraggingState(handler, history) {
- var _this = _super.call(this, handler) || this;
- _this.history = history;
- return _this;
- }
- MouseHandlerDraggingState.prototype.onMouseMove = function (evt) {
- if (evt.button !== Event_1.MouseButton.Left) {
- this.cancelChanges();
- this.handler.switchToDefaultState();
- }
- else {
- this.onApplyChanges(evt);
- if (!this.modified)
- this.handler.raiseDragStart(this.getDraggingElementKeys());
- this.modified = true;
- }
- };
- MouseHandlerDraggingState.prototype.cancelChanges = function () {
- this.history.undoTransaction();
- this.modified = false;
- };
- MouseHandlerDraggingState.prototype.onMouseUp = function (evt) {
- this.handler.switchToDefaultState();
- };
- MouseHandlerDraggingState.prototype.start = function () {
- this.history.beginTransaction();
- };
- MouseHandlerDraggingState.prototype.finish = function () {
- if (this.modified) {
- this.onFinishWithChanges();
- this.modified = false;
- this.history.endTransaction();
- this.handler.raiseDragEnd(this.getDraggingElementKeys());
- }
- else
- this.history.endTransaction();
- };
- MouseHandlerDraggingState.prototype.onFinishWithChanges = function () { };
- MouseHandlerDraggingState.prototype.getSnappedPoint = function (evt, point) {
- return this.handler.getSnappedPoint(evt, point);
- };
- return MouseHandlerDraggingState;
- }(MouseHandlerStateBase_1.MouseHandlerCancellableState));
- exports.MouseHandlerDraggingState = MouseHandlerDraggingState;
- /***/ }),
- /* 25 */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- Object.defineProperty(exports, "__esModule", { value: true });
- var ShapeParameter = /** @class */ (function () {
- function ShapeParameter(key, value) {
- this.key = key;
- this.value = value;
- }
- return ShapeParameter;
- }());
- exports.ShapeParameter = ShapeParameter;
- var ShapeParameters = /** @class */ (function () {
- function ShapeParameters() {
- this.items = {};
- }
- ShapeParameters.prototype.add = function (parameter) {
- this.items[parameter.key] = parameter;
- };
- ShapeParameters.prototype.addRange = function (parameters) {
- for (var i = 0; i < parameters.length; i++)
- this.add(parameters[i]);
- };
- ShapeParameters.prototype.get = function (key) {
- return this.items[key];
- };
- ShapeParameters.prototype.forEach = function (callback) {
- for (var key in this.items)
- if (this.items.hasOwnProperty(key))
- callback(this.items[key]);
- };
- ShapeParameters.prototype.clone = function () {
- var result = new ShapeParameters();
- this.forEach(function (p) { result.add(new ShapeParameter(p.key, p.value)); });
- return result;
- };
- ShapeParameters.prototype.toObject = function () {
- var result = {};
- var modified = false;
- this.forEach(function (p) {
- result[p.key] = { 'value': p.value };
- modified = true;
- });
- return modified ? result : null;
- };
- ShapeParameters.prototype.fromObject = function (obj) {
- this.forEach(function (p) {
- var paramObj = obj[p.key];
- if (paramObj) {
- if (typeof paramObj["value"] === "number")
- p.value = paramObj["value"];
- }
- });
- };
- return ShapeParameters;
- }());
- exports.ShapeParameters = ShapeParameters;
- /***/ }),
- /* 26 */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- Object.defineProperty(exports, "__esModule", { value: true });
- var Event_1 = __webpack_require__(14);
- var __1 = __webpack_require__(46);
- var Utils_1 = __webpack_require__(0);
- var Base_1 = __webpack_require__(19);
- var RenderUtils = /** @class */ (function () {
- function RenderUtils() {
- }
- RenderUtils.updateSvgElementSize = function (svgElement, width, height) {
- svgElement.style.width = width + "px";
- svgElement.style.height = height + "px";
- svgElement.setAttribute("viewBox", "0 0 " + width + " " + height);
- };
- RenderUtils.removeContent = function (element) {
- while (element.firstChild)
- element.removeChild(element.firstChild);
- };
- RenderUtils.setElementEventData = function (element, type, key, value) {
- if (type === Event_1.MouseEventElementType.Undefined)
- return;
- element.setAttribute("data-type", type.toString());
- if (key !== undefined)
- element.setAttribute("data-key", key.toString());
- if (value !== undefined)
- element.setAttribute("data-value", value.toString());
- };
- RenderUtils.getElementEventData = function (element) {
- if (element.getAttribute && element.getAttribute("data-type")) {
- return new Event_1.MouseEventSource(parseInt(element.getAttribute("data-type")), element.getAttribute("data-key"), element.getAttribute("data-value"));
- }
- };
- RenderUtils.getHtmlElementStylePropertyName = function (propertyName) {
- switch (propertyName) {
- case "fill":
- return "color";
- case "text-anchor":
- return "text-align";
- }
- return propertyName;
- };
- RenderUtils.getStylePropertyValue = function (propertyName, propertyValue, reverseTextAnchor) {
- if (reverseTextAnchor === void 0) { reverseTextAnchor = false; }
- if (propertyName === "text-anchor" && reverseTextAnchor) {
- if (propertyValue === "start")
- return "end";
- if (propertyValue === "end")
- return "start";
- }
- return propertyValue;
- };
- RenderUtils.applyStyleToElement = function (style, element, reverseTextAnchor) {
- var _this = this;
- if (reverseTextAnchor === void 0) { reverseTextAnchor = false; }
- var defaultStyle = style.getDefaultInstance();
- style.forEach(function (propertyName) {
- var propertyValue = style[propertyName];
- var elPropertyName = (element instanceof HTMLElement) ? _this.getHtmlElementStylePropertyName(propertyName) : propertyName;
- if (propertyValue !== undefined && propertyValue !== "" && propertyValue !== defaultStyle[propertyName])
- element.style.setProperty(elPropertyName, _this.getStylePropertyValue(propertyName, propertyValue, reverseTextAnchor));
- else
- element.style.setProperty(elPropertyName, "");
- });
- };
- RenderUtils.generateSvgElementId = function (prefix) {
- return prefix + "_" + Base_1.CreateGuid();
- };
- RenderUtils.getSvgTextRectangle = function (textEl, lineWidth) {
- if (lineWidth === void 0) { lineWidth = 0; }
- var bBox;
- try {
- bBox = textEl.getBBox();
- }
- catch (_a) { } // TODO make measure in another way because of FF error
- if (bBox) {
- var x = __1.UnitConverter.pixelsToTwips(Math.round(bBox.x)) - lineWidth;
- var y = __1.UnitConverter.pixelsToTwips(Math.round(bBox.y)) - lineWidth;
- var width = __1.UnitConverter.pixelsToTwips(Math.round(bBox.width)) + 2 * lineWidth;
- var height = __1.UnitConverter.pixelsToTwips(Math.round(bBox.height)) + 2 * lineWidth;
- return Utils_1.Rectangle.create(x, y, width, height);
- }
- };
- return RenderUtils;
- }());
- exports.RenderUtils = RenderUtils;
- /***/ }),
- /* 27 */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- var __extends = (this && this.__extends) || (function () {
- var extendStatics = function (d, b) {
- extendStatics = Object.setPrototypeOf ||
- ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
- function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
- return extendStatics(d, b);
- };
- return function (d, b) {
- extendStatics(d, b);
- function __() { this.constructor = d; }
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
- };
- })();
- Object.defineProperty(exports, "__esModule", { value: true });
- var Utils_1 = __webpack_require__(0);
- var ConnectorRenderPoint = /** @class */ (function (_super) {
- __extends(ConnectorRenderPoint, _super);
- function ConnectorRenderPoint(x, y, pointIndex, skipped) {
- if (pointIndex === void 0) { pointIndex = -1; }
- if (skipped === void 0) { skipped = false; }
- var _this = _super.call(this, x, y) || this;
- _this.pointIndex = pointIndex;
- _this.skipped = skipped;
- return _this;
- }
- ConnectorRenderPoint.prototype.offset = function (offsetX, offsetY) {
- if (offsetX === void 0) { offsetX = 0; }
- if (offsetY === void 0) { offsetY = 0; }
- return new ConnectorRenderPoint(this.x + offsetX, this.y + offsetY);
- };
- ConnectorRenderPoint.prototype.multiply = function (multiplierX, multiplierY) {
- if (multiplierX === void 0) { multiplierX = 1; }
- if (multiplierY === void 0) { multiplierY = multiplierX; }
- return new ConnectorRenderPoint(this.x * multiplierX, this.y * multiplierY);
- };
- ConnectorRenderPoint.prototype.clone = function () { return new ConnectorRenderPoint(this.x, this.y, this.pointIndex); };
- return ConnectorRenderPoint;
- }(Utils_1.Point));
- exports.ConnectorRenderPoint = ConnectorRenderPoint;
- /***/ }),
- /* 28 */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- Object.defineProperty(exports, "__esModule", { value: true });
- var ConnectorLineOption;
- (function (ConnectorLineOption) {
- ConnectorLineOption[ConnectorLineOption["Straight"] = 0] = "Straight";
- ConnectorLineOption[ConnectorLineOption["Orthogonal"] = 1] = "Orthogonal";
- })(ConnectorLineOption = exports.ConnectorLineOption || (exports.ConnectorLineOption = {}));
- var ConnectorLineEnding;
- (function (ConnectorLineEnding) {
- ConnectorLineEnding[ConnectorLineEnding["None"] = 0] = "None";
- ConnectorLineEnding[ConnectorLineEnding["Arrow"] = 1] = "Arrow";
- })(ConnectorLineEnding = exports.ConnectorLineEnding || (exports.ConnectorLineEnding = {}));
- var ConnectorProperties = /** @class */ (function () {
- function ConnectorProperties() {
- this.lineOption = ConnectorLineOption.Orthogonal;
- this.startLineEnding = ConnectorLineEnding.None;
- this.endLineEnding = ConnectorLineEnding.Arrow;
- }
- ConnectorProperties.prototype.clone = function () {
- var clone = new ConnectorProperties();
- clone.lineOption = this.lineOption;
- clone.startLineEnding = this.startLineEnding;
- clone.endLineEnding = this.endLineEnding;
- return clone;
- };
- ConnectorProperties.prototype.forEach = function (callback) {
- for (var propertyName in this) {
- if (this.hasOwnProperty(propertyName))
- callback(propertyName);
- }
- };
- ConnectorProperties.prototype.toObject = function () {
- var result = {};
- var modified = false;
- if (this.lineOption !== ConnectorLineOption.Orthogonal) {
- result["lineOption"] = this.lineOption;
- modified = true;
- }
- if (this.startLineEnding !== ConnectorLineEnding.None) {
- result["startLineEnding"] = this.startLineEnding;
- modified = true;
- }
- if (this.endLineEnding !== ConnectorLineEnding.Arrow) {
- result["endLineEnding"] = this.endLineEnding;
- modified = true;
- }
- return modified ? result : null;
- };
- ConnectorProperties.prototype.fromObject = function (obj) {
- if (typeof obj["lineOption"] === "number")
- this.lineOption = obj["lineOption"];
- if (typeof obj["startLineEnding"] === "number")
- this.startLineEnding = obj["startLineEnding"];
- if (typeof obj["endLineEnding"] === "number")
- this.endLineEnding = obj["endLineEnding"];
- };
- return ConnectorProperties;
- }());
- exports.ConnectorProperties = ConnectorProperties;
- /***/ }),
- /* 29 */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- var __extends = (this && this.__extends) || (function () {
- var extendStatics = function (d, b) {
- extendStatics = Object.setPrototypeOf ||
- ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
- function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
- return extendStatics(d, b);
- };
- return function (d, b) {
- extendStatics(d, b);
- function __() { this.constructor = d; }
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
- };
- })();
- Object.defineProperty(exports, "__esModule", { value: true });
- var HistoryItem_1 = __webpack_require__(4);
- var SetSelectionHistoryItem = /** @class */ (function (_super) {
- __extends(SetSelectionHistoryItem, _super);
- function SetSelectionHistoryItem(selection, selectedKeys) {
- var _this = _super.call(this) || this;
- _this.selectedKeys = selectedKeys;
- _this.selection = selection;
- return _this;
- }
- SetSelectionHistoryItem.prototype.redo = function () {
- this.oldSelection = this.selection.getKeys().slice(0);
- this.selection.set(this.selectedKeys);
- };
- SetSelectionHistoryItem.prototype.undo = function () {
- this.selection.set(this.oldSelection);
- };
- return SetSelectionHistoryItem;
- }(HistoryItem_1.HistoryItem));
- exports.SetSelectionHistoryItem = SetSelectionHistoryItem;
- /***/ }),
- /* 30 */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- Object.defineProperty(exports, "__esModule", { value: true });
- var ShapeType_1 = __webpack_require__(1);
- var ProcessShapeDescription_1 = __webpack_require__(120);
- var DecisionShapeDescription_1 = __webpack_require__(121);
- var ManualInputShapeDescription_1 = __webpack_require__(122);
- var DataShapeDescription_1 = __webpack_require__(123);
- var TerminatorShapeDescription_1 = __webpack_require__(124);
- var PredefinedProcessShapeDescription_1 = __webpack_require__(125);
- var ArrowNorthSouthShapeDescription_1 = __webpack_require__(126);
- var ArrowRightShapeDescription_1 = __webpack_require__(127);
- var ArrowTopShapeDescription_1 = __webpack_require__(128);
- var CrossShapeDescription_1 = __webpack_require__(129);
- var DiamondShapeDescription_1 = __webpack_require__(75);
- var EllipseShapeDescription_1 = __webpack_require__(56);
- var HeartShapeDescription_1 = __webpack_require__(130);
- var RectangleShapeDescription_1 = __webpack_require__(12);
- var TextShapeDescription_1 = __webpack_require__(76);
- var PentagonShapeDescription_1 = __webpack_require__(77);
- var HexagonShapeDescription_1 = __webpack_require__(78);
- var OctagonShapeDescription_1 = __webpack_require__(131);
- var StarShapeDescription_1 = __webpack_require__(132);
- var ArrowBottomShapeDescription_1 = __webpack_require__(133);
- var ArrowEastWestShapeDescription_1 = __webpack_require__(134);
- var ArrowLeftShapeDescription_1 = __webpack_require__(135);
- var TriangleShapeDescription_1 = __webpack_require__(79);
- var DocumentShapeDescription_1 = __webpack_require__(80);
- var MultipleDocumentsShapeDescription_1 = __webpack_require__(136);
- var PreparationShapeDescription_1 = __webpack_require__(137);
- var HardDiskShapeDescription_1 = __webpack_require__(138);
- var DatabaseShapeDescription_1 = __webpack_require__(139);
- var InternalStorageShapeDescription_1 = __webpack_require__(140);
- var PaperTapeShapeDescription_1 = __webpack_require__(141);
- var ManualOperationShapeDescription_1 = __webpack_require__(142);
- var DelayShapeDescription_1 = __webpack_require__(143);
- var StoredDataShapeDescription_1 = __webpack_require__(144);
- var MergeShapeDescription_1 = __webpack_require__(145);
- var DisplayShapeDescription_1 = __webpack_require__(146);
- var OrShapeDescription_1 = __webpack_require__(147);
- var SummingJunctionShapeDescription_1 = __webpack_require__(148);
- var CustomShapeDescription_1 = __webpack_require__(149);
- var ShapeDescriptionManager = /** @class */ (function () {
- function ShapeDescriptionManager() {
- }
- ShapeDescriptionManager.get = function (type) {
- return this.descriptions[type];
- };
- ShapeDescriptionManager.getTypesByCategory = function (category) {
- var result = [];
- for (var key in this.descriptions) {
- if (ShapeDescriptionManager.descriptions.hasOwnProperty(key)) {
- if (!category || this.descriptions[key].category === category)
- result.push(parseInt(key));
- }
- }
- return result;
- };
- ShapeDescriptionManager.register = function (description) {
- if (this.descriptions[description.key] !== undefined)
- throw Error("Description key is duplicated");
- this.descriptions[description.key] = description;
- };
- ShapeDescriptionManager.unregister = function (shapeType) {
- delete this.descriptions[shapeType];
- };
- ShapeDescriptionManager.registerCustomShape = function (shape) {
- if (shape.id === undefined)
- throw Error("Custom shape id is not defined");
- if (this.descriptions[ShapeType_1.ShapeType.Custom + shape.id] !== undefined)
- throw Error("Custom shape id is duplicated");
- this.register(new CustomShapeDescription_1.CustomShapeDescription(ShapeType_1.ShapeType.Custom + shape.id, shape.title, shape.svgUrl, shape.svgLeft, shape.svgTop, shape.svgWidth, shape.svgHeight, shape.defaultWidth, shape.defaultHeight, shape.defaultText, shape.allowHasText, shape.textLeft, shape.textTop, shape.textWidth, shape.textHeight, shape.connectionPoints, shape.category));
- };
- ShapeDescriptionManager.unregisterCustomShape = function (id) {
- this.unregister(ShapeType_1.ShapeType.Custom + id);
- };
- ShapeDescriptionManager.descriptions = {};
- return ShapeDescriptionManager;
- }());
- exports.ShapeDescriptionManager = ShapeDescriptionManager;
- ShapeDescriptionManager.register(new ArrowBottomShapeDescription_1.ArrowBottomShapeDescription());
- ShapeDescriptionManager.register(new ArrowEastWestShapeDescription_1.ArrowEastWestShapeDescription());
- ShapeDescriptionManager.register(new ArrowLeftShapeDescription_1.ArrowLeftShapeDescription());
- ShapeDescriptionManager.register(new ArrowNorthSouthShapeDescription_1.ArrowNorthSouthShapeDescription());
- ShapeDescriptionManager.register(new ArrowRightShapeDescription_1.ArrowRightShapeDescription());
- ShapeDescriptionManager.register(new ArrowTopShapeDescription_1.ArrowTopShapeDescription());
- ShapeDescriptionManager.register(new CrossShapeDescription_1.CrossShapeDescription());
- ShapeDescriptionManager.register(new DiamondShapeDescription_1.DiamondShapeDescription());
- ShapeDescriptionManager.register(new EllipseShapeDescription_1.EllipseShapeDescription());
- ShapeDescriptionManager.register(new HeartShapeDescription_1.HeartShapeDescription());
- ShapeDescriptionManager.register(new RectangleShapeDescription_1.RectangleShapeDescription());
- ShapeDescriptionManager.register(new TriangleShapeDescription_1.TriangleShapeDescription());
- ShapeDescriptionManager.register(new TextShapeDescription_1.TextShapeDescription());
- ShapeDescriptionManager.register(new PentagonShapeDescription_1.PentagonShapeDescription());
- ShapeDescriptionManager.register(new HexagonShapeDescription_1.HexagonShapeDescription());
- ShapeDescriptionManager.register(new OctagonShapeDescription_1.OctagonShapeDescription());
- ShapeDescriptionManager.register(new StarShapeDescription_1.StarShapeDescription());
- ShapeDescriptionManager.register(new ProcessShapeDescription_1.ProcessShapeDescription());
- ShapeDescriptionManager.register(new DecisionShapeDescription_1.DecisionShapeDescription());
- ShapeDescriptionManager.register(new TerminatorShapeDescription_1.TerminatorShapeDescription());
- ShapeDescriptionManager.register(new PredefinedProcessShapeDescription_1.PredefinedProcessShapeDescription());
- ShapeDescriptionManager.register(new DocumentShapeDescription_1.DocumentShapeDescription());
- ShapeDescriptionManager.register(new MultipleDocumentsShapeDescription_1.MultipleDocumentsShapeDescription());
- ShapeDescriptionManager.register(new ManualInputShapeDescription_1.ManualInputShapeDescription());
- ShapeDescriptionManager.register(new PreparationShapeDescription_1.PreparationShapeDescription());
- ShapeDescriptionManager.register(new DataShapeDescription_1.DataShapeDescription());
- ShapeDescriptionManager.register(new DatabaseShapeDescription_1.DatabaseShapeDescription());
- ShapeDescriptionManager.register(new HardDiskShapeDescription_1.HardDiskShapeDescription());
- ShapeDescriptionManager.register(new InternalStorageShapeDescription_1.InternalStorageShapeDescription());
- ShapeDescriptionManager.register(new PaperTapeShapeDescription_1.PaperTapeShapeDescription());
- ShapeDescriptionManager.register(new ManualOperationShapeDescription_1.ManualOperationShapeDescription());
- ShapeDescriptionManager.register(new DelayShapeDescription_1.DelayShapeDescription());
- ShapeDescriptionManager.register(new StoredDataShapeDescription_1.StoredDataShapeDescription());
- ShapeDescriptionManager.register(new DisplayShapeDescription_1.DisplayShapeDescription());
- ShapeDescriptionManager.register(new MergeShapeDescription_1.MergeShapeDescription());
- ShapeDescriptionManager.register(new OrShapeDescription_1.OrShapeDescription());
- ShapeDescriptionManager.register(new SummingJunctionShapeDescription_1.SummingJunctionShapeDescription());
- /***/ }),
- /* 31 */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- Object.defineProperty(exports, "__esModule", { value: true });
- var Shape_1 = __webpack_require__(9);
- var Connector_1 = __webpack_require__(5);
- var Exporter = /** @class */ (function () {
- function Exporter() {
- }
- Exporter.export = function (model) {
- var obj = {
- page: {},
- connectors: [],
- shapes: []
- };
- obj.page = {
- "width": model.size.width,
- "height": model.size.height,
- "pageColor": model.pageColor,
- "pageWidth": model.pageSize.width,
- "pageHeight": model.pageSize.height,
- "pageLandscape": model.pageLandscape,
- "gridSize": model.gridSize,
- "showGrid": model.showGrid,
- "snapToGrid": model.snapToGrid,
- "units": model.units
- };
- this.exportItemsCore(model.items, obj);
- return JSON.stringify(obj);
- };
- Exporter.exportItems = function (items) {
- var obj = {
- connectors: [],
- shapes: []
- };
- this.exportItemsCore(items, obj);
- return JSON.stringify(obj);
- };
- Exporter.exportItemsCore = function (items, obj) {
- var _this = this;
- items.forEach(function (item) {
- if (item instanceof Shape_1.Shape) {
- obj.shapes.push(_this.exportShape(item));
- }
- if (item instanceof Connector_1.Connector) {
- var connectorObj = _this.exportConnector(item);
- if (item.beginItem) {
- connectorObj["beginItemKey"] = item.beginItem.key;
- connectorObj["beginConnectionPointIndex"] = item.beginConnectionPointIndex;
- }
- if (item.endItem) {
- connectorObj["endItemKey"] = item.endItem.key;
- connectorObj["endConnectionPointIndex"] = item.endConnectionPointIndex;
- }
- obj.connectors.push(connectorObj);
- }
- });
- };
- Exporter.exportItem = function (item) {
- return {
- "key": item.key,
- "dataKey": item.dataKey,
- "locked": item.locked,
- "zIndex": item.zIndex
- };
- };
- Exporter.exportShape = function (shape) {
- var result = this.exportItem(shape);
- result["type"] = shape.description.key;
- result["text"] = shape.text;
- result["x"] = shape.position.x;
- result["y"] = shape.position.y;
- result["width"] = shape.size.width;
- result["height"] = shape.size.height;
- var paramsObj = shape.parameters.toObject();
- if (paramsObj)
- result["parameters"] = paramsObj;
- var styleObj = shape.style.toObject();
- if (styleObj)
- result["style"] = styleObj;
- var styleTextObj = shape.styleText.toObject();
- if (styleTextObj)
- result["styleText"] = styleTextObj;
- return result;
- };
- Exporter.exportConnector = function (connector) {
- var result = this.exportItem(connector);
- result["points"] = connector.points.map(function (p) { return { "x": p.x, "y": p.y }; });
- var textObj = connector.texts.toObject();
- if (textObj)
- result["texts"] = textObj;
- var propsObj = connector.properties.toObject();
- if (propsObj)
- result["properties"] = propsObj;
- var styleObj = connector.style.toObject();
- if (styleObj)
- result["style"] = styleObj;
- var styleTextObj = connector.styleText.toObject();
- if (styleTextObj)
- result["styleText"] = styleTextObj;
- return result;
- };
- // Images
- Exporter.exportSvg = function (canvasManager, callback) {
- canvasManager.exportSvgImage(callback);
- };
- Exporter.exportPng = function (canvasManager, callback) {
- canvasManager.exportPngImage(callback);
- };
- Exporter.exportJpg = function (canvasManager, callback) {
- canvasManager.exportJpgImage(callback);
- };
- return Exporter;
- }());
- exports.Exporter = Exporter;
- /***/ }),
- /* 32 */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- var __extends = (this && this.__extends) || (function () {
- var extendStatics = function (d, b) {
- extendStatics = Object.setPrototypeOf ||
- ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
- function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
- return extendStatics(d, b);
- };
- return function (d, b) {
- extendStatics(d, b);
- function __() { this.constructor = d; }
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
- };
- })();
- Object.defineProperty(exports, "__esModule", { value: true });
- var Utils_1 = __webpack_require__(0);
- var DiagramItem_1 = __webpack_require__(3);
- var ConnectionPoint = /** @class */ (function (_super) {
- __extends(ConnectionPoint, _super);
- function ConnectionPoint(x, y, side) {
- if (side === void 0) { side = DiagramItem_1.ConnectionPointSide.Undefined; }
- var _this = _super.call(this, x, y) || this;
- _this.side = side;
- return _this;
- }
- ConnectionPoint.prototype.offset = function (offsetX, offsetY) {
- if (offsetX === void 0) { offsetX = 0; }
- if (offsetY === void 0) { offsetY = 0; }
- return new ConnectionPoint(this.x + offsetX, this.y + offsetY);
- };
- ConnectionPoint.prototype.multiply = function (multiplierX, multiplierY) {
- if (multiplierX === void 0) { multiplierX = 1; }
- if (multiplierY === void 0) { multiplierY = multiplierX; }
- return new ConnectionPoint(this.x * multiplierX, this.y * multiplierY);
- };
- ConnectionPoint.prototype.clone = function () { return new ConnectionPoint(this.x, this.y, this.side); };
- ConnectionPoint.prototype.toPoint = function () { return new Utils_1.Point(this.x, this.y); };
- return ConnectionPoint;
- }(Utils_1.Point));
- exports.ConnectionPoint = ConnectionPoint;
- /***/ }),
- /* 33 */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- Object.defineProperty(exports, "__esModule", { value: true });
- var DiagramItem_1 = __webpack_require__(3);
- var Connector_1 = __webpack_require__(5);
- var ConnectorPointsOrthogonalSideCalculatorBase = /** @class */ (function () {
- function ConnectorPointsOrthogonalSideCalculatorBase(parent) {
- this.parent = parent;
- }
- Object.defineProperty(ConnectorPointsOrthogonalSideCalculatorBase.prototype, "connector", {
- get: function () { return this.parent.connector; },
- enumerable: true,
- configurable: true
- });
- Object.defineProperty(ConnectorPointsOrthogonalSideCalculatorBase.prototype, "beginRect", {
- get: function () { return this.parent.beginRect; },
- enumerable: true,
- configurable: true
- });
- Object.defineProperty(ConnectorPointsOrthogonalSideCalculatorBase.prototype, "endRect", {
- get: function () { return this.parent.endRect; },
- enumerable: true,
- configurable: true
- });
- ConnectorPointsOrthogonalSideCalculatorBase.prototype.getBeginOffsetPoints = function (targetSide, originPoint, targetPoint, originRect) {
- originPoint = this.getCorrectOriginPoint(originPoint, originRect);
- if (targetSide !== DiagramItem_1.ConnectionPointSide.Undefined) {
- if (this.isBeginEndSame())
- return this.getSameShapeOffsetPoints(targetSide, originPoint, targetPoint, originRect);
- else if (this.isBeginEndOverlappedPoints(originPoint, targetPoint))
- return this.getOverlappedPointsOffsetPoints(targetSide, originPoint, targetPoint, originRect);
- else if (this.isBeginEndOverlapped())
- return this.getBeginOverlappedShapeOffsetPoints(targetSide, originPoint, targetPoint, originRect);
- }
- else if (this.isOriginRectContainsTargetPoint(originRect, targetPoint))
- return this.getOverlappedPointsOffsetPoints(targetSide, originPoint, targetPoint, originRect);
- if (this.isOnSidePoint(originPoint, targetPoint))
- return this.getBeginOnSideOffsetPoints(targetSide, originPoint, targetPoint, originRect);
- return this.getBeginOffSideOffsetPoints(targetSide, originPoint, targetPoint, originRect);
- };
- ConnectorPointsOrthogonalSideCalculatorBase.prototype.getEndOffsetPoints = function (targetSide, originPoint, targetPoint, originRect) {
- originPoint = this.getCorrectOriginPoint(originPoint, originRect);
- if (targetSide !== DiagramItem_1.ConnectionPointSide.Undefined) {
- if (this.isBeginEndSame())
- return this.getSameShapeOffsetPoints(targetSide, originPoint, targetPoint, originRect);
- else if (this.isBeginEndOverlappedPoints(targetPoint, originPoint))
- return this.getOverlappedPointsOffsetPoints(targetSide, originPoint, targetPoint, originRect);
- else if (this.isBeginEndOverlapped())
- return this.getEndOverlappedShapeOffsetPoints(targetSide, originPoint, targetPoint, originRect);
- }
- else if (this.isOriginRectContainsTargetPoint(originRect, targetPoint))
- return this.getOverlappedPointsOffsetPoints(targetSide, originPoint, targetPoint, originRect);
- if (this.isOnSidePoint(originPoint, targetPoint))
- return this.getEndOnSideOffsetPoints(targetSide, originPoint, targetPoint, originRect);
- return this.getEndOffSideOffsetPoints(targetSide, originPoint, targetPoint, originRect);
- };
- ConnectorPointsOrthogonalSideCalculatorBase.prototype.getSide = function (originPoint, targetPoint) {
- var diffX = Math.abs(targetPoint.x - originPoint.x);
- var diffY = Math.abs(targetPoint.y - originPoint.y);
- if (diffX > diffY) {
- if (targetPoint.x > originPoint.x)
- return DiagramItem_1.ConnectionPointSide.East;
- else
- return DiagramItem_1.ConnectionPointSide.West;
- }
- else {
- if (targetPoint.y > originPoint.y)
- return DiagramItem_1.ConnectionPointSide.South;
- else
- return DiagramItem_1.ConnectionPointSide.North;
- }
- };
- ConnectorPointsOrthogonalSideCalculatorBase.prototype.getSideCalculator = function (originPoint, targetPoint) {
- return this.parent.getSideCalculator(this.getSide(originPoint, targetPoint));
- };
- ConnectorPointsOrthogonalSideCalculatorBase.prototype.getMinOffset = function () {
- return Connector_1.Connector.minOffset;
- };
- ConnectorPointsOrthogonalSideCalculatorBase.prototype.isBeginEndSame = function () {
- return this.connector.beginItem === this.connector.endItem;
- };
- ConnectorPointsOrthogonalSideCalculatorBase.prototype.isBeginEndOverlapped = function () {
- return this.beginRect && this.endRect && this.beginRect.intersect(this.endRect);
- };
- ConnectorPointsOrthogonalSideCalculatorBase.prototype.isBeginEndOverlappedX = function () {
- return this.beginRect && this.endRect && this.beginRect.intersectX(this.endRect);
- };
- ConnectorPointsOrthogonalSideCalculatorBase.prototype.isBeginEndOverlappedY = function () {
- return this.beginRect && this.endRect && this.beginRect.intersectY(this.endRect);
- };
- ConnectorPointsOrthogonalSideCalculatorBase.prototype.isBeginEndOverlappedPoints = function (beginPoint, endPoint) {
- return this.beginRect && this.endRect && (this.beginRect.contains(endPoint) || this.endRect.contains(beginPoint));
- };
- ConnectorPointsOrthogonalSideCalculatorBase.prototype.isOriginRectContainsTargetPoint = function (originRect, targetPoint) {
- return originRect && originRect.contains(targetPoint);
- };
- return ConnectorPointsOrthogonalSideCalculatorBase;
- }());
- exports.ConnectorPointsOrthogonalSideCalculatorBase = ConnectorPointsOrthogonalSideCalculatorBase;
- /***/ }),
- /* 34 */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- var __extends = (this && this.__extends) || (function () {
- var extendStatics = function (d, b) {
- extendStatics = Object.setPrototypeOf ||
- ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
- function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
- return extendStatics(d, b);
- };
- return function (d, b) {
- extendStatics(d, b);
- function __() { this.constructor = d; }
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
- };
- })();
- Object.defineProperty(exports, "__esModule", { value: true });
- var Structures_1 = __webpack_require__(22);
- var Shape_1 = __webpack_require__(9);
- var Utils_1 = __webpack_require__(0);
- var ListUtils_1 = __webpack_require__(60);
- var GraphBase = /** @class */ (function () {
- function GraphBase(nodes, edges) {
- this.nodeMap = {};
- this.edgeMap = {};
- this.nodes = [];
- this.edges = [];
- this.onInit();
- nodes.forEach(this.addNode.bind(this));
- edges.forEach(this.addEdge.bind(this));
- }
- Object.defineProperty(GraphBase.prototype, "items", {
- get: function () {
- return this.nodes.map(this.getNode.bind(this));
- },
- enumerable: true,
- configurable: true
- });
- GraphBase.prototype.onInit = function () { };
- GraphBase.prototype.addEdge = function (edge) {
- this.edgeMap[edge.key] = edge;
- this.edges.push(edge);
- };
- GraphBase.prototype.addNode = function (node) {
- this.nodeMap[node.key] = node;
- this.nodes.push(node.key);
- };
- GraphBase.prototype.getNode = function (key) {
- return this.nodeMap[key];
- };
- GraphBase.prototype.getEdge = function (key) {
- return this.edgeMap[key];
- };
- GraphBase.prototype.isEmpty = function () {
- return !this.nodes.length && !this.edges.length;
- };
- GraphBase.prototype.getAdjacentEdges = function (nodeKey, connectionMode) {
- if (connectionMode === void 0) { connectionMode = Structures_1.ConnectionMode.OutgoingAndIncoming; }
- return this.edges.filter(function (e) {
- return connectionMode & Structures_1.ConnectionMode.Incoming && e.to === nodeKey ||
- connectionMode & Structures_1.ConnectionMode.Outgoing && e.from === nodeKey;
- });
- };
- return GraphBase;
- }());
- var Graph = /** @class */ (function (_super) {
- __extends(Graph, _super);
- function Graph() {
- return _super !== null && _super.apply(this, arguments) || this;
- }
- Graph.prototype.cast = function (castNode, castEdge) {
- var _this = this;
- var newNodes = this.nodes.map(function (nk) { return castNode(_this.getNode(nk)); });
- var newEdges = this.edges.map(function (e) { return castEdge ? castEdge(e) : e; });
- return new Graph(newNodes, newEdges);
- };
- Graph.prototype.getConnectedComponents = function () {
- var iterator = this.createIterator(Structures_1.ConnectionMode.OutgoingAndIncoming);
- iterator.visitEachEdgeOnce = true;
- var components = [];
- var _loop_1 = function (i) {
- var nodes = [];
- var edges = [];
- iterator.onNode = function (n) { return nodes.push(n); };
- iterator.onEdge = function (e) { return edges.push(e); };
- iterator.iterate(this_1.nodes[i]);
- if (nodes.length)
- components.push(new Graph(nodes, edges));
- };
- var this_1 = this;
- for (var i = 0; i < this.nodes.length; i++) {
- _loop_1(i);
- }
- return components;
- };
- Graph.prototype.createIterator = function (connectionMode) {
- var iterator = new GraphIterator(this, connectionMode);
- iterator.comparer = function (a, b) { return a.weight - b.weight; };
- return iterator;
- };
- Graph.prototype.getSpanningGraph = function (rootKey, connectionMode, edgeWeightFunc) {
- var _this = this;
- if (edgeWeightFunc === void 0) { edgeWeightFunc = undefined; }
- if (!this.nodes.length)
- return new Graph([], []);
- if (!edgeWeightFunc)
- edgeWeightFunc = function (e) { return e.weight; };
- var sortedAdjacentEdges = [];
- var spanningTreeNodesSet = new ListUtils_1.HashSet();
- var spanningTreeEdgesSet = new ListUtils_1.HashSet([], function (e) { return e.getHashKey(); });
- this.addNodeToSpanningGraph(rootKey, connectionMode, sortedAdjacentEdges, spanningTreeNodesSet, spanningTreeEdgesSet, edgeWeightFunc);
- while (sortedAdjacentEdges.length && spanningTreeNodesSet.length !== this.nodes.length) {
- var minWeighedEdge = sortedAdjacentEdges.shift();
- spanningTreeEdgesSet.tryPush(minWeighedEdge);
- var node = spanningTreeNodesSet.contains(minWeighedEdge.from) ? minWeighedEdge.to : minWeighedEdge.from;
- this.addNodeToSpanningGraph(node, connectionMode, sortedAdjacentEdges, spanningTreeNodesSet, spanningTreeEdgesSet, edgeWeightFunc);
- sortedAdjacentEdges = sortedAdjacentEdges.filter(function (e) { return !spanningTreeNodesSet.contains(e.from) || !spanningTreeNodesSet.contains(e.to); });
- }
- return new Graph(spanningTreeNodesSet.list().map(function (nk) { return _this.getNode(nk); }), spanningTreeEdgesSet.list());
- };
- Graph.prototype.addNodeToSpanningGraph = function (nodeKey, connectionMode, adjacentEdges, spanningTreeNodesSet, spanningTreeEdgesSet, edgeWeightFunc) {
- spanningTreeNodesSet.tryPush(nodeKey);
- this.getAdjacentEdges(nodeKey, connectionMode)
- .filter(function (e) { return !spanningTreeEdgesSet.contains(e); })
- .forEach(function (e) {
- var weight = edgeWeightFunc(e);
- var pos = Utils_1.Utils.binaryIndexOf(adjacentEdges, function (a) { return a.weight - weight; });
- pos = pos < 0 ? ~pos : pos;
- while (pos < adjacentEdges.length && edgeWeightFunc(adjacentEdges[pos]) === weight)
- pos++;
- adjacentEdges.splice(pos, 0, new Structures_1.Edge(e.key, e.from, e.to, weight));
- });
- };
- Graph.create = function (shapes, connectors) {
- var nodes = shapes;
- var edges = connectors
- .filter(function (i) { return i.beginItem && i.endItem instanceof Shape_1.Shape && i.endItem && i.endItem instanceof Shape_1.Shape && i.beginItem !== i.endItem; }) // TBD: ShapeItem?
- .map(function (i) { return new Structures_1.Edge(i.key, i.beginItem && i.beginItem.key, i.endItem && i.endItem.key); });
- return new Graph(nodes, edges);
- };
- return Graph;
- }(GraphBase));
- exports.Graph = Graph;
- var FastGraph = /** @class */ (function (_super) {
- __extends(FastGraph, _super);
- function FastGraph() {
- return _super !== null && _super.apply(this, arguments) || this;
- }
- FastGraph.prototype.onInit = function () {
- this.parentToChildren = {};
- this.childToParents = {};
- };
- FastGraph.prototype.addEdge = function (edge) {
- _super.prototype.addEdge.call(this, edge);
- (this.parentToChildren[edge.from] || (this.parentToChildren[edge.from] = [])).push(edge.to);
- (this.childToParents[edge.to] || (this.childToParents[edge.to] = [])).push(edge.from);
- };
- FastGraph.prototype.getChildren = function (parent) {
- return this.parentToChildren[parent] || [];
- };
- FastGraph.prototype.getParents = function (child) {
- return this.childToParents[child] || [];
- };
- FastGraph.prototype.createIterator = function (connectionMode) {
- return new GraphIterator(this, connectionMode);
- };
- return FastGraph;
- }(GraphBase));
- exports.FastGraph = FastGraph;
- var GraphIterator = /** @class */ (function () {
- function GraphIterator(graph, connectionMode) {
- if (connectionMode === void 0) { connectionMode = Structures_1.ConnectionMode.OutgoingAndIncoming; }
- this.graph = graph;
- this.connectionMode = connectionMode;
- this.visitEachEdgeOnce = true;
- this.visitEachNodeOnce = true;
- this.visitedNodes = {};
- this.visitedEdges = {};
- }
- GraphIterator.prototype.iterate = function (nodeKey) {
- if (!this.visitEachNodeOnce && !this.visitEachEdgeOnce && !this.skipNode)
- throw "skipNode or visitEachNodeOnce or visitEachEdgeOnce must be set to avoid SOF";
- this.iterateCore(nodeKey);
- };
- GraphIterator.prototype.iterateCore = function (nodeKey) {
- var _this = this;
- var node = this.graph.getNode(nodeKey);
- if (this.skipNode && this.skipNode(node) || (this.visitEachNodeOnce && this.isNodeVisited(nodeKey)))
- return;
- this.visitedNodes[nodeKey] = true;
- this.onNode && this.onNode(node);
- var edges = this.graph.getAdjacentEdges(nodeKey, this.connectionMode);
- if (this.skipEdge)
- edges = edges.filter(function (e) { return !_this.skipEdge(e); });
- if (this.connectionMode & Structures_1.ConnectionMode.Outgoing) {
- var outgoing = edges.filter(function (e) { return e.from === nodeKey; });
- if (this.comparer)
- outgoing.sort(this.comparer);
- outgoing.forEach(function (e) {
- if (_this.visitEachEdgeOnce && _this.visitedEdges[e.key])
- return;
- _this.visitedEdges[e.key] = true;
- _this.onEdge && _this.onEdge(e, true);
- _this.iterateCore(e.to);
- _this.onAfterEdge && _this.onAfterEdge(e, true);
- });
- }
- this.onAllEdges && this.onAllEdges(node, true);
- if (this.connectionMode & Structures_1.ConnectionMode.Incoming) {
- var incoming = edges.filter(function (e) { return e.to === nodeKey; });
- if (this.comparer)
- incoming.sort(this.comparer);
- incoming.forEach(function (e) {
- if (_this.visitEachEdgeOnce && _this.visitedEdges[e.key])
- return;
- _this.visitedEdges[e.key] = true;
- _this.onEdge && _this.onEdge(e, false);
- _this.iterateCore(e.from);
- _this.onAfterEdge && _this.onAfterEdge(e, false);
- });
- }
- this.onAllEdges && this.onAllEdges(node, false);
- };
- GraphIterator.prototype.isNodeVisited = function (nodeKey) {
- return !!this.visitedNodes[nodeKey];
- };
- GraphIterator.prototype.isEdgeVisited = function (edgeKey) {
- return !!this.visitedEdges[edgeKey];
- };
- return GraphIterator;
- }());
- exports.GraphIterator = GraphIterator;
- /***/ }),
- /* 35 */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- var __extends = (this && this.__extends) || (function () {
- var extendStatics = function (d, b) {
- extendStatics = Object.setPrototypeOf ||
- ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
- function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
- return extendStatics(d, b);
- };
- return function (d, b) {
- extendStatics(d, b);
- function __() { this.constructor = d; }
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
- };
- })();
- Object.defineProperty(exports, "__esModule", { value: true });
- var HistoryItem_1 = __webpack_require__(4);
- var Connector_1 = __webpack_require__(5);
- var AddConnectionHistoryItem = /** @class */ (function (_super) {
- __extends(AddConnectionHistoryItem, _super);
- function AddConnectionHistoryItem(connector, item, connectionPointIndex, position) {
- var _this = _super.call(this) || this;
- _this.connectorKey = connector.key;
- _this.itemKey = item.key;
- _this.connectionPointIndex = connectionPointIndex;
- _this.position = position;
- return _this;
- }
- AddConnectionHistoryItem.prototype.redo = function (manipulator) {
- var connector = manipulator.model.findConnector(this.connectorKey);
- var item = manipulator.model.findItem(this.itemKey);
- manipulator.addConnection(connector, item, this.connectionPointIndex, this.position);
- };
- AddConnectionHistoryItem.prototype.undo = function (manipulator) {
- var connector = manipulator.model.findConnector(this.connectorKey);
- manipulator.deleteConnection(connector, this.position);
- };
- return AddConnectionHistoryItem;
- }(HistoryItem_1.HistoryItem));
- exports.AddConnectionHistoryItem = AddConnectionHistoryItem;
- var SetConnectionPointIndexHistoryItem = /** @class */ (function (_super) {
- __extends(SetConnectionPointIndexHistoryItem, _super);
- function SetConnectionPointIndexHistoryItem(connector, connectionPointIndex, position) {
- var _this = _super.call(this) || this;
- _this.connectorKey = connector.key;
- _this.connectionPointIndex = connectionPointIndex;
- _this.position = position;
- return _this;
- }
- SetConnectionPointIndexHistoryItem.prototype.redo = function (manipulator) {
- var connector = manipulator.model.findConnector(this.connectorKey);
- this.oldConnectionPointIndex = this.position === Connector_1.ConnectorPosition.Begin ? connector.beginConnectionPointIndex : connector.endConnectionPointIndex;
- manipulator.setConnectionPointIndex(connector, this.connectionPointIndex, this.position);
- };
- SetConnectionPointIndexHistoryItem.prototype.undo = function (manipulator) {
- var connector = manipulator.model.findConnector(this.connectorKey);
- manipulator.setConnectionPointIndex(connector, this.oldConnectionPointIndex, this.position);
- };
- return SetConnectionPointIndexHistoryItem;
- }(HistoryItem_1.HistoryItem));
- exports.SetConnectionPointIndexHistoryItem = SetConnectionPointIndexHistoryItem;
- /***/ }),
- /* 36 */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- var __extends = (this && this.__extends) || (function () {
- var extendStatics = function (d, b) {
- extendStatics = Object.setPrototypeOf ||
- ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
- function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
- return extendStatics(d, b);
- };
- return function (d, b) {
- extendStatics(d, b);
- function __() { this.constructor = d; }
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
- };
- })();
- Object.defineProperty(exports, "__esModule", { value: true });
- var HistoryItem_1 = __webpack_require__(4);
- var MoveConnectorPointHistoryItem = /** @class */ (function (_super) {
- __extends(MoveConnectorPointHistoryItem, _super);
- function MoveConnectorPointHistoryItem(connectorKey, pointIndex, point) {
- var _this = _super.call(this) || this;
- _this.connectorKey = connectorKey;
- _this.pointIndex = pointIndex;
- _this.point = point;
- return _this;
- }
- MoveConnectorPointHistoryItem.prototype.redo = function (manipulator) {
- var connector = manipulator.model.findConnector(this.connectorKey);
- this.oldPoint = connector.points[this.pointIndex].clone();
- manipulator.moveConnectorPoint(connector, this.pointIndex, this.point);
- };
- MoveConnectorPointHistoryItem.prototype.undo = function (manipulator) {
- var connector = manipulator.model.findConnector(this.connectorKey);
- manipulator.moveConnectorPoint(connector, this.pointIndex, this.oldPoint);
- };
- return MoveConnectorPointHistoryItem;
- }(HistoryItem_1.HistoryItem));
- exports.MoveConnectorPointHistoryItem = MoveConnectorPointHistoryItem;
- /***/ }),
- /* 37 */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- var __extends = (this && this.__extends) || (function () {
- var extendStatics = function (d, b) {
- extendStatics = Object.setPrototypeOf ||
- ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
- function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
- return extendStatics(d, b);
- };
- return function (d, b) {
- extendStatics(d, b);
- function __() { this.constructor = d; }
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
- };
- })();
- Object.defineProperty(exports, "__esModule", { value: true });
- var ShapeType_1 = __webpack_require__(1);
- var ModelUtils_1 = __webpack_require__(8);
- var DataImporter_1 = __webpack_require__(119);
- var DataLayoutType;
- (function (DataLayoutType) {
- DataLayoutType[DataLayoutType["Tree"] = 0] = "Tree";
- DataLayoutType[DataLayoutType["Sugiyama"] = 1] = "Sugiyama";
- })(DataLayoutType = exports.DataLayoutType || (exports.DataLayoutType = {}));
- var DataSource = /** @class */ (function () {
- function DataSource(key, name, nodeDataSource, edgeDataSource, nodeDataImporter, edgeDataImporter) {
- this.nodes = [];
- this.edges = [];
- this.nodeKeyMap = {};
- this.edgeKeyMap = {};
- this.useNodeParentId = false;
- this.useNodeItems = false;
- if (key === undefined || key === null)
- throw new Error("DataSource key must be specified");
- this.key = key.toString();
- this.name = name;
- this.nodeDataImporter = this.createNodeDataImporter(nodeDataImporter);
- this.edgeDataImporter = this.createEdgeDataImporter(edgeDataImporter);
- this.nodeDataSource = nodeDataSource || [];
- this.edgeDataSource = edgeDataSource || [];
- this.fetchData();
- }
- DataSource.prototype.fetchData = function () {
- var _this = this;
- this.useNodeParentId = false;
- this.useNodeItems = false;
- this.nodeDataSource.forEach(function (nodeDataObj) {
- _this.addNode(nodeDataObj);
- });
- if (this.useEdgesArray()) {
- this.edgeDataSource.forEach(function (edgeDataObj) {
- _this.addEdge(edgeDataObj);
- });
- }
- else {
- this.nodes.forEach(function (node) {
- _this.addNodeEdgesByParentId(node);
- });
- }
- };
- DataSource.prototype.useEdgesArray = function () {
- return Array.isArray(this.edgeDataSource) && this.edgeDataSource.length;
- };
- DataSource.prototype.addNode = function (nodeDataObj, parentNodeDataObj) {
- var _this = this;
- var node = this.addNodeInternal(nodeDataObj, this.nodeDataImporter.getText(nodeDataObj), this.nodeDataImporter.getType(nodeDataObj), parentNodeDataObj);
- if (!this.useNodeParentId && !this.useEdgesArray()) {
- var childNodeDataObjs = this.nodeDataImporter.getItems(nodeDataObj);
- if (Array.isArray(childNodeDataObjs) && childNodeDataObjs.length) {
- childNodeDataObjs.forEach(function (childNodeDataObj) {
- var childNode = _this.addNode(childNodeDataObj, nodeDataObj);
- _this.addEdgeInternal(undefined, node.key, childNode.key);
- _this.useNodeItems = true;
- });
- }
- }
- return node;
- };
- DataSource.prototype.addNodeEdgesByParentId = function (node) {
- if (!this.useNodeItems && !this.useEdgesArray()) {
- var parentKey = this.nodeDataImporter.getParentKey(node.dataObj);
- if (parentKey !== undefined && parentKey !== null) {
- this.addEdgeInternal(undefined, this.getNodeKey(node.dataObj, this.nodeDataImporter.getParentKey), this.getNodeKey(node.dataObj, this.nodeDataImporter.getKey));
- this.useNodeParentId = true;
- }
- }
- };
- DataSource.prototype.addNodeInternal = function (nodeDataObj, text, type, parentNodeDataObj) {
- var externalKey = this.nodeDataImporter.getKey(nodeDataObj);
- var key = (externalKey !== undefined && externalKey !== null) ? externalKey.toString() : ModelUtils_1.ModelUtils.getGuidItemKey();
- var node = new DataSourceNodeItem(this.key, key, nodeDataObj, text, type || ShapeType_1.ShapeType.Rectangle, parentNodeDataObj);
- this.nodes.push(node);
- if (externalKey === undefined || externalKey === null) {
- externalKey = key;
- this.nodeDataImporter.setKey(nodeDataObj, key);
- }
- if (externalKey !== undefined && externalKey !== null)
- this.nodeKeyMap[externalKey] = key;
- return node;
- };
- DataSource.prototype.addEdge = function (edgeDataObj) {
- return this.addEdgeInternal(edgeDataObj, this.getNodeKey(edgeDataObj, this.edgeDataImporter.getFrom), this.getNodeKey(edgeDataObj, this.edgeDataImporter.getTo));
- };
- DataSource.prototype.addEdgeInternal = function (edgeDataObj, from, to) {
- var externalKey = edgeDataObj && this.edgeDataImporter.getKey(edgeDataObj);
- var key = (externalKey !== undefined && externalKey !== null) ? externalKey.toString() : ModelUtils_1.ModelUtils.getGuidItemKey();
- var edge = new DataSourceEdgeItem(this.key, key, edgeDataObj, from, to);
- this.edges.push(edge);
- if (externalKey === undefined || externalKey === null) {
- externalKey = key;
- if (edgeDataObj)
- this.edgeDataImporter.setKey(edgeDataObj, key);
- }
- if (externalKey !== undefined && externalKey !== null)
- this.edgeKeyMap[externalKey] = key;
- return edge;
- };
- DataSource.prototype.findNode = function (key) {
- return this.nodes.filter(function (i) { return key !== undefined && i.key === key; })[0];
- };
- DataSource.prototype.findEdge = function (key) {
- return this.edges.filter(function (i) { return key !== undefined && i.key === key; })[0];
- };
- DataSource.prototype.getNodeKey = function (nodeDataObj, getKey) {
- return this.nodeKeyMap[getKey(nodeDataObj)];
- };
- DataSource.prototype.createModelItems = function (history, model, selection, layoutType) {
- ModelUtils_1.ModelUtils.createItemsByDataSource(history, model, selection, this, layoutType);
- };
- DataSource.prototype.createNodeDataImporter = function (importer) {
- var result = new DataImporter_1.DataSourceNodeDataImporter();
- if (importer) {
- if (importer.getKey)
- result.getKey = importer.getKey;
- if (importer.setKey)
- result.setKey = importer.setKey;
- if (importer.getText)
- result.getText = importer.getText;
- if (importer.setText)
- result.setText = importer.setText;
- if (importer.getType)
- result.getType = importer.getType;
- if (importer.setType)
- result.setType = importer.setType;
- if (importer.getParentKey)
- result.getParentKey = importer.getParentKey;
- if (importer.setParentKey)
- result.setParentKey = importer.setParentKey;
- if (importer.getItems)
- result.getItems = importer.getItems;
- if (importer.setItems)
- result.setItems = importer.setItems;
- }
- return result;
- };
- DataSource.prototype.createEdgeDataImporter = function (importer) {
- var result = new DataImporter_1.DataSourceEdgeDataImporter();
- if (importer) {
- if (importer.getKey)
- result.getKey = importer.getKey;
- if (importer.setKey)
- result.setKey = importer.setKey;
- if (importer.getFrom)
- result.getFrom = importer.getFrom;
- if (importer.setFrom)
- result.setFrom = importer.setFrom;
- if (importer.getTo)
- result.getTo = importer.getTo;
- if (importer.setTo)
- result.setTo = importer.setTo;
- }
- return result;
- };
- return DataSource;
- }());
- exports.DataSource = DataSource;
- var DataSourceItem = /** @class */ (function () {
- function DataSourceItem(sourceKey, key, dataObj) {
- this.sourceKey = sourceKey;
- this.key = key;
- this.dataObj = dataObj;
- }
- return DataSourceItem;
- }());
- exports.DataSourceItem = DataSourceItem;
- var DataSourceNodeItem = /** @class */ (function (_super) {
- __extends(DataSourceNodeItem, _super);
- function DataSourceNodeItem(sourceKey, key, dataObj, text, type, parentDataObj) {
- var _this = _super.call(this, sourceKey, key, dataObj) || this;
- _this.text = text;
- _this.type = type;
- _this.parentDataObj = parentDataObj;
- return _this;
- }
- return DataSourceNodeItem;
- }(DataSourceItem));
- exports.DataSourceNodeItem = DataSourceNodeItem;
- var DataSourceEdgeItem = /** @class */ (function (_super) {
- __extends(DataSourceEdgeItem, _super);
- function DataSourceEdgeItem(sourceKey, key, dataObj, from, to) {
- var _this = _super.call(this, sourceKey, key, dataObj) || this;
- _this.sourceKey = sourceKey;
- _this.from = from;
- _this.to = to;
- return _this;
- }
- return DataSourceEdgeItem;
- }(DataSourceItem));
- exports.DataSourceEdgeItem = DataSourceEdgeItem;
- /***/ }),
- /* 38 */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- var __extends = (this && this.__extends) || (function () {
- var extendStatics = function (d, b) {
- extendStatics = Object.setPrototypeOf ||
- ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
- function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
- return extendStatics(d, b);
- };
- return function (d, b) {
- extendStatics(d, b);
- function __() { this.constructor = d; }
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
- };
- })();
- Object.defineProperty(exports, "__esModule", { value: true });
- var RenderManager_1 = __webpack_require__(10);
- var Primitive_1 = __webpack_require__(15);
- var EllipsePrimitive = /** @class */ (function (_super) {
- __extends(EllipsePrimitive, _super);
- function EllipsePrimitive(cx, cy, rx, ry, style, className) {
- var _this = _super.call(this, style, className) || this;
- _this.cx = cx;
- _this.cy = cy;
- _this.rx = rx;
- _this.ry = ry;
- return _this;
- }
- EllipsePrimitive.prototype.createMainElement = function () {
- return document.createElementNS(RenderManager_1.svgNS, "ellipse");
- };
- EllipsePrimitive.prototype.applyElementProperties = function (element) {
- this.setUnitAttribute(element, "cx", this.cx);
- this.setUnitAttribute(element, "cy", this.cy);
- this.setUnitAttribute(element, "rx", this.rx);
- this.setUnitAttribute(element, "ry", this.ry);
- _super.prototype.applyElementProperties.call(this, element);
- };
- return EllipsePrimitive;
- }(Primitive_1.SvgPrimitive));
- exports.EllipsePrimitive = EllipsePrimitive;
- /***/ }),
- /* 39 */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- Object.defineProperty(exports, "__esModule", { value: true });
- var Utils_1 = __webpack_require__(0);
- var NodeInfo = /** @class */ (function () {
- function NodeInfo(key, margin, size, connectionPoints) {
- if (connectionPoints === void 0) { connectionPoints = []; }
- this.key = key;
- this.margin = margin;
- this.size = size;
- this.connectionPoints = connectionPoints;
- }
- return NodeInfo;
- }());
- exports.NodeInfo = NodeInfo;
- var NodeLayout = /** @class */ (function () {
- function NodeLayout(info, position) {
- this.info = info;
- this.position = position;
- }
- Object.defineProperty(NodeLayout.prototype, "key", {
- get: function () { return this.info.key; },
- enumerable: true,
- configurable: true
- });
- Object.defineProperty(NodeLayout.prototype, "rectangle", {
- get: function () {
- return new Utils_1.Rectangle(this.position, this.info.size);
- },
- enumerable: true,
- configurable: true
- });
- return NodeLayout;
- }());
- exports.NodeLayout = NodeLayout;
- var EdgeLayout = /** @class */ (function () {
- function EdgeLayout(key, beginIndex, endIndex) {
- this.key = key;
- this.beginIndex = beginIndex;
- this.endIndex = endIndex;
- }
- return EdgeLayout;
- }());
- exports.EdgeLayout = EdgeLayout;
- var Margin = /** @class */ (function () {
- function Margin(top, right, bottom, left) {
- if (right === void 0) { right = top; }
- if (bottom === void 0) { bottom = top; }
- if (left === void 0) { left = top; }
- this.top = top;
- this.right = right;
- this.bottom = bottom;
- this.left = left;
- }
- Margin.empty = function () {
- return new Margin(0);
- };
- return Margin;
- }());
- exports.Margin = Margin;
- /***/ }),
- /* 40 */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- var __extends = (this && this.__extends) || (function () {
- var extendStatics = function (d, b) {
- extendStatics = Object.setPrototypeOf ||
- ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
- function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
- return extendStatics(d, b);
- };
- return function (d, b) {
- extendStatics(d, b);
- function __() { this.constructor = d; }
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
- };
- })();
- Object.defineProperty(exports, "__esModule", { value: true });
- var BaseBuilder_1 = __webpack_require__(82);
- var Graph_1 = __webpack_require__(34);
- var NodeLayout_1 = __webpack_require__(39);
- var Structures_1 = __webpack_require__(22);
- var ListUtils_1 = __webpack_require__(60);
- var Utils_1 = __webpack_require__(0);
- var LayoutSettings_1 = __webpack_require__(18);
- var GraphLayout_1 = __webpack_require__(81);
- var Connector_1 = __webpack_require__(5);
- var CycleRemover_1 = __webpack_require__(153);
- var SugiyamaLayoutBuilder = /** @class */ (function (_super) {
- __extends(SugiyamaLayoutBuilder, _super);
- function SugiyamaLayoutBuilder() {
- return _super !== null && _super.apply(this, arguments) || this;
- }
- SugiyamaLayoutBuilder.prototype.build = function () {
- var _this = this;
- var offset = 0;
- var layout = new GraphLayout_1.GraphLayout();
- var nodeOrderer = new SugiyamaNodesOrderer();
- this.graph.getConnectedComponents()
- .forEach(function (component) {
- var acyclicGraphInfo = CycleRemover_1.CycleRemover.removeCycles(component);
- var layers = SugiyamaLayerDistributor.getLayers(acyclicGraphInfo.graph);
- var orderedGraph = nodeOrderer.orderNodes(acyclicGraphInfo.graph, layers);
- var removedEdges = Object.keys(acyclicGraphInfo.removedEdges).map(function (ek) { return component.getEdge(ek); });
- var coordinatedGraph = nodeOrderer.assignAbsCoordinates(orderedGraph);
- var componentLayout = _this.createInfoGraphLayout(coordinatedGraph, acyclicGraphInfo.reversedEdges, removedEdges);
- layout.extend(_this.setComponentOffset(componentLayout, offset));
- offset += _this.getComponentOffset(componentLayout);
- });
- return layout;
- };
- // Order Nodes
- SugiyamaLayoutBuilder.prototype.createInfoGraphLayout = function (coordinatedGraph, reversedEdges, removedEdges) {
- var _this = this;
- var currentPosition = new Utils_1.Point(0, 0);
- var items = coordinatedGraph.items;
- var sortedLayers = new ListUtils_1.HashSet(items.map(function (n) { return n.layer; }).sort());
- var absOffsetInfo = this.getAbsOffsetInfo(coordinatedGraph.items);
- var positions = {};
- var totalDepth = 0;
- var leftEdge = Number.MAX_SAFE_INTEGER;
- var rightEdge = Number.MIN_SAFE_INTEGER;
- var _loop_1 = function (i) {
- var layer = sortedLayers.item(i);
- var maxDepthLayer = 0;
- items
- .filter(function (n) { return n.layer === layer; })
- .sort(function (a, b) { return a.position - b.position; })
- .forEach(function (n) {
- var depthNodeSize = _this.getDepthNodeSize(n);
- var directionOffset = _this.chooseDirectionValue(0, depthNodeSize);
- var absPosition = _this.getAbsPosition(n.position, _this.getBreadthNodeSize(n), absOffsetInfo);
- currentPosition = _this.setBreadth(currentPosition, absPosition);
- var nodePosition = _this.setDepthOffset(currentPosition, -directionOffset);
- positions[n.key] = nodePosition;
- if (n.isDummy)
- return;
- var breadth = _this.settings.orientation === LayoutSettings_1.OrientationKind.Horizontal ? nodePosition.y : nodePosition.x;
- leftEdge = Math.min(leftEdge, breadth);
- rightEdge = Math.max(rightEdge, breadth + _this.getBreadthNodeSize(n));
- maxDepthLayer = Math.max(maxDepthLayer, _this.getDepthNodeSize(n));
- });
- totalDepth += maxDepthLayer;
- currentPosition = this_1.setBreadth(currentPosition, 0);
- currentPosition = this_1.setDepthOffset(currentPosition, this_1.getDirectionValue(maxDepthLayer + this_1.settings.layerSpacing));
- };
- var this_1 = this;
- for (var i = 0; i < sortedLayers.length; i++) {
- _loop_1(i);
- }
- totalDepth += (sortedLayers.length - 1) * this.settings.layerSpacing;
- var layout = new GraphLayout_1.GraphLayout();
- this.createNodesLayout(coordinatedGraph, layout, leftEdge, totalDepth, positions);
- this.createEdgesLayout(coordinatedGraph, layout, reversedEdges, removedEdges);
- return layout;
- //this.getDummyEdgesRoutes(infoGraph);
- };
- SugiyamaLayoutBuilder.prototype.createNodesLayout = function (infoGraph, layout, leftEdge, totalDepth, positions) {
- var _this = this;
- var offset = this.settings.orientation === LayoutSettings_1.OrientationKind.Vertical ?
- new Utils_1.Point(-leftEdge, this.chooseDirectionValue(0, totalDepth)) :
- new Utils_1.Point(this.chooseDirectionValue(0, totalDepth), -leftEdge);
- infoGraph.items.forEach(function (n) {
- if (!n.isDummy) {
- var node = _this.graph.getNode(n.key);
- layout.addNode(new NodeLayout_1.NodeLayout(node, positions[n.key].offset(offset.x, offset.y)));
- }
- });
- };
- SugiyamaLayoutBuilder.prototype.createEdgesLayout = function (infoGraph, layout, reversedEdges, removedEdges) {
- var DIRECT = this.getDirectEdgeLayout();
- var TOP_TO_BOTTOM = this.getDiffLevelEdgeLayout(true);
- var BOTTOM_TO_TOP = this.getDiffLevelEdgeLayout(false);
- var TOP_TO_TOP = this.getSameLevelEdgeLayout(true);
- var BOTTOM_TO_BOTTOM = this.getSameLevelEdgeLayout(false);
- var occupied = {};
- infoGraph.edges
- .filter(function (e) { return !e.isDummy; })
- .concat(removedEdges.map(function (e) { return new EdgeOnLayer(e.key, false, e.from, e.to); }))
- .sort(function (a, b) {
- return (infoGraph.getNode(a.originFrom).layer - infoGraph.getNode(b.originFrom).layer) ||
- (infoGraph.getNode(a.to).layer - infoGraph.getNode(b.to).layer);
- })
- .forEach(function (e) {
- var isReversed = reversedEdges[e.key];
- var from = infoGraph.getNode(isReversed ? e.to : e.originFrom);
- var to = infoGraph.getNode(isReversed ? e.originFrom : e.to);
- if (to.layer - from.layer === 1)
- layout.addEdge(new NodeLayout_1.EdgeLayout(e.key, DIRECT.from, DIRECT.to));
- else {
- var candidates_1 = [];
- if (to.position - from.position >= 1) {
- candidates_1.push(TOP_TO_BOTTOM);
- candidates_1.push({ from: DIRECT.from, to: TOP_TO_BOTTOM.to });
- candidates_1.push({ from: TOP_TO_BOTTOM.from, to: DIRECT.to });
- }
- else if (to.position - from.position <= -1) {
- candidates_1.push(BOTTOM_TO_TOP);
- candidates_1.push({ from: DIRECT.from, to: BOTTOM_TO_TOP.to });
- candidates_1.push({ from: BOTTOM_TO_TOP.from, to: DIRECT.to });
- }
- else {
- var oneliner = from.position === to.position && to.position === 0 ? [TOP_TO_TOP, BOTTOM_TO_BOTTOM] : [BOTTOM_TO_BOTTOM, TOP_TO_TOP];
- oneliner.forEach(function (c) { return candidates_1.push(c); });
- oneliner.forEach(function (c) {
- candidates_1.push({ from: c.from, to: DIRECT.to });
- candidates_1.push({ from: DIRECT.from, to: c.to });
- });
- }
- candidates_1.push(DIRECT);
- for (var i = 0, candidate = void 0; candidate = candidates_1[i]; i++) {
- var fromKey = from.key + "_" + candidate.from;
- var toKey = to.key + "_" + candidate.to;
- if (occupied[fromKey] !== Connector_1.ConnectorPosition.End && occupied[toKey] !== Connector_1.ConnectorPosition.Begin) {
- layout.addEdge(new NodeLayout_1.EdgeLayout(e.key, candidate.from, candidate.to));
- occupied[fromKey] = Connector_1.ConnectorPosition.Begin;
- occupied[toKey] = Connector_1.ConnectorPosition.End;
- break;
- }
- }
- }
- });
- };
- SugiyamaLayoutBuilder.prototype.getDirectEdgeLayout = function () {
- if (this.settings.orientation === LayoutSettings_1.OrientationKind.Horizontal)
- return this.settings.direction === LayoutSettings_1.LogicalDirectionKind.Forward ? { from: 1, to: 3 } : { from: 3, to: 1 };
- return this.settings.direction === LayoutSettings_1.LogicalDirectionKind.Forward ? { from: 2, to: 0 } : { from: 0, to: 2 };
- };
- SugiyamaLayoutBuilder.prototype.getDiffLevelEdgeLayout = function (topToBottom) {
- if (this.settings.orientation === LayoutSettings_1.OrientationKind.Horizontal)
- return topToBottom ? { from: 2, to: 0 } : { from: 0, to: 2 };
- return topToBottom ? { from: 3, to: 1 } : { from: 1, to: 3 };
- };
- SugiyamaLayoutBuilder.prototype.getSameLevelEdgeLayout = function (topToBottom) {
- if (this.settings.orientation === LayoutSettings_1.OrientationKind.Horizontal)
- return topToBottom ? { from: 0, to: 0 } : { from: 2, to: 2 };
- return topToBottom ? { from: 3, to: 3 } : { from: 1, to: 1 };
- };
- // private getDummyEdgesRoutes(infoGraph: FastGraph<NodeOnLayer, EdgeOnLayer>): {[nodeKey: string]: NodeOnLayer[]} {
- // let resultRoutes: {[nodeKey: string]: NodeOnLayer[]} = {};
- // let dummyEdgeRoutes: {[edgeHash: string]: NodeOnLayer[]} = {};
- // infoGraph.edges
- // .filter(e => !infoGraph.getNode(e.from).isDummy && infoGraph.getNode(e.to).isDummy)
- // .forEach(rootEdge => {
- // let edgeHash = rootEdge.getHashCode();
- // dummyEdgeRoutes[edgeHash] = [];
- // let iterator = infoGraph.createIterator(ConnectionMode.Outgoing);
- // iterator.visitEachEdgeOnce = false;
- // iterator.onNode = (n) => dummyEdgeRoutes[edgeHash].push(n);
- // iterator.skipNode = (n) => !n.isDummy;
- // iterator.skipEdge = (e) => false;
- // iterator.onEdge = (e, out) => {
- // if(!infoGraph.getNode(e.to).isDummy)
- // resultRoutes[new EdgeOnLayer(e.key, e.isDummy, rootEdge.from, e.to).getHashCode()] = dummyEdgeRoutes[edgeHash];
- // };
- // iterator.iterate(rootEdge.to);
- // });
- // return resultRoutes;
- // }
- SugiyamaLayoutBuilder.prototype.getAbsOffsetInfo = function (nodesInfos) {
- var _this = this;
- var absOffsetMatrix = {};
- var addCell = function (n, intAbsCoord) {
- if (absOffsetMatrix[intAbsCoord] === undefined)
- absOffsetMatrix[intAbsCoord] = _this.getBreadthNodeSize(n);
- absOffsetMatrix[intAbsCoord] = Math.max(absOffsetMatrix[intAbsCoord], _this.getBreadthNodeSize(n));
- };
- nodesInfos.forEach(function (n) {
- var intAbsCoord = Math.trunc(n.position);
- addCell(n, intAbsCoord);
- if (absOffsetMatrix[intAbsCoord] % 1 !== 0)
- addCell(n, intAbsCoord + 1);
- });
- var absOffsetInfo = {};
- var leftOffset = 0;
- Object.keys(absOffsetMatrix).sort().forEach(function (coord) {
- absOffsetInfo[coord] = { leftOffset: leftOffset, width: absOffsetMatrix[coord] };
- leftOffset += absOffsetMatrix[coord] + _this.settings.columnSpacing;
- });
- return absOffsetInfo;
- };
- SugiyamaLayoutBuilder.prototype.setBreadth = function (position, breadthPosition) {
- if (this.settings.orientation === LayoutSettings_1.OrientationKind.Vertical)
- return new Utils_1.Point(breadthPosition, position.y);
- return new Utils_1.Point(position.x, breadthPosition);
- };
- SugiyamaLayoutBuilder.prototype.setDepthOffset = function (position, offset) {
- if (this.settings.orientation === LayoutSettings_1.OrientationKind.Horizontal)
- return new Utils_1.Point(position.x + offset, position.y);
- return new Utils_1.Point(position.x, position.y + offset);
- };
- SugiyamaLayoutBuilder.prototype.getAbsPosition = function (absCoordinate, itemSize, absoluteOffsetInfo) {
- var intAbsCoord = Math.trunc(absCoordinate);
- var absLeftOffset = absoluteOffsetInfo[intAbsCoord].leftOffset;
- var cellWidth = absoluteOffsetInfo[intAbsCoord].width;
- if (absCoordinate % 1 === 0)
- return absLeftOffset + (cellWidth - itemSize) / 2;
- return absLeftOffset + cellWidth - (itemSize - this.settings.columnSpacing) / 2;
- };
- SugiyamaLayoutBuilder.prototype.getBreadthNodeSize = function (node) {
- return node.isDummy ? 0 : this.getBreadthNodeSizeCore(this.graph.getNode(node.key));
- };
- SugiyamaLayoutBuilder.prototype.getDepthNodeSize = function (node) {
- return node.isDummy ? 0 : this.getDepthNodeSizeCore(this.graph.getNode(node.key));
- };
- return SugiyamaLayoutBuilder;
- }(BaseBuilder_1.LayoutBuilder));
- exports.SugiyamaLayoutBuilder = SugiyamaLayoutBuilder;
- var SugiyamaLayerDistributor = /** @class */ (function () {
- function SugiyamaLayerDistributor() {
- }
- SugiyamaLayerDistributor.getLayers = function (acyclicGraph) {
- var feasibleTree = this.getFeasibleTree(acyclicGraph);
- return this.calcNodesLayers(feasibleTree);
- };
- SugiyamaLayerDistributor.getFeasibleTree = function (graph) {
- var layers = this.initLayerAssignment(graph);
- return graph.getSpanningGraph(graph.nodes[0], Structures_1.ConnectionMode.OutgoingAndIncoming, function (e) { return layers[e.to] - layers[e.from]; });
- };
- SugiyamaLayerDistributor.initLayerAssignment = function (graph) {
- var layers = {};
- var currentLayer = 0;
- var actualAssignedNodes = {};
- var assigningNodes = graph.nodes.filter(function (n) { return !graph.getAdjacentEdges(n, Structures_1.ConnectionMode.Incoming).length; });
- var _loop_2 = function () {
- assigningNodes.forEach(function (n) {
- layers[n] = currentLayer;
- actualAssignedNodes[n] = true;
- });
- Object.keys(actualAssignedNodes).forEach(function (n) {
- if (graph.getAdjacentEdges(n, Structures_1.ConnectionMode.Outgoing).filter(function (e) { return layers[e.to] === undefined; }).length === 0)
- delete actualAssignedNodes[n];
- });
- var assigningNodesSet = {};
- Object.keys(actualAssignedNodes).forEach(function (n) {
- graph.getAdjacentEdges(n, Structures_1.ConnectionMode.Outgoing)
- .map(function (e) { return e.to; })
- .filter(function (n) { return layers[n] === undefined && graph.getAdjacentEdges(n, Structures_1.ConnectionMode.Incoming).reduce(function (acc, e) { return acc && layers[e.from] !== undefined; }, true); })
- .forEach(function (n) { return assigningNodesSet[n] = true; });
- });
- assigningNodes = Object.keys(assigningNodesSet);
- currentLayer++;
- };
- while (assigningNodes.length) {
- _loop_2();
- }
- return layers;
- };
- SugiyamaLayerDistributor.calcNodesLayers = function (graph) {
- var layers = {};
- var minLayer = Number.MAX_SAFE_INTEGER;
- var currentLevel = 0;
- var iterator = graph.createIterator(Structures_1.ConnectionMode.OutgoingAndIncoming);
- iterator.visitEachEdgeOnce = false;
- iterator.onNode = function (n) {
- layers[n.key] = currentLevel;
- minLayer = Math.min(minLayer, currentLevel);
- };
- iterator.skipNode = function (n) { return layers[n.key] !== undefined; };
- iterator.skipEdge = function (e) { return layers[e.from] !== undefined && layers[e.to] !== undefined; };
- iterator.onEdge = function (e, out) {
- if (out)
- currentLevel = layers[e.from] + 1;
- else
- currentLevel = layers[e.to] - 1;
- };
- iterator.iterate(graph.nodes[0]);
- for (var key in layers) {
- if (!layers.hasOwnProperty(key))
- continue;
- layers[key] -= minLayer;
- }
- return layers;
- };
- return SugiyamaLayerDistributor;
- }());
- exports.SugiyamaLayerDistributor = SugiyamaLayerDistributor;
- var SugiyamaNodesOrderer = /** @class */ (function () {
- function SugiyamaNodesOrderer() {
- this.idCounter = -10000;
- }
- SugiyamaNodesOrderer.prototype.orderNodes = function (graph, layers) {
- var maxIteration = 14; //magic number - http://www.graphviz.org/Documentation/TSE93.pdf PAGE (14)
- var currentIteration = 1;
- var graphInfo = this.initGraphInfo(graph, layers);
- var nodeInfos = graphInfo.items;
- var orderInfo = this.initOrder(nodeInfos);
- var bestNodesPositions = this.getNodeToPositionMap(nodeInfos);
- var bestCrossCount = this.getCrossCount(orderInfo, graphInfo);
- var isParentToChildren = true;
- while (currentIteration < maxIteration && bestCrossCount != 0) {
- orderInfo = this.getNodesOrder(orderInfo, graphInfo, isParentToChildren);
- var crossCount = this.getCrossCount(orderInfo, graphInfo);
- if (crossCount < bestCrossCount) {
- bestNodesPositions = this.getNodeToPositionMap(graphInfo.items);
- bestCrossCount = crossCount;
- }
- isParentToChildren = !isParentToChildren;
- currentIteration++;
- }
- //transpose() procedure doesn`t implement.
- //http://www.graphviz.org/Documentation/TSE93.pdf PAGE(16)
- graphInfo.items.forEach(function (n) { return n.position = bestNodesPositions[n.key]; });
- return graphInfo;
- };
- SugiyamaNodesOrderer.prototype.getNodesOrder = function (current, graph, isParentToChildren) {
- var _this = this;
- var order = {};
- var _loop_3 = function (layer) {
- if (!current.hasOwnProperty(layer))
- return "continue";
- var nodePositions = {};
- current[layer].forEach(function (ni) {
- var adjacentNodesPositions = (isParentToChildren ? graph.getChildren(ni.key) : graph.getParents(ni.key))
- .map(function (nk) { return graph.getNode(nk).position; });
- nodePositions[ni.key] = _this.getNodePosition(adjacentNodesPositions);
- });
- order[layer] = this_2.sortNodes(nodePositions, graph);
- };
- var this_2 = this;
- for (var layer in current) {
- _loop_3(layer);
- }
- return order;
- };
- SugiyamaNodesOrderer.prototype.sortNodes = function (nodePositions, graph) {
- return Object.keys(nodePositions)
- .sort(function (a, b) { return nodePositions[a] - nodePositions[b]; })
- .map(function (nk, index) {
- var node = graph.getNode(nk);
- node.position = index;
- return node;
- });
- };
- SugiyamaNodesOrderer.prototype.getNodePosition = function (adjacentNodesPositions) {
- adjacentNodesPositions = adjacentNodesPositions.sort();
- if (!adjacentNodesPositions.length)
- return 0;
- var medianIndex = Math.floor(adjacentNodesPositions.length / 2);
- if (adjacentNodesPositions.length === 2 || adjacentNodesPositions.length % 2 === 1)
- return adjacentNodesPositions[medianIndex];
- var leftMedianPosition = adjacentNodesPositions[medianIndex - 1] - adjacentNodesPositions[0];
- var rightMedianPosition = adjacentNodesPositions[adjacentNodesPositions.length - 1] - adjacentNodesPositions[medianIndex];
- return Math.floor((adjacentNodesPositions[medianIndex - 1] * rightMedianPosition + adjacentNodesPositions[medianIndex] * leftMedianPosition) /
- (leftMedianPosition + rightMedianPosition));
- };
- SugiyamaNodesOrderer.prototype.initOrder = function (nodeInfos) {
- var result = {};
- nodeInfos.forEach(function (ni) { return (result[ni.layer] || (result[ni.layer] = [])).push(ni); });
- return result;
- };
- SugiyamaNodesOrderer.prototype.getCrossCount = function (orderInfo, graph) {
- var count = 0;
- var _loop_4 = function (layer) {
- if (!orderInfo.hasOwnProperty(layer))
- return "continue";
- var viewedAdjacentNodesPositions = [];
- orderInfo[layer].forEach(function (n) {
- var positions = graph.getChildren(n.key).map(function (c) { return graph.getNode(c).position; });
- positions.forEach(function (p) {
- count += viewedAdjacentNodesPositions.filter(function (vp) { return p < vp; }).length;
- });
- viewedAdjacentNodesPositions.push.apply(viewedAdjacentNodesPositions, positions);
- });
- };
- for (var layer in orderInfo) {
- _loop_4(layer);
- }
- return count;
- };
- SugiyamaNodesOrderer.prototype.initGraphInfo = function (graph, layers) {
- var _this = this;
- var countNodesOnLayer = {};
- var nodesInfoMap = {};
- var nodeInfos = [];
- var edgeInfos = [];
- graph.nodes.forEach(function (n) {
- var layer = layers[n];
- if (countNodesOnLayer[layer] === undefined)
- countNodesOnLayer[layer] = 0;
- var info = new NodeOnLayer(n, false, layer, countNodesOnLayer[layer]++);
- nodesInfoMap[n] = info;
- nodeInfos.push(info);
- });
- graph.edges.forEach(function (e) {
- var span = layers[e.to] - layers[e.from];
- if (span > 1) {
- var prevNodeInfo = nodesInfoMap[e.from];
- for (var delta = 1; delta < span; delta++) {
- var dNodeInfo = new NodeOnLayer(_this.createDummyID(), true, layers[e.from] + delta, countNodesOnLayer[layers[e.from] + delta]++);
- edgeInfos.push(new EdgeOnLayer(_this.createDummyID(), true, prevNodeInfo.key, dNodeInfo.key));
- nodeInfos.push(dNodeInfo);
- prevNodeInfo = dNodeInfo;
- }
- edgeInfos.push(new EdgeOnLayer(e.key, false, prevNodeInfo.key, nodesInfoMap[e.to].key, nodesInfoMap[e.from].key));
- }
- else
- edgeInfos.push(new EdgeOnLayer(e.key, false, nodesInfoMap[e.from].key, nodesInfoMap[e.to].key));
- });
- return new Graph_1.FastGraph(nodeInfos, edgeInfos);
- };
- SugiyamaNodesOrderer.prototype.createDummyID = function () {
- return "dummy_" + --this.idCounter;
- };
- SugiyamaNodesOrderer.prototype.getNodeToPositionMap = function (nodeInfos) {
- return nodeInfos.reduce(function (acc, ni) {
- acc[ni.key] = ni.position;
- return acc;
- }, {});
- };
- // absolute positioning
- SugiyamaNodesOrderer.prototype.assignAbsCoordinates = function (graph) {
- var absCoordinates = this.getAbsCoodinate(graph);
- return new Graph_1.FastGraph(graph.items.map(function (n) { return new NodeOnLayer(n.key, n.isDummy, n.layer, absCoordinates[n.key]); }), graph.edges.slice(0));
- };
- SugiyamaNodesOrderer.prototype.getAbsCoodinate = function (graph) {
- var _this = this;
- var orderInfo = graph.items.reduce(function (acc, n) {
- acc[n.layer] = acc[n.layer] || [];
- var pos = Utils_1.Utils.binaryIndexOf(acc[n.layer], function (ni) { return ni.position - n.position; });
- acc[n.layer].splice(pos < 0 ? ~pos : pos, 0, n);
- return acc;
- }, {});
- var medianPositions = [MedianAlignmentMode.TopLeft, MedianAlignmentMode.TopRight, MedianAlignmentMode.BottomLeft, MedianAlignmentMode.BottomRight]
- .map(function (alignment) { return _this.getPositionByMedian(graph, alignment, orderInfo); });
- var nodeToPosition = {};
- graph.items.forEach(function (n) {
- var posList = medianPositions.map(function (positions) { return positions[n.key]; }).sort();
- nodeToPosition[n.key] = (posList[1] + posList[2]) / 2;
- });
- return nodeToPosition;
- };
- SugiyamaNodesOrderer.prototype.getPositionByMedian = function (graph, alignment, orderInfo) {
- var nodeInfos = graph.items;
- var positions = this.getNodeToPositionMap(nodeInfos);
- var medians = this.getMedians(graph, nodeInfos, alignment);
- medians = this.resolveMedianConflicts(graph, orderInfo, medians, alignment);
- this.getSortedBlocks(graph, nodeInfos, medians, alignment)
- .forEach(function (block) {
- var maxPos = block.reduce(function (acc, n) { return positions[n.key] > acc ? positions[n.key] : acc; }, -2);
- block.forEach(function (n) {
- var delta = maxPos - positions[n.key];
- if (delta > 0) {
- orderInfo[n.layer]
- .filter(function (ln) { return ln.position > n.position; })
- .forEach(function (ln) { return positions[ln.key] += delta; });
- }
- positions[n.key] = maxPos;
- });
- });
- return positions;
- };
- SugiyamaNodesOrderer.prototype.getSortedBlocks = function (graph, nodeInfos, medians, alignment) {
- var blocks = [];
- var isBottom = alignment === MedianAlignmentMode.BottomLeft || alignment === MedianAlignmentMode.BottomRight;
- var allNodesInfo = new ListUtils_1.HashSet(nodeInfos.slice(0).sort(function (a, b) { return isBottom ? (a.layer - b.layer) : (b.layer - a.layer); }), function (n) { return n.key; });
- while (allNodesInfo.length) {
- var firstNode = allNodesInfo.item(0);
- var block = this.getBlock(graph, firstNode, medians, alignment);
- blocks.push(block);
- block.forEach(function (n) { return allNodesInfo.remove(n); });
- }
- blocks.sort(function (x, y) {
- var xMinNodeInfo = x.reduce(function (min, n) { return n.position < min.position ? n : min; }, x[0]);
- var yOnMinXLayer = y.filter(function (n) { return n.layer == xMinNodeInfo.layer; })[0];
- if (yOnMinXLayer)
- return xMinNodeInfo.position - yOnMinXLayer.position;
- var yMinNodeInfo = y.reduce(function (min, n) { return n.position < min.position ? n : min; }, y[0]);
- var xOnMinXLayer = x.filter(function (n) { return n.layer == yMinNodeInfo.layer; })[0];
- if (xOnMinXLayer)
- return xOnMinXLayer.position - yMinNodeInfo.position;
- return xMinNodeInfo.layer - yMinNodeInfo.layer;
- });
- return blocks;
- };
- SugiyamaNodesOrderer.prototype.getBlock = function (graph, root, medians, alignment) {
- var block = [];
- var median = null;
- do {
- if (median)
- root = alignment === MedianAlignmentMode.TopLeft || alignment === MedianAlignmentMode.TopRight ? graph.getNode(median.from) : graph.getNode(median.to);
- block.push(root);
- median = medians[root.key];
- } while (median);
- return block;
- };
- SugiyamaNodesOrderer.prototype.resolveMedianConflicts = function (graph, layers, medians, alignment) {
- var _this = this;
- var filteredMedians = {};
- var _loop_5 = function (layer) {
- var minPos = undefined, maxPos = undefined;
- if (!layers.hasOwnProperty(layer))
- return "continue";
- var nodeInfos = layers[layer];
- if (alignment === MedianAlignmentMode.TopRight || alignment === MedianAlignmentMode.BottomRight)
- nodeInfos = nodeInfos.slice(0).sort(function (a, b) { return b.position - a.position; }); // sorted descending
- nodeInfos.forEach(function (n) {
- var median = medians[n.key];
- if (!median)
- filteredMedians[n.key] = null;
- else {
- var medianItemKey = alignment === MedianAlignmentMode.TopLeft || alignment === MedianAlignmentMode.TopRight ? median.from : median.to;
- var medianPosition = graph.getNode(medianItemKey).position;
- if (_this.checkMedianConfict(minPos, maxPos, medianPosition, alignment))
- filteredMedians[n.key] = null;
- else {
- minPos = minPos === undefined ? medianPosition : Math.min(minPos, medianPosition);
- maxPos = maxPos === undefined ? medianPosition : Math.max(maxPos, medianPosition);
- filteredMedians[n.key] = median;
- }
- }
- });
- };
- for (var layer in layers) {
- _loop_5(layer);
- }
- return filteredMedians;
- };
- SugiyamaNodesOrderer.prototype.checkMedianConfict = function (min, max, medianPosition, alignment) {
- if (min === undefined || max === undefined)
- return false;
- if (alignment === MedianAlignmentMode.TopLeft || alignment === MedianAlignmentMode.BottomLeft)
- return max >= medianPosition;
- return min <= medianPosition;
- };
- SugiyamaNodesOrderer.prototype.getMedians = function (graph, nodeInfos, alignment) {
- var _this = this;
- var medians = {};
- nodeInfos.forEach(function (n) {
- var actualAdjacentEdges = _this.getActualAdjacentEdges(graph, n, alignment);
- var medianPosition = _this.getMedianPosition(actualAdjacentEdges.length, alignment);
- medians[n.key] = actualAdjacentEdges[medianPosition];
- });
- return medians;
- };
- SugiyamaNodesOrderer.prototype.getMedianPosition = function (length, alignment) {
- if (length === 0)
- return -1;
- if (length % 2 !== 0)
- return Math.floor(length / 2);
- if (alignment === MedianAlignmentMode.TopLeft || alignment === MedianAlignmentMode.BottomLeft)
- return Math.floor(length / 2) - 1;
- if (alignment === MedianAlignmentMode.TopRight || alignment === MedianAlignmentMode.BottomRight)
- return Math.floor(length / 2);
- throw new Error("Invalid Operation");
- };
- SugiyamaNodesOrderer.prototype.getActualAdjacentEdges = function (graph, node, alignment) {
- if (alignment === MedianAlignmentMode.TopLeft || alignment === MedianAlignmentMode.TopRight)
- return graph.getAdjacentEdges(node.key, Structures_1.ConnectionMode.Incoming).sort(function (a, b) { return graph.getNode(a.from).position - graph.getNode(b.from).position; });
- return graph.getAdjacentEdges(node.key, Structures_1.ConnectionMode.Outgoing).sort(function (a, b) { return graph.getNode(a.to).position - graph.getNode(b.to).position; });
- };
- return SugiyamaNodesOrderer;
- }());
- exports.SugiyamaNodesOrderer = SugiyamaNodesOrderer;
- var NodeOnLayer = /** @class */ (function () {
- function NodeOnLayer(key, isDummy, layer, position) {
- this.key = key;
- this.isDummy = isDummy;
- this.layer = layer;
- this.position = position;
- }
- NodeOnLayer.prototype.getHashCode = function () {
- return this.key.toString();
- };
- return NodeOnLayer;
- }());
- exports.NodeOnLayer = NodeOnLayer;
- var EdgeOnLayer = /** @class */ (function () {
- function EdgeOnLayer(key, isDummy, from, to, originFrom) {
- this.key = key;
- this.isDummy = isDummy;
- this.from = from;
- this.to = to;
- this._originFrom = originFrom;
- }
- EdgeOnLayer.prototype.getHashCode = function () {
- return this.from + "-" + this.to;
- };
- Object.defineProperty(EdgeOnLayer.prototype, "originFrom", {
- get: function () {
- return this._originFrom !== undefined ? this._originFrom : this.from;
- },
- enumerable: true,
- configurable: true
- });
- return EdgeOnLayer;
- }());
- exports.EdgeOnLayer = EdgeOnLayer;
- var MedianAlignmentMode;
- (function (MedianAlignmentMode) {
- MedianAlignmentMode[MedianAlignmentMode["TopLeft"] = 0] = "TopLeft";
- MedianAlignmentMode[MedianAlignmentMode["TopRight"] = 1] = "TopRight";
- MedianAlignmentMode[MedianAlignmentMode["BottomLeft"] = 2] = "BottomLeft";
- MedianAlignmentMode[MedianAlignmentMode["BottomRight"] = 3] = "BottomRight";
- })(MedianAlignmentMode || (MedianAlignmentMode = {}));
- /***/ }),
- /* 41 */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- var __extends = (this && this.__extends) || (function () {
- var extendStatics = function (d, b) {
- extendStatics = Object.setPrototypeOf ||
- ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
- function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
- return extendStatics(d, b);
- };
- return function (d, b) {
- extendStatics(d, b);
- function __() { this.constructor = d; }
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
- };
- })();
- Object.defineProperty(exports, "__esModule", { value: true });
- var StylePropertyCommandBase_1 = __webpack_require__(85);
- var ChangeStyleTextHistoryItem_1 = __webpack_require__(42);
- var Style_1 = __webpack_require__(47);
- var ToggleStyleTextPropertyCommand = /** @class */ (function (_super) {
- __extends(ToggleStyleTextPropertyCommand, _super);
- function ToggleStyleTextPropertyCommand() {
- return _super !== null && _super.apply(this, arguments) || this;
- }
- ToggleStyleTextPropertyCommand.prototype.getStateValue = function () {
- var value = this.control.selection.inputPosition.getStyleTextPropertyValue(this.getStyleProperty());
- return value === this.getStylePropertyValue();
- };
- ToggleStyleTextPropertyCommand.prototype.executeCore = function (state) {
- var _this = this;
- this.control.history.beginTransaction();
- var styleProperty = this.getStyleProperty();
- var styleValue = state.value ? Style_1.StyleText.defaultInstace[styleProperty] : this.getStylePropertyValue();
- var items = this.control.selection.getSelectedItems();
- items.forEach(function (item) {
- _this.control.history.addAndRedo(new ChangeStyleTextHistoryItem_1.ChangeStyleTextHistoryItem(item.key, styleProperty, styleValue));
- });
- this.control.selection.inputPosition.setStyleTextPropertyValue(this.getStyleProperty(), styleValue);
- this.control.history.endTransaction();
- return true;
- };
- ToggleStyleTextPropertyCommand.prototype.getStyleObj = function (item) {
- return item.styleText;
- };
- return ToggleStyleTextPropertyCommand;
- }(StylePropertyCommandBase_1.StylePropertyCommandBase));
- exports.ToggleStyleTextPropertyCommand = ToggleStyleTextPropertyCommand;
- /***/ }),
- /* 42 */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- var __extends = (this && this.__extends) || (function () {
- var extendStatics = function (d, b) {
- extendStatics = Object.setPrototypeOf ||
- ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
- function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
- return extendStatics(d, b);
- };
- return function (d, b) {
- extendStatics(d, b);
- function __() { this.constructor = d; }
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
- };
- })();
- Object.defineProperty(exports, "__esModule", { value: true });
- var ChangeStyleHistoryItemBase_1 = __webpack_require__(86);
- var ChangeStyleTextHistoryItem = /** @class */ (function (_super) {
- __extends(ChangeStyleTextHistoryItem, _super);
- function ChangeStyleTextHistoryItem(itemKey, styleProperty, styleValue) {
- return _super.call(this, itemKey, styleProperty, styleValue) || this;
- }
- ChangeStyleTextHistoryItem.prototype.redo = function (manipulator) {
- var item = manipulator.model.findItem(this.itemKey);
- this.oldStyleValue = item.styleText[this.styleProperty];
- manipulator.changeStyleText(item, this.styleProperty, this.styleValue);
- };
- ChangeStyleTextHistoryItem.prototype.undo = function (manipulator) {
- var item = manipulator.model.findItem(this.itemKey);
- manipulator.changeStyleText(item, this.styleProperty, this.oldStyleValue);
- };
- return ChangeStyleTextHistoryItem;
- }(ChangeStyleHistoryItemBase_1.ChangeStyleHistoryItemBase));
- exports.ChangeStyleTextHistoryItem = ChangeStyleTextHistoryItem;
- /***/ }),
- /* 43 */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- var __extends = (this && this.__extends) || (function () {
- var extendStatics = function (d, b) {
- extendStatics = Object.setPrototypeOf ||
- ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
- function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
- return extendStatics(d, b);
- };
- return function (d, b) {
- extendStatics(d, b);
- function __() { this.constructor = d; }
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
- };
- })();
- Object.defineProperty(exports, "__esModule", { value: true });
- var CommandBase_1 = __webpack_require__(7);
- var CommandStates_1 = __webpack_require__(6);
- var Graph_1 = __webpack_require__(34);
- var Shape_1 = __webpack_require__(9);
- var Connector_1 = __webpack_require__(5);
- var Structures_1 = __webpack_require__(22);
- var ModelUtils_1 = __webpack_require__(8);
- var LayoutUtils_1 = __webpack_require__(59);
- var LayoutSettings_1 = __webpack_require__(18);
- var AutoLayoutCommandBase = /** @class */ (function (_super) {
- __extends(AutoLayoutCommandBase, _super);
- function AutoLayoutCommandBase() {
- return _super !== null && _super.apply(this, arguments) || this;
- }
- AutoLayoutCommandBase.prototype.getState = function () {
- return new CommandStates_1.SimpleCommandState(!this.control.selection.isEmpty());
- };
- AutoLayoutCommandBase.prototype.executeCore = function (state, parameter) {
- var _this = this;
- this.control.history.beginTransaction();
- var graph = this.getGraphBySelection();
- var layout = this.createLayout(graph);
- var nonGraphItems = ModelUtils_1.ModelUtils.getSymmetricDifference(layout.nodeToLayout, this.control.model.items);
- layout = ModelUtils_1.ModelUtils.offsetLayoutToFreeSpace(layout, nonGraphItems.map(function (i) { return i.rectangle; }));
- if (this.control.model.snapToGrid)
- ModelUtils_1.ModelUtils.adjustLayoutToSnapGrid(this.control.model, layout);
- ModelUtils_1.ModelUtils.applyLayoutToNodes(this.control.history, this.control.model, layout, graph.edges.map(function (e) { return _this.control.model.findConnector(e.key); }));
- ModelUtils_1.ModelUtils.applyLayoutToConnectors(this.control.history, layout, graph.edges.map(function (e) { return _this.control.model.findConnector(e.key); }));
- ModelUtils_1.ModelUtils.tryUpdateModelSize(this.control.history, this.control.model);
- this.control.history.endTransaction();
- return true;
- };
- AutoLayoutCommandBase.prototype.getGraphBySelection = function () {
- var _this = this;
- var selectedItems = this.control.selection.getSelectedItems();
- var graph = new Graph_1.Graph([], []);
- var knownIds = {};
- selectedItems.forEach(function (c) { return _this.extendByConnectedComponents(c, graph, knownIds); });
- graph.nodes = graph.nodes.sort(function (a, b) { return _this.control.model.findShape(a).key.localeCompare(_this.control.model.findShape(b).key); });
- return graph;
- };
- AutoLayoutCommandBase.prototype.extendByConnectedComponents = function (item, graph, knownIds) {
- var _this = this;
- if (!item || knownIds[item.key])
- return;
- knownIds[item.key] = true;
- if (item instanceof Connector_1.Connector && item.beginItem && item.endItem && item.beginItem !== item.endItem) {
- graph.addEdge(new Structures_1.Edge(item.key, item.beginItem && item.beginItem.key, item.endItem && item.endItem.key));
- this.extendByConnectedComponents(item.beginItem, graph, knownIds);
- this.extendByConnectedComponents(item.endItem, graph, knownIds);
- }
- else if (item instanceof Shape_1.Shape) {
- graph.addNode(LayoutUtils_1.LayoutUtils.shapeToLayout(item));
- item.attachedConnectors.forEach(function (c) { return _this.extendByConnectedComponents(c, graph, knownIds); });
- }
- };
- AutoLayoutCommandBase.prototype.createLayoutSettings = function () {
- return (this.control.model.snapToGrid) ? new LayoutSettings_1.TreeLayoutSettings(this.control.model.gridSize) : new LayoutSettings_1.TreeLayoutSettings();
- };
- return AutoLayoutCommandBase;
- }(CommandBase_1.CommandBase));
- exports.AutoLayoutCommandBase = AutoLayoutCommandBase;
- /***/ }),
- /* 44 */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- Object.defineProperty(exports, "__esModule", { value: true });
- var ModelChange_1 = __webpack_require__(48);
- var Shape_1 = __webpack_require__(9);
- var Event_1 = __webpack_require__(14);
- var Connector_1 = __webpack_require__(5);
- var Utils_1 = __webpack_require__(0);
- var UnitConverter_1 = __webpack_require__(13);
- var Model_1 = __webpack_require__(21);
- var ConnectorProperties_1 = __webpack_require__(28);
- var DiagramItem_1 = __webpack_require__(3);
- var TextPrimitive_1 = __webpack_require__(50);
- var RectaglePrimitive_1 = __webpack_require__(53);
- var EllipsePrimitive_1 = __webpack_require__(38);
- var ClipPathPrimitive_1 = __webpack_require__(52);
- var PatternPrimitive_1 = __webpack_require__(182);
- var PathPrimitive_1 = __webpack_require__(2);
- var GroupPrimitive_1 = __webpack_require__(183);
- var MaskPrimitive_1 = __webpack_require__(184);
- var TextFilterPrimitive_1 = __webpack_require__(72);
- var RenderManager_1 = __webpack_require__(10);
- var Browser_1 = __webpack_require__(20);
- var LinePrimitive_1 = __webpack_require__(69);
- var ExtensionLinesVisualizer_1 = __webpack_require__(92);
- var Utils_2 = __webpack_require__(26);
- var Base_1 = __webpack_require__(19);
- var CanvasManager = /** @class */ (function () {
- function CanvasManager(svgElement) {
- this.itemSelectorGroupContainers = {};
- this.itemSelectorElements = {};
- this.itemGroupContainers = {};
- this.itemElements = {};
- this.itemSelectionRectElements = {};
- this.connectorSelectionElements = {};
- this.connectorSelectionTextElements = {};
- this.connectorSelectionMaskTextElements = {};
- this.selectionMarkElements = [];
- this.lockedSelectionMarkElements = {};
- this.parameterPointMarkElements = {};
- this.connectionPointElements = [];
- this.connectionTargetElements = [];
- this.connectionMarkElements = [];
- this.extensionLineElements = [];
- this.gridPatternId = Utils_2.RenderUtils.generateSvgElementId("gridPattern");
- this.pagesGridPatternId = Utils_2.RenderUtils.generateSvgElementId("pagesGridPattern");
- this.pagesGridClipId = Utils_2.RenderUtils.generateSvgElementId("pagesGridClip");
- this.initializeContainerElements(svgElement);
- }
- CanvasManager.prototype.initializeContainerElements = function (svgElement) {
- this.svgElement = svgElement;
- this.backgroundContainer = this.createAndChangePrimitiveElement(new GroupPrimitive_1.GroupPrimitive([], null), this.svgElement);
- this.itemSelectorsContainer = this.createAndChangePrimitiveElement(new GroupPrimitive_1.GroupPrimitive([], null), this.svgElement);
- this.itemsContainer = this.createAndChangePrimitiveElement(new GroupPrimitive_1.GroupPrimitive([], null), this.svgElement);
- this.itemSelectionContainer = this.createAndChangePrimitiveElement(new GroupPrimitive_1.GroupPrimitive([], null), this.svgElement);
- this.visualizersContainer = this.createAndChangePrimitiveElement(new GroupPrimitive_1.GroupPrimitive([], null), this.svgElement);
- this.selectionMarksContainer = this.createAndChangePrimitiveElement(new GroupPrimitive_1.GroupPrimitive([], null), this.svgElement);
- };
- CanvasManager.prototype.clear = function () {
- Utils_2.RenderUtils.removeContent(this.itemSelectorsContainer);
- Utils_2.RenderUtils.removeContent(this.itemsContainer);
- Utils_2.RenderUtils.removeContent(this.itemSelectionContainer);
- Utils_2.RenderUtils.removeContent(this.selectionMarksContainer);
- Utils_2.RenderUtils.removeContent(this.visualizersContainer);
- this.itemSelectorGroupContainers = {};
- this.itemSelectorElements = {};
- this.itemGroupContainers = {};
- this.itemElements = {};
- this.itemSelectionRectElements = {};
- this.connectorSelectionElements = {};
- this.connectorSelectionTextElements = {};
- this.connectorSelectionMaskTextElements = {};
- this.selectionMarkElements = [];
- this.lockedSelectionMarkElements = {};
- this.parameterPointMarkElements = {};
- this.selectionRectElement = undefined;
- this.resizeInfoElement = undefined;
- this.connectionPointElements = [];
- this.connectionTargetElements = [];
- this.connectionMarkElements = [];
- this.extensionLineElements = [];
- };
- // Notifications
- CanvasManager.prototype.NotifyModelChanged = function (changes) {
- for (var i = 0, change = void 0; change = changes[i]; i++) {
- if (change instanceof ModelChange_1.ShapeChange)
- this.applyShapeChange(change);
- else if (change instanceof ModelChange_1.ConnectorChange)
- this.applyConnectorChange(change);
- else if (change instanceof ModelChange_1.PageChange)
- this.applyPageChange(change);
- }
- };
- CanvasManager.prototype.NotifyRedrawSelection = function (selection) {
- var _this = this;
- this.hideSelection();
- var items = selection.getSelectedItems(true);
- var shapes = selection.getSelectedShapes(true);
- var connectors = selection.getSelectedConnectors(true);
- if (items.length <= 1) {
- shapes.forEach(function (shape) {
- if (shape.locked)
- _this.showLockedSelectionMarks(shape);
- else {
- var shapeRect = _this.correctShapeSelectionRect(shape.rectangle.multiply(_this.zoomLevel), CanvasManager.selectionRectLineWidth);
- _this.showShapeSelectionRect(shape, shapeRect, Event_1.MouseEventElementType.SelectionRect, "item-selection-rect");
- _this.showShapeSelectionMarks(shape);
- _this.showShapeParameterPoints(shape);
- }
- });
- connectors.forEach(function (connector) {
- if (connector.locked)
- _this.showLockedSelectionMarks(connector);
- else {
- _this.showConnectorSelection(connector, "connector-selection");
- _this.showConnectorSelectionMarks(connector);
- }
- });
- }
- else {
- var rect = this.correctShapeSelectionRect(Model_1.DiagramModel.getRectangle(items.filter(function (item) { return !item.locked; })).multiply(this.zoomLevel), CanvasManager.selectionRectLineWidth);
- this.showShapeSelectionRect(null, rect, Event_1.MouseEventElementType.SelectionRect, "items-selection-rect");
- shapes.forEach(function (shape) {
- if (shape.locked)
- _this.showLockedSelectionMarks(shape);
- else {
- var shapeRect = _this.correctShapeSelectionRect(shape.rectangle.multiply(_this.zoomLevel), CanvasManager.multiSelectionRectLineWidth);
- _this.showShapeSelectionRect(shape, shapeRect, Event_1.MouseEventElementType.SelectionRect, "item-multi-selection-rect");
- _this.showShapeParameterPoints(shape);
- }
- });
- connectors.forEach(function (connector) {
- if (connector.locked)
- _this.showLockedSelectionMarks(connector);
- else
- _this.showConnectorSelection(connector, "connector-multi-selection");
- });
- if (shapes.length > 0)
- this.showSelectionMarks(rect, "-1");
- }
- };
- CanvasManager.prototype.NotifySelectionRectShow = function (rect) {
- this.showSelectionRect(rect.multiply(this.zoomLevel));
- };
- CanvasManager.prototype.NotifySelectionRectHide = function () {
- this.hideSelectionRect();
- };
- CanvasManager.prototype.NotifyResizeInfoShow = function (point, text) {
- this.showResizeInfo(point.multiply(this.zoomLevel), text);
- };
- CanvasManager.prototype.NotifyResizeInfoHide = function () {
- this.hideResizeInfo();
- };
- CanvasManager.prototype.NotifyConnectionPointsShow = function (key, points, activePointIndex) {
- var _this = this;
- points.forEach(function (p, index) {
- _this.showConnectionPoint(index, p.point.multiply(_this.zoomLevel), p.side, key, index, index === activePointIndex);
- });
- };
- CanvasManager.prototype.NotifyConnectionPointsHide = function () {
- this.hideConnectionPoints();
- };
- CanvasManager.prototype.NotifyConnectionMarksShow = function (key, points, activePointIndex) {
- var _this = this;
- points.forEach(function (p, index) {
- var point = p.point.multiply(_this.zoomLevel);
- switch (p.side) {
- case DiagramItem_1.ConnectionPointSide.North:
- point.y -= CanvasManager.connectionMarkShift;
- break;
- case DiagramItem_1.ConnectionPointSide.South:
- point.y += CanvasManager.connectionMarkShift;
- break;
- case DiagramItem_1.ConnectionPointSide.East:
- point.x += CanvasManager.connectionMarkShift;
- break;
- case DiagramItem_1.ConnectionPointSide.West:
- point.x -= CanvasManager.connectionMarkShift;
- break;
- }
- _this.showConnectionMark(index, point, p.side, key, index, index === activePointIndex);
- });
- };
- CanvasManager.prototype.NotifyConnectionMarksHide = function () {
- this.hideConnectionMarks();
- };
- CanvasManager.prototype.NotifyConnectionTargetShow = function (key, targetRect) {
- var rect = this.correctShapeSelectionRect(targetRect.multiply(this.zoomLevel), CanvasManager.connectionTargetBorderWidth);
- this.showConnectionTarget(0, rect);
- };
- CanvasManager.prototype.NotifyConnectionTargetHide = function () {
- this.hideConnectionTarget();
- };
- CanvasManager.prototype.NotifyExtensionLinesShow = function (lines) {
- var _this = this;
- this.hideExtensionLines();
- lines.forEach(function (line, index) {
- _this.showExtensionLine(index, line.type, line.segment.startPoint.multiply(_this.zoomLevel), line.segment.endPoint.multiply(_this.zoomLevel), line.text);
- });
- };
- CanvasManager.prototype.NotifyExtensionLinesHide = function () {
- this.hideExtensionLines();
- };
- CanvasManager.prototype.NotifyDragStart = function (itemKeys) {
- var _this = this;
- itemKeys.forEach(function (itemKey) {
- if (_this.itemSelectorElements[itemKey])
- _this.itemSelectorElements[itemKey].style.pointerEvents = "none";
- if (_this.itemElements[itemKey])
- _this.itemElements[itemKey].style.pointerEvents = "none";
- });
- this.selectionMarksContainer.style.display = "none";
- };
- CanvasManager.prototype.NotifyDragEnd = function (itemKeys) {
- var _this = this;
- itemKeys.forEach(function (itemKey) {
- if (_this.itemSelectorElements[itemKey])
- _this.itemSelectorElements[itemKey].style.pointerEvents = "";
- if (_this.itemElements[itemKey])
- _this.itemElements[itemKey].style.pointerEvents = "";
- });
- this.selectionMarksContainer.style.display = "";
- };
- CanvasManager.prototype.NotifyTextInputStart = function (item, text, position, size) {
- var element = this.itemElements[item.key];
- var className = element.getAttribute("class");
- element.setAttribute("class", className + " text-input");
- this.visualizersContainer.style.display = "none";
- };
- CanvasManager.prototype.NotifyTextInputEnd = function (item) {
- var element = this.itemElements[item.key];
- var className = element.getAttribute("class");
- element.setAttribute("class", className.replace(" text-input", ""));
- this.visualizersContainer.style.display = "";
- };
- // Drawing
- CanvasManager.prototype.applyShapeChange = function (change) {
- var shape = change.shape;
- var key = shape.key;
- var itemParent = this.getItemGroupContainer(shape.zIndex);
- var itemSelectorParent = this.getItemSelectorGroupContainer(shape.zIndex);
- switch (change.type) {
- case ModelChange_1.ItemChangeType.Create:
- this.itemElements[key] = this.createItemElements(key, shape.getPrimitives(), itemParent, "shape", Event_1.MouseEventElementType.Shape);
- this.itemSelectorElements[key] = this.createItemElements(key, shape.getSelectorPrimitives(), itemSelectorParent, "shape", Event_1.MouseEventElementType.Shape);
- break;
- case ModelChange_1.ItemChangeType.Remove:
- this.removeItemElements(itemParent, this.itemElements[key]);
- delete this.itemElements[key];
- this.removeItemElements(itemSelectorParent, this.itemSelectorElements[key]);
- delete this.itemSelectorElements[key];
- break;
- case ModelChange_1.ItemChangeType.UpdateStructure:
- this.changeItemElements(shape.getPrimitives(), this.itemElements[key], true);
- this.changeItemElements(shape.getSelectorPrimitives(), this.itemSelectorElements[key], true);
- break;
- case ModelChange_1.ItemChangeType.Update:
- this.changeItemElements(shape.getPrimitives(), this.itemElements[key]);
- this.changeItemElements(shape.getSelectorPrimitives(), this.itemSelectorElements[key]);
- break;
- case ModelChange_1.ItemChangeType.UpdateZIndex:
- this.moveItemElements(itemParent, this.itemElements[key]);
- this.moveItemElements(itemSelectorParent, this.itemSelectorElements[key]);
- break;
- }
- };
- CanvasManager.prototype.applyConnectorChange = function (change) {
- var connector = change.connector;
- var key = connector.key;
- var itemParent = this.getItemGroupContainer(connector.zIndex);
- var itemSelectorParent = this.getItemSelectorGroupContainer(connector.zIndex);
- switch (change.type) {
- case ModelChange_1.ItemChangeType.Create:
- this.itemElements[key] = this.createItemElements(key, connector.getPrimitives(), itemParent, "connector", Event_1.MouseEventElementType.Connector);
- this.itemSelectorElements[key] = this.createItemElements(key, connector.getSelectorPrimitives(), itemSelectorParent, "connector", Event_1.MouseEventElementType.Connector);
- break;
- case ModelChange_1.ItemChangeType.Remove:
- this.removeItemElements(itemParent, this.itemElements[key]);
- delete this.itemElements[key];
- this.removeItemElements(itemSelectorParent, this.itemSelectorElements[key]);
- delete this.itemSelectorElements[key];
- this.invalidateConnectorSelectionTextElements(key);
- break;
- case ModelChange_1.ItemChangeType.UpdateStructure:
- this.changeItemElements(connector.getPrimitives(), this.itemElements[key], true);
- this.changeItemElements(connector.getSelectorPrimitives(), this.itemSelectorElements[key], true);
- this.invalidateConnectorSelectionTextElements(key);
- break;
- case ModelChange_1.ItemChangeType.Update:
- this.changeItemElements(connector.getPrimitives(), this.itemElements[key]);
- this.changeItemElements(connector.getSelectorPrimitives(), this.itemSelectorElements[key]);
- break;
- case ModelChange_1.ItemChangeType.UpdateZIndex:
- this.moveItemElements(itemParent, this.itemElements[key]);
- this.moveItemElements(itemSelectorParent, this.itemSelectorElements[key]);
- break;
- }
- };
- CanvasManager.prototype.createItemElements = function (key, primitives, parent, className, type) {
- var gEl = this.createAndChangePrimitiveElement(new GroupPrimitive_1.GroupPrimitive([], className), parent);
- Utils_2.RenderUtils.setElementEventData(gEl, type, key);
- this.createAndChangePrimitivesElements(primitives, gEl);
- return gEl;
- };
- CanvasManager.prototype.changeItemElements = function (primitives, element, updateStructure) {
- if (updateStructure === void 0) { updateStructure = false; }
- if (updateStructure) {
- Utils_2.RenderUtils.removeContent(element);
- this.createAndChangePrimitivesElements(primitives, element);
- }
- else
- this.changePrimitivesElements(primitives, element);
- };
- CanvasManager.prototype.removeItemElements = function (parent, element) {
- if (element)
- parent.removeChild(element);
- };
- CanvasManager.prototype.moveItemElements = function (parent, element, sibling) {
- if (element) {
- if (sibling !== undefined)
- parent.insertBefore(element, sibling);
- else
- parent.appendChild(element);
- }
- };
- CanvasManager.prototype.getItemGroupContainer = function (zIndex) {
- if (this.itemGroupContainers[zIndex] === undefined) {
- this.itemGroupContainers[zIndex] = this.createAndChangePrimitiveElement(new GroupPrimitive_1.GroupPrimitive([], null), this.itemsContainer, this.itemGroupContainers[zIndex + 1]);
- }
- return this.itemGroupContainers[zIndex];
- };
- CanvasManager.prototype.getItemSelectorGroupContainer = function (zIndex) {
- if (this.itemSelectorGroupContainers[zIndex] === undefined) {
- this.itemSelectorGroupContainers[zIndex] = this.createAndChangePrimitiveElement(new GroupPrimitive_1.GroupPrimitive([], null), this.itemSelectorsContainer, this.itemSelectorGroupContainers[zIndex + 1]);
- }
- return this.itemSelectorGroupContainers[zIndex];
- };
- CanvasManager.prototype.applyPageChange = function (change) {
- this.zoomLevel = change.model.zoomLevel;
- this.itemsContainer.style.transform = "scale(" + this.zoomLevel + ")";
- this.itemSelectorsContainer.style.transform = "scale(" + this.zoomLevel + ")";
- this.svgWidth = UnitConverter_1.UnitConverter.twipsToPixels(change.model.size.width) * this.zoomLevel;
- this.svgHeight = UnitConverter_1.UnitConverter.twipsToPixels(change.model.size.height) * this.zoomLevel;
- this.updateGridElements(change.model.showGrid, UnitConverter_1.UnitConverter.twipsToPixels(change.model.gridSize) * this.zoomLevel);
- this.updatePagesGridElements(UnitConverter_1.UnitConverter.twipsToPixels(change.model.pageWidth) * this.zoomLevel, UnitConverter_1.UnitConverter.twipsToPixels(change.model.pageHeight) * this.zoomLevel);
- this.svgElement.style.backgroundColor = change.model.pageColor;
- var filterElements = Base_1.GetNodesByClassName(this.svgElement, "text-filter-flood");
- for (var i = 0; i < filterElements.length; i++) {
- filterElements[i].style.setProperty("flood-color", change.model.pageColor);
- }
- };
- CanvasManager.prototype.getGridRectElement = function (primitive) {
- if (this.gridRectElement === undefined)
- this.gridRectElement = this.createPrimitiveElement(primitive, this.backgroundContainer);
- return this.gridRectElement;
- };
- CanvasManager.prototype.getGridPatternElement = function (primitive) {
- if (this.gridPatternElement === undefined)
- this.gridPatternElement = this.createPrimitiveElement(primitive, this.backgroundContainer);
- return this.gridPatternElement;
- };
- CanvasManager.prototype.updateGridElements = function (visible, size) {
- var _this = this;
- var gridRectPrimitive = new RectaglePrimitive_1.RectanglePrimitive("0", "0", "100%", "100%", null, null, null, function (element) {
- element.style.setProperty("fill", "url('#" + _this.gridPatternId + "')");
- });
- var rectEl = this.getGridRectElement(gridRectPrimitive);
- if (!visible)
- rectEl.style.display = "none";
- else {
- rectEl.style.display = "";
- this.changePrimitiveElement(gridRectPrimitive, rectEl);
- var sizes = [0, 1, 2, 3, 4].map(function (i) { return Math.round(size * i); });
- var outerPathCommands = [
- new PathPrimitive_1.PathPrimitiveMoveToCommand(sizes[4].toString(), "0"),
- new PathPrimitive_1.PathPrimitiveLineToCommand(sizes[4].toString(), sizes[4].toString()),
- new PathPrimitive_1.PathPrimitiveLineToCommand("0", sizes[4].toString())
- ];
- var innerPathCommands = [];
- for (var i = 1; i <= 3; i++) {
- innerPathCommands.push(new PathPrimitive_1.PathPrimitiveMoveToCommand(sizes[i].toString(), "0"));
- innerPathCommands.push(new PathPrimitive_1.PathPrimitiveLineToCommand(sizes[i].toString(), sizes[4].toString()));
- }
- for (var i = 1; i <= 3; i++) {
- innerPathCommands.push(new PathPrimitive_1.PathPrimitiveMoveToCommand("0", sizes[i].toString()));
- innerPathCommands.push(new PathPrimitive_1.PathPrimitiveLineToCommand(sizes[4].toString(), sizes[i].toString()));
- }
- var gridPatternPrimitive = new PatternPrimitive_1.PatternPrimitive(this.gridPatternId, [
- new PathPrimitive_1.PathPrimitive(outerPathCommands, null, "grid-outer-line"),
- new PathPrimitive_1.PathPrimitive(innerPathCommands, null, "grid-inner-line")
- ], 0, 0, (size * 4 / this.svgWidth).toString(), (size * 4 / this.svgHeight).toString());
- this.changePrimitiveElement(gridPatternPrimitive, this.getGridPatternElement(gridPatternPrimitive));
- }
- };
- CanvasManager.prototype.getPagesGridRectElement = function (primitive) {
- if (this.pagesGridRectElement === undefined)
- this.pagesGridRectElement = this.createPrimitiveElement(primitive, this.backgroundContainer);
- return this.pagesGridRectElement;
- };
- CanvasManager.prototype.getPagesGridClipPathElement = function (primitive) {
- if (this.pagesGridClipPathElement === undefined)
- this.pagesGridClipPathElement = this.createPrimitiveElement(primitive, this.backgroundContainer);
- return this.pagesGridClipPathElement;
- };
- CanvasManager.prototype.getPagesGridPatternElement = function (primitive) {
- if (this.pagesGridPatternElement === undefined)
- this.pagesGridPatternElement = this.createPrimitiveElement(primitive, this.backgroundContainer);
- return this.pagesGridPatternElement;
- };
- CanvasManager.prototype.updatePagesGridElements = function (width, height) {
- var _this = this;
- var pagesGridRectPrimitive = new RectaglePrimitive_1.RectanglePrimitive("0", "0", "100%", "100%", null, null, this.pagesGridClipId, function (element) {
- element.style.setProperty("fill", "url('#" + _this.pagesGridPatternId + "')");
- });
- this.changePrimitiveElement(pagesGridRectPrimitive, this.getPagesGridRectElement(pagesGridRectPrimitive));
- var horPages = Math.round(this.svgWidth / width);
- var verPages = Math.round(this.svgHeight / height);
- var pageGridPathCommands = [
- new PathPrimitive_1.PathPrimitiveMoveToCommand((width - CanvasManager.pagesGridLineWidth / 2).toString(), "0"),
- new PathPrimitive_1.PathPrimitiveLineToCommand((width - CanvasManager.pagesGridLineWidth / 2).toString(), (height - CanvasManager.pagesGridLineWidth / 2).toString()),
- new PathPrimitive_1.PathPrimitiveLineToCommand("0", (height - CanvasManager.pagesGridLineWidth / 2).toString())
- ];
- var pagesGridPatternPrimitive = new PatternPrimitive_1.PatternPrimitive(this.pagesGridPatternId, [
- new PathPrimitive_1.PathPrimitive(pageGridPathCommands, null, "pages-grid-line")
- ], 0, 0, ((horPages > 1) ? 1 / horPages : 1).toString(), ((verPages > 1) ? 1 / verPages : 1).toString());
- this.changePrimitiveElement(pagesGridPatternPrimitive, this.getPagesGridPatternElement(pagesGridPatternPrimitive));
- var pagesGridClipPathPrimitive = new ClipPathPrimitive_1.ClipPathPrimitive(this.pagesGridClipId, [
- new RectaglePrimitive_1.RectanglePrimitive(0, 0, (this.svgWidth - CanvasManager.pagesGridLineWidth * 2).toString(), (this.svgHeight - CanvasManager.pagesGridLineWidth * 2).toString())
- ]);
- this.changePrimitiveElement(pagesGridClipPathPrimitive, this.getPagesGridClipPathElement(pagesGridClipPathPrimitive));
- };
- // Selection
- CanvasManager.prototype.hideSelection = function () {
- this.hideItemSelectionRects();
- this.hideConnectorSelection();
- this.hideSelectionMarkElements();
- this.hideLockedSelectionMarkElements();
- this.hideParameterPointMarkElements();
- };
- CanvasManager.prototype.showShapeSelectionMarks = function (shape) {
- var rect = new Utils_1.Rectangle(shape.position, shape.size).multiply(this.zoomLevel);
- this.showSelectionMarks(rect, shape.key);
- };
- CanvasManager.prototype.showConnectorSelectionMarks = function (connector) {
- var _this = this;
- connector.points.forEach(function (pt, index) {
- var isEdgePoint = (index === 0 || index === connector.points.length - 1);
- var className = isEdgePoint ? "selection-mark" : "connector-point-mark";
- var markSize = isEdgePoint ? CanvasManager.selectionMarkSize : CanvasManager.connectorPointMarkSize;
- if (isEdgePoint || connector.properties.lineOption === ConnectorProperties_1.ConnectorLineOption.Straight) {
- _this.showSelectionMark(index, pt.multiply(_this.zoomLevel), markSize, Event_1.MouseEventElementType.ConnectorPoint, connector.key, index, className);
- }
- else {
- _this.showSelectionMark(index, pt.multiply(_this.zoomLevel), markSize, Event_1.MouseEventElementType.Undefined, "-1", -1, className + " disabled");
- }
- });
- this.showConnectorSideMarks(connector);
- };
- CanvasManager.prototype.showConnectorSideMarks = function (connector) {
- var _this = this;
- var points = connector.getRenderPoints(true);
- var type = (connector.properties.lineOption === ConnectorProperties_1.ConnectorLineOption.Straight) ?
- Event_1.MouseEventElementType.ConnectorSide : Event_1.MouseEventElementType.ConnectorOrthogonalSide;
- var prevPt, prevPtIndex;
- points.forEach(function (pt, index) {
- if (pt.skipped)
- return;
- if (prevPt !== undefined) {
- if (_this.canShowConnectorSideMark(connector, pt, prevPt)) {
- var classNameSuffix = connector.properties.lineOption === ConnectorProperties_1.ConnectorLineOption.Orthogonal ?
- (pt.x - prevPt.x === 0 ? "vertical" : "horizontal") : "";
- _this.showSelectionMark(connector.points.length + index - 1, new Utils_1.Point(prevPt.x + (pt.x - prevPt.x) / 2, prevPt.y + (pt.y - prevPt.y) / 2).multiply(_this.zoomLevel), CanvasManager.connectorSideMarkSize, type, connector.key, prevPtIndex + "_" + index, "connector-side-mark " + classNameSuffix);
- }
- }
- prevPt = pt;
- prevPtIndex = index;
- });
- };
- CanvasManager.prototype.canShowConnectorSideMark = function (connector, point1, point2) {
- if (connector.properties.lineOption === ConnectorProperties_1.ConnectorLineOption.Straight) {
- var minSize = CanvasManager.selectionMarkSize + CanvasManager.connectorSideMarkSize;
- return Utils_1.GeometryUtils.getDistance(point1, point2) > minSize;
- }
- if (connector.properties.lineOption === ConnectorProperties_1.ConnectorLineOption.Orthogonal) {
- return ((point1.x - point2.x === 0 || Math.abs(point1.x - point2.x) > Connector_1.Connector.minOffset) &&
- (point1.y - point2.y === 0 || Math.abs(point1.y - point2.y) > Connector_1.Connector.minOffset));
- }
- return false;
- };
- CanvasManager.prototype.showSelectionMarks = function (rect, key) {
- this.showSelectionMark(0, new Utils_1.Point(rect.left, rect.top), CanvasManager.selectionMarkSize, Event_1.MouseEventElementType.ShapeResizeBox, key, Event_1.ResizeEventSource.ResizeBox_NW, "selection-mark");
- this.showSelectionMark(1, new Utils_1.Point(rect.left + rect.size.width / 2, rect.top), CanvasManager.selectionMarkSize, Event_1.MouseEventElementType.ShapeResizeBox, key, Event_1.ResizeEventSource.ResizeBox_N, "selection-mark");
- this.showSelectionMark(2, new Utils_1.Point(rect.right, rect.top), CanvasManager.selectionMarkSize, Event_1.MouseEventElementType.ShapeResizeBox, key, Event_1.ResizeEventSource.ResizeBox_NE, "selection-mark");
- this.showSelectionMark(3, new Utils_1.Point(rect.right, rect.top + rect.size.height / 2), CanvasManager.selectionMarkSize, Event_1.MouseEventElementType.ShapeResizeBox, key, Event_1.ResizeEventSource.ResizeBox_E, "selection-mark");
- this.showSelectionMark(4, new Utils_1.Point(rect.right, rect.bottom), CanvasManager.selectionMarkSize, Event_1.MouseEventElementType.ShapeResizeBox, key, Event_1.ResizeEventSource.ResizeBox_SE, "selection-mark");
- this.showSelectionMark(5, new Utils_1.Point(rect.left + rect.size.width / 2, rect.bottom), CanvasManager.selectionMarkSize, Event_1.MouseEventElementType.ShapeResizeBox, key, Event_1.ResizeEventSource.ResizeBox_S, "selection-mark");
- this.showSelectionMark(6, new Utils_1.Point(rect.left, rect.bottom), CanvasManager.selectionMarkSize, Event_1.MouseEventElementType.ShapeResizeBox, key, Event_1.ResizeEventSource.ResizeBox_SW, "selection-mark");
- this.showSelectionMark(7, new Utils_1.Point(rect.left, rect.top + rect.size.height / 2), CanvasManager.selectionMarkSize, Event_1.MouseEventElementType.ShapeResizeBox, key, Event_1.ResizeEventSource.ResizeBox_W, "selection-mark");
- };
- CanvasManager.prototype.showSelectionMark = function (index, point, size, type, key, value, className) {
- var primitive = new RectaglePrimitive_1.RectanglePrimitive(point.x - size / 2, point.y - size / 2, size, size, null, className);
- var rectEl = this.getSelectionMarkElement(primitive, index);
- this.changePrimitiveElement(primitive, rectEl);
- Utils_2.RenderUtils.setElementEventData(rectEl, type, key, value);
- };
- CanvasManager.prototype.hideSelectionMarkElements = function () {
- for (var i = 0; i < this.selectionMarkElements.length; i++) {
- if (this.selectionMarkElements[i])
- this.selectionMarkElements[i].style.display = "none";
- }
- };
- CanvasManager.prototype.getSelectionMarkElement = function (primitive, index) {
- var rectEl = this.selectionMarkElements[index];
- if (rectEl !== undefined)
- rectEl.style.display = "";
- else {
- rectEl = this.createPrimitiveElement(primitive, this.selectionMarksContainer);
- this.selectionMarkElements[index] = rectEl;
- }
- return rectEl;
- };
- CanvasManager.prototype.showLockedSelectionMarks = function (item) {
- var rect = item.rectangle.multiply(this.zoomLevel);
- this.showLockedSelectionMark(item.key, 0, new Utils_1.Point(rect.left, rect.top), CanvasManager.lockedSelectionMarkSize, "locked-selection-mark");
- this.showLockedSelectionMark(item.key, 1, new Utils_1.Point(rect.right, rect.top), CanvasManager.lockedSelectionMarkSize, "locked-selection-mark");
- this.showLockedSelectionMark(item.key, 2, new Utils_1.Point(rect.right, rect.bottom), CanvasManager.lockedSelectionMarkSize, "locked-selection-mark");
- this.showLockedSelectionMark(item.key, 3, new Utils_1.Point(rect.left, rect.bottom), CanvasManager.lockedSelectionMarkSize, "locked-selection-mark");
- };
- CanvasManager.prototype.showLockedSelectionMark = function (key, index, point, size, className) {
- var primitive = new PathPrimitive_1.PathPrimitive([
- new PathPrimitive_1.PathPrimitiveMoveToCommand(point.x - size / 2, point.y - size / 2),
- new PathPrimitive_1.PathPrimitiveLineToCommand(point.x + size / 2, point.y + size / 2),
- new PathPrimitive_1.PathPrimitiveMoveToCommand(point.x + size / 2, point.y - size / 2),
- new PathPrimitive_1.PathPrimitiveLineToCommand(point.x - size / 2, point.y + size / 2)
- ], null, className);
- var pathEl = this.getLockedSelectionMarkElement(primitive, key, index);
- this.changePrimitiveElement(primitive, pathEl);
- };
- CanvasManager.prototype.hideLockedSelectionMarkElements = function () {
- for (var key in this.lockedSelectionMarkElements) {
- if (this.lockedSelectionMarkElements.hasOwnProperty(key)) {
- for (var i = 0; i < this.lockedSelectionMarkElements[key].length; i++)
- this.lockedSelectionMarkElements[key][i].style.display = "none";
- }
- }
- };
- CanvasManager.prototype.getLockedSelectionMarkElement = function (primitive, key, index) {
- var pathEl = this.lockedSelectionMarkElements[key] !== undefined ? this.lockedSelectionMarkElements[key][index] : undefined;
- if (pathEl !== undefined)
- pathEl.style.display = "";
- else {
- if (this.lockedSelectionMarkElements[key] === undefined)
- this.lockedSelectionMarkElements[key] = [];
- pathEl = this.createPrimitiveElement(primitive, this.selectionMarksContainer);
- this.lockedSelectionMarkElements[key][index] = pathEl;
- }
- return pathEl;
- };
- CanvasManager.prototype.showShapeParameterPoints = function (shape) {
- var _this = this;
- shape.description.getParameterPoints(shape).forEach(function (pp, index) {
- var size = CanvasManager.geomertyMarkSize;
- var point = pp.point.multiply(_this.zoomLevel);
- var primitive = new RectaglePrimitive_1.RectanglePrimitive(point.x - size / 2, point.y - size / 2, size, size, null, "geometry-mark");
- var rectEl = _this.getParameterPointMarkElement(primitive, shape.key, index);
- _this.changePrimitiveElement(primitive, rectEl);
- Utils_2.RenderUtils.setElementEventData(rectEl, Event_1.MouseEventElementType.ShapeParameterBox, shape.key, pp.key);
- });
- };
- CanvasManager.prototype.hideParameterPointMarkElements = function () {
- for (var key in this.parameterPointMarkElements) {
- if (this.parameterPointMarkElements.hasOwnProperty(key)) {
- for (var i = 0; i < this.parameterPointMarkElements[key].length; i++)
- this.parameterPointMarkElements[key][i].style.display = "none";
- }
- }
- };
- CanvasManager.prototype.getParameterPointMarkElement = function (primitive, key, index) {
- var rectEl = this.parameterPointMarkElements[key] !== undefined ? this.parameterPointMarkElements[key][index] : undefined;
- if (rectEl !== undefined)
- rectEl.style.display = "";
- else {
- if (this.parameterPointMarkElements[key] === undefined)
- this.parameterPointMarkElements[key] = [];
- rectEl = this.createPrimitiveElement(primitive, this.selectionMarksContainer);
- this.parameterPointMarkElements[key][index] = rectEl;
- }
- return rectEl;
- };
- CanvasManager.prototype.showShapeSelectionRect = function (shape, rect, type, className) {
- var primitive = new RectaglePrimitive_1.RectanglePrimitive(rect.left, rect.top, rect.width, rect.height, null, className);
- var rectEl = this.getItemSelectionRectElement(primitive, shape ? shape.key : "-1");
- this.changePrimitiveElement(primitive, rectEl);
- Utils_2.RenderUtils.setElementEventData(rectEl, type, "-1", -1);
- };
- CanvasManager.prototype.hideItemSelectionRects = function () {
- for (var key in this.itemSelectionRectElements)
- if (this.itemSelectionRectElements.hasOwnProperty(key))
- this.itemSelectionRectElements[key].style.display = "none";
- };
- CanvasManager.prototype.getItemSelectionRectElement = function (primitive, key) {
- var rectEl = this.itemSelectionRectElements[key];
- if (rectEl !== undefined)
- rectEl.style.display = "";
- else {
- rectEl = this.createPrimitiveElement(primitive, this.itemSelectionContainer);
- this.itemSelectionRectElements[key] = rectEl;
- }
- return rectEl;
- };
- CanvasManager.prototype.showSelectionRect = function (rect) {
- var primitive = new RectaglePrimitive_1.RectanglePrimitive(rect.left, rect.top, rect.size.width, rect.size.height, null, "selection-rect");
- var rectEl = this.getSelectionRectElement(primitive);
- this.changePrimitiveElement(primitive, rectEl);
- };
- CanvasManager.prototype.hideSelectionRect = function () {
- if (this.selectionRectElement !== undefined)
- this.selectionRectElement.style.display = "none";
- };
- CanvasManager.prototype.getSelectionRectElement = function (primitive) {
- if (this.selectionRectElement !== undefined)
- this.selectionRectElement.style.display = "";
- else
- this.selectionRectElement = this.createPrimitiveElement(primitive, this.visualizersContainer);
- return this.selectionRectElement;
- };
- CanvasManager.prototype.showResizeInfo = function (point, text) {
- var rectPrimitive = new RectaglePrimitive_1.RectanglePrimitive(point.x, point.y, 0, 0);
- var primitive = new GroupPrimitive_1.GroupPrimitive([
- rectPrimitive,
- new TextPrimitive_1.TextPrimitive(point.x, point.y, text)
- ], "resize-info");
- var groupEl = this.getResizeInfoElement(primitive);
- this.changePrimitiveElement(primitive, groupEl);
- var textRect = Utils_2.RenderUtils.getSvgTextRectangle(groupEl.childNodes[1], CanvasManager.resizeInfoLineWidth)
- .inflate(CanvasManager.resizeInfoTextOffset, CanvasManager.resizeInfoTextOffset);
- rectPrimitive.x = textRect.left;
- rectPrimitive.y = textRect.top;
- rectPrimitive.width = textRect.width;
- rectPrimitive.height = textRect.height;
- this.changePrimitiveElement(primitive, groupEl);
- };
- CanvasManager.prototype.hideResizeInfo = function () {
- if (this.resizeInfoElement !== undefined)
- this.resizeInfoElement.style.display = "none";
- };
- CanvasManager.prototype.getResizeInfoElement = function (primitive) {
- if (this.resizeInfoElement !== undefined)
- this.resizeInfoElement.style.display = "";
- else
- this.resizeInfoElement = this.createPrimitiveElement(primitive, this.visualizersContainer);
- return this.resizeInfoElement;
- };
- CanvasManager.prototype.showConnectorSelection = function (connector, className) {
- var _this = this;
- var points = connector.getRenderPoints();
- var pathCommands = [];
- var prevPt, firstPt, lastPt;
- var difX = 0, difY = 0;
- points.forEach(function (pt) {
- pt = pt.multiply(_this.zoomLevel);
- if (prevPt === undefined) {
- firstPt = pt;
- pathCommands.push(new PathPrimitive_1.PathPrimitiveMoveToCommand(pt.x, pt.y));
- }
- else {
- pathCommands.push(new PathPrimitive_1.PathPrimitiveLineToCommand(pt.x, pt.y));
- difX = Math.max(difX, Math.abs(prevPt.x - pt.x));
- difY = Math.max(difY, Math.abs(prevPt.y - pt.y));
- }
- prevPt = pt;
- });
- lastPt = prevPt;
- if (difX < CanvasManager.connectorSelectionLineWidth || difY < CanvasManager.connectorSelectionLineWidth) {
- // Increase mask size
- var offsetX = difX < CanvasManager.connectorSelectionLineWidth ? CanvasManager.connectorSelectionLineWidth : 0;
- var offsetY = (difY < CanvasManager.connectorSelectionLineWidth ? CanvasManager.connectorSelectionLineWidth : 0);
- pathCommands.push(new PathPrimitive_1.PathPrimitiveLineToCommand(lastPt.x - offsetX, lastPt.y - offsetY));
- }
- var maskId = Utils_2.RenderUtils.generateSvgElementId("maskSel");
- var cliPathId = Utils_2.RenderUtils.generateSvgElementId("clipSel");
- var primitive = new GroupPrimitive_1.GroupPrimitive([
- new PathPrimitive_1.PathPrimitive(pathCommands, null, className, cliPathId, function (el) {
- el.setAttribute("mask", "url(#" + maskId + ")");
- }),
- new MaskPrimitive_1.MaskPrimitive(maskId, [
- new RectaglePrimitive_1.RectanglePrimitive("0", "0", "100%", "100%", null, "background"),
- new PathPrimitive_1.PathPrimitive(pathCommands),
- new RectaglePrimitive_1.RectanglePrimitive(firstPt.x - CanvasManager.connectorSelectionWidth / 2, firstPt.y - CanvasManager.connectorSelectionWidth / 2, CanvasManager.connectorSelectionWidth, CanvasManager.connectorSelectionWidth),
- new RectaglePrimitive_1.RectanglePrimitive(lastPt.x - CanvasManager.connectorSelectionWidth / 2, lastPt.y - CanvasManager.connectorSelectionWidth / 2, CanvasManager.connectorSelectionWidth, CanvasManager.connectorSelectionWidth),
- new GroupPrimitive_1.GroupPrimitive([])
- ], "connector-selection-mask", "-1000%", "-1000%", "2100%", "2100%")
- ]);
- var gEl = this.getConnectorSelectionElement(primitive, connector.key);
- this.changePrimitiveElement(primitive, gEl);
- this.showConnectorTextsSelection(connector, gEl, gEl.querySelector("g"), className, maskId);
- };
- CanvasManager.prototype.showConnectorTextsSelection = function (connector, parent, maskParent, className, maskId) {
- var _this = this;
- var textRects = [];
- if (maskParent && connector.allowHasText) {
- var index_1 = 0;
- connector.texts.forEach(function (textObj) {
- var text = connector.getText(textObj.position);
- if (text && text !== "") {
- var position = connector.getTextPoint(textObj.position);
- var filterId = Utils_2.RenderUtils.generateSvgElementId("filterSel");
- var textPrimitive = new GroupPrimitive_1.GroupPrimitive([
- new TextPrimitive_1.TextPrimitive(position.x, position.y, text, undefined, connector.styleText, true, null, filterId),
- new TextFilterPrimitive_1.TextFilterPrimitive(filterId, false)
- ]);
- var gTextEl = _this.getConnectorSelectionMaskTextElement(textPrimitive, maskParent, connector.key, index_1);
- _this.changePrimitiveElement(textPrimitive, gTextEl);
- var textEl = gTextEl.querySelector("text");
- var textRect = Utils_2.RenderUtils.getSvgTextRectangle(textEl, CanvasManager.connectorSelectionLineWidth);
- if (textRect)
- textRects.push(textRect.multiply(_this.zoomLevel));
- }
- index_1++;
- });
- }
- for (var i = 0; i < textRects.length; i++) {
- var textRectPrimitive = new RectaglePrimitive_1.RectanglePrimitive(textRects[i].left, textRects[i].top, textRects[i].width, textRects[i].height, null, className + " text", null);
- var rectEl = this.getConnectorSelectionTextElement(textRectPrimitive, parent, connector.key, i);
- this.changePrimitiveElement(textRectPrimitive, rectEl);
- }
- };
- CanvasManager.prototype.hideConnectorSelection = function () {
- for (var key in this.connectorSelectionElements) {
- if (this.connectorSelectionElements.hasOwnProperty(key))
- this.connectorSelectionElements[key].style.display = "none";
- }
- for (var key in this.connectorSelectionMaskTextElements) {
- if (this.connectorSelectionMaskTextElements.hasOwnProperty(key)) {
- for (var i = 0; i < this.connectorSelectionMaskTextElements[key].length; i++)
- this.connectorSelectionMaskTextElements[key][i].style.display = "none";
- }
- }
- for (var key in this.connectorSelectionTextElements) {
- if (this.connectorSelectionTextElements.hasOwnProperty(key)) {
- for (var i = 0; i < this.connectorSelectionTextElements[key].length; i++)
- this.connectorSelectionTextElements[key][i].style.display = "none";
- }
- }
- };
- CanvasManager.prototype.getConnectorSelectionElement = function (primitive, key) {
- var gEl = this.connectorSelectionElements[key];
- if (gEl !== undefined)
- gEl.style.display = "";
- else {
- gEl = this.createPrimitiveElement(primitive, this.itemSelectionContainer);
- this.connectorSelectionElements[key] = gEl;
- }
- return gEl;
- };
- CanvasManager.prototype.getConnectorSelectionTextElement = function (primitive, parent, key, index) {
- var textGroupEl = this.connectorSelectionTextElements[key] !== undefined ? this.connectorSelectionTextElements[key][index] : undefined;
- if (textGroupEl !== undefined)
- textGroupEl.style.display = "";
- else {
- if (this.connectorSelectionTextElements[key] === undefined)
- this.connectorSelectionTextElements[key] = [];
- textGroupEl = this.createPrimitiveElement(primitive, parent);
- this.connectorSelectionTextElements[key][index] = textGroupEl;
- }
- return textGroupEl;
- };
- CanvasManager.prototype.getConnectorSelectionMaskTextElement = function (primitive, parent, key, index) {
- var textGroupEl = this.connectorSelectionMaskTextElements[key] !== undefined ? this.connectorSelectionMaskTextElements[key][index] : undefined;
- if (textGroupEl !== undefined)
- textGroupEl.style.display = "";
- else {
- if (this.connectorSelectionMaskTextElements[key] === undefined)
- this.connectorSelectionMaskTextElements[key] = [];
- textGroupEl = this.createPrimitiveElement(primitive, parent);
- this.connectorSelectionMaskTextElements[key][index] = textGroupEl;
- }
- return textGroupEl;
- };
- CanvasManager.prototype.invalidateConnectorSelectionTextElements = function (key) {
- var gEl = this.connectorSelectionElements[key];
- if (gEl) {
- var textContainerEl = gEl.querySelector("g");
- Utils_2.RenderUtils.removeContent(textContainerEl);
- if (this.connectorSelectionMaskTextElements[key])
- delete this.connectorSelectionMaskTextElements[key];
- }
- };
- CanvasManager.prototype.showConnectionPoint = function (index, point, side, key, value, active) {
- var className = "connection-point";
- this.showConnectionPointCore(index * 2, point.x, point.y, CanvasManager.connectionPointLargeSize, CanvasManager.connectionPointLargeSize, Event_1.MouseEventElementType.ShapeConnectionPoint, key, value, className + " selector");
- this.showConnectionPointCore(index * 2 + 1, point.x, point.y, CanvasManager.connectionPointSmallSize, CanvasManager.connectionPointSmallSize, Event_1.MouseEventElementType.ShapeConnectionPoint, key, value, className + (active ? " active" : ""));
- };
- CanvasManager.prototype.showConnectionPointCore = function (index, cx, cy, rx, ry, type, key, value, className) {
- var primitive = new EllipsePrimitive_1.EllipsePrimitive(cx, cy, rx, ry, null, className);
- var ellEl = this.getConnectionPointElement(primitive, index);
- this.changePrimitiveElement(primitive, ellEl);
- Utils_2.RenderUtils.setElementEventData(ellEl, type, key, value);
- };
- CanvasManager.prototype.hideConnectionPoints = function () {
- for (var i = 0; i < this.connectionPointElements.length; i++)
- this.connectionPointElements[i].style.display = "none";
- };
- CanvasManager.prototype.getConnectionPointElement = function (primitive, index) {
- var ellEl = this.connectionPointElements[index];
- if (ellEl !== undefined)
- ellEl.style.display = "";
- else {
- ellEl = this.createPrimitiveElement(primitive, this.visualizersContainer);
- this.connectionPointElements[index] = ellEl;
- }
- return ellEl;
- };
- CanvasManager.prototype.showConnectionTarget = function (index, targetRect) {
- var primitive = new RectaglePrimitive_1.RectanglePrimitive(targetRect.left, targetRect.top, targetRect.width, targetRect.height, null, "connection-target");
- var rectEl = this.getConnectionTargetElement(primitive, index);
- this.changePrimitiveElement(primitive, rectEl);
- };
- CanvasManager.prototype.hideConnectionTarget = function () {
- for (var i = 0; i < this.connectionTargetElements.length; i++)
- this.connectionTargetElements[i].style.display = "none";
- };
- CanvasManager.prototype.getConnectionTargetElement = function (primitive, index) {
- var ellEl = this.connectionTargetElements[index];
- if (ellEl !== undefined)
- ellEl.style.display = "";
- else {
- ellEl = this.createPrimitiveElement(primitive, this.itemSelectionContainer);
- this.connectionTargetElements[index] = ellEl;
- }
- return ellEl;
- };
- CanvasManager.prototype.showConnectionMark = function (index, point, side, key, value, active) {
- var className = "connection-mark";
- this.showConnectionMarkSelector(index * 2, point.x - CanvasManager.connectionMarkLargeSize / 2, point.y - CanvasManager.connectionMarkLargeSize / 2, CanvasManager.connectionMarkLargeSize, CanvasManager.connectionMarkLargeSize, Event_1.MouseEventElementType.ShapeConnection, key, value, className + " selector");
- this.showConnectionMarkArrow(index * 2 + 1, point.x - CanvasManager.connectionMarkSmallSize / 2, point.y - CanvasManager.connectionMarkSmallSize / 2, CanvasManager.connectionMarkSmallSize, CanvasManager.connectionMarkSmallSize, side, Event_1.MouseEventElementType.ShapeConnection, key, value, className + (active ? " active" : ""));
- };
- CanvasManager.prototype.showConnectionMarkArrow = function (index, x, y, width, height, side, type, key, value, className) {
- var pathCommands = [];
- switch (side) {
- case DiagramItem_1.ConnectionPointSide.East:
- pathCommands = [
- new PathPrimitive_1.PathPrimitiveMoveToCommand(x, y + height / 3),
- new PathPrimitive_1.PathPrimitiveLineToCommand(x + width / 2, y + height / 3),
- new PathPrimitive_1.PathPrimitiveLineToCommand(x + width / 2, y),
- new PathPrimitive_1.PathPrimitiveLineToCommand(x + width, y + height / 2),
- new PathPrimitive_1.PathPrimitiveLineToCommand(x + width / 2, y + height),
- new PathPrimitive_1.PathPrimitiveLineToCommand(x + width / 2, y + height * 2 / 3),
- new PathPrimitive_1.PathPrimitiveLineToCommand(x, y + height * 2 / 3),
- new PathPrimitive_1.PathPrimitiveClosePathCommand()
- ];
- break;
- case DiagramItem_1.ConnectionPointSide.West:
- pathCommands = [
- new PathPrimitive_1.PathPrimitiveMoveToCommand(x + width, y + height / 3),
- new PathPrimitive_1.PathPrimitiveLineToCommand(x + width / 2, y + height / 3),
- new PathPrimitive_1.PathPrimitiveLineToCommand(x + width / 2, y),
- new PathPrimitive_1.PathPrimitiveLineToCommand(x, y + height / 2),
- new PathPrimitive_1.PathPrimitiveLineToCommand(x + width / 2, y + height),
- new PathPrimitive_1.PathPrimitiveLineToCommand(x + width / 2, y + height * 2 / 3),
- new PathPrimitive_1.PathPrimitiveLineToCommand(x + width, y + height * 2 / 3),
- new PathPrimitive_1.PathPrimitiveClosePathCommand()
- ];
- break;
- case DiagramItem_1.ConnectionPointSide.South:
- pathCommands = [
- new PathPrimitive_1.PathPrimitiveMoveToCommand(x + width * 2 / 3, y),
- new PathPrimitive_1.PathPrimitiveLineToCommand(x + width * 2 / 3, y + height / 2),
- new PathPrimitive_1.PathPrimitiveLineToCommand(x + width, y + height / 2),
- new PathPrimitive_1.PathPrimitiveLineToCommand(x + width / 2, y + height),
- new PathPrimitive_1.PathPrimitiveLineToCommand(x, y + height / 2),
- new PathPrimitive_1.PathPrimitiveLineToCommand(x + width / 3, y + height / 2),
- new PathPrimitive_1.PathPrimitiveLineToCommand(x + width / 3, y),
- new PathPrimitive_1.PathPrimitiveClosePathCommand()
- ];
- break;
- case DiagramItem_1.ConnectionPointSide.North:
- pathCommands = [
- new PathPrimitive_1.PathPrimitiveMoveToCommand(x + width / 3, y + height),
- new PathPrimitive_1.PathPrimitiveLineToCommand(x + width / 3, y + height / 2),
- new PathPrimitive_1.PathPrimitiveLineToCommand(x, y + height / 2),
- new PathPrimitive_1.PathPrimitiveLineToCommand(x + width / 2, y),
- new PathPrimitive_1.PathPrimitiveLineToCommand(x + width, y + height / 2),
- new PathPrimitive_1.PathPrimitiveLineToCommand(x + width * 2 / 3, y + height / 2),
- new PathPrimitive_1.PathPrimitiveLineToCommand(x + width * 2 / 3, y + height),
- new PathPrimitive_1.PathPrimitiveClosePathCommand()
- ];
- break;
- }
- var primitive = new PathPrimitive_1.PathPrimitive(pathCommands, null, className);
- var ellEl = this.getConnectionMarkElement(primitive, index);
- this.changePrimitiveElement(primitive, ellEl);
- Utils_2.RenderUtils.setElementEventData(ellEl, Event_1.MouseEventElementType.ShapeConnection, key, value);
- };
- CanvasManager.prototype.showConnectionMarkSelector = function (index, x, y, width, height, type, key, value, className) {
- var primitive = new RectaglePrimitive_1.RectanglePrimitive(x, y, width, height, null, className);
- var ellEl = this.getConnectionMarkElement(primitive, index);
- this.changePrimitiveElement(primitive, ellEl);
- Utils_2.RenderUtils.setElementEventData(ellEl, Event_1.MouseEventElementType.ShapeConnection, key, value);
- };
- CanvasManager.prototype.hideConnectionMarks = function () {
- for (var i = 0; i < this.connectionMarkElements.length; i++)
- this.connectionMarkElements[i].style.display = "none";
- };
- CanvasManager.prototype.getConnectionMarkElement = function (primitive, index) {
- var ellEl = this.connectionMarkElements[index];
- if (ellEl !== undefined)
- ellEl.style.display = "";
- else {
- ellEl = this.createPrimitiveElement(primitive, this.visualizersContainer);
- this.connectionMarkElements[index] = ellEl;
- }
- return ellEl;
- };
- CanvasManager.prototype.showExtensionLine = function (index, type, startPoint, endPoint, text) {
- var className = "extension-line";
- if (type === ExtensionLinesVisualizer_1.ExtensionLineType.VerticalCenterAfter || type === ExtensionLinesVisualizer_1.ExtensionLineType.VerticalCenterBefore ||
- type === ExtensionLinesVisualizer_1.ExtensionLineType.HorizontalCenterAbove || type === ExtensionLinesVisualizer_1.ExtensionLineType.HorizontalCenterBelow)
- className += " center";
- if (type === ExtensionLinesVisualizer_1.ExtensionLineType.VerticalCenterToPageCenter || type === ExtensionLinesVisualizer_1.ExtensionLineType.HorizontalCenterToPageCenter ||
- type === ExtensionLinesVisualizer_1.ExtensionLineType.LeftToPageCenter || type === ExtensionLinesVisualizer_1.ExtensionLineType.RightToPageCenter ||
- type === ExtensionLinesVisualizer_1.ExtensionLineType.TopToPageCenter || type === ExtensionLinesVisualizer_1.ExtensionLineType.BottomToPageCenter)
- className += " page";
- var filterId = "filterEL" + index;
- var x1_1 = 0, y1_1 = 0, x1_2 = 0, y1_2 = 0, x2_1 = 0, y2_1 = 0, x2_2 = 0, y2_2 = 0;
- if (startPoint.y === endPoint.y) {
- x1_1 = startPoint.x;
- y1_1 = startPoint.y - CanvasManager.extensionLineEndingSize;
- x1_2 = startPoint.x;
- y1_2 = startPoint.y + CanvasManager.extensionLineEndingSize;
- x2_1 = endPoint.x;
- y2_1 = startPoint.y - CanvasManager.extensionLineEndingSize;
- x2_2 = endPoint.x;
- y2_2 = startPoint.y + CanvasManager.extensionLineEndingSize;
- }
- else if (startPoint.x === endPoint.x) {
- x1_1 = startPoint.x - CanvasManager.extensionLineEndingSize;
- y1_1 = startPoint.y;
- x1_2 = startPoint.x + CanvasManager.extensionLineEndingSize;
- y1_2 = startPoint.y;
- x2_1 = startPoint.x - CanvasManager.extensionLineEndingSize;
- y2_1 = endPoint.y;
- x2_2 = startPoint.x + CanvasManager.extensionLineEndingSize;
- y2_2 = endPoint.y;
- }
- var linePrimitives = [
- new LinePrimitive_1.LinePrimitive(startPoint.x, startPoint.y, endPoint.x, endPoint.y),
- new LinePrimitive_1.LinePrimitive(x1_1, y1_1, x1_2, y1_2),
- new LinePrimitive_1.LinePrimitive(x2_1, y2_1, x2_2, y2_2),
- new TextPrimitive_1.TextPrimitive((endPoint.x + startPoint.x) / 2, (endPoint.y + startPoint.y) / 2, text, undefined, null, false, null, filterId, function (el) {
- el.style.display = text && text !== "" ? "inherit" : "none";
- }),
- new TextFilterPrimitive_1.TextFilterPrimitive(filterId)
- ];
- var primitive = new GroupPrimitive_1.GroupPrimitive(linePrimitives, className);
- var ellEl = this.getExtensionLineElement(primitive, index);
- this.changePrimitiveElement(primitive, ellEl);
- };
- CanvasManager.prototype.hideExtensionLines = function () {
- for (var i = 0; i < this.extensionLineElements.length; i++) {
- if (this.extensionLineElements[i])
- this.extensionLineElements[i].style.display = "none";
- }
- };
- CanvasManager.prototype.getExtensionLineElement = function (primitive, index) {
- var ellEl = this.extensionLineElements[index];
- if (ellEl !== undefined)
- ellEl.style.display = "";
- else {
- ellEl = this.createPrimitiveElement(primitive, this.visualizersContainer);
- this.extensionLineElements[index] = (ellEl);
- }
- return ellEl;
- };
- // Export
- CanvasManager.prototype.getSvgImage = function () {
- var svgEl = this.svgElement.cloneNode();
- Utils_2.RenderUtils.updateSvgElementSize(svgEl, this.svgWidth / this.zoomLevel, this.svgHeight / this.zoomLevel);
- var exportCssRules = this.getExportCssRules();
- var useCssRules = exportCssRules && !Browser_1.Browser.IE;
- if (useCssRules) {
- var style = document.createElementNS(RenderManager_1.svgNS, "style");
- style.innerHTML = exportCssRules;
- svgEl.appendChild(style);
- }
- for (var i = 0; i < this.itemsContainer.childNodes.length; i++) {
- var node = this.itemsContainer.childNodes[i].cloneNode(true);
- if (!useCssRules)
- this.inlineStyle(node, this.itemsContainer.childNodes[i]);
- svgEl.appendChild(node);
- }
- return this.getSvgBase64String(svgEl);
- };
- CanvasManager.prototype.getSvgBase64String = function (svgElement) {
- var xml = new XMLSerializer().serializeToString(svgElement);
- return CanvasManager.base64Start + this.getBase64EncodeUnicode(xml);
- };
- CanvasManager.prototype.getBase64EncodeUnicode = function (s) {
- return btoa(encodeURIComponent(s).replace(/%([0-9A-F]{2})/g, function (match, p1) { return String.fromCharCode(parseInt("0x" + p1, 16)); }));
- };
- CanvasManager.prototype.getExportCssRules = function () {
- for (var i = 0; i < document.styleSheets.length; i++) {
- var rules = this.getRules(document.styleSheets[i]);
- if (rules) {
- var cssText = "";
- for (var j = 0; j < rules.length; j++) {
- var rule = rules[j];
- var selectorText = this.isCSSStyleRule(rule) ? rule.selectorText : null;
- if (selectorText && this.checkSelector(selectorText))
- cssText += rule.cssText + "\n";
- }
- if (cssText.length > 0)
- return "\n" + cssText;
- }
- }
- };
- CanvasManager.prototype.checkSelector = function (selectorText) {
- for (var i = 0; i < CanvasManager.exportStyleRules.length; i++) {
- if (selectorText.indexOf(CanvasManager.exportStyleRules[i]) === 0)
- return true;
- }
- return false;
- };
- CanvasManager.prototype.getRules = function (styleSheet) {
- try {
- return this.isCSSStyleSheet(styleSheet) ? styleSheet.rules || styleSheet.cssRules : null;
- }
- catch (_a) { } // Catch access dinied exception
- };
- CanvasManager.prototype.isCSSStyleSheet = function (stylesheet) {
- return stylesheet.rules !== undefined;
- };
- CanvasManager.prototype.isCSSStyleRule = function (rule) {
- return rule.selectorText !== undefined;
- };
- CanvasManager.prototype.inlineStyle = function (destNode, srcNode) {
- for (var i = 0; i < destNode.childNodes.length; i++) {
- var child = destNode.childNodes[i];
- if (!child.tagName)
- continue;
- if (child.tagName === "g")
- this.inlineStyle(child, srcNode.childNodes[i]);
- else if (child.style) {
- var style = window.getComputedStyle(srcNode.childNodes[i]);
- if (style !== undefined) {
- for (var index = 0; index < CanvasManager.exportStyleAttributes.length; index++) {
- var styleProperty = CanvasManager.exportStyleAttributes[index];
- child.style.setProperty(styleProperty, style.getPropertyValue(styleProperty));
- }
- }
- }
- }
- };
- CanvasManager.prototype.exportSvgImage = function (callback) {
- callback(this.getSvgImage());
- };
- CanvasManager.prototype.exportBinaryImage = function (mimeType, width, height, callback) {
- var canvasEl = document.createElement('canvas');
- canvasEl.width = width;
- canvasEl.height = height;
- var imgEl = document.createElement('img');
- imgEl.width = width;
- imgEl.height = height;
- imgEl.setAttribute('crossOrigin', 'anonymous');
- imgEl.onload = function () {
- var ctx = canvasEl.getContext("2d");
- ctx.fillStyle = "white";
- ctx.fillRect(0, 0, width, height);
- ctx.drawImage(imgEl, 0, 0);
- callback(canvasEl.toDataURL(mimeType));
- };
- imgEl.src = this.getSvgImage();
- };
- CanvasManager.prototype.exportPngImage = function (callback) {
- this.exportBinaryImage("image/png", this.svgWidth, this.svgHeight, callback);
- };
- CanvasManager.prototype.exportJpgImage = function (callback) {
- this.exportBinaryImage("image/jpeg", this.svgWidth, this.svgHeight, callback);
- };
- // Utils
- CanvasManager.prototype.createAndChangePrimitivesElements = function (primitives, parent) {
- var _this = this;
- primitives.forEach(function (primitive) {
- _this.createAndChangePrimitiveElement(primitive, parent);
- });
- };
- CanvasManager.prototype.changePrimitivesElements = function (primitives, parent) {
- var _this = this;
- primitives.forEach(function (primitive, index) {
- var element = parent.childNodes[index];
- _this.changePrimitiveElement(primitive, element);
- });
- };
- CanvasManager.prototype.createPrimitiveElement = function (primitive, parent, sibling) {
- var element = primitive.createElement();
- if (sibling !== undefined)
- parent.insertBefore(element, sibling);
- else
- parent.appendChild(element);
- return element;
- };
- CanvasManager.prototype.createAndChangePrimitiveElement = function (primitive, parent, sibling) {
- var element = this.createPrimitiveElement(primitive, parent, sibling);
- this.changePrimitiveElement(primitive, element);
- return element;
- };
- CanvasManager.prototype.changePrimitiveElement = function (primitive, element) {
- primitive.applyElementProperties(element);
- };
- CanvasManager.prototype.correctShapeSelectionRect = function (rect, lineWidth) {
- var corr = Math.ceil(Shape_1.Shape.lineWidth / 2 * this.zoomLevel);
- rect = rect.inflate(corr, corr);
- var lwCorr = Math.floor(lineWidth / 2);
- rect.position.x -= lwCorr;
- rect.position.y -= lwCorr;
- rect.size.width += lineWidth;
- rect.size.height += lineWidth;
- return rect;
- };
- CanvasManager.selectionMarkSize = UnitConverter_1.UnitConverter.pixelsToTwips(10);
- CanvasManager.lockedSelectionMarkSize = UnitConverter_1.UnitConverter.pixelsToTwips(8);
- CanvasManager.selectionRectLineWidth = UnitConverter_1.UnitConverter.pixelsToTwips(1);
- CanvasManager.multiSelectionRectLineWidth = UnitConverter_1.UnitConverter.pixelsToTwips(1);
- CanvasManager.connectionPointSmallSize = UnitConverter_1.UnitConverter.pixelsToTwips(5);
- CanvasManager.connectionPointLargeSize = UnitConverter_1.UnitConverter.pixelsToTwips(8);
- CanvasManager.connectionMarkSmallSize = UnitConverter_1.UnitConverter.pixelsToTwips(12);
- CanvasManager.connectionMarkLargeSize = UnitConverter_1.UnitConverter.pixelsToTwips(16);
- CanvasManager.connectionMarkShift = UnitConverter_1.UnitConverter.pixelsToTwips(16);
- CanvasManager.connectionTargetBorderWidth = UnitConverter_1.UnitConverter.pixelsToTwips(2);
- CanvasManager.connectorSelectionLineWidth = UnitConverter_1.UnitConverter.pixelsToTwips(1);
- CanvasManager.connectorSelectionWidth = UnitConverter_1.UnitConverter.pixelsToTwips(6);
- CanvasManager.geomertyMarkSize = UnitConverter_1.UnitConverter.pixelsToTwips(8);
- CanvasManager.connectorPointMarkSize = UnitConverter_1.UnitConverter.pixelsToTwips(6);
- CanvasManager.connectorSideMarkSize = UnitConverter_1.UnitConverter.pixelsToTwips(6);
- CanvasManager.extensionLineWidth = UnitConverter_1.UnitConverter.pixelsToTwips(1);
- CanvasManager.extensionLineOffset = UnitConverter_1.UnitConverter.pixelsToTwips(1);
- CanvasManager.extensionLineEndingSize = UnitConverter_1.UnitConverter.pixelsToTwips(6);
- CanvasManager.resizeInfoOffset = UnitConverter_1.UnitConverter.pixelsToTwips(16);
- CanvasManager.resizeInfoTextOffset = UnitConverter_1.UnitConverter.pixelsToTwips(2);
- CanvasManager.resizeInfoLineWidth = UnitConverter_1.UnitConverter.pixelsToTwips(1);
- CanvasManager.pagesGridLineWidth = 2;
- CanvasManager.base64Start = 'data:image/svg+xml;base64,';
- CanvasManager.exportStyleRules = [
- ".dxdi-canvas .shape ", ".dxdi-canvas .connector "
- ];
- CanvasManager.exportStyleAttributes = [
- "fill", "stroke", "stroke-width", "shape-rendering",
- "font-family", "font-size", "font-weight", "font-style", "text-decoration", "text-anchor"
- ];
- return CanvasManager;
- }());
- exports.CanvasManager = CanvasManager;
- /***/ }),
- /* 45 */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- var __extends = (this && this.__extends) || (function () {
- var extendStatics = function (d, b) {
- extendStatics = Object.setPrototypeOf ||
- ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
- function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
- return extendStatics(d, b);
- };
- return function (d, b) {
- extendStatics(d, b);
- function __() { this.constructor = d; }
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
- };
- })();
- Object.defineProperty(exports, "__esModule", { value: true });
- var KeyCode_1 = __webpack_require__(16);
- var MouseHandlerStateBase = /** @class */ (function () {
- function MouseHandlerStateBase(handler) {
- this.handler = handler;
- }
- MouseHandlerStateBase.prototype.start = function () { };
- MouseHandlerStateBase.prototype.finish = function () { };
- MouseHandlerStateBase.prototype.onMouseDoubleClick = function (_evt) { };
- MouseHandlerStateBase.prototype.onMouseDown = function (_evt) { };
- MouseHandlerStateBase.prototype.onMouseUp = function (_evt) { };
- MouseHandlerStateBase.prototype.onMouseMove = function (_evt) { };
- MouseHandlerStateBase.prototype.onMouseWheel = function (_evt) { };
- MouseHandlerStateBase.prototype.onDragStart = function (_evt) { };
- MouseHandlerStateBase.prototype.onDragEnd = function (_evt) { };
- MouseHandlerStateBase.prototype.onShortcut = function (_shortcutCode) { return false; };
- return MouseHandlerStateBase;
- }());
- exports.MouseHandlerStateBase = MouseHandlerStateBase;
- var MouseHandlerCancellableState = /** @class */ (function (_super) {
- __extends(MouseHandlerCancellableState, _super);
- function MouseHandlerCancellableState() {
- return _super !== null && _super.apply(this, arguments) || this;
- }
- MouseHandlerCancellableState.prototype.onShortcut = function (code) {
- if (code === KeyCode_1.KeyCode.Esc) {
- this.cancelChanges();
- this.handler.switchToDefaultState();
- return true;
- }
- return false;
- };
- return MouseHandlerCancellableState;
- }(MouseHandlerStateBase));
- exports.MouseHandlerCancellableState = MouseHandlerCancellableState;
- /***/ }),
- /* 46 */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- Object.defineProperty(exports, "__esModule", { value: true });
- var CommandManager_1 = __webpack_require__(68);
- exports.DiagramCommand = CommandManager_1.DiagramCommand;
- var Diagram_1 = __webpack_require__(213);
- exports.DiagramControl = Diagram_1.DiagramControl;
- var Utils_1 = __webpack_require__(0);
- exports.EventDispatcher = Utils_1.EventDispatcher;
- var ShapeType_1 = __webpack_require__(1);
- exports.ShapeType = ShapeType_1.ShapeType;
- exports.ShapeCategory = ShapeType_1.ShapeCategory;
- var UnitConverter_1 = __webpack_require__(13);
- exports.UnitConverter = UnitConverter_1.UnitConverter;
- var Browser_1 = __webpack_require__(20);
- exports.Browser = Browser_1.Browser;
- var DataSource_1 = __webpack_require__(37);
- exports.DataLayoutType = DataSource_1.DataLayoutType;
- __webpack_require__(247);
- /***/ }),
- /* 47 */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- var __extends = (this && this.__extends) || (function () {
- var extendStatics = function (d, b) {
- extendStatics = Object.setPrototypeOf ||
- ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
- function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
- return extendStatics(d, b);
- };
- return function (d, b) {
- extendStatics(d, b);
- function __() { this.constructor = d; }
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
- };
- })();
- Object.defineProperty(exports, "__esModule", { value: true });
- var StyleBase = /** @class */ (function () {
- function StyleBase() {
- }
- StyleBase.prototype.clone = function () {
- var _this = this;
- var style = this.createInstance();
- this.forEach(function (propertyName) { style[propertyName] = _this[propertyName]; });
- return style;
- };
- StyleBase.prototype.forEach = function (callback) {
- for (var propertyName in this) {
- if (this.hasOwnProperty(propertyName))
- callback(propertyName);
- }
- };
- StyleBase.prototype.toObject = function () {
- var _this = this;
- var result = {};
- var modified = false;
- var defaultStyle = this.getDefaultInstance();
- this.forEach(function (key) {
- if (_this[key] !== defaultStyle[key]) {
- result[key] = _this[key];
- modified = true;
- }
- });
- return modified ? result : null;
- };
- StyleBase.prototype.fromObject = function (obj) {
- for (var key in obj) {
- if (obj.hasOwnProperty(key)) {
- if (this[key] !== undefined)
- this[key] = obj[key];
- }
- }
- };
- return StyleBase;
- }());
- exports.StyleBase = StyleBase;
- var Style = /** @class */ (function (_super) {
- __extends(Style, _super);
- function Style() {
- var _this = _super.call(this) || this;
- // Default values must be the same with css
- _this["fill"] = "white";
- _this["stroke"] = "black";
- return _this;
- }
- Style.prototype.createInstance = function () {
- return new Style();
- };
- Style.prototype.getDefaultInstance = function () {
- return Style.defaultInstace;
- };
- Style.defaultInstace = new Style();
- return Style;
- }(StyleBase));
- exports.Style = Style;
- var StyleText = /** @class */ (function (_super) {
- __extends(StyleText, _super);
- function StyleText() {
- var _this = _super.call(this) || this;
- // Default values must be the same with css
- _this["fill"] = "black";
- _this["font-family"] = "Arial";
- _this["font-size"] = "10pt";
- _this["font-weight"] = "";
- _this["font-style"] = "";
- _this["text-decoration"] = "";
- _this["text-anchor"] = "middle";
- return _this;
- }
- StyleText.prototype.createInstance = function () {
- return new StyleText();
- };
- StyleText.prototype.getDefaultInstance = function () {
- return StyleText.defaultInstace;
- };
- StyleText.defaultInstace = new StyleText();
- return StyleText;
- }(StyleBase));
- exports.StyleText = StyleText;
- /***/ }),
- /* 48 */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- var __extends = (this && this.__extends) || (function () {
- var extendStatics = function (d, b) {
- extendStatics = Object.setPrototypeOf ||
- ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
- function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
- return extendStatics(d, b);
- };
- return function (d, b) {
- extendStatics(d, b);
- function __() { this.constructor = d; }
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
- };
- })();
- Object.defineProperty(exports, "__esModule", { value: true });
- var ItemChangeType;
- (function (ItemChangeType) {
- ItemChangeType[ItemChangeType["Create"] = 0] = "Create";
- ItemChangeType[ItemChangeType["Update"] = 1] = "Update";
- ItemChangeType[ItemChangeType["UpdateStructure"] = 2] = "UpdateStructure";
- ItemChangeType[ItemChangeType["UpdateZIndex"] = 3] = "UpdateZIndex";
- ItemChangeType[ItemChangeType["Remove"] = 4] = "Remove";
- })(ItemChangeType = exports.ItemChangeType || (exports.ItemChangeType = {}));
- var PageChangeType;
- (function (PageChangeType) {
- PageChangeType[PageChangeType["Create"] = 0] = "Create";
- PageChangeType[PageChangeType["Update"] = 1] = "Update";
- PageChangeType[PageChangeType["Remove"] = 2] = "Remove";
- })(PageChangeType = exports.PageChangeType || (exports.PageChangeType = {}));
- var ChangeBase = /** @class */ (function () {
- function ChangeBase(key, type) {
- this.key = key;
- this.type = type;
- }
- return ChangeBase;
- }());
- exports.ChangeBase = ChangeBase;
- var ShapeChange = /** @class */ (function (_super) {
- __extends(ShapeChange, _super);
- function ShapeChange(shape, type) {
- var _this = _super.call(this, shape.key, type) || this;
- _this.shape = shape;
- return _this;
- }
- return ShapeChange;
- }(ChangeBase));
- exports.ShapeChange = ShapeChange;
- var ConnectorChange = /** @class */ (function (_super) {
- __extends(ConnectorChange, _super);
- function ConnectorChange(connector, type) {
- var _this = _super.call(this, connector.key, type) || this;
- _this.connector = connector;
- return _this;
- }
- return ConnectorChange;
- }(ChangeBase));
- exports.ConnectorChange = ConnectorChange;
- var PageChange = /** @class */ (function (_super) {
- __extends(PageChange, _super);
- function PageChange(model, type, offset) {
- var _this = _super.call(this, "-1", type) || this;
- _this.model = model;
- _this.offset = offset;
- return _this;
- }
- return PageChange;
- }(ChangeBase));
- exports.PageChange = PageChange;
- /***/ }),
- /* 49 */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- Object.defineProperty(exports, "__esModule", { value: true });
- var Browser_1 = __webpack_require__(20);
- var TouchUIHelper_1 = __webpack_require__(70);
- var Base_1 = __webpack_require__(19);
- var Evt = /** @class */ (function () {
- function Evt() {
- }
- Evt.GetEvent = function (evt) {
- return (typeof (event) != "undefined" && event != null && Browser_1.Browser.IE) ? event : evt;
- };
- Evt.AttachEventToElement = function (element, eventName, handler, onlyBubbling) {
- if (onlyBubbling === void 0) { onlyBubbling = false; }
- if (element.addEventListener)
- element.addEventListener(eventName, handler, !onlyBubbling);
- else
- element.attachEvent("on" + eventName, handler);
- };
- Evt.AttachEventToDocument = function (eventName, handler) {
- var attachingAllowed = TouchUIHelper_1.TouchUIHelper.onEventAttachingToDocument(eventName, handler);
- if (attachingAllowed)
- Evt.AttachEventToElement(document, eventName, handler);
- };
- Evt.PreventEvent = function (evt) {
- if (evt.preventDefault)
- evt.preventDefault();
- else
- evt.returnValue = false;
- return false;
- };
- Evt.GetKeyCode = function (evt) {
- return Browser_1.Browser.NetscapeFamily || Browser_1.Browser.Opera ? evt.which : evt.keyCode;
- };
- Evt.GetEventSource = function (evt) {
- if (!Base_1.IsExists(evt))
- return null;
- return evt.srcElement ? evt.srcElement : evt.target;
- };
- Evt.GetMouseWheelEventName = function () {
- if (Browser_1.Browser.Safari)
- return "mousewheel";
- if (Browser_1.Browser.NetscapeFamily && Browser_1.Browser.MajorVersion < 17)
- return "DOMMouseScroll";
- return "wheel";
- };
- Evt.IsLeftButtonPressed = function (evt) {
- if (TouchUIHelper_1.TouchUIHelper.isTouchEvent(evt))
- return true;
- evt = Evt.GetEvent(evt);
- if (!evt)
- return false;
- if (Browser_1.Browser.IE && Browser_1.Browser.Version < 11) {
- if (Browser_1.Browser.MSTouchUI)
- return true;
- return evt.button % 2 == 1; // B213431
- }
- else if (Browser_1.Browser.WebKitFamily) {
- if (evt.type === "pointermove")
- return evt.buttons === 1;
- return evt.which == 1;
- }
- else if (Browser_1.Browser.NetscapeFamily || Browser_1.Browser.Edge || (Browser_1.Browser.IE && Browser_1.Browser.Version >= 11)) {
- if (evt.type === TouchUIHelper_1.TouchUIHelper.touchMouseMoveEventName)
- return evt.buttons === 1;
- return evt.which == 1;
- }
- else if (Browser_1.Browser.Opera)
- return evt.button == 0;
- return true;
- };
- Evt.PreventEventAndBubble = function (evt) {
- Evt.PreventEvent(evt);
- if (evt.stopPropagation)
- evt.stopPropagation();
- evt.cancelBubble = true;
- return false;
- };
- Evt.clientEventRequiresDocScrollCorrection = function () {
- var isSafariVerLess3 = Browser_1.Browser.Safari && Browser_1.Browser.Version < 3, isMacOSMobileVerLess51 = Browser_1.Browser.MacOSMobilePlatform && Browser_1.Browser.Version < 5.1;
- return Browser_1.Browser.AndroidDefaultBrowser || Browser_1.Browser.AndroidChromeBrowser || !(isSafariVerLess3 || isMacOSMobileVerLess51);
- };
- Evt.GetEventX = function (evt) {
- if (TouchUIHelper_1.TouchUIHelper.isTouchEvent(evt))
- return TouchUIHelper_1.TouchUIHelper.getEventX(evt);
- return evt.clientX + (Evt.clientEventRequiresDocScrollCorrection() ? Base_1.GetDocumentScrollLeft() : 0);
- };
- Evt.GetEventY = function (evt) {
- if (TouchUIHelper_1.TouchUIHelper.isTouchEvent(evt))
- return TouchUIHelper_1.TouchUIHelper.getEventY(evt);
- return evt.clientY + (Evt.clientEventRequiresDocScrollCorrection() ? Base_1.GetDocumentScrollTop() : 0);
- };
- Evt.CancelBubble = function (evt) {
- evt.cancelBubble = true;
- return false;
- };
- return Evt;
- }());
- exports.Evt = Evt;
- /***/ }),
- /* 50 */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- var __extends = (this && this.__extends) || (function () {
- var extendStatics = function (d, b) {
- extendStatics = Object.setPrototypeOf ||
- ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
- function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
- return extendStatics(d, b);
- };
- return function (d, b) {
- extendStatics(d, b);
- function __() { this.constructor = d; }
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
- };
- })();
- Object.defineProperty(exports, "__esModule", { value: true });
- var RenderManager_1 = __webpack_require__(10);
- var Primitive_1 = __webpack_require__(15);
- var Utils_1 = __webpack_require__(26);
- var TextPrimitive = /** @class */ (function (_super) {
- __extends(TextPrimitive, _super);
- function TextPrimitive(x, y, text, width, style, reverseTextAhchor, clipPathId, filterId, onApplyProperties) {
- var _this = _super.call(this, style, "", clipPathId, onApplyProperties) || this;
- _this.x = x;
- _this.y = y;
- _this.text = text;
- _this.width = width;
- _this.reverseTextAhchor = reverseTextAhchor;
- _this.filterId = filterId;
- _this.textSegmens = _this.text.split("\n").filter(function (s) { return s; });
- return _this;
- }
- TextPrimitive.prototype.createMainElement = function () {
- return document.createElementNS(RenderManager_1.svgNS, "text");
- };
- TextPrimitive.prototype.applyElementProperties = function (element) {
- this.setUnitAttribute(element, "x", this.x);
- this.setUnitAttribute(element, "y", this.y);
- if (this.filterId)
- element.setAttribute("filter", "url(#" + this.filterId + ")");
- _super.prototype.applyElementProperties.call(this, element);
- this.applyElementText(element);
- };
- TextPrimitive.prototype.applyElementText = function (element) {
- var _this = this;
- Utils_1.RenderUtils.removeContent(element);
- var lineCount = 0;
- this.textSegmens.forEach(function (txt, index) {
- var tspan = _this.createTSpanElement(element);
- lineCount++;
- if (_this.width) {
- var words = txt.split(" ");
- var line = "", prevLine = "";
- for (var i = 0; i < words.length; i++) {
- line += (line.length ? " " : "") + words[i];
- tspan.textContent = line;
- var lineWidth = Utils_1.RenderUtils.getSvgTextRectangle(element).width;
- if (lineWidth >= _this.width && prevLine !== "") {
- tspan.textContent = prevLine;
- prevLine = line = words[i];
- tspan = _this.createTSpanElement(element);
- tspan.textContent = line;
- lineCount++;
- }
- else {
- prevLine = line;
- }
- }
- }
- else {
- tspan.textContent = txt;
- }
- });
- var firstTSpan = element.firstChild;
- if (firstTSpan) {
- var dy = -((lineCount - 1) / 2) + TextPrimitive.baselineCorrection;
- firstTSpan.setAttribute("dy", dy.toFixed(2) + "em");
- }
- };
- TextPrimitive.prototype.createTSpanElement = function (parent) {
- var tspan = document.createElementNS(RenderManager_1.svgNS, "tspan");
- parent.appendChild(tspan);
- this.setUnitAttribute(tspan, "x", this.x);
- tspan.setAttribute("dy", "1.05em");
- return tspan;
- };
- TextPrimitive.prototype.applyElementStyleProperties = function (element) {
- this.applyElementStylePropertiesCore(element, this.reverseTextAhchor);
- };
- TextPrimitive.baselineCorrection = 0.35;
- return TextPrimitive;
- }(Primitive_1.SvgPrimitive));
- exports.TextPrimitive = TextPrimitive;
- /***/ }),
- /* 51 */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- var __extends = (this && this.__extends) || (function () {
- var extendStatics = function (d, b) {
- extendStatics = Object.setPrototypeOf ||
- ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
- function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
- return extendStatics(d, b);
- };
- return function (d, b) {
- extendStatics(d, b);
- function __() { this.constructor = d; }
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
- };
- })();
- Object.defineProperty(exports, "__esModule", { value: true });
- var HistoryItem_1 = __webpack_require__(4);
- var ShapeDescriptionManager_1 = __webpack_require__(30);
- var Shape_1 = __webpack_require__(9);
- var AddShapeHistoryItem = /** @class */ (function (_super) {
- __extends(AddShapeHistoryItem, _super);
- function AddShapeHistoryItem(shapeType, position, text, dataKey) {
- var _this = _super.call(this) || this;
- _this.shapeType = shapeType;
- _this.position = position;
- _this.text = text;
- _this.dataKey = dataKey;
- return _this;
- }
- AddShapeHistoryItem.prototype.redo = function (manipulator) {
- var shape = new Shape_1.Shape(ShapeDescriptionManager_1.ShapeDescriptionManager.get(this.shapeType), this.position);
- if (typeof this.text === "string")
- shape.text = this.text;
- if (this.dataKey !== undefined)
- shape.dataKey = this.dataKey;
- manipulator.addShape(shape, this.shapeKey);
- this.shapeKey = shape.key;
- };
- AddShapeHistoryItem.prototype.undo = function (manipulator) {
- manipulator.deleteShape(manipulator.model.findShape(this.shapeKey));
- };
- return AddShapeHistoryItem;
- }(HistoryItem_1.HistoryItem));
- exports.AddShapeHistoryItem = AddShapeHistoryItem;
- /***/ }),
- /* 52 */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- var __extends = (this && this.__extends) || (function () {
- var extendStatics = function (d, b) {
- extendStatics = Object.setPrototypeOf ||
- ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
- function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
- return extendStatics(d, b);
- };
- return function (d, b) {
- extendStatics(d, b);
- function __() { this.constructor = d; }
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
- };
- })();
- Object.defineProperty(exports, "__esModule", { value: true });
- var RenderManager_1 = __webpack_require__(10);
- var Primitive_1 = __webpack_require__(15);
- var ClipPathPrimitive = /** @class */ (function (_super) {
- __extends(ClipPathPrimitive, _super);
- function ClipPathPrimitive(id, children) {
- var _this = _super.call(this) || this;
- _this.id = id;
- _this.children = children;
- return _this;
- }
- ClipPathPrimitive.prototype.createMainElement = function () {
- return document.createElementNS(RenderManager_1.svgNS, "clipPath");
- };
- ClipPathPrimitive.prototype.applyElementProperties = function (element) {
- if (this.id)
- element.setAttribute("id", this.id);
- _super.prototype.applyElementProperties.call(this, element);
- };
- return ClipPathPrimitive;
- }(Primitive_1.SvgPrimitive));
- exports.ClipPathPrimitive = ClipPathPrimitive;
- /***/ }),
- /* 53 */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- var __extends = (this && this.__extends) || (function () {
- var extendStatics = function (d, b) {
- extendStatics = Object.setPrototypeOf ||
- ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
- function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
- return extendStatics(d, b);
- };
- return function (d, b) {
- extendStatics(d, b);
- function __() { this.constructor = d; }
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
- };
- })();
- Object.defineProperty(exports, "__esModule", { value: true });
- var RenderManager_1 = __webpack_require__(10);
- var Primitive_1 = __webpack_require__(15);
- var RectanglePrimitive = /** @class */ (function (_super) {
- __extends(RectanglePrimitive, _super);
- function RectanglePrimitive(x, y, width, height, style, className, clipPathId, onApplyProperties) {
- var _this = _super.call(this, style, className, clipPathId, onApplyProperties) || this;
- _this.x = x;
- _this.y = y;
- _this.width = width;
- _this.height = height;
- return _this;
- }
- RectanglePrimitive.prototype.createMainElement = function () {
- return document.createElementNS(RenderManager_1.svgNS, "rect");
- };
- RectanglePrimitive.prototype.applyElementProperties = function (element) {
- this.setUnitAttribute(element, "x", this.x);
- this.setUnitAttribute(element, "y", this.y);
- this.setUnitAttribute(element, "width", this.width);
- this.setUnitAttribute(element, "height", this.height);
- _super.prototype.applyElementProperties.call(this, element);
- };
- return RectanglePrimitive;
- }(Primitive_1.SvgPrimitive));
- exports.RectanglePrimitive = RectanglePrimitive;
- /***/ }),
- /* 54 */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- var __extends = (this && this.__extends) || (function () {
- var extendStatics = function (d, b) {
- extendStatics = Object.setPrototypeOf ||
- ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
- function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
- return extendStatics(d, b);
- };
- return function (d, b) {
- extendStatics(d, b);
- function __() { this.constructor = d; }
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
- };
- })();
- Object.defineProperty(exports, "__esModule", { value: true });
- var ShapeDescription_1 = __webpack_require__(11);
- var Utils_1 = __webpack_require__(0);
- var ShapeParameters_1 = __webpack_require__(25);
- var ShapeType_1 = __webpack_require__(1);
- var DiagramItem_1 = __webpack_require__(3);
- exports.ArrowVerticalTriangleHeightParameterName = "th";
- exports.ArrowVerticalLineWidthParameterName = "lw";
- var ArrowVerticalShapeDescription = /** @class */ (function (_super) {
- __extends(ArrowVerticalShapeDescription, _super);
- function ArrowVerticalShapeDescription(title) {
- return _super.call(this, title, "", new Utils_1.Size(ShapeDescription_1.ShapeDefaultDimension * 0.375, ShapeDescription_1.ShapeDefaultDimension)) || this;
- }
- Object.defineProperty(ArrowVerticalShapeDescription.prototype, "category", {
- get: function () { return ShapeType_1.ShapeCategory.General; },
- enumerable: true,
- configurable: true
- });
- ArrowVerticalShapeDescription.prototype.createParameters = function (parameters) {
- parameters.addRange([
- new ShapeParameters_1.ShapeParameter(exports.ArrowVerticalTriangleHeightParameterName, Math.sqrt(Math.pow(this.defaultSize.width, 2) - Math.pow(this.defaultSize.width / 2, 2))),
- new ShapeParameters_1.ShapeParameter(exports.ArrowVerticalLineWidthParameterName, this.defaultSize.width / 3)
- ]);
- };
- ArrowVerticalShapeDescription.prototype.normalizeParameters = function (shape, parameters) {
- this.changeParameterValue(parameters, exports.ArrowVerticalTriangleHeightParameterName, function (p) { return Math.max(0, Math.min(shape.size.height, p.value)); });
- this.changeParameterValue(parameters, exports.ArrowVerticalLineWidthParameterName, function (p) { return Math.max(0, Math.min(shape.size.width, p.value)); });
- };
- ArrowVerticalShapeDescription.prototype.processConnectionPoint = function (shape, point, index) {
- var delta = (shape.size.width - shape.parameters.get(exports.ArrowVerticalLineWidthParameterName).value) / 2;
- var side = shape.getConnectionPointSide(index);
- if (side === DiagramItem_1.ConnectionPointSide.East)
- point.x -= delta;
- else if (side === DiagramItem_1.ConnectionPointSide.West)
- point.x += delta;
- };
- return ArrowVerticalShapeDescription;
- }(ShapeDescription_1.ShapeDescription));
- exports.ArrowVerticalShapeDescription = ArrowVerticalShapeDescription;
- /***/ }),
- /* 55 */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- var __extends = (this && this.__extends) || (function () {
- var extendStatics = function (d, b) {
- extendStatics = Object.setPrototypeOf ||
- ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
- function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
- return extendStatics(d, b);
- };
- return function (d, b) {
- extendStatics(d, b);
- function __() { this.constructor = d; }
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
- };
- })();
- Object.defineProperty(exports, "__esModule", { value: true });
- var ShapeDescription_1 = __webpack_require__(11);
- var Utils_1 = __webpack_require__(0);
- var ShapeParameters_1 = __webpack_require__(25);
- var ShapeType_1 = __webpack_require__(1);
- var DiagramItem_1 = __webpack_require__(3);
- exports.ArrowVerticalTriangleWidthParameterName = "tw";
- exports.ArrowVerticalLineHeightParameterName = "lh";
- var ArrowHorizontalShapeDescription = /** @class */ (function (_super) {
- __extends(ArrowHorizontalShapeDescription, _super);
- function ArrowHorizontalShapeDescription(title) {
- return _super.call(this, title, "", new Utils_1.Size(ShapeDescription_1.ShapeDefaultDimension, ShapeDescription_1.ShapeDefaultDimension * 0.375)) || this;
- }
- Object.defineProperty(ArrowHorizontalShapeDescription.prototype, "category", {
- get: function () { return ShapeType_1.ShapeCategory.General; },
- enumerable: true,
- configurable: true
- });
- ArrowHorizontalShapeDescription.prototype.createParameters = function (parameters) {
- parameters.addRange([
- new ShapeParameters_1.ShapeParameter(exports.ArrowVerticalTriangleWidthParameterName, Math.sqrt(Math.pow(this.defaultSize.height, 2) - Math.pow(this.defaultSize.height / 2, 2))),
- new ShapeParameters_1.ShapeParameter(exports.ArrowVerticalLineHeightParameterName, this.defaultSize.height / 3)
- ]);
- };
- ArrowHorizontalShapeDescription.prototype.normalizeParameters = function (shape, parameters) {
- this.changeParameterValue(parameters, exports.ArrowVerticalTriangleWidthParameterName, function (p) { return Math.max(0, Math.min(shape.size.width, p.value)); });
- this.changeParameterValue(parameters, exports.ArrowVerticalLineHeightParameterName, function (p) { return Math.max(0, Math.min(shape.size.height, p.value)); });
- };
- ArrowHorizontalShapeDescription.prototype.processConnectionPoint = function (shape, point, index) {
- var delta = (shape.size.height - shape.parameters.get(exports.ArrowVerticalLineHeightParameterName).value) / 2;
- var side = shape.getConnectionPointSide(index);
- if (side === DiagramItem_1.ConnectionPointSide.North)
- point.y += delta;
- else if (side === DiagramItem_1.ConnectionPointSide.South)
- point.y -= delta;
- };
- return ArrowHorizontalShapeDescription;
- }(ShapeDescription_1.ShapeDescription));
- exports.ArrowHorizontalShapeDescription = ArrowHorizontalShapeDescription;
- /***/ }),
- /* 56 */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- var __extends = (this && this.__extends) || (function () {
- var extendStatics = function (d, b) {
- extendStatics = Object.setPrototypeOf ||
- ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
- function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
- return extendStatics(d, b);
- };
- return function (d, b) {
- extendStatics(d, b);
- function __() { this.constructor = d; }
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
- };
- })();
- Object.defineProperty(exports, "__esModule", { value: true });
- var ShapeDescription_1 = __webpack_require__(11);
- var Utils_1 = __webpack_require__(0);
- var EllipsePrimitive_1 = __webpack_require__(38);
- var ShapeType_1 = __webpack_require__(1);
- var EllipseShapeDescription = /** @class */ (function (_super) {
- __extends(EllipseShapeDescription, _super);
- function EllipseShapeDescription(title, defaultText) {
- if (title === void 0) { title = "Ellipse"; }
- if (defaultText === void 0) { defaultText = ""; }
- return _super.call(this, title, defaultText, new Utils_1.Size(ShapeDescription_1.ShapeDefaultDimension, ShapeDescription_1.ShapeDefaultDimension * 0.75)) || this;
- }
- Object.defineProperty(EllipseShapeDescription.prototype, "key", {
- get: function () { return ShapeType_1.ShapeType.Ellipsis; },
- enumerable: true,
- configurable: true
- });
- Object.defineProperty(EllipseShapeDescription.prototype, "category", {
- get: function () { return ShapeType_1.ShapeCategory.General; },
- enumerable: true,
- configurable: true
- });
- EllipseShapeDescription.prototype.createPrimitives = function (shape) {
- var rect = shape.rectangle;
- var width = rect.width, height = rect.height;
- var _a = rect.center, cx = _a.x, cy = _a.y;
- var primitives = [];
- return primitives.concat([
- new EllipsePrimitive_1.EllipsePrimitive(cx, cy, width / 2, height / 2, shape.style),
- ])
- .concat(this.createTextPrimitives(shape));
- };
- return EllipseShapeDescription;
- }(ShapeDescription_1.ShapeDescription));
- exports.EllipseShapeDescription = EllipseShapeDescription;
- /***/ }),
- /* 57 */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- var __extends = (this && this.__extends) || (function () {
- var extendStatics = function (d, b) {
- extendStatics = Object.setPrototypeOf ||
- ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
- function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
- return extendStatics(d, b);
- };
- return function (d, b) {
- extendStatics(d, b);
- function __() { this.constructor = d; }
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
- };
- })();
- Object.defineProperty(exports, "__esModule", { value: true });
- var ShapeDescription_1 = __webpack_require__(11);
- var ShapeType_1 = __webpack_require__(1);
- var PolygonShapeDescription = /** @class */ (function (_super) {
- __extends(PolygonShapeDescription, _super);
- function PolygonShapeDescription(title, defaultText) {
- var _this = _super.call(this, title, defaultText) || this;
- _this.defaultSize.height = _this.calculateHeight(ShapeDescription_1.ShapeDefaultDimension);
- return _this;
- }
- Object.defineProperty(PolygonShapeDescription.prototype, "category", {
- get: function () { return ShapeType_1.ShapeCategory.General; },
- enumerable: true,
- configurable: true
- });
- Object.defineProperty(PolygonShapeDescription.prototype, "angle", {
- get: function () {
- return Math.PI * (this.angleCount - 2) / this.angleCount;
- },
- enumerable: true,
- configurable: true
- });
- return PolygonShapeDescription;
- }(ShapeDescription_1.ShapeDescription));
- exports.PolygonShapeDescription = PolygonShapeDescription;
- /***/ }),
- /* 58 */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- var __extends = (this && this.__extends) || (function () {
- var extendStatics = function (d, b) {
- extendStatics = Object.setPrototypeOf ||
- ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
- function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
- return extendStatics(d, b);
- };
- return function (d, b) {
- extendStatics(d, b);
- function __() { this.constructor = d; }
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
- };
- })();
- Object.defineProperty(exports, "__esModule", { value: true });
- var HistoryItem_1 = __webpack_require__(4);
- var Connector_1 = __webpack_require__(5);
- var AddConnectorHistoryItem = /** @class */ (function (_super) {
- __extends(AddConnectorHistoryItem, _super);
- function AddConnectorHistoryItem(points, dataKey) {
- var _this = _super.call(this) || this;
- _this.points = points;
- _this.dataKey = dataKey;
- return _this;
- }
- AddConnectorHistoryItem.prototype.redo = function (manipulator) {
- var connector = new Connector_1.Connector(this.points);
- if (this.dataKey !== undefined)
- connector.dataKey = this.dataKey;
- manipulator.addConnector(connector, this.connectorKey);
- this.connectorKey = connector.key;
- };
- AddConnectorHistoryItem.prototype.undo = function (manipulator) {
- var connector = manipulator.model.findConnector(this.connectorKey);
- manipulator.deleteConnector(connector);
- };
- return AddConnectorHistoryItem;
- }(HistoryItem_1.HistoryItem));
- exports.AddConnectorHistoryItem = AddConnectorHistoryItem;
- /***/ }),
- /* 59 */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- Object.defineProperty(exports, "__esModule", { value: true });
- var Connector_1 = __webpack_require__(5);
- var NodeLayout_1 = __webpack_require__(39);
- var ShapeDescriptionManager_1 = __webpack_require__(30);
- var LayoutUtils = /** @class */ (function () {
- function LayoutUtils() {
- }
- LayoutUtils.shapeToLayout = function (shape) {
- var margin = new NodeLayout_1.Margin(0);
- var shapeRect = shape.rectangle;
- shape.attachedConnectors.filter(function (c) { return !c.beginItem || !c.endItem; }).forEach(function (c) {
- var connRect = c.rectangle;
- margin.left = Math.max(margin.left, shapeRect.left - connRect.left + Connector_1.Connector.minOffset);
- margin.right = Math.max(margin.right, connRect.right - shapeRect.right + Connector_1.Connector.minOffset);
- margin.top = Math.max(margin.top, shapeRect.top - connRect.top + Connector_1.Connector.minOffset);
- margin.bottom = Math.max(margin.bottom, connRect.bottom - shapeRect.bottom + Connector_1.Connector.minOffset);
- });
- var layout = new NodeLayout_1.NodeInfo(shape.key, margin, shape.size.clone());
- layout.connectionPoints = shape.description.getConnectionPoints();
- return layout;
- };
- LayoutUtils.importNodeToLayout = function (node) {
- var margin = new NodeLayout_1.Margin(0);
- var description = ShapeDescriptionManager_1.ShapeDescriptionManager.get(node.type);
- var layout = new NodeLayout_1.NodeInfo(node.key, margin, description.defaultSize.clone());
- layout.connectionPoints = description.getConnectionPoints();
- return layout;
- };
- return LayoutUtils;
- }());
- exports.LayoutUtils = LayoutUtils;
- /***/ }),
- /* 60 */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- Object.defineProperty(exports, "__esModule", { value: true });
- var HashSet = /** @class */ (function () {
- function HashSet(list, getHashCode) {
- if (list === void 0) { list = []; }
- if (getHashCode === void 0) { getHashCode = function (item) { return item.toString(); }; }
- var _this = this;
- this.items = [];
- this.map = {};
- this.getHashCode = getHashCode;
- list.forEach(function (i) { return _this.tryPush(i); });
- }
- HashSet.prototype.tryPush = function (item) {
- var code = this.getHashCode(item);
- if (this.map[code] === undefined) {
- this.map[code] = this.items.push(item) - 1;
- return true;
- }
- return false;
- };
- HashSet.prototype.contains = function (item) {
- return this.map[this.getHashCode(item)] !== undefined;
- };
- HashSet.prototype.forEach = function (callback) {
- this.items.forEach(callback);
- };
- HashSet.prototype.filter = function (predicate) {
- return this.items.filter(predicate);
- };
- HashSet.prototype.list = function () {
- return this.items.slice(0);
- };
- HashSet.prototype.item = function (index) {
- return this.items[index];
- };
- HashSet.prototype.first = function () {
- return this.items[0];
- };
- HashSet.prototype.remove = function (item) {
- var code = this.getHashCode(item);
- var index = this.map[code];
- if (typeof index === "number") {
- delete this.map[code];
- this.items.splice(index, 1);
- for (var i = index; i < this.items.length; i++)
- this.map[this.getHashCode(this.items[i])]--;
- }
- else
- throw "Item not found";
- };
- Object.defineProperty(HashSet.prototype, "length", {
- get: function () { return this.items.length; },
- enumerable: true,
- configurable: true
- });
- return HashSet;
- }());
- exports.HashSet = HashSet;
- /***/ }),
- /* 61 */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- var __extends = (this && this.__extends) || (function () {
- var extendStatics = function (d, b) {
- extendStatics = Object.setPrototypeOf ||
- ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
- function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
- return extendStatics(d, b);
- };
- return function (d, b) {
- extendStatics(d, b);
- function __() { this.constructor = d; }
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
- };
- })();
- Object.defineProperty(exports, "__esModule", { value: true });
- var Forest_1 = __webpack_require__(151);
- var GraphLayout_1 = __webpack_require__(81);
- var NodeLayout_1 = __webpack_require__(39);
- var Utils_1 = __webpack_require__(0);
- var BaseBuilder_1 = __webpack_require__(82);
- var Structures_1 = __webpack_require__(22);
- var DiagramItem_1 = __webpack_require__(3);
- var LayoutSettings_1 = __webpack_require__(18);
- var TreeLayoutBuilder = /** @class */ (function (_super) {
- __extends(TreeLayoutBuilder, _super);
- function TreeLayoutBuilder() {
- return _super !== null && _super.apply(this, arguments) || this;
- }
- TreeLayoutBuilder.prototype.build = function () {
- var forest = Forest_1.Forest.create(this.graph);
- var layouts = [];
- for (var tree = void 0, i = 0; tree = forest.trees[i]; i++) {
- var layout_1 = this.processTree(tree);
- layouts.push(layout_1);
- }
- var offset = 0, layout = new GraphLayout_1.GraphLayout();
- for (var layoutComponent = void 0, i = 0; layoutComponent = layouts[i]; i++) {
- layout.extend(this.setComponentOffset(layoutComponent, offset));
- offset += this.getComponentOffset(layoutComponent);
- }
- return layout;
- };
- TreeLayoutBuilder.prototype.processTree = function (tree) {
- var layout = new GraphLayout_1.GraphLayout();
- var rootLayout = new NodeLayout_1.NodeLayout(tree.root, new Utils_1.Point(tree.root.margin.left, tree.root.margin.top));
- layout.addNode(rootLayout);
- this.processChildren(rootLayout, tree, layout, 0);
- if (this.settings.alignment === LayoutSettings_1.Alignment.Center)
- this.processParents(layout, rootLayout, tree);
- return layout;
- };
- TreeLayoutBuilder.prototype.processChildren = function (parent, tree, layout, nearbyPoint) {
- var _this = this;
- var children = tree.getChildren(parent.info);
- var edges = this.graph.getAdjacentEdges(parent.key, Structures_1.ConnectionMode.Outgoing);
- var distantPoint = nearbyPoint;
- var prevSiblingLayout;
- var _loop_1 = function (child, i) {
- var nearbyMargin = this_1.isVertical() ? child.margin.left : child.margin.top;
- if (prevSiblingLayout) {
- var prevSiblingDistantPoint = this_1.getChangingCoordinateForLayer(prevSiblingLayout.position) + this_1.getSizeMeasurement(prevSiblingLayout.info.size);
- var actualNearbyMargin = distantPoint - prevSiblingDistantPoint;
- nearbyMargin = Math.max(0, nearbyMargin - actualNearbyMargin);
- nearbyMargin += this_1.settings.columnSpacing;
- }
- var layerStartingPoint = this_1.isVertical() ? Math.max(parent.info.margin.bottom, child.margin.top) : Math.max(parent.info.margin.right, child.margin.left);
- var nodePosition = this_1.isVertical() ?
- new Utils_1.Point(distantPoint + nearbyMargin, parent.position.y + parent.info.size.height + layerStartingPoint + this_1.settings.layerSpacing) :
- new Utils_1.Point(parent.position.x + parent.info.size.width + layerStartingPoint + this_1.settings.layerSpacing, distantPoint + nearbyMargin);
- var childLayout = new NodeLayout_1.NodeLayout(child, nodePosition);
- distantPoint = Math.max(this_1.getChangingCoordinateForLayer(childLayout.position) + this_1.getSizeMeasurement(childLayout.info.size), this_1.processChildren(childLayout, tree, layout, distantPoint));
- layout.addNode(childLayout);
- edges.filter(function (e) { return e.to === child.key; }).forEach(function (e) {
- var beginIndex = _this.isVertical() ? DiagramItem_1.ConnectionPointSide.South : DiagramItem_1.ConnectionPointSide.East;
- var endIndex = _this.isVertical() ? DiagramItem_1.ConnectionPointSide.North : DiagramItem_1.ConnectionPointSide.West;
- layout.addEdge(new NodeLayout_1.EdgeLayout(e.key, beginIndex, endIndex));
- });
- prevSiblingLayout = childLayout;
- };
- var this_1 = this;
- for (var child = void 0, i = 0; child = children[i]; i++) {
- _loop_1(child, i);
- }
- return distantPoint + this.settings.subTreeColumnSpacing;
- };
- TreeLayoutBuilder.prototype.processParents = function (layout, parent, tree, parentNextSibling) {
- var children = tree.getChildren(parent.info);
- for (var child = void 0, i = children.length - 1; child = children[i]; i--)
- this.processParents(layout, layout.nodeToLayout[child.key], tree, children[i + 1]);
- if (children.length) {
- var nearbyPoint = this.getChangingCoordinateForLayer(layout.nodeToLayout[children[0].key].position);
- var distantPoint = this.getRectangleDistantEdge(layout.nodeToLayout[children[children.length - 1].key].rectangle);
- var position = nearbyPoint + (distantPoint - nearbyPoint) / 2 - this.getSizeMeasurement(parent.info.size) / 2;
- position = Math.max(this.getChangingCoordinateForLayer(parent.position), this.correctByMargin(position, parent, parentNextSibling && layout.nodeToLayout[parentNextSibling.key]));
- if (this.isVertical())
- parent.position.x = position;
- else
- parent.position.y = position;
- }
- };
- TreeLayoutBuilder.prototype.getChangingCoordinateForLayer = function (point) {
- return this.isVertical() ? point.x : point.y;
- };
- TreeLayoutBuilder.prototype.getRectangleDistantEdge = function (rectangle) {
- return this.isVertical() ? rectangle.right : rectangle.bottom;
- };
- TreeLayoutBuilder.prototype.getSizeMeasurement = function (size) {
- return this.isVertical() ? size.width : size.height;
- };
- TreeLayoutBuilder.prototype.correctByMargin = function (position, element, distant) {
- if (distant) {
- var distantPoint = this.isVertical() ? Math.max(distant.info.margin.left, element.info.margin.right) : Math.max(distant.info.margin.top, element.info.margin.bottom);
- position = Math.min(position, this.getChangingCoordinateForLayer(distant.position) - distantPoint - this.getSizeMeasurement(element.info.size));
- }
- return position;
- };
- TreeLayoutBuilder.prototype.isVertical = function () {
- return this.settings.orientation === LayoutSettings_1.OrientationKind.Vertical;
- };
- return TreeLayoutBuilder;
- }(BaseBuilder_1.LayoutBuilder));
- exports.TreeLayoutBuilder = TreeLayoutBuilder;
- /***/ }),
- /* 62 */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- var __extends = (this && this.__extends) || (function () {
- var extendStatics = function (d, b) {
- extendStatics = Object.setPrototypeOf ||
- ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
- function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
- return extendStatics(d, b);
- };
- return function (d, b) {
- extendStatics(d, b);
- function __() { this.constructor = d; }
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
- };
- })();
- Object.defineProperty(exports, "__esModule", { value: true });
- var ChangeStylePropertyCommandBase_1 = __webpack_require__(87);
- var ChangeStyleTextHistoryItem_1 = __webpack_require__(42);
- var ChangeStyleTextPropertyCommand = /** @class */ (function (_super) {
- __extends(ChangeStyleTextPropertyCommand, _super);
- function ChangeStyleTextPropertyCommand() {
- return _super !== null && _super.apply(this, arguments) || this;
- }
- ChangeStyleTextPropertyCommand.prototype.getStateValue = function () {
- return this.control.selection.inputPosition.getStyleTextPropertyValue(this.getStyleProperty());
- };
- ChangeStyleTextPropertyCommand.prototype.getStyleObj = function (item) {
- return item.styleText;
- };
- ChangeStyleTextPropertyCommand.prototype.createHistoryItem = function (item, styleProperty, styleValue) {
- return new ChangeStyleTextHistoryItem_1.ChangeStyleTextHistoryItem(item.key, styleProperty, styleValue);
- };
- ChangeStyleTextPropertyCommand.prototype.updateInputPosition = function (value) {
- this.control.selection.inputPosition.setStyleTextPropertyValue(this.getStyleProperty(), value);
- };
- return ChangeStyleTextPropertyCommand;
- }(ChangeStylePropertyCommandBase_1.ChangeStylePropertyCommandBase));
- exports.ChangeStyleTextPropertyCommand = ChangeStyleTextPropertyCommand;
- /***/ }),
- /* 63 */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- var __extends = (this && this.__extends) || (function () {
- var extendStatics = function (d, b) {
- extendStatics = Object.setPrototypeOf ||
- ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
- function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
- return extendStatics(d, b);
- };
- return function (d, b) {
- extendStatics(d, b);
- function __() { this.constructor = d; }
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
- };
- })();
- Object.defineProperty(exports, "__esModule", { value: true });
- var ChangeStyleHistoryItemBase_1 = __webpack_require__(86);
- var ChangeStyleHistoryItem = /** @class */ (function (_super) {
- __extends(ChangeStyleHistoryItem, _super);
- function ChangeStyleHistoryItem(itemKey, styleProperty, styleValue) {
- return _super.call(this, itemKey, styleProperty, styleValue) || this;
- }
- ChangeStyleHistoryItem.prototype.redo = function (manipulator) {
- var item = manipulator.model.findItem(this.itemKey);
- this.oldStyleValue = item.style[this.styleProperty];
- manipulator.changeStyle(item, this.styleProperty, this.styleValue);
- };
- ChangeStyleHistoryItem.prototype.undo = function (manipulator) {
- var item = manipulator.model.findItem(this.itemKey);
- manipulator.changeStyle(item, this.styleProperty, this.oldStyleValue);
- };
- return ChangeStyleHistoryItem;
- }(ChangeStyleHistoryItemBase_1.ChangeStyleHistoryItemBase));
- exports.ChangeStyleHistoryItem = ChangeStyleHistoryItem;
- /***/ }),
- /* 64 */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- var __extends = (this && this.__extends) || (function () {
- var extendStatics = function (d, b) {
- extendStatics = Object.setPrototypeOf ||
- ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
- function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
- return extendStatics(d, b);
- };
- return function (d, b) {
- extendStatics(d, b);
- function __() { this.constructor = d; }
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
- };
- })();
- Object.defineProperty(exports, "__esModule", { value: true });
- var CommandBase_1 = __webpack_require__(7);
- var CommandStates_1 = __webpack_require__(6);
- var CanvasManager_1 = __webpack_require__(44);
- var RenderManager_1 = __webpack_require__(10);
- var ExportImageCommand = /** @class */ (function (_super) {
- __extends(ExportImageCommand, _super);
- function ExportImageCommand() {
- return _super !== null && _super.apply(this, arguments) || this;
- }
- ExportImageCommand.prototype.getState = function () {
- return new CommandStates_1.SimpleCommandState(true);
- };
- ExportImageCommand.prototype.executeCore = function (state, parameter) {
- var _this = this;
- try {
- var canvasManager = this.getCanvasManager();
- var exportFunc = this.getExportFunc();
- exportFunc(canvasManager, function (url) {
- parameter(url);
- _this.tryDisposeCanvasManager();
- });
- }
- catch (e) {
- this.tryDisposeCanvasManager();
- throw e;
- }
- return true;
- };
- ExportImageCommand.prototype.getCanvasManager = function () {
- if (this.control.canvasManager !== undefined)
- return this.control.canvasManager;
- if (this.canvasManager === undefined)
- this.canvasManager = this.createCanvasManager();
- return this.canvasManager;
- };
- ExportImageCommand.prototype.createCanvasManager = function () {
- var svgElement = RenderManager_1.RenderManager.createSvgElement(true);
- document.body.appendChild(svgElement);
- var canvasManager = new CanvasManager_1.CanvasManager(svgElement);
- this.control.modelManipulator.onModelChanged.add(canvasManager);
- this.control.modelManipulator.onLoad();
- return canvasManager;
- };
- ExportImageCommand.prototype.tryDisposeCanvasManager = function () {
- if (this.canvasManager) {
- document.body.removeChild(this.canvasManager.svgElement);
- delete this.canvasManager;
- }
- };
- return ExportImageCommand;
- }(CommandBase_1.CommandBase));
- exports.ExportImageCommand = ExportImageCommand;
- /***/ }),
- /* 65 */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- var __extends = (this && this.__extends) || (function () {
- var extendStatics = function (d, b) {
- extendStatics = Object.setPrototypeOf ||
- ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
- function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
- return extendStatics(d, b);
- };
- return function (d, b) {
- extendStatics(d, b);
- function __() { this.constructor = d; }
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
- };
- })();
- Object.defineProperty(exports, "__esModule", { value: true });
- var CommandBase_1 = __webpack_require__(7);
- var ClipboardCommand = /** @class */ (function (_super) {
- __extends(ClipboardCommand, _super);
- function ClipboardCommand() {
- return _super !== null && _super.apply(this, arguments) || this;
- }
- ClipboardCommand.prototype.setClipboardData = function (data) {
- if (this.control.renderManager)
- this.control.renderManager.setClipboardData(data);
- else
- ClipboardCommand.clipboardData = data;
- };
- ClipboardCommand.prototype.getClipboardData = function (callback) {
- if (this.control.renderManager)
- this.control.renderManager.getClipboardData(callback);
- else
- callback(ClipboardCommand.clipboardData);
- };
- return ClipboardCommand;
- }(CommandBase_1.CommandBase));
- exports.ClipboardCommand = ClipboardCommand;
- /***/ }),
- /* 66 */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- var __extends = (this && this.__extends) || (function () {
- var extendStatics = function (d, b) {
- extendStatics = Object.setPrototypeOf ||
- ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
- function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
- return extendStatics(d, b);
- };
- return function (d, b) {
- extendStatics(d, b);
- function __() { this.constructor = d; }
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
- };
- })();
- Object.defineProperty(exports, "__esModule", { value: true });
- var ModelUtils_1 = __webpack_require__(8);
- var MouseHandlerMoveShapeStateBase_1 = __webpack_require__(95);
- var KeyCode_1 = __webpack_require__(16);
- var MouseHandlerMoveClonedShapeState = /** @class */ (function (_super) {
- __extends(MouseHandlerMoveClonedShapeState, _super);
- function MouseHandlerMoveClonedShapeState(handler, history, model, selection, moveStartPoint) {
- var _this = _super.call(this, handler, history, model, selection) || this;
- _this.model = model;
- _this.selection = selection;
- _this.moveStartPoint = moveStartPoint;
- return _this;
- }
- MouseHandlerMoveClonedShapeState.prototype.onMouseDown = function (evt) {
- var dx = this.moveStartPoint ? evt.layoutPoint.x - this.moveStartPoint.x : 0;
- var dy = this.moveStartPoint ? evt.layoutPoint.y - this.moveStartPoint.y : 0;
- ModelUtils_1.ModelUtils.cloneSelectionToOffset(this.history, this.model, this.selection, dx, dy);
- _super.prototype.onMouseDown.call(this, evt);
- };
- MouseHandlerMoveClonedShapeState.isMoveClonedShapeEvent = function (evt) {
- return evt.modifiers & KeyCode_1.ModifierKey.Ctrl && evt.modifiers & KeyCode_1.ModifierKey.Shift;
- };
- return MouseHandlerMoveClonedShapeState;
- }(MouseHandlerMoveShapeStateBase_1.MouseHandlerMoveShapeStateBase));
- exports.MouseHandlerMoveClonedShapeState = MouseHandlerMoveClonedShapeState;
- /***/ }),
- /* 67 */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- Object.defineProperty(exports, "__esModule", { value: true });
- var ConnectionPointInfo = /** @class */ (function () {
- function ConnectionPointInfo(point, side) {
- this.point = point;
- this.side = side;
- }
- return ConnectionPointInfo;
- }());
- exports.ConnectionPointInfo = ConnectionPointInfo;
- var ConnectionPointsVisualizerBase = /** @class */ (function () {
- function ConnectionPointsVisualizerBase(dispatcher) {
- this.dispatcher = dispatcher;
- }
- ConnectionPointsVisualizerBase.prototype.getKey = function () {
- return this.key;
- };
- ConnectionPointsVisualizerBase.prototype.setPoints = function (key, points, pointIndex) {
- if (this.key !== key || this.pointIndex !== pointIndex) {
- this.key = key;
- this.points = points;
- this.pointIndex = pointIndex;
- this.raiseShow();
- }
- };
- ConnectionPointsVisualizerBase.prototype.setPointIndex = function (pointIndex) {
- if (0 <= pointIndex && pointIndex < this.points.length && this.pointIndex !== pointIndex) {
- this.pointIndex = pointIndex;
- this.raiseShow();
- }
- };
- ConnectionPointsVisualizerBase.prototype.update = function () {
- this.raiseShow();
- };
- ConnectionPointsVisualizerBase.prototype.reset = function () {
- if (this.key !== "-1") {
- this.key = "-1";
- this.points = [];
- this.pointIndex = -1;
- this.raiseHide();
- }
- };
- return ConnectionPointsVisualizerBase;
- }());
- exports.ConnectionPointsVisualizerBase = ConnectionPointsVisualizerBase;
- /***/ }),
- /* 68 */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- Object.defineProperty(exports, "__esModule", { value: true });
- var DeleteCommand_1 = __webpack_require__(100);
- var UndoCommand_1 = __webpack_require__(156);
- var RedoCommand_1 = __webpack_require__(157);
- var ImportCommand_1 = __webpack_require__(158);
- var ExportCommand_1 = __webpack_require__(159);
- var ToggleFontBoldCommand_1 = __webpack_require__(160);
- var ToggleFontItalicCommand_1 = __webpack_require__(161);
- var ToggleFontUnderlineCommand_1 = __webpack_require__(162);
- var ChangeFontNameCommand_1 = __webpack_require__(163);
- var ChangeFontSizeCommand_1 = __webpack_require__(164);
- var ChangeFontColorCommand_1 = __webpack_require__(165);
- var ChangeFillColorCommand_1 = __webpack_require__(166);
- var ChangeStrokeColorCommand_1 = __webpack_require__(167);
- var ImportDataSourceCommand_1 = __webpack_require__(168);
- var ChangeTextAlignCommand_1 = __webpack_require__(169);
- var ChangeConnectorLineEndingCommand_1 = __webpack_require__(170);
- var ChangeConnectorLineOptionCommand_1 = __webpack_require__(171);
- var SelectAllCommand_1 = __webpack_require__(172);
- var KeyCode_1 = __webpack_require__(16);
- var AutoLayoutTreeVerticalCommand_1 = __webpack_require__(173);
- var ChangeSnapToGridCommand_1 = __webpack_require__(174);
- var ChangeGridSizeCommand_1 = __webpack_require__(176);
- var ChangePageLandscapeCommand_1 = __webpack_require__(177);
- var ChangePageSizeCommand_1 = __webpack_require__(179);
- var ExportPngCommand_1 = __webpack_require__(181);
- var ExportSvgCommand_1 = __webpack_require__(185);
- var ExportJpgCommand_1 = __webpack_require__(186);
- var CopySelectionCommand_1 = __webpack_require__(187);
- var CutSelectionCommand_1 = __webpack_require__(188);
- var PasteSelectionCommand_1 = __webpack_require__(189);
- var ImportBPMNCommand_1 = __webpack_require__(192);
- var SendToBackCommand_1 = __webpack_require__(194);
- var BringToFrontCommand_1 = __webpack_require__(195);
- var AutoLayoutLayeredHorizontalCommand_1 = __webpack_require__(196);
- var MoveCommands_1 = __webpack_require__(197);
- var ChangeZoomLevelCommand_1 = __webpack_require__(198);
- var BindDocumentCommand_1 = __webpack_require__(199);
- var UnbindDocumentCommand_1 = __webpack_require__(201);
- var AutoLayoutTreeHorizontalCommand_1 = __webpack_require__(202);
- var AutoLayoutLayeredVerticalCommand_1 = __webpack_require__(203);
- var CloseDataSourceCommand_1 = __webpack_require__(204);
- var LockCommand_1 = __webpack_require__(205);
- var UnlockCommand_1 = __webpack_require__(207);
- var CloneCommand_1 = __webpack_require__(208);
- var ChangeUnitsCommand_1 = __webpack_require__(209);
- var ChangePageColorCommand_1 = __webpack_require__(210);
- var ChangeShowGridCommand_1 = __webpack_require__(211);
- var ToggleFullscreenCommand_1 = __webpack_require__(212);
- var DiagramCommand;
- (function (DiagramCommand) {
- DiagramCommand[DiagramCommand["Undo"] = 0] = "Undo";
- DiagramCommand[DiagramCommand["Redo"] = 1] = "Redo";
- DiagramCommand[DiagramCommand["Cut"] = 2] = "Cut";
- DiagramCommand[DiagramCommand["Copy"] = 3] = "Copy";
- DiagramCommand[DiagramCommand["Paste"] = 4] = "Paste";
- DiagramCommand[DiagramCommand["SelectAll"] = 5] = "SelectAll";
- DiagramCommand[DiagramCommand["Delete"] = 6] = "Delete";
- DiagramCommand[DiagramCommand["Import"] = 7] = "Import";
- DiagramCommand[DiagramCommand["ImportBPMN"] = 8] = "ImportBPMN";
- DiagramCommand[DiagramCommand["Export"] = 9] = "Export";
- DiagramCommand[DiagramCommand["ExportSvg"] = 10] = "ExportSvg";
- DiagramCommand[DiagramCommand["ExportPng"] = 11] = "ExportPng";
- DiagramCommand[DiagramCommand["ExportJpg"] = 12] = "ExportJpg";
- DiagramCommand[DiagramCommand["ImportDataSource"] = 13] = "ImportDataSource";
- DiagramCommand[DiagramCommand["CloseDataSource"] = 14] = "CloseDataSource";
- DiagramCommand[DiagramCommand["BindDocument"] = 15] = "BindDocument";
- DiagramCommand[DiagramCommand["UnbindDocument"] = 16] = "UnbindDocument";
- DiagramCommand[DiagramCommand["Bold"] = 17] = "Bold";
- DiagramCommand[DiagramCommand["Italic"] = 18] = "Italic";
- DiagramCommand[DiagramCommand["Underline"] = 19] = "Underline";
- DiagramCommand[DiagramCommand["FontName"] = 20] = "FontName";
- DiagramCommand[DiagramCommand["FontSize"] = 21] = "FontSize";
- DiagramCommand[DiagramCommand["FontColor"] = 22] = "FontColor";
- DiagramCommand[DiagramCommand["FillColor"] = 23] = "FillColor";
- DiagramCommand[DiagramCommand["StrokeColor"] = 24] = "StrokeColor";
- DiagramCommand[DiagramCommand["TextLeftAlign"] = 25] = "TextLeftAlign";
- DiagramCommand[DiagramCommand["TextCenterAlign"] = 26] = "TextCenterAlign";
- DiagramCommand[DiagramCommand["TextRightAlign"] = 27] = "TextRightAlign";
- DiagramCommand[DiagramCommand["ConnectorLineOption"] = 28] = "ConnectorLineOption";
- DiagramCommand[DiagramCommand["ConnectorStartLineEnding"] = 29] = "ConnectorStartLineEnding";
- DiagramCommand[DiagramCommand["ConnectorEndLineEnding"] = 30] = "ConnectorEndLineEnding";
- DiagramCommand[DiagramCommand["BringToFront"] = 31] = "BringToFront";
- DiagramCommand[DiagramCommand["SendToBack"] = 32] = "SendToBack";
- DiagramCommand[DiagramCommand["MoveLeft"] = 33] = "MoveLeft";
- DiagramCommand[DiagramCommand["MoveStepLeft"] = 34] = "MoveStepLeft";
- DiagramCommand[DiagramCommand["MoveRight"] = 35] = "MoveRight";
- DiagramCommand[DiagramCommand["MoveStepRight"] = 36] = "MoveStepRight";
- DiagramCommand[DiagramCommand["MoveUp"] = 37] = "MoveUp";
- DiagramCommand[DiagramCommand["MoveStepUp"] = 38] = "MoveStepUp";
- DiagramCommand[DiagramCommand["MoveDown"] = 39] = "MoveDown";
- DiagramCommand[DiagramCommand["MoveStepDown"] = 40] = "MoveStepDown";
- DiagramCommand[DiagramCommand["CloneLeft"] = 41] = "CloneLeft";
- DiagramCommand[DiagramCommand["CloneRight"] = 42] = "CloneRight";
- DiagramCommand[DiagramCommand["CloneUp"] = 43] = "CloneUp";
- DiagramCommand[DiagramCommand["CloneDown"] = 44] = "CloneDown";
- DiagramCommand[DiagramCommand["AutoLayoutTree"] = 45] = "AutoLayoutTree";
- DiagramCommand[DiagramCommand["AutoLayoutFlow"] = 46] = "AutoLayoutFlow";
- DiagramCommand[DiagramCommand["AutoLayoutTreeVertical"] = 47] = "AutoLayoutTreeVertical";
- DiagramCommand[DiagramCommand["AutoLayoutTreeHorizontal"] = 48] = "AutoLayoutTreeHorizontal";
- DiagramCommand[DiagramCommand["AutoLayoutLayeredVertical"] = 49] = "AutoLayoutLayeredVertical";
- DiagramCommand[DiagramCommand["AutoLayoutLayeredHorizontal"] = 50] = "AutoLayoutLayeredHorizontal";
- DiagramCommand[DiagramCommand["Lock"] = 51] = "Lock";
- DiagramCommand[DiagramCommand["Unlock"] = 52] = "Unlock";
- DiagramCommand[DiagramCommand["Units"] = 53] = "Units";
- DiagramCommand[DiagramCommand["PageSize"] = 54] = "PageSize";
- DiagramCommand[DiagramCommand["PageLandscape"] = 55] = "PageLandscape";
- DiagramCommand[DiagramCommand["PageColor"] = 56] = "PageColor";
- DiagramCommand[DiagramCommand["GridSize"] = 57] = "GridSize";
- DiagramCommand[DiagramCommand["ShowGrid"] = 58] = "ShowGrid";
- DiagramCommand[DiagramCommand["SnapToGrid"] = 59] = "SnapToGrid";
- DiagramCommand[DiagramCommand["ZoomLevel"] = 60] = "ZoomLevel";
- DiagramCommand[DiagramCommand["Fullscreen"] = 61] = "Fullscreen";
- })(DiagramCommand = exports.DiagramCommand || (exports.DiagramCommand = {}));
- var CommandManager = /** @class */ (function () {
- function CommandManager(control) {
- this.commands = {};
- this.shortcutsToCommand = {};
- this.lastCommandsChain = [];
- this.executingCommandsChain = [];
- this.executingCommandCounter = 0;
- this.isPublicApiCall = false;
- this.createCommand(control, DiagramCommand.Undo, UndoCommand_1.UndoCommand, KeyCode_1.ModifierKey.Ctrl | KeyCode_1.KeyCode.Key_z, KeyCode_1.ModifierKey.Meta | KeyCode_1.KeyCode.Key_z);
- this.createCommand(control, DiagramCommand.Redo, RedoCommand_1.RedoCommand, KeyCode_1.ModifierKey.Ctrl | KeyCode_1.KeyCode.Key_y, KeyCode_1.ModifierKey.Ctrl | KeyCode_1.ModifierKey.Shift | KeyCode_1.KeyCode.Key_z, KeyCode_1.ModifierKey.Meta | KeyCode_1.ModifierKey.Shift | KeyCode_1.KeyCode.Key_z);
- this.createCommand(control, DiagramCommand.Cut, CutSelectionCommand_1.CutSelectionCommand, KeyCode_1.KeyCode.Key_x | KeyCode_1.ModifierKey.Ctrl, KeyCode_1.KeyCode.Key_x | KeyCode_1.ModifierKey.Meta);
- this.createCommand(control, DiagramCommand.Copy, CopySelectionCommand_1.CopySelectionCommand, KeyCode_1.KeyCode.Key_c | KeyCode_1.ModifierKey.Ctrl, KeyCode_1.KeyCode.Key_c | KeyCode_1.ModifierKey.Meta);
- this.createCommand(control, DiagramCommand.Paste, PasteSelectionCommand_1.PasteSelectionCommand);
- this.createCommand(control, DiagramCommand.SelectAll, SelectAllCommand_1.SelectAllCommand, KeyCode_1.KeyCode.Key_a | KeyCode_1.ModifierKey.Ctrl, KeyCode_1.KeyCode.Key_a | KeyCode_1.ModifierKey.Meta);
- this.createCommand(control, DiagramCommand.Delete, DeleteCommand_1.DeleteCommand, KeyCode_1.KeyCode.Delete, KeyCode_1.KeyCode.Backspace);
- this.createCommand(control, DiagramCommand.Import, ImportCommand_1.ImportCommand);
- this.createCommand(control, DiagramCommand.ImportBPMN, ImportBPMNCommand_1.ImportBPMNCommand);
- this.createCommand(control, DiagramCommand.Export, ExportCommand_1.ExportCommand);
- this.createCommand(control, DiagramCommand.ExportSvg, ExportSvgCommand_1.ExportSvgCommand);
- this.createCommand(control, DiagramCommand.ExportPng, ExportPngCommand_1.ExportPngCommand);
- this.createCommand(control, DiagramCommand.ExportJpg, ExportJpgCommand_1.ExportJpgCommand);
- this.createCommand(control, DiagramCommand.ImportDataSource, ImportDataSourceCommand_1.ImportDataSourceCommand);
- this.createCommand(control, DiagramCommand.CloseDataSource, CloseDataSourceCommand_1.CloseDataSourceCommand);
- this.createCommand(control, DiagramCommand.BindDocument, BindDocumentCommand_1.BindDocumentCommand);
- this.createCommand(control, DiagramCommand.UnbindDocument, UnbindDocumentCommand_1.UnbindDocumentCommand);
- this.createCommand(control, DiagramCommand.Bold, ToggleFontBoldCommand_1.ToggleFontBoldCommand, KeyCode_1.ModifierKey.Ctrl | KeyCode_1.KeyCode.Key_b, KeyCode_1.ModifierKey.Meta | KeyCode_1.KeyCode.Key_b);
- this.createCommand(control, DiagramCommand.Italic, ToggleFontItalicCommand_1.ToggleFontItalicCommand, KeyCode_1.ModifierKey.Ctrl | KeyCode_1.KeyCode.Key_i, KeyCode_1.ModifierKey.Meta | KeyCode_1.KeyCode.Key_i);
- this.createCommand(control, DiagramCommand.Underline, ToggleFontUnderlineCommand_1.ToggleFontUnderlineCommand, KeyCode_1.ModifierKey.Ctrl | KeyCode_1.KeyCode.Key_u, KeyCode_1.ModifierKey.Meta | KeyCode_1.KeyCode.Key_u);
- this.createCommand(control, DiagramCommand.FontName, ChangeFontNameCommand_1.ChangeFontNameCommand);
- this.createCommand(control, DiagramCommand.FontSize, ChangeFontSizeCommand_1.ChangeFontSizeCommand);
- this.createCommand(control, DiagramCommand.FontColor, ChangeFontColorCommand_1.ChangeFontColorCommand);
- this.createCommand(control, DiagramCommand.FillColor, ChangeFillColorCommand_1.ChangeFillColorCommand);
- this.createCommand(control, DiagramCommand.StrokeColor, ChangeStrokeColorCommand_1.ChangeStrokeColorCommand);
- this.createCommand(control, DiagramCommand.TextLeftAlign, ChangeTextAlignCommand_1.TextLeftAlignCommand);
- this.createCommand(control, DiagramCommand.TextCenterAlign, ChangeTextAlignCommand_1.TextCenterAlignCommand);
- this.createCommand(control, DiagramCommand.TextRightAlign, ChangeTextAlignCommand_1.TextRightAlignCommand);
- this.createCommand(control, DiagramCommand.ConnectorLineOption, ChangeConnectorLineOptionCommand_1.ChangeConnectorLineOptionCommand);
- this.createCommand(control, DiagramCommand.ConnectorStartLineEnding, ChangeConnectorLineEndingCommand_1.ChangeConnectorStartLineEndingCommand);
- this.createCommand(control, DiagramCommand.ConnectorEndLineEnding, ChangeConnectorLineEndingCommand_1.ChangeConnectorEndLineEndingCommand);
- this.createCommand(control, DiagramCommand.BringToFront, BringToFrontCommand_1.BringToFrontCommand);
- this.createCommand(control, DiagramCommand.SendToBack, SendToBackCommand_1.SendToBackCommand);
- this.createCommand(control, DiagramCommand.MoveLeft, MoveCommands_1.MoveLeftCommand, KeyCode_1.ModifierKey.Shift | KeyCode_1.KeyCode.Left);
- this.createCommand(control, DiagramCommand.MoveStepLeft, MoveCommands_1.MoveStepLeftCommand, KeyCode_1.KeyCode.Left);
- this.createCommand(control, DiagramCommand.MoveRight, MoveCommands_1.MoveRightCommand, KeyCode_1.ModifierKey.Shift | KeyCode_1.KeyCode.Right);
- this.createCommand(control, DiagramCommand.MoveStepRight, MoveCommands_1.MoveStepRightCommand, KeyCode_1.KeyCode.Right);
- this.createCommand(control, DiagramCommand.MoveUp, MoveCommands_1.MoveUpCommand, KeyCode_1.ModifierKey.Shift | KeyCode_1.KeyCode.Up);
- this.createCommand(control, DiagramCommand.MoveStepUp, MoveCommands_1.MoveStepUpCommand, KeyCode_1.KeyCode.Up);
- this.createCommand(control, DiagramCommand.MoveDown, MoveCommands_1.MoveDownCommand, KeyCode_1.ModifierKey.Shift | KeyCode_1.KeyCode.Down);
- this.createCommand(control, DiagramCommand.MoveStepDown, MoveCommands_1.MoveStepDownCommand, KeyCode_1.KeyCode.Down);
- this.createCommand(control, DiagramCommand.CloneLeft, CloneCommand_1.CloneLeftCommand, KeyCode_1.ModifierKey.Ctrl | KeyCode_1.ModifierKey.Shift | KeyCode_1.KeyCode.Left);
- this.createCommand(control, DiagramCommand.CloneRight, CloneCommand_1.CloneRightCommand, KeyCode_1.ModifierKey.Ctrl | KeyCode_1.ModifierKey.Shift | KeyCode_1.KeyCode.Right);
- this.createCommand(control, DiagramCommand.CloneUp, CloneCommand_1.CloneUpCommand, KeyCode_1.ModifierKey.Ctrl | KeyCode_1.ModifierKey.Shift | KeyCode_1.KeyCode.Up);
- this.createCommand(control, DiagramCommand.CloneDown, CloneCommand_1.CloneDownCommand, KeyCode_1.ModifierKey.Ctrl | KeyCode_1.ModifierKey.Shift | KeyCode_1.KeyCode.Down);
- this.createCommand(control, DiagramCommand.Lock, LockCommand_1.LockCommand);
- this.createCommand(control, DiagramCommand.Unlock, UnlockCommand_1.UnLockCommand);
- this.createCommand(control, DiagramCommand.AutoLayoutTree, AutoLayoutTreeVerticalCommand_1.AutoLayoutTreeVerticalCommand); // TODO: remove after, need for BC
- this.createCommand(control, DiagramCommand.AutoLayoutFlow, AutoLayoutLayeredHorizontalCommand_1.AutoLayoutLayeredHorizontalCommand); // TODO: remove after, need for BC
- this.createCommand(control, DiagramCommand.Units, ChangeUnitsCommand_1.ChangeUnitsCommand);
- this.createCommand(control, DiagramCommand.PageSize, ChangePageSizeCommand_1.ChangePageSizeCommand);
- this.createCommand(control, DiagramCommand.PageLandscape, ChangePageLandscapeCommand_1.ChangePageLandscapeCommand);
- this.createCommand(control, DiagramCommand.PageColor, ChangePageColorCommand_1.ChangePageColorCommand);
- this.createCommand(control, DiagramCommand.GridSize, ChangeGridSizeCommand_1.ChangeGridSizeCommand);
- this.createCommand(control, DiagramCommand.ShowGrid, ChangeShowGridCommand_1.ChangeShowGridCommand);
- this.createCommand(control, DiagramCommand.SnapToGrid, ChangeSnapToGridCommand_1.ChangeSnapToGridCommand);
- this.createCommand(control, DiagramCommand.ZoomLevel, ChangeZoomLevelCommand_1.ChangeZoomLevelCommand);
- this.createCommand(control, DiagramCommand.AutoLayoutTreeVertical, AutoLayoutTreeVerticalCommand_1.AutoLayoutTreeVerticalCommand);
- this.createCommand(control, DiagramCommand.AutoLayoutTreeHorizontal, AutoLayoutTreeHorizontalCommand_1.AutoLayoutTreeHorizontalCommand); // Not Implemented
- this.createCommand(control, DiagramCommand.AutoLayoutLayeredVertical, AutoLayoutLayeredVerticalCommand_1.AutoLayoutLayeredVerticalCommand);
- this.createCommand(control, DiagramCommand.AutoLayoutLayeredHorizontal, AutoLayoutLayeredHorizontalCommand_1.AutoLayoutLayeredHorizontalCommand);
- this.createCommand(control, DiagramCommand.Fullscreen, ToggleFullscreenCommand_1.ToggleFullscreenCommand, KeyCode_1.KeyCode.F11);
- }
- CommandManager.prototype.getCommand = function (key) {
- return this.commands[key];
- };
- CommandManager.prototype.beforeExecuting = function (command) {
- this.executingCommandsChain.push(command);
- this.executingCommandCounter++;
- };
- CommandManager.prototype.afterExecuting = function () {
- this.executingCommandCounter--;
- if (this.executingCommandCounter === 0) {
- this.lastCommandsChain = this.executingCommandsChain;
- this.executingCommandsChain = [];
- }
- };
- CommandManager.prototype.assertLastExecutedCommandsChain = function (checkLength) {
- var types = [];
- for (var _i = 1; _i < arguments.length; _i++) {
- types[_i - 1] = arguments[_i];
- }
- if (checkLength && this.lastCommandsChain.length !== types.length)
- return false;
- for (var i = 0, type; type = types[i]; i++) {
- if (!this.lastCommandsChain[i] || !(this.lastCommandsChain[i] instanceof type))
- return false;
- }
- return true;
- };
- CommandManager.prototype.processShortcut = function (code) {
- var command = this.shortcutsToCommand[code];
- if (command)
- return command.execute();
- return false;
- };
- CommandManager.prototype.processPaste = function (clipboardData) {
- var command = this.getCommand(DiagramCommand.Paste);
- if (command)
- command.performPaste(clipboardData);
- return true;
- };
- // ISelectionChangesListener
- CommandManager.prototype.NotifySelectionChanged = function (_selection) {
- this.lastCommandsChain = [];
- };
- CommandManager.prototype.NotifyScrollPositionChanged = function () { };
- CommandManager.prototype.createCommand = function (control, commandId, commandType) {
- var shortcuts = [];
- for (var _i = 3; _i < arguments.length; _i++) {
- shortcuts[_i - 3] = arguments[_i];
- }
- this.commands[commandId] = new commandType(control);
- for (var i = 0; i < shortcuts.length; i++) {
- var shortcut = shortcuts[i];
- if (typeof shortcut === "number")
- this.shortcutsToCommand[shortcut] = this.commands[commandId];
- }
- };
- return CommandManager;
- }());
- exports.CommandManager = CommandManager;
- /***/ }),
- /* 69 */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- var __extends = (this && this.__extends) || (function () {
- var extendStatics = function (d, b) {
- extendStatics = Object.setPrototypeOf ||
- ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
- function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
- return extendStatics(d, b);
- };
- return function (d, b) {
- extendStatics(d, b);
- function __() { this.constructor = d; }
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
- };
- })();
- Object.defineProperty(exports, "__esModule", { value: true });
- var RenderManager_1 = __webpack_require__(10);
- var Primitive_1 = __webpack_require__(15);
- var LinePrimitive = /** @class */ (function (_super) {
- __extends(LinePrimitive, _super);
- function LinePrimitive(x1, y1, x2, y2, style, className, clipPathId, onApplyProperties) {
- var _this = _super.call(this, style, className, clipPathId, onApplyProperties) || this;
- _this.x1 = x1;
- _this.y1 = y1;
- _this.x2 = x2;
- _this.y2 = y2;
- return _this;
- }
- LinePrimitive.prototype.createMainElement = function () {
- return document.createElementNS(RenderManager_1.svgNS, "line");
- };
- LinePrimitive.prototype.applyElementProperties = function (element) {
- this.setUnitAttribute(element, "x1", this.x1);
- this.setUnitAttribute(element, "y1", this.y1);
- this.setUnitAttribute(element, "x2", this.x2);
- this.setUnitAttribute(element, "y2", this.y2);
- _super.prototype.applyElementProperties.call(this, element);
- };
- return LinePrimitive;
- }(Primitive_1.SvgPrimitive));
- exports.LinePrimitive = LinePrimitive;
- /***/ }),
- /* 70 */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- Object.defineProperty(exports, "__esModule", { value: true });
- var Browser_1 = __webpack_require__(20);
- var Base_1 = __webpack_require__(19);
- var TouchUIHelper = /** @class */ (function () {
- function TouchUIHelper() {
- }
- TouchUIHelper.onEventAttachingToDocument = function (eventName, func) {
- if (Browser_1.Browser.MacOSMobilePlatform && TouchUIHelper.isTouchEventName(eventName)) {
- if (!TouchUIHelper.documentTouchHandlers[eventName])
- TouchUIHelper.documentTouchHandlers[eventName] = [];
- TouchUIHelper.documentTouchHandlers[eventName].push(func);
- return TouchUIHelper.documentEventAttachingAllowed;
- }
- return true;
- };
- TouchUIHelper.isTouchEventName = function (eventName) {
- return Browser_1.Browser.WebKitTouchUI && (eventName.indexOf("touch") > -1 || eventName.indexOf("gesture") > -1);
- };
- TouchUIHelper.isTouchEvent = function (evt) {
- if (!evt)
- return false;
- return Browser_1.Browser.WebKitTouchUI && Base_1.IsExists(evt.changedTouches);
- };
- TouchUIHelper.getEventX = function (evt) {
- return Browser_1.Browser.IE ? evt.pageX : evt.changedTouches[0].pageX;
- };
- TouchUIHelper.getEventY = function (evt) {
- return Browser_1.Browser.IE ? evt.pageY : evt.changedTouches[0].pageY;
- };
- TouchUIHelper.touchMouseDownEventName = Browser_1.Browser.WebKitTouchUI ? "touchstart" : (Browser_1.Browser.Edge && Browser_1.Browser.MSTouchUI && window.PointerEvent ? "pointerdown" : "mousedown");
- TouchUIHelper.touchMouseUpEventName = Browser_1.Browser.WebKitTouchUI ? "touchend" : (Browser_1.Browser.Edge && Browser_1.Browser.MSTouchUI && window.PointerEvent ? "pointerup" : "mouseup");
- TouchUIHelper.touchMouseMoveEventName = Browser_1.Browser.WebKitTouchUI ? "touchmove" : (Browser_1.Browser.Edge && Browser_1.Browser.MSTouchUI && window.PointerEvent ? "pointermove" : "mousemove");
- TouchUIHelper.msTouchDraggableClassName = "dxMSTouchDraggable";
- TouchUIHelper.documentTouchHandlers = {};
- TouchUIHelper.documentEventAttachingAllowed = true;
- return TouchUIHelper;
- }());
- exports.TouchUIHelper = TouchUIHelper;
- //export class TouchUIHelper {
- // isGesture: false;
- // isMouseEventFromScrolling: false;
- // isNativeScrollingAllowed: true;
- // clickSensetivity: 10;
- // documentTouchHandlers: {};
- // documentEventAttachingAllowed: true;
- // isTouchEvent(evt) {
- // if (!evt)
- // return false;
- // return ASPx.Browser.WebKitTouchUI && ASPx.IsExists(evt.changedTouches);
- // }
- // getEventX(evt) {
- // return ASPx.Browser.IE ? evt.pageX : evt.changedTouches[0].pageX;
- // }
- // getEventY (evt) {
- // return ASPx.Browser.IE ? evt.pageY : evt.changedTouches[0].pageY;
- // }
- // getWebkitMajorVersion() {
- // if (!this.webkitMajorVersion) {
- // var regExp = new RegExp("applewebkit/(\\d+)", "i");
- // var matches = regExp.exec(ASPx.Browser.UserAgent);
- // if (matches && matches.index >= 1)
- // this.webkitMajorVersion = matches[1];
- // }
- // return this.webkitMajorVersion;
- // }
- // getIsLandscapeOrientation() {
- // if (ASPx.Browser.MacOSMobilePlatform || ASPx.Browser.AndroidMobilePlatform)
- // return Math.abs(window.orientation) == 90;
- // return ASPx.GetDocumentClientWidth() > ASPx.GetDocumentClientHeight();
- // }
- // nativeScrollingSupported() {
- // var allowedSafariVersion = ASPx.Browser.Version >= 5.1 && ASPx.Browser.Version < 8; //T250059
- // var allowedWebKitVersion = this.getWebkitMajorVersion() > 533 && (ASPx.Browser.Chrome || this.getWebkitMajorVersion() < 600);
- // return (ASPx.Browser.MacOSMobilePlatform && (allowedSafariVersion || allowedWebKitVersion))
- // || (ASPx.Browser.AndroidMobilePlatform && ASPx.Browser.PlaformMajorVersion >= 3) || (ASPx.Browser.MSTouchUI && (!ASPx.Browser.WindowsPhonePlatform || !ASPx.Browser.IE));
- // }
- // makeScrollableIfRequired(element, options) {
- // if (ASPx.Browser.WebKitTouchUI && element) {
- // var overflow = ASPx.GetCurrentStyle(element).overflow;
- // if (element.tagName == "DIV" && overflow != "hidden" && overflow != "visible") {
- // return this.MakeScrollable(element);
- // }
- // }
- // }
- // preventScrollOnEvent(evt) {
- // }
- // handleFastTapIfRequired(evt, action, preventCommonClickEvents) {
- // if (ASPx.Browser.WebKitTouchUI && evt.type == 'touchstart' && action) {
- // this.FastTapHelper.HandleFastTap(evt, action, preventCommonClickEvents);
- // return true;
- // }
- // return false;
- // }
- // ensureDocumentSizesCorrect () {
- // return (document.documentElement.clientWidth - document.documentElement.clientHeight) / (screen.width - screen.height) > 0;
- // }
- // ensureOrientationChanged(onOrientationChangedFunction) {
- // if (ASPxClientUtils.iOSPlatform || this.ensureDocumentSizesCorrect())
- // onOrientationChangedFunction();
- // else {
- // window.setTimeout(function () {
- // this.ensureOrientationChanged(onOrientationChangedFunction);
- // }.aspxBind(this), 100);
- // }
- // }
- // onEventAttachingToDocument(eventName, func) {
- // if (ASPx.Browser.MacOSMobilePlatform && this.isTouchEventName(eventName)) {
- // if (!this.documentTouchHandlers[eventName])
- // this.documentTouchHandlers[eventName] = [];
- // this.documentTouchHandlers[eventName].push(func);
- // return this.documentEventAttachingAllowed;
- // }
- // return true;
- // }
- // onEventDettachedFromDocument(eventName, func) {
- // if (ASPx.Browser.MacOSMobilePlatform && this.isTouchEventName(eventName)) {
- // var handlers = this.documentTouchHandlers[eventName];
- // if (handlers)
- // ASPx.Data.ArrayRemove(handlers, func);
- // }
- // }
- // processDocumentTouchEventHandlers(proc) {
- // var touchEventNames = ["touchstart", "touchend", "touchmove", "gesturestart", "gestureend"];
- // for (var i = 0; i < touchEventNames.length; i++) {
- // var eventName = touchEventNames[i];
- // var handlers = this.documentTouchHandlers[eventName];
- // if (handlers) {
- // for (var j = 0; j < handlers.length; j++) {
- // proc(eventName, handlers[j]);
- // }
- // }
- // }
- // }
- // removeDocumentTouchEventHandlers() {
- // if (ASPx.Browser.MacOSMobilePlatform) {
- // this.documentEventAttachingAllowed = false;
- // this.processDocumentTouchEventHandlers(ASPx.Evt.DetachEventFromDocumentCore);
- // }
- // }
- // restoreDocumentTouchEventHandlers () {
- // if (ASPx.Browser.MacOSMobilePlatform) {
- // this.documentEventAttachingAllowed = true;
- // this.processDocumentTouchEventHandlers(ASPx.Evt.AttachEventToDocumentCore);
- // }
- // }
- // IsNativeScrolling() {
- // return TouchUIHelper.nativeScrollingSupported() && TouchUIHelper.isNativeScrollingAllowed;
- // }
- // pointerEnabled: !!(window.PointerEvent || window.MSPointerEvent);
- // pointerDownEventName: window.PointerEvent ? "pointerdown" : "MSPointerDown",
- // pointerUpEventName: window.PointerEvent ? "pointerup" : "MSPointerUp",
- // pointerCancelEventName: window.PointerEvent ? "pointercancel" : "MSPointerCancel",
- // pointerMoveEventName: window.PointerEvent ? "pointermove" : "MSPointerMove",
- // pointerOverEventName: window.PointerEvent ? "pointerover" : "MSPointerOver",
- // pointerOutEventName: window.PointerEvent ? "pointerout" : "MSPointerOut",
- // pointerType: {
- // Touch: (ASPx.Browser.IE && ASPx.Browser.Version == 10) ? 2 : "touch",
- // Pen: (ASPx.Browser.IE && ASPx.Browser.Version == 10) ? 3 : "pen",
- // Mouse: (ASPx.Browser.IE && ASPx.Browser.Version == 10) ? 4 : "mouse"
- // }
- // msGestureEnabled: !!(window.PointerEvent || window.MSPointerEvent) && typeof (MSGesture) != "undefined";
- // msTouchCreateGesturesWrapper(element, onTap) {
- // if (!TouchUIHelper.msGestureEnabled)
- // return;
- // var gesture = new MSGesture();
- // gesture.target = element;
- // ASPx.Evt.AttachEventToElement(element, TouchUIHelper.pointerDownEventName, function (evt) {
- // gesture.addPointer(evt.pointerId);
- // });
- // ASPx.Evt.AttachEventToElement(element, TouchUIHelper.pointerUpEventName, function (evt) {
- // gesture.stop();
- // });
- // if (onTap)
- // ASPx.Evt.AttachEventToElement(element, "MSGestureTap", onTap);
- // return gesture;
- // }
- //}
- /***/ }),
- /* 71 */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- Object.defineProperty(exports, "__esModule", { value: true });
- var ConnectorPointsCalculatorBase = /** @class */ (function () {
- function ConnectorPointsCalculatorBase(connector) {
- this.connector = connector;
- }
- return ConnectorPointsCalculatorBase;
- }());
- exports.ConnectorPointsCalculatorBase = ConnectorPointsCalculatorBase;
- /***/ }),
- /* 72 */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- var __extends = (this && this.__extends) || (function () {
- var extendStatics = function (d, b) {
- extendStatics = Object.setPrototypeOf ||
- ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
- function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
- return extendStatics(d, b);
- };
- return function (d, b) {
- extendStatics(d, b);
- function __() { this.constructor = d; }
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
- };
- })();
- Object.defineProperty(exports, "__esModule", { value: true });
- var RenderManager_1 = __webpack_require__(10);
- var FilterPrimitive_1 = __webpack_require__(113);
- var Model_1 = __webpack_require__(21);
- var TextFilterPrimitive = /** @class */ (function (_super) {
- __extends(TextFilterPrimitive, _super);
- function TextFilterPrimitive(id, useFloodColor, x, y, width, height) {
- if (useFloodColor === void 0) { useFloodColor = true; }
- if (x === void 0) { x = "-0.05"; }
- if (y === void 0) { y = "-0.05"; }
- if (width === void 0) { width = "1.1"; }
- if (height === void 0) { height = "1.1"; }
- var _this = _super.call(this, id, x, y, width, height) || this;
- _this.id = id;
- _this.useFloodColor = useFloodColor;
- _this.x = x;
- _this.y = y;
- _this.width = width;
- _this.height = height;
- return _this;
- }
- TextFilterPrimitive.prototype.createChildElements = function (parent) {
- var floodColor = this.getFloodColor(parent.parentElement);
- var feFlood = document.createElementNS(RenderManager_1.svgNS, "feFlood");
- if (this.useFloodColor) {
- feFlood.setAttribute("flood-color", floodColor);
- feFlood.setAttribute("class", "text-filter-flood");
- if (floodColor !== Model_1.DiagramModel.defaultPageColor)
- feFlood.style.setProperty("flood-color", floodColor);
- }
- parent.appendChild(feFlood);
- var feComposite = document.createElementNS(RenderManager_1.svgNS, "feComposite");
- feComposite.setAttribute("in", "SourceGraphic");
- feComposite.setAttribute("operator", "atop");
- parent.appendChild(feComposite);
- };
- TextFilterPrimitive.prototype.getFloodColor = function (element) {
- while (element != null) {
- if (element.tagName == "BODY" || element.nodeName == "#document")
- break;
- if (element.tagName === "svg" && element.style.backgroundColor !== "")
- return element.style.backgroundColor;
- element = element.parentNode;
- }
- return Model_1.DiagramModel.defaultPageColor;
- };
- return TextFilterPrimitive;
- }(FilterPrimitive_1.FilterPrimitive));
- exports.TextFilterPrimitive = TextFilterPrimitive;
- /***/ }),
- /* 73 */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- var __extends = (this && this.__extends) || (function () {
- var extendStatics = function (d, b) {
- extendStatics = Object.setPrototypeOf ||
- ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
- function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
- return extendStatics(d, b);
- };
- return function (d, b) {
- extendStatics(d, b);
- function __() { this.constructor = d; }
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
- };
- })();
- Object.defineProperty(exports, "__esModule", { value: true });
- var HistoryItem_1 = __webpack_require__(4);
- var Connector_1 = __webpack_require__(5);
- var DeleteConnectionHistoryItem = /** @class */ (function (_super) {
- __extends(DeleteConnectionHistoryItem, _super);
- function DeleteConnectionHistoryItem(connector, position) {
- var _this = _super.call(this) || this;
- _this.connectorKey = connector.key;
- _this.position = position;
- _this.itemKey = connector.getExtremeItem(_this.position).key;
- return _this;
- }
- DeleteConnectionHistoryItem.prototype.redo = function (manipulator) {
- var connector = manipulator.model.findConnector(this.connectorKey);
- this.oldConnectionPointIndex = this.position === Connector_1.ConnectorPosition.Begin ? connector.beginConnectionPointIndex : connector.endConnectionPointIndex;
- manipulator.deleteConnection(connector, this.position);
- };
- DeleteConnectionHistoryItem.prototype.undo = function (manipulator) {
- var connector = manipulator.model.findConnector(this.connectorKey);
- var item = manipulator.model.findItem(this.itemKey);
- manipulator.addConnection(connector, item, this.oldConnectionPointIndex, this.position);
- };
- return DeleteConnectionHistoryItem;
- }(HistoryItem_1.HistoryItem));
- exports.DeleteConnectionHistoryItem = DeleteConnectionHistoryItem;
- /***/ }),
- /* 74 */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- var __extends = (this && this.__extends) || (function () {
- var extendStatics = function (d, b) {
- extendStatics = Object.setPrototypeOf ||
- ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
- function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
- return extendStatics(d, b);
- };
- return function (d, b) {
- extendStatics(d, b);
- function __() { this.constructor = d; }
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
- };
- })();
- Object.defineProperty(exports, "__esModule", { value: true });
- var HistoryItem_1 = __webpack_require__(4);
- var DeleteShapeHistoryItem = /** @class */ (function (_super) {
- __extends(DeleteShapeHistoryItem, _super);
- function DeleteShapeHistoryItem(shapeKey) {
- var _this = _super.call(this) || this;
- _this.shapeKey = shapeKey;
- return _this;
- }
- DeleteShapeHistoryItem.prototype.redo = function (manipulator) {
- var shape = manipulator.model.findShape(this.shapeKey);
- this.shape = shape.clone();
- manipulator.deleteShape(shape);
- };
- DeleteShapeHistoryItem.prototype.undo = function (manipulator) {
- manipulator.addShape(this.shape, this.shape.key);
- };
- return DeleteShapeHistoryItem;
- }(HistoryItem_1.HistoryItem));
- exports.DeleteShapeHistoryItem = DeleteShapeHistoryItem;
- /***/ }),
- /* 75 */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- var __extends = (this && this.__extends) || (function () {
- var extendStatics = function (d, b) {
- extendStatics = Object.setPrototypeOf ||
- ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
- function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
- return extendStatics(d, b);
- };
- return function (d, b) {
- extendStatics(d, b);
- function __() { this.constructor = d; }
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
- };
- })();
- Object.defineProperty(exports, "__esModule", { value: true });
- var ShapeDescription_1 = __webpack_require__(11);
- var PathPrimitive_1 = __webpack_require__(2);
- var ShapeType_1 = __webpack_require__(1);
- var DiamondShapeDescription = /** @class */ (function (_super) {
- __extends(DiamondShapeDescription, _super);
- function DiamondShapeDescription(title, defaultText, defaultSize) {
- if (title === void 0) { title = "Diamond"; }
- if (defaultText === void 0) { defaultText = ""; }
- if (defaultSize === void 0) { defaultSize = ShapeDescription_1.ShapeDefaultSize.clone(); }
- return _super.call(this, title, defaultText, defaultSize) || this;
- }
- Object.defineProperty(DiamondShapeDescription.prototype, "key", {
- get: function () { return ShapeType_1.ShapeType.Diamond; },
- enumerable: true,
- configurable: true
- });
- Object.defineProperty(DiamondShapeDescription.prototype, "category", {
- get: function () { return ShapeType_1.ShapeCategory.General; },
- enumerable: true,
- configurable: true
- });
- DiamondShapeDescription.prototype.createPrimitives = function (shape) {
- var rect = shape.rectangle;
- var left = rect.left, top = rect.top, right = rect.right, bottom = rect.bottom;
- var _a = rect.center, cx = _a.x, cy = _a.y;
- var primitives = [];
- return primitives.concat([
- new PathPrimitive_1.PathPrimitive([
- new PathPrimitive_1.PathPrimitiveMoveToCommand(cx, top),
- new PathPrimitive_1.PathPrimitiveLineToCommand(right, cy),
- new PathPrimitive_1.PathPrimitiveLineToCommand(cx, bottom),
- new PathPrimitive_1.PathPrimitiveLineToCommand(left, cy),
- new PathPrimitive_1.PathPrimitiveClosePathCommand()
- ], shape.style)
- ])
- .concat(this.createTextPrimitives(shape));
- };
- return DiamondShapeDescription;
- }(ShapeDescription_1.ShapeDescription));
- exports.DiamondShapeDescription = DiamondShapeDescription;
- /***/ }),
- /* 76 */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- var __extends = (this && this.__extends) || (function () {
- var extendStatics = function (d, b) {
- extendStatics = Object.setPrototypeOf ||
- ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
- function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
- return extendStatics(d, b);
- };
- return function (d, b) {
- extendStatics(d, b);
- function __() { this.constructor = d; }
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
- };
- })();
- Object.defineProperty(exports, "__esModule", { value: true });
- var ShapeDescription_1 = __webpack_require__(11);
- var Utils_1 = __webpack_require__(0);
- var ShapeType_1 = __webpack_require__(1);
- var TextShapeDescription = /** @class */ (function (_super) {
- __extends(TextShapeDescription, _super);
- function TextShapeDescription() {
- return _super.call(this, "Text", "Text", new Utils_1.Size(ShapeDescription_1.ShapeDefaultDimension, ShapeDescription_1.ShapeDefaultDimension * 0.5)) || this;
- }
- Object.defineProperty(TextShapeDescription.prototype, "key", {
- get: function () { return ShapeType_1.ShapeType.Text; },
- enumerable: true,
- configurable: true
- });
- Object.defineProperty(TextShapeDescription.prototype, "category", {
- get: function () { return ShapeType_1.ShapeCategory.General; },
- enumerable: true,
- configurable: true
- });
- TextShapeDescription.prototype.createPrimitives = function (shape, forToolbox) {
- return this.createTextPrimitives(shape, forToolbox);
- };
- return TextShapeDescription;
- }(ShapeDescription_1.ShapeDescription));
- exports.TextShapeDescription = TextShapeDescription;
- /***/ }),
- /* 77 */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- var __extends = (this && this.__extends) || (function () {
- var extendStatics = function (d, b) {
- extendStatics = Object.setPrototypeOf ||
- ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
- function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
- return extendStatics(d, b);
- };
- return function (d, b) {
- extendStatics(d, b);
- function __() { this.constructor = d; }
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
- };
- })();
- Object.defineProperty(exports, "__esModule", { value: true });
- var PathPrimitive_1 = __webpack_require__(2);
- var ShapeType_1 = __webpack_require__(1);
- var PolygonShapeDescription_1 = __webpack_require__(57);
- var DiagramItem_1 = __webpack_require__(3);
- var PentagonShapeDescription = /** @class */ (function (_super) {
- __extends(PentagonShapeDescription, _super);
- function PentagonShapeDescription(title, defaultText) {
- if (title === void 0) { title = "Pentagon"; }
- if (defaultText === void 0) { defaultText = ""; }
- var _this = _super.call(this, title, defaultText) || this;
- _this.defaultRatio = _this.defaultSize.height / _this.defaultSize.width;
- return _this;
- }
- Object.defineProperty(PentagonShapeDescription.prototype, "key", {
- get: function () { return ShapeType_1.ShapeType.Pentagon; },
- enumerable: true,
- configurable: true
- });
- Object.defineProperty(PentagonShapeDescription.prototype, "angleCount", {
- get: function () { return 5; },
- enumerable: true,
- configurable: true
- });
- PentagonShapeDescription.prototype.createPrimitives = function (shape) {
- var rect = shape.rectangle;
- var left = rect.left, top = rect.top, right = rect.right, bottom = rect.bottom, width = rect.width, height = rect.height;
- var cx = rect.center.x;
- var ratio = height / width / this.defaultRatio;
- var angle = Math.PI - this.angle;
- var py = width / 2 * Math.tan(angle / 2) * ratio;
- var y = top + py;
- var px = (height - py) / Math.tan(angle) / ratio;
- var x1 = left + px;
- var x2 = right - px;
- var primitives = [];
- return primitives.concat([
- new PathPrimitive_1.PathPrimitive([
- new PathPrimitive_1.PathPrimitiveMoveToCommand(cx, top),
- new PathPrimitive_1.PathPrimitiveLineToCommand(right, y),
- new PathPrimitive_1.PathPrimitiveLineToCommand(x2, bottom),
- new PathPrimitive_1.PathPrimitiveLineToCommand(x1, bottom),
- new PathPrimitive_1.PathPrimitiveLineToCommand(left, y),
- new PathPrimitive_1.PathPrimitiveClosePathCommand()
- ], shape.style)
- ])
- .concat(this.createTextPrimitives(shape));
- };
- PentagonShapeDescription.prototype.processConnectionPoint = function (shape, point, index) {
- var side = shape.getConnectionPointSide(index);
- if (side === DiagramItem_1.ConnectionPointSide.East || side === DiagramItem_1.ConnectionPointSide.West) {
- var rect = shape.rectangle;
- var top_1 = rect.top, width = rect.width, height = rect.height;
- var ratio = height / width / this.defaultRatio;
- var angle = Math.PI - this.angle;
- var py = width / 2 * Math.tan(angle / 2) * ratio;
- var y = top_1 + py;
- if (side === DiagramItem_1.ConnectionPointSide.East)
- point.y = y;
- else if (side === DiagramItem_1.ConnectionPointSide.West)
- point.y = y;
- }
- };
- PentagonShapeDescription.prototype.calculateHeight = function (width) {
- var angle = Math.PI - this.angle;
- var h1 = width / 2 * Math.tan(angle / 2);
- var side = width / 2 / Math.cos(angle / 2);
- var h2 = side * Math.sin(angle);
- return h1 + h2;
- };
- return PentagonShapeDescription;
- }(PolygonShapeDescription_1.PolygonShapeDescription));
- exports.PentagonShapeDescription = PentagonShapeDescription;
- /***/ }),
- /* 78 */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- var __extends = (this && this.__extends) || (function () {
- var extendStatics = function (d, b) {
- extendStatics = Object.setPrototypeOf ||
- ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
- function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
- return extendStatics(d, b);
- };
- return function (d, b) {
- extendStatics(d, b);
- function __() { this.constructor = d; }
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
- };
- })();
- Object.defineProperty(exports, "__esModule", { value: true });
- var PathPrimitive_1 = __webpack_require__(2);
- var ShapeType_1 = __webpack_require__(1);
- var PolygonShapeDescription_1 = __webpack_require__(57);
- var HexagonShapeDescription = /** @class */ (function (_super) {
- __extends(HexagonShapeDescription, _super);
- function HexagonShapeDescription(title, defaultText) {
- if (title === void 0) { title = "Hexagon"; }
- if (defaultText === void 0) { defaultText = ""; }
- return _super.call(this, title, defaultText) || this;
- }
- Object.defineProperty(HexagonShapeDescription.prototype, "key", {
- get: function () { return ShapeType_1.ShapeType.Hexagon; },
- enumerable: true,
- configurable: true
- });
- Object.defineProperty(HexagonShapeDescription.prototype, "angleCount", {
- get: function () { return 6; },
- enumerable: true,
- configurable: true
- });
- HexagonShapeDescription.prototype.createPrimitives = function (shape) {
- var rect = shape.rectangle;
- var left = rect.left, top = rect.top, right = rect.right, bottom = rect.bottom, width = rect.width, height = rect.height;
- var cy = rect.center.y;
- var angle = Math.PI - this.angle;
- var sideX = width / (1 + 2 * Math.cos(angle));
- var x1 = left + (width - sideX) / 2;
- var x2 = x1 + sideX;
- var primitives = [];
- return primitives.concat([
- new PathPrimitive_1.PathPrimitive([
- new PathPrimitive_1.PathPrimitiveMoveToCommand(x1, top),
- new PathPrimitive_1.PathPrimitiveLineToCommand(x2, top),
- new PathPrimitive_1.PathPrimitiveLineToCommand(right, cy),
- new PathPrimitive_1.PathPrimitiveLineToCommand(x2, bottom),
- new PathPrimitive_1.PathPrimitiveLineToCommand(x1, bottom),
- new PathPrimitive_1.PathPrimitiveLineToCommand(left, cy),
- new PathPrimitive_1.PathPrimitiveClosePathCommand()
- ], shape.style)
- ])
- .concat(this.createTextPrimitives(shape));
- };
- HexagonShapeDescription.prototype.calculateHeight = function (width) {
- var angle = Math.PI - this.angle;
- var sideX = width / (1 + 2 * Math.cos(angle));
- return 2 * sideX * Math.sin(angle);
- };
- return HexagonShapeDescription;
- }(PolygonShapeDescription_1.PolygonShapeDescription));
- exports.HexagonShapeDescription = HexagonShapeDescription;
- /***/ }),
- /* 79 */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- var __extends = (this && this.__extends) || (function () {
- var extendStatics = function (d, b) {
- extendStatics = Object.setPrototypeOf ||
- ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
- function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
- return extendStatics(d, b);
- };
- return function (d, b) {
- extendStatics(d, b);
- function __() { this.constructor = d; }
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
- };
- })();
- Object.defineProperty(exports, "__esModule", { value: true });
- var ShapeDescription_1 = __webpack_require__(11);
- var PathPrimitive_1 = __webpack_require__(2);
- var ShapeType_1 = __webpack_require__(1);
- var ConnectionPoint_1 = __webpack_require__(32);
- var DiagramItem_1 = __webpack_require__(3);
- var TriangleShapeDescription = /** @class */ (function (_super) {
- __extends(TriangleShapeDescription, _super);
- function TriangleShapeDescription(title, defaultText) {
- if (title === void 0) { title = "Triangle"; }
- if (defaultText === void 0) { defaultText = ""; }
- var _this = _super.call(this, title, defaultText) || this;
- _this.defaultSize.height = _this.calculateHeight(ShapeDescription_1.ShapeDefaultDimension);
- return _this;
- }
- Object.defineProperty(TriangleShapeDescription.prototype, "key", {
- get: function () { return ShapeType_1.ShapeType.Triangle; },
- enumerable: true,
- configurable: true
- });
- Object.defineProperty(TriangleShapeDescription.prototype, "category", {
- get: function () { return ShapeType_1.ShapeCategory.General; },
- enumerable: true,
- configurable: true
- });
- TriangleShapeDescription.prototype.createConnectionPoints = function () {
- return [
- new ConnectionPoint_1.ConnectionPoint(0.5, 0, DiagramItem_1.ConnectionPointSide.North),
- new ConnectionPoint_1.ConnectionPoint(0.75, 0.5, DiagramItem_1.ConnectionPointSide.East),
- new ConnectionPoint_1.ConnectionPoint(0.5, 1, DiagramItem_1.ConnectionPointSide.South),
- new ConnectionPoint_1.ConnectionPoint(0.25, 0.5, DiagramItem_1.ConnectionPointSide.West)
- ];
- };
- TriangleShapeDescription.prototype.createPrimitives = function (shape) {
- var rect = shape.rectangle;
- var left = rect.left, top = rect.top, right = rect.right, bottom = rect.bottom;
- var primitives = [];
- return primitives.concat([
- new PathPrimitive_1.PathPrimitive([
- new PathPrimitive_1.PathPrimitiveMoveToCommand(rect.center.x, top),
- new PathPrimitive_1.PathPrimitiveLineToCommand(right, bottom),
- new PathPrimitive_1.PathPrimitiveLineToCommand(left, bottom),
- new PathPrimitive_1.PathPrimitiveClosePathCommand()
- ], shape.style)
- ])
- .concat(this.createTextPrimitives(shape));
- };
- TriangleShapeDescription.prototype.calculateHeight = function (width) {
- return Math.sqrt(Math.pow(width, 2) - Math.pow(width / 2, 2));
- };
- return TriangleShapeDescription;
- }(ShapeDescription_1.ShapeDescription));
- exports.TriangleShapeDescription = TriangleShapeDescription;
- /***/ }),
- /* 80 */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- var __extends = (this && this.__extends) || (function () {
- var extendStatics = function (d, b) {
- extendStatics = Object.setPrototypeOf ||
- ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
- function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
- return extendStatics(d, b);
- };
- return function (d, b) {
- extendStatics(d, b);
- function __() { this.constructor = d; }
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
- };
- })();
- Object.defineProperty(exports, "__esModule", { value: true });
- var RectangleShapeDescription_1 = __webpack_require__(12);
- var ShapeType_1 = __webpack_require__(1);
- var PathPrimitive_1 = __webpack_require__(2);
- var DiagramItem_1 = __webpack_require__(3);
- var DocumentShapeDescription = /** @class */ (function (_super) {
- __extends(DocumentShapeDescription, _super);
- function DocumentShapeDescription(title, defaultText) {
- if (title === void 0) { title = "Document"; }
- if (defaultText === void 0) { defaultText = "Document"; }
- return _super.call(this, title, defaultText) || this;
- }
- Object.defineProperty(DocumentShapeDescription.prototype, "key", {
- get: function () { return ShapeType_1.ShapeType.Document; },
- enumerable: true,
- configurable: true
- });
- Object.defineProperty(DocumentShapeDescription.prototype, "category", {
- get: function () { return ShapeType_1.ShapeCategory.Flowchart; },
- enumerable: true,
- configurable: true
- });
- DocumentShapeDescription.prototype.createPrimitives = function (shape) {
- var primitives = [];
- return primitives
- .concat(this.createDocumentPrimitives(shape.rectangle, shape.style))
- .concat(this.createTextPrimitives(shape));
- };
- DocumentShapeDescription.prototype.createDocumentPrimitives = function (rect, style) {
- var left = rect.left, top = rect.top, right = rect.right, bottom = rect.bottom, width = rect.width, height = rect.height;
- var cx = rect.center.x;
- var dy = height * DocumentShapeDescription.curveOffsetRatio;
- var primitives = [];
- return primitives.concat([
- new PathPrimitive_1.PathPrimitive([
- new PathPrimitive_1.PathPrimitiveMoveToCommand(left, top),
- new PathPrimitive_1.PathPrimitiveLineToCommand(right, top),
- new PathPrimitive_1.PathPrimitiveLineToCommand(right, bottom),
- new PathPrimitive_1.PathPrimitiveQuadraticCurveToCommand(right - width * 0.25, bottom - 2 * dy, cx, bottom - dy),
- new PathPrimitive_1.PathPrimitiveQuadraticCurveToCommand(left + width * 0.25, bottom + dy, left, bottom - dy),
- new PathPrimitive_1.PathPrimitiveClosePathCommand()
- ], style)
- ]);
- };
- DocumentShapeDescription.prototype.processConnectionPoint = function (shape, point, index) {
- var side = shape.getConnectionPointSide(index);
- if (side === DiagramItem_1.ConnectionPointSide.South)
- point.y -= shape.size.height * DocumentShapeDescription.curveOffsetRatio;
- };
- DocumentShapeDescription.prototype.getTextRectangle = function (rect) {
- return rect.resize(0, -rect.height * DocumentShapeDescription.curveOffsetRatio);
- };
- DocumentShapeDescription.curveOffsetRatio = 0.1;
- return DocumentShapeDescription;
- }(RectangleShapeDescription_1.RectangleShapeDescription));
- exports.DocumentShapeDescription = DocumentShapeDescription;
- /***/ }),
- /* 81 */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- Object.defineProperty(exports, "__esModule", { value: true });
- var Utils_1 = __webpack_require__(0);
- var NodeLayout_1 = __webpack_require__(39);
- var GraphLayout = /** @class */ (function () {
- function GraphLayout() {
- this.nodeKeys = [];
- this.nodeToLayout = {};
- this.edgeToPosition = {};
- }
- GraphLayout.prototype.forEachNode = function (callback) {
- var _this = this;
- this.nodeKeys.forEach(function (nk) { return callback(_this.nodeToLayout[nk], nk); });
- };
- GraphLayout.prototype.addNode = function (nodeLayout) {
- if (this.nodeToLayout[nodeLayout.key])
- throw Error("Node layout is already registered");
- this.nodeKeys.push(nodeLayout.key);
- this.nodeToLayout[nodeLayout.key] = nodeLayout;
- };
- GraphLayout.prototype.addEdge = function (edgeLayout) {
- if (this.edgeToPosition[edgeLayout.key])
- throw Error("Edge layout is already registered");
- this.edgeToPosition[edgeLayout.key] = edgeLayout;
- };
- GraphLayout.prototype.getRectangle = function (includeMargins) {
- var _this = this;
- return Utils_1.GeometryUtils.getCommonRectangle(this.nodeKeys.map(function (nk) { return _this.nodeToLayout[nk].rectangle; }));
- };
- GraphLayout.prototype.offsetNodes = function (deltaX, deltaY) {
- var _this = this;
- if (deltaX === void 0) { deltaX = 0; }
- if (deltaY === void 0) { deltaY = 0; }
- var layout = new GraphLayout();
- this.nodeKeys.forEach(function (nk) {
- var nl = _this.nodeToLayout[nk];
- layout.addNode(new NodeLayout_1.NodeLayout(nl.info, nl.position.offset(deltaX, deltaY)));
- });
- layout.copyEdges(this);
- return layout;
- };
- GraphLayout.prototype.extend = function (layout) {
- var _this = this;
- layout.forEachNode(function (nl) { return _this.addNode(nl); });
- this.copyEdges(layout);
- };
- GraphLayout.prototype.copyEdges = function (source) {
- var _this = this;
- Object.keys(source.edgeToPosition).forEach(function (e) {
- var edge = source.edgeToPosition[e];
- _this.addEdge(new NodeLayout_1.EdgeLayout(edge.key, edge.beginIndex, edge.endIndex));
- });
- };
- return GraphLayout;
- }());
- exports.GraphLayout = GraphLayout;
- /***/ }),
- /* 82 */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- Object.defineProperty(exports, "__esModule", { value: true });
- var LayoutSettings_1 = __webpack_require__(18);
- var LayoutBuilder = /** @class */ (function () {
- function LayoutBuilder(settings, graph) {
- this.settings = settings;
- this.graph = graph;
- }
- LayoutBuilder.prototype.getBreadthNodeSizeCore = function (node) {
- return this.settings.orientation === LayoutSettings_1.OrientationKind.Vertical ?
- (node.size.width + node.margin.left + node.margin.right) :
- (node.size.height + node.margin.top + node.margin.bottom);
- };
- LayoutBuilder.prototype.getDepthNodeSizeCore = function (node) {
- return this.settings.orientation === LayoutSettings_1.OrientationKind.Horizontal ?
- (node.size.width + node.margin.left + node.margin.right) :
- (node.size.height + node.margin.top + node.margin.bottom);
- };
- LayoutBuilder.prototype.chooseDirectionValue = function (near, far) {
- return this.settings.direction === LayoutSettings_1.LogicalDirectionKind.Forward ? near : far;
- };
- LayoutBuilder.prototype.getDirectionValue = function (value) {
- return this.settings.direction === LayoutSettings_1.LogicalDirectionKind.Forward ? value : -value;
- };
- LayoutBuilder.prototype.getComponentOffset = function (graphLayout) {
- var rect = graphLayout.getRectangle(true);
- var offset = this.settings.orientation === LayoutSettings_1.OrientationKind.Vertical ? rect.width : rect.height;
- return offset + this.settings.componentSpacing;
- };
- LayoutBuilder.prototype.setComponentOffset = function (graphLayout, offset) {
- return this.settings.orientation === LayoutSettings_1.OrientationKind.Vertical ?
- graphLayout.offsetNodes(offset) :
- graphLayout.offsetNodes(0, offset);
- };
- return LayoutBuilder;
- }());
- exports.LayoutBuilder = LayoutBuilder;
- /***/ }),
- /* 83 */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- var __extends = (this && this.__extends) || (function () {
- var extendStatics = function (d, b) {
- extendStatics = Object.setPrototypeOf ||
- ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
- function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
- return extendStatics(d, b);
- };
- return function (d, b) {
- extendStatics(d, b);
- function __() { this.constructor = d; }
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
- };
- })();
- Object.defineProperty(exports, "__esModule", { value: true });
- var HistoryItem_1 = __webpack_require__(4);
- var CloneHistoryItem = /** @class */ (function (_super) {
- __extends(CloneHistoryItem, _super);
- function CloneHistoryItem(item) {
- var _this = _super.call(this) || this;
- _this.item = item;
- return _this;
- }
- CloneHistoryItem.prototype.redo = function (manipulator) {
- this.clearConnections(this.item);
- this.addItem(this.item, manipulator);
- };
- CloneHistoryItem.prototype.undo = function (manipulator) {
- var item = manipulator.model.findItem(this.item.key);
- this.clearConnections(item);
- this.deleteItem(item, manipulator);
- };
- return CloneHistoryItem;
- }(HistoryItem_1.HistoryItem));
- exports.CloneHistoryItem = CloneHistoryItem;
- /***/ }),
- /* 84 */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- Object.defineProperty(exports, "__esModule", { value: true });
- var Model_1 = __webpack_require__(21);
- var Shape_1 = __webpack_require__(9);
- var Utils_1 = __webpack_require__(0);
- var ShapeDescriptionManager_1 = __webpack_require__(30);
- var Connector_1 = __webpack_require__(5);
- var ShapeType_1 = __webpack_require__(1);
- var Importer = /** @class */ (function () {
- function Importer() {
- }
- Importer.import = function (json) {
- var model = new Model_1.DiagramModel();
- var obj = this.parseJSON(json);
- this.importPageSettings(model, obj["page"]);
- var shapes = this.importShapes(obj["shapes"]);
- for (var i = 0; i < shapes.length; i++) {
- var shape = shapes[i];
- if (model.findItem(shape.key))
- throw Error("Item key is duplicated");
- model.pushItem(shape);
- }
- var connectors = this.importConnectors(obj["connectors"]);
- for (var i = 0; i < connectors.length; i++) {
- var connector = connectors[i];
- connector.endItem = model.findItem(connector["endItemKey"]) || undefined;
- delete connector["endItemKey"];
- connector.beginItem = model.findItem(connector["beginItemKey"]) || undefined;
- delete connector["beginItemKey"];
- if (model.findItem(connector.key))
- throw Error("Item key is duplicated");
- model.pushItem(connector);
- this.updateConnections(connector);
- }
- return model;
- };
- Importer.importItems = function (json, model) {
- var result = [];
- var obj = this.parseJSON(json);
- var itemHash = {};
- var shapes = this.importShapes(obj["shapes"]);
- var key;
- for (var i = 0; i < shapes.length; i++) {
- var shape = shapes[i];
- var oldKey = shape.key;
- key = model.getNextKey(key);
- shape.key = key;
- itemHash[oldKey] = shape;
- result.push(shape);
- }
- var connectors = this.importConnectors(obj["connectors"]);
- for (var i = 0; i < connectors.length; i++) {
- var connector = connectors[i];
- var oldKey = connector.key;
- key = model.getNextKey(key);
- connector.key = key;
- itemHash[oldKey] = connector;
- var endItemKey = connector["endItemKey"];
- connector.endItem = itemHash[endItemKey];
- delete connector["endItemKey"];
- var beginItemKey = connector["beginItemKey"];
- connector.beginItem = itemHash[beginItemKey];
- delete connector["beginItemKey"];
- result.push(connector);
- this.updateConnections(connector);
- }
- return result;
- };
- Importer.importItemsData = function (json, model) {
- var obj = this.parseJSON(json);
- var shapes = this.importShapes(obj["shapes"]);
- for (var i = 0; i < shapes.length; i++) {
- var srcShape = shapes[i];
- var destShape = void 0;
- if (srcShape.dataKey !== undefined)
- destShape = model.findShapeByDataKey(srcShape.dataKey);
- if (!destShape)
- destShape = model.findShape(srcShape.key);
- if (destShape) {
- destShape.dataKey = srcShape.dataKey;
- destShape.locked = srcShape.locked;
- destShape.position = srcShape.position.clone();
- destShape.size = srcShape.size.clone();
- destShape.parameters = srcShape.parameters.clone();
- destShape.style = srcShape.style.clone();
- destShape.styleText = srcShape.styleText.clone();
- destShape.zIndex = srcShape.zIndex;
- }
- }
- var connectors = this.importConnectors(obj["connectors"]);
- for (var i = 0; i < connectors.length; i++) {
- var srcConnector = connectors[i];
- var destConnector = void 0;
- if (srcConnector.dataKey !== undefined)
- destConnector = model.findConnectorByDataKey(srcConnector.dataKey);
- if (!destConnector)
- destConnector = model.findConnector(srcConnector.key);
- if (destConnector) {
- destConnector.dataKey = srcConnector.dataKey;
- destConnector.locked = srcConnector.locked;
- destConnector.points = srcConnector.points.slice();
- destConnector.properties = srcConnector.properties.clone();
- destConnector.style = srcConnector.style.clone();
- destConnector.styleText = srcConnector.styleText.clone();
- destConnector.zIndex = srcConnector.zIndex;
- }
- }
- };
- Importer.canImport = function (json) {
- var obj = this.parseJSON(json);
- return Array.isArray(obj["shapes"]) || Array.isArray(obj["connectors"]);
- };
- Importer.importPageSettings = function (model, pageObj) {
- if (!pageObj)
- return;
- this.assert(pageObj["width"], "number");
- this.assert(pageObj["height"], "number");
- if (typeof pageObj["width"] === "number")
- model.size.width = pageObj["width"];
- if (typeof pageObj["height"] === "number")
- model.size.height = pageObj["height"];
- if (typeof pageObj["pageColor"] === "string")
- model.pageColor = pageObj["pageColor"];
- if (typeof pageObj["pageWidth"] === "number")
- model.pageSize.width = pageObj["pageWidth"];
- if (typeof pageObj["pageHeight"] === "number")
- model.pageSize.height = pageObj["pageHeight"];
- if (typeof pageObj["pageLandscape"] === "boolean")
- model.pageLandscape = pageObj["pageLandscape"];
- if (typeof pageObj["gridSize"] === "number")
- model.gridSize = pageObj["gridSize"];
- if (typeof pageObj["showGrid"] === "boolean")
- model.showGrid = pageObj["showGrid"];
- if (typeof pageObj["snapToGrid"] === "boolean")
- model.snapToGrid = pageObj["snapToGrid"];
- if (typeof pageObj["units"] === "number")
- model.units = pageObj["units"];
- };
- Importer.importShapes = function (shapesObj) {
- var result = [];
- if (!shapesObj)
- return result;
- if (!Array.isArray(shapesObj))
- throw Error("Invalid Format");
- for (var i = 0; i < shapesObj.length; i++) {
- var shapeObj = shapesObj[i];
- result.push(this.importShape(shapeObj));
- }
- return result;
- };
- Importer.importShape = function (shapeObj) {
- this.assert(shapeObj["key"], "string");
- this.assert(shapeObj["x"], "number");
- this.assert(shapeObj["y"], "number");
- var position = new Utils_1.Point(shapeObj["x"], shapeObj["y"]);
- this.assert(shapeObj["type"], "number");
- var shapeType = shapeObj["type"];
- var description = ShapeDescriptionManager_1.ShapeDescriptionManager.get(shapeType);
- var shape = new Shape_1.Shape(description || ShapeDescriptionManager_1.ShapeDescriptionManager.get(ShapeType_1.ShapeType.Rectangle), position);
- shape.key = shapeObj["key"];
- if (typeof shapeObj["dataKey"] === "string")
- shape.dataKey = shapeObj["dataKey"];
- if (typeof shapeObj["locked"] === "boolean")
- shape.locked = shapeObj["locked"];
- if (typeof shapeObj["width"] === "number")
- shape.size.width = shapeObj["width"];
- if (typeof shapeObj["height"] === "number")
- shape.size.height = shapeObj["height"];
- if (typeof shapeObj["text"] === "string")
- shape.text = shapeObj["text"];
- if (shapeObj["parameters"]) {
- shape.parameters.fromObject(shapeObj["parameters"]);
- shape.description.normalizeParameters(shape, shape.parameters);
- }
- if (shapeObj["style"])
- shape.style.fromObject(shapeObj["style"]);
- if (shapeObj["styleText"])
- shape.styleText.fromObject(shapeObj["styleText"]);
- if (typeof shapeObj["zIndex"] === "number")
- shape.zIndex = shapeObj["zIndex"];
- return shape;
- };
- Importer.importConnectors = function (connectorsObj) {
- var result = [];
- if (!connectorsObj)
- return result;
- if (!Array.isArray(connectorsObj))
- throw Error("Invalid Format");
- for (var i = 0; i < connectorsObj.length; i++) {
- var shapeObj = connectorsObj[i];
- result.push(this.importConnector(shapeObj));
- }
- return result;
- };
- Importer.importConnector = function (connectorObj) {
- var _this = this;
- this.assert(connectorObj["key"], "string");
- if (!Array.isArray(connectorObj["points"]))
- throw Error("Invalid Format");
- var points = connectorObj["points"].map(function (pt) {
- _this.assert(pt["x"], "number");
- _this.assert(pt["y"], "number");
- return new Utils_1.Point(pt["x"], pt["y"]);
- });
- var connector = new Connector_1.Connector(points);
- connector.key = connectorObj["key"];
- if (typeof connectorObj["dataKey"] === "string")
- connector.dataKey = connectorObj["dataKey"];
- if (typeof connectorObj["locked"] === "boolean")
- connector.locked = connectorObj["locked"];
- connector.endConnectionPointIndex = typeof connectorObj["endConnectionPointIndex"] === "number" ? connectorObj["endConnectionPointIndex"] : -1;
- connector.beginConnectionPointIndex = typeof connectorObj["beginConnectionPointIndex"] === "number" ? connectorObj["beginConnectionPointIndex"] : -1;
- if (connectorObj["endItemKey"] !== undefined)
- this.assert(connectorObj["endItemKey"], "string");
- if (connectorObj["beginItemKey"] !== undefined)
- this.assert(connectorObj["beginItemKey"], "string");
- connector["endItemKey"] = connectorObj["endItemKey"];
- connector["beginItemKey"] = connectorObj["beginItemKey"];
- if (connectorObj["texts"])
- connector.texts.fromObject(connectorObj["texts"]);
- if (connectorObj["properties"])
- connector.properties.fromObject(connectorObj["properties"]);
- if (connectorObj["style"])
- connector.style.fromObject(connectorObj["style"]);
- if (connectorObj["styleText"])
- connector.styleText.fromObject(connectorObj["styleText"]);
- if (typeof connectorObj["zIndex"] === "number")
- connector.zIndex = connectorObj["zIndex"];
- return connector;
- };
- Importer.updateConnections = function (connector) {
- if (connector.endItem) {
- connector.endItem.attachedConnectors.push(connector);
- connector.points[connector.points.length - 1] = connector.endItem.getConnectionPoint(connector.endConnectionPointIndex, connector.points[connector.points.length - 2]);
- }
- if (connector.beginItem) {
- connector.beginItem.attachedConnectors.push(connector);
- connector.points[0] = connector.beginItem.getConnectionPoint(connector.beginConnectionPointIndex, connector.points[1]);
- }
- };
- Importer.parseJSON = function (json) {
- if (!json || json === "")
- return {};
- try {
- return JSON.parse(json);
- }
- catch (_a) {
- return {};
- }
- };
- Importer.assert = function (value, type) {
- if (value === undefined)
- throw Error("Invalid Format");
- if (type !== undefined && typeof value !== type)
- throw Error("Invalid Format");
- };
- return Importer;
- }());
- exports.Importer = Importer;
- /***/ }),
- /* 85 */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- var __extends = (this && this.__extends) || (function () {
- var extendStatics = function (d, b) {
- extendStatics = Object.setPrototypeOf ||
- ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
- function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
- return extendStatics(d, b);
- };
- return function (d, b) {
- extendStatics(d, b);
- function __() { this.constructor = d; }
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
- };
- })();
- Object.defineProperty(exports, "__esModule", { value: true });
- var CommandBase_1 = __webpack_require__(7);
- var CommandStates_1 = __webpack_require__(6);
- var StylePropertyCommandBase = /** @class */ (function (_super) {
- __extends(StylePropertyCommandBase, _super);
- function StylePropertyCommandBase() {
- return _super !== null && _super.apply(this, arguments) || this;
- }
- StylePropertyCommandBase.prototype.getState = function () {
- return new CommandStates_1.SimpleCommandState(true, this.getStateValue());
- };
- return StylePropertyCommandBase;
- }(CommandBase_1.CommandBase));
- exports.StylePropertyCommandBase = StylePropertyCommandBase;
- /***/ }),
- /* 86 */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- var __extends = (this && this.__extends) || (function () {
- var extendStatics = function (d, b) {
- extendStatics = Object.setPrototypeOf ||
- ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
- function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
- return extendStatics(d, b);
- };
- return function (d, b) {
- extendStatics(d, b);
- function __() { this.constructor = d; }
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
- };
- })();
- Object.defineProperty(exports, "__esModule", { value: true });
- var HistoryItem_1 = __webpack_require__(4);
- var ChangeStyleHistoryItemBase = /** @class */ (function (_super) {
- __extends(ChangeStyleHistoryItemBase, _super);
- function ChangeStyleHistoryItemBase(itemKey, styleProperty, styleValue) {
- var _this = _super.call(this) || this;
- _this.itemKey = itemKey;
- _this.styleProperty = styleProperty;
- _this.styleValue = styleValue;
- return _this;
- }
- ChangeStyleHistoryItemBase.prototype.redo = function (manipulator) {
- var item = manipulator.model.findItem(this.itemKey);
- this.oldStyleValue = item.style[this.styleProperty];
- manipulator.changeStyle(item, this.styleProperty, this.styleValue);
- };
- ChangeStyleHistoryItemBase.prototype.undo = function (manipulator) {
- var item = manipulator.model.findItem(this.itemKey);
- manipulator.changeStyle(item, this.styleProperty, this.oldStyleValue);
- };
- return ChangeStyleHistoryItemBase;
- }(HistoryItem_1.HistoryItem));
- exports.ChangeStyleHistoryItemBase = ChangeStyleHistoryItemBase;
- /***/ }),
- /* 87 */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- var __extends = (this && this.__extends) || (function () {
- var extendStatics = function (d, b) {
- extendStatics = Object.setPrototypeOf ||
- ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
- function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
- return extendStatics(d, b);
- };
- return function (d, b) {
- extendStatics(d, b);
- function __() { this.constructor = d; }
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
- };
- })();
- Object.defineProperty(exports, "__esModule", { value: true });
- var StylePropertyCommandBase_1 = __webpack_require__(85);
- var ChangeStylePropertyCommandBase = /** @class */ (function (_super) {
- __extends(ChangeStylePropertyCommandBase, _super);
- function ChangeStylePropertyCommandBase() {
- return _super !== null && _super.apply(this, arguments) || this;
- }
- ChangeStylePropertyCommandBase.prototype.executeCore = function (state, parameter) {
- var _this = this;
- this.control.history.beginTransaction();
- var items = this.control.selection.getSelectedItems();
- items.forEach(function (item) {
- var styleProperty = _this.getStyleProperty();
- _this.control.history.addAndRedo(_this.createHistoryItem(item, styleProperty, parameter));
- });
- this.updateInputPosition(parameter);
- this.control.history.endTransaction();
- return true;
- };
- return ChangeStylePropertyCommandBase;
- }(StylePropertyCommandBase_1.StylePropertyCommandBase));
- exports.ChangeStylePropertyCommandBase = ChangeStylePropertyCommandBase;
- /***/ }),
- /* 88 */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- var __extends = (this && this.__extends) || (function () {
- var extendStatics = function (d, b) {
- extendStatics = Object.setPrototypeOf ||
- ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
- function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
- return extendStatics(d, b);
- };
- return function (d, b) {
- extendStatics(d, b);
- function __() { this.constructor = d; }
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
- };
- })();
- Object.defineProperty(exports, "__esModule", { value: true });
- var ChangeStylePropertyCommandBase_1 = __webpack_require__(87);
- var ChangeStyleHistoryItem_1 = __webpack_require__(63);
- var ChangeStylePropertyCommand = /** @class */ (function (_super) {
- __extends(ChangeStylePropertyCommand, _super);
- function ChangeStylePropertyCommand() {
- return _super !== null && _super.apply(this, arguments) || this;
- }
- ChangeStylePropertyCommand.prototype.getStateValue = function () {
- return this.control.selection.inputPosition.getStylePropertyValue(this.getStyleProperty());
- };
- ChangeStylePropertyCommand.prototype.getStyleObj = function (item) {
- return item.style;
- };
- ChangeStylePropertyCommand.prototype.createHistoryItem = function (item, styleProperty, styleValue) {
- return new ChangeStyleHistoryItem_1.ChangeStyleHistoryItem(item.key, styleProperty, styleValue);
- };
- ChangeStylePropertyCommand.prototype.updateInputPosition = function (value) {
- this.control.selection.inputPosition.setStylePropertyValue(this.getStyleProperty(), value);
- };
- return ChangeStylePropertyCommand;
- }(ChangeStylePropertyCommandBase_1.ChangeStylePropertyCommandBase));
- exports.ChangeStylePropertyCommand = ChangeStylePropertyCommand;
- /***/ }),
- /* 89 */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- var __extends = (this && this.__extends) || (function () {
- var extendStatics = function (d, b) {
- extendStatics = Object.setPrototypeOf ||
- ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
- function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
- return extendStatics(d, b);
- };
- return function (d, b) {
- extendStatics(d, b);
- function __() { this.constructor = d; }
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
- };
- })();
- Object.defineProperty(exports, "__esModule", { value: true });
- var CommandBase_1 = __webpack_require__(7);
- var CommandStates_1 = __webpack_require__(6);
- var ImportDataCommandBase = /** @class */ (function (_super) {
- __extends(ImportDataCommandBase, _super);
- function ImportDataCommandBase() {
- return _super !== null && _super.apply(this, arguments) || this;
- }
- ImportDataCommandBase.prototype.getState = function () {
- return new CommandStates_1.SimpleCommandState(true);
- };
- ImportDataCommandBase.prototype.executeCore = function (state, parameter) {
- if (!parameter || !Array.isArray(parameter.nodeDataSource))
- throw Error("Format exception");
- this.performImportData(parameter);
- if (this.control.renderManager)
- this.control.renderManager.onWindowResize(null);
- return true;
- };
- ImportDataCommandBase.prototype.createItems = function (dataSource, layoutType) {
- dataSource.createModelItems(this.control.history, this.control.model, this.control.selection, layoutType);
- };
- return ImportDataCommandBase;
- }(CommandBase_1.CommandBase));
- exports.ImportDataCommandBase = ImportDataCommandBase;
- /***/ }),
- /* 90 */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- var __extends = (this && this.__extends) || (function () {
- var extendStatics = function (d, b) {
- extendStatics = Object.setPrototypeOf ||
- ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
- function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
- return extendStatics(d, b);
- };
- return function (d, b) {
- extendStatics(d, b);
- function __() { this.constructor = d; }
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
- };
- })();
- Object.defineProperty(exports, "__esModule", { value: true });
- var CommandBase_1 = __webpack_require__(7);
- var CommandStates_1 = __webpack_require__(6);
- var ChangeConnectorPropertyHistoryItem_1 = __webpack_require__(91);
- var ChangeConnectorPropertyCommand = /** @class */ (function (_super) {
- __extends(ChangeConnectorPropertyCommand, _super);
- function ChangeConnectorPropertyCommand() {
- return _super !== null && _super.apply(this, arguments) || this;
- }
- ChangeConnectorPropertyCommand.prototype.getState = function () {
- return new CommandStates_1.SimpleCommandState(true, this.getStateValue());
- };
- ChangeConnectorPropertyCommand.prototype.getStateValue = function () {
- return this.control.selection.inputPosition.getConnectorPropertyValue(this.getPropertyName());
- };
- ChangeConnectorPropertyCommand.prototype.executeCore = function (state, parameter) {
- var _this = this;
- this.control.history.beginTransaction();
- var connectors = this.control.selection.getSelectedConnectors();
- connectors.forEach(function (connector) {
- var propertyName = _this.getPropertyName();
- _this.control.history.addAndRedo(new ChangeConnectorPropertyHistoryItem_1.ChangeConnectorPropertyHistoryItem(connector.key, propertyName, parameter));
- });
- this.control.selection.inputPosition.setConnectorPropertyValue(this.getPropertyName(), parameter);
- this.control.history.endTransaction();
- return true;
- };
- return ChangeConnectorPropertyCommand;
- }(CommandBase_1.CommandBase));
- exports.ChangeConnectorPropertyCommand = ChangeConnectorPropertyCommand;
- /***/ }),
- /* 91 */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- var __extends = (this && this.__extends) || (function () {
- var extendStatics = function (d, b) {
- extendStatics = Object.setPrototypeOf ||
- ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
- function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
- return extendStatics(d, b);
- };
- return function (d, b) {
- extendStatics(d, b);
- function __() { this.constructor = d; }
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
- };
- })();
- Object.defineProperty(exports, "__esModule", { value: true });
- var HistoryItem_1 = __webpack_require__(4);
- var ChangeConnectorPropertyHistoryItem = /** @class */ (function (_super) {
- __extends(ChangeConnectorPropertyHistoryItem, _super);
- function ChangeConnectorPropertyHistoryItem(connectorKey, propertyName, value) {
- var _this = _super.call(this) || this;
- _this.connectorKey = connectorKey;
- _this.propertyName = propertyName;
- _this.value = value;
- return _this;
- }
- ChangeConnectorPropertyHistoryItem.prototype.redo = function (manipulator) {
- var connector = manipulator.model.findConnector(this.connectorKey);
- this.oldValue = connector.properties[this.propertyName];
- manipulator.changeConnectorProperty(connector, this.propertyName, this.value);
- };
- ChangeConnectorPropertyHistoryItem.prototype.undo = function (manipulator) {
- var connector = manipulator.model.findConnector(this.connectorKey);
- manipulator.changeConnectorProperty(connector, this.propertyName, this.oldValue);
- };
- return ChangeConnectorPropertyHistoryItem;
- }(HistoryItem_1.HistoryItem));
- exports.ChangeConnectorPropertyHistoryItem = ChangeConnectorPropertyHistoryItem;
- /***/ }),
- /* 92 */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- Object.defineProperty(exports, "__esModule", { value: true });
- var ExtensionLineType;
- (function (ExtensionLineType) {
- ExtensionLineType[ExtensionLineType["LeftToLeftAbove"] = 0] = "LeftToLeftAbove";
- ExtensionLineType[ExtensionLineType["LeftToLeftBelow"] = 1] = "LeftToLeftBelow";
- ExtensionLineType[ExtensionLineType["RightToRightAbove"] = 2] = "RightToRightAbove";
- ExtensionLineType[ExtensionLineType["RightToRightBelow"] = 3] = "RightToRightBelow";
- ExtensionLineType[ExtensionLineType["LeftToRightAbove"] = 4] = "LeftToRightAbove";
- ExtensionLineType[ExtensionLineType["LeftToRightBelow"] = 5] = "LeftToRightBelow";
- ExtensionLineType[ExtensionLineType["RightToLeftAbove"] = 6] = "RightToLeftAbove";
- ExtensionLineType[ExtensionLineType["RightToLeftBelow"] = 7] = "RightToLeftBelow";
- ExtensionLineType[ExtensionLineType["TopToTopBefore"] = 8] = "TopToTopBefore";
- ExtensionLineType[ExtensionLineType["TopToTopAfter"] = 9] = "TopToTopAfter";
- ExtensionLineType[ExtensionLineType["BottomToBottomBefore"] = 10] = "BottomToBottomBefore";
- ExtensionLineType[ExtensionLineType["BottomToBottomAfter"] = 11] = "BottomToBottomAfter";
- ExtensionLineType[ExtensionLineType["TopToBottomBefore"] = 12] = "TopToBottomBefore";
- ExtensionLineType[ExtensionLineType["TopToBottomAfter"] = 13] = "TopToBottomAfter";
- ExtensionLineType[ExtensionLineType["BottomToTopBefore"] = 14] = "BottomToTopBefore";
- ExtensionLineType[ExtensionLineType["BottomToTopAfter"] = 15] = "BottomToTopAfter";
- ExtensionLineType[ExtensionLineType["HorizontalCenterAbove"] = 16] = "HorizontalCenterAbove";
- ExtensionLineType[ExtensionLineType["HorizontalCenterBelow"] = 17] = "HorizontalCenterBelow";
- ExtensionLineType[ExtensionLineType["VerticalCenterBefore"] = 18] = "VerticalCenterBefore";
- ExtensionLineType[ExtensionLineType["VerticalCenterAfter"] = 19] = "VerticalCenterAfter";
- ExtensionLineType[ExtensionLineType["VerticalCenterToPageCenter"] = 20] = "VerticalCenterToPageCenter";
- ExtensionLineType[ExtensionLineType["HorizontalCenterToPageCenter"] = 21] = "HorizontalCenterToPageCenter";
- ExtensionLineType[ExtensionLineType["LeftToPageCenter"] = 22] = "LeftToPageCenter";
- ExtensionLineType[ExtensionLineType["RightToPageCenter"] = 23] = "RightToPageCenter";
- ExtensionLineType[ExtensionLineType["TopToPageCenter"] = 24] = "TopToPageCenter";
- ExtensionLineType[ExtensionLineType["BottomToPageCenter"] = 25] = "BottomToPageCenter";
- })(ExtensionLineType = exports.ExtensionLineType || (exports.ExtensionLineType = {}));
- var ExtensionLine = /** @class */ (function () {
- function ExtensionLine(type, segment, text) {
- this.type = type;
- this.segment = segment;
- this.text = text;
- }
- return ExtensionLine;
- }());
- exports.ExtensionLine = ExtensionLine;
- var ExtensionLinesVisualizer = /** @class */ (function () {
- function ExtensionLinesVisualizer(dispatcher) {
- this.dispatcher = dispatcher;
- this.lines = [];
- this.lineIndexByType = {};
- }
- ExtensionLinesVisualizer.prototype.addSegment = function (type, segment, text) {
- var curIndex = this.lineIndexByType[type];
- if (curIndex === undefined) {
- var line = new ExtensionLine(type, segment, text);
- var index = this.lines.push(line);
- this.lineIndexByType[line.type] = index - 1;
- this.raiseShow();
- }
- else if (segment.distance < this.lines[curIndex].segment.distance) {
- var line = new ExtensionLine(type, segment, text);
- this.lines.splice(curIndex, 1, line);
- this.raiseShow();
- }
- };
- ExtensionLinesVisualizer.prototype.update = function () {
- this.raiseShow();
- };
- ExtensionLinesVisualizer.prototype.reset = function () {
- if (this.lines.length) {
- this.lines = [];
- this.lineIndexByType = {};
- this.raiseHide();
- }
- };
- ExtensionLinesVisualizer.prototype.raiseShow = function () {
- var _this = this;
- this.dispatcher.raise1(function (l) { return l.NotifyExtensionLinesShow(_this.lines); });
- };
- ExtensionLinesVisualizer.prototype.raiseHide = function () {
- this.dispatcher.raise1(function (l) { return l.NotifyExtensionLinesHide(); });
- };
- return ExtensionLinesVisualizer;
- }());
- exports.ExtensionLinesVisualizer = ExtensionLinesVisualizer;
- /***/ }),
- /* 93 */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- var __extends = (this && this.__extends) || (function () {
- var extendStatics = function (d, b) {
- extendStatics = Object.setPrototypeOf ||
- ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
- function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
- return extendStatics(d, b);
- };
- return function (d, b) {
- extendStatics(d, b);
- function __() { this.constructor = d; }
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
- };
- })();
- Object.defineProperty(exports, "__esModule", { value: true });
- var HistoryItem_1 = __webpack_require__(4);
- var ChangeZindexHistoryItem = /** @class */ (function (_super) {
- __extends(ChangeZindexHistoryItem, _super);
- function ChangeZindexHistoryItem(item, zIndex) {
- var _this = _super.call(this) || this;
- _this.itemKey = item.key;
- _this.zIndex = zIndex;
- return _this;
- }
- ChangeZindexHistoryItem.prototype.redo = function (manipulator) {
- var item = manipulator.model.findItem(this.itemKey);
- this.oldZIndex = item.zIndex;
- manipulator.changeZIndex(item, this.zIndex);
- };
- ChangeZindexHistoryItem.prototype.undo = function (manipulator) {
- var item = manipulator.model.findItem(this.itemKey);
- manipulator.changeZIndex(item, this.oldZIndex);
- };
- return ChangeZindexHistoryItem;
- }(HistoryItem_1.HistoryItem));
- exports.ChangeZindexHistoryItem = ChangeZindexHistoryItem;
- /***/ }),
- /* 94 */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- var __extends = (this && this.__extends) || (function () {
- var extendStatics = function (d, b) {
- extendStatics = Object.setPrototypeOf ||
- ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
- function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
- return extendStatics(d, b);
- };
- return function (d, b) {
- extendStatics(d, b);
- function __() { this.constructor = d; }
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
- };
- })();
- Object.defineProperty(exports, "__esModule", { value: true });
- var CommandBase_1 = __webpack_require__(7);
- var CommandStates_1 = __webpack_require__(6);
- var ChangeLockedHistoryItem_1 = __webpack_require__(206);
- var SetSelectionHistoryItem_1 = __webpack_require__(29);
- var ChangeLockedCommand = /** @class */ (function (_super) {
- __extends(ChangeLockedCommand, _super);
- function ChangeLockedCommand() {
- return _super !== null && _super.apply(this, arguments) || this;
- }
- ChangeLockedCommand.prototype.getState = function () {
- var _this = this;
- var items = this.control.selection.getSelectedItems(true);
- var enabled = false;
- items.forEach(function (item) { if (item.locked !== _this.getLockState())
- enabled = true; });
- return new CommandStates_1.SimpleCommandState(enabled);
- };
- ChangeLockedCommand.prototype.executeCore = function (state, parameter) {
- var _this = this;
- this.control.history.beginTransaction();
- var items = this.control.selection.getSelectedItems(true);
- items.forEach(function (item) {
- _this.control.history.addAndRedo(new ChangeLockedHistoryItem_1.ChangeLockedHistoryItem(item, _this.getLockState()));
- });
- this.control.history.addAndRedo(new SetSelectionHistoryItem_1.SetSelectionHistoryItem(this.control.selection, this.control.selection.getKeys())); // Update canvas
- this.control.history.endTransaction();
- return true;
- };
- return ChangeLockedCommand;
- }(CommandBase_1.CommandBase));
- exports.ChangeLockedCommand = ChangeLockedCommand;
- /***/ }),
- /* 95 */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- var __extends = (this && this.__extends) || (function () {
- var extendStatics = function (d, b) {
- extendStatics = Object.setPrototypeOf ||
- ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
- function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
- return extendStatics(d, b);
- };
- return function (d, b) {
- extendStatics(d, b);
- function __() { this.constructor = d; }
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
- };
- })();
- Object.defineProperty(exports, "__esModule", { value: true });
- var Utils_1 = __webpack_require__(0);
- var MouseHandlerDraggingState_1 = __webpack_require__(24);
- var ModelUtils_1 = __webpack_require__(8);
- var MouseHandlerMoveShapeStateBase = /** @class */ (function (_super) {
- __extends(MouseHandlerMoveShapeStateBase, _super);
- function MouseHandlerMoveShapeStateBase(handler, history, model, selection) {
- var _this = _super.call(this, handler, history) || this;
- _this.model = model;
- _this.selection = selection;
- _this.startScrollLeft = 0;
- _this.startScrollTop = 0;
- return _this;
- }
- MouseHandlerMoveShapeStateBase.prototype.finish = function () {
- this.handler.resetExtensionLines();
- _super.prototype.finish.call(this);
- };
- MouseHandlerMoveShapeStateBase.prototype.onMouseDown = function (evt) {
- this.startPoint = evt.layoutPoint;
- this.shapes = this.selection.getSelectedShapes();
- this.connectors = this.selection.getSelectedConnectors();
- if (this.shapes.length === 0) {
- this.handler.switchToDefaultState();
- return;
- }
- this.startShapePositions = this.shapes.map(function (shape) { return shape.position.clone(); });
- this.startConnectorPoints = this.connectors.map(function (c) { return c.points.map(function (p) { return p.clone(); }); });
- _super.prototype.onMouseDown.call(this, evt);
- };
- MouseHandlerMoveShapeStateBase.prototype.onMouseMove = function (evt) {
- _super.prototype.onMouseMove.call(this, evt);
- this.handler.setExtensionLines(this.selection.getSelectedShapes());
- };
- MouseHandlerMoveShapeStateBase.prototype.onApplyChanges = function (evt) {
- var _this = this;
- this.shapes.forEach(function (shape, index) {
- var pos = _this.getPosition(evt, _this.startShapePositions[index]);
- ModelUtils_1.ModelUtils.setShapePosition(_this.history, _this.model, shape.key, pos, _this.history.addOrModifyAndRedo);
- shape.attachedConnectors.forEach(function (connector) {
- ModelUtils_1.ModelUtils.removeConnectorIntermediatePoints(_this.history, connector);
- ModelUtils_1.ModelUtils.updateConnectorAttachedPoints(_this.history, connector, _this.history.addOrModifyAndRedo);
- });
- });
- this.connectors.forEach(function (connector, index) {
- var delta = _this.startShapePositions[0].offset(-_this.shapes[0].position.x, -_this.shapes[0].position.y);
- if (delta.x !== 0 || delta.y !== 0) {
- var startPtIndex = connector.beginItem ? 1 : 0;
- var endPtIndex = connector.endItem ? (connector.points.length - 2) : (connector.points.length - 1);
- for (var i = startPtIndex; i <= endPtIndex; i++)
- ModelUtils_1.ModelUtils.setConnectorPoint(_this.history, _this.model, connector.key, i, _this.startConnectorPoints[index][i].offset(-delta.x, -delta.y), _this.history.addOrModifyAndRedo);
- }
- });
- this.handler.tryUpdateModelSize();
- };
- MouseHandlerMoveShapeStateBase.prototype.getDraggingElementKeys = function () {
- return this.shapes.map(function (shape) { return shape.key; });
- };
- MouseHandlerMoveShapeStateBase.prototype.getXPosition = function (evt, baseX) {
- return baseX + evt.layoutPoint.x - this.startPoint.x;
- };
- MouseHandlerMoveShapeStateBase.prototype.getYPosition = function (evt, baseY) {
- return baseY + evt.layoutPoint.y - this.startPoint.y;
- };
- MouseHandlerMoveShapeStateBase.prototype.getPosition = function (evt, basePoint) {
- return new Utils_1.Point(this.handler.getSnappedPos(evt, this.getXPosition(evt, basePoint.x)), this.handler.getSnappedPos(evt, this.getYPosition(evt, basePoint.y)));
- };
- return MouseHandlerMoveShapeStateBase;
- }(MouseHandlerDraggingState_1.MouseHandlerDraggingState));
- exports.MouseHandlerMoveShapeStateBase = MouseHandlerMoveShapeStateBase;
- /***/ }),
- /* 96 */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- var __extends = (this && this.__extends) || (function () {
- var extendStatics = function (d, b) {
- extendStatics = Object.setPrototypeOf ||
- ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
- function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
- return extendStatics(d, b);
- };
- return function (d, b) {
- extendStatics(d, b);
- function __() { this.constructor = d; }
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
- };
- })();
- Object.defineProperty(exports, "__esModule", { value: true });
- var Connector_1 = __webpack_require__(5);
- var Event_1 = __webpack_require__(14);
- var MouseHandlerDraggingState_1 = __webpack_require__(24);
- var DeleteConnectionHistoryItem_1 = __webpack_require__(73);
- var AddConnectionHistoryItem_1 = __webpack_require__(35);
- var MoveConnectorPointHistoryItem_1 = __webpack_require__(36);
- var ModelUtils_1 = __webpack_require__(8);
- var MouseHandlerMoveConnectorPointStateBase = /** @class */ (function (_super) {
- __extends(MouseHandlerMoveConnectorPointStateBase, _super);
- function MouseHandlerMoveConnectorPointStateBase(handler, history, model) {
- var _this = _super.call(this, handler, history) || this;
- _this.model = model;
- return _this;
- }
- MouseHandlerMoveConnectorPointStateBase.prototype.finish = function () {
- this.handler.resetConnectionTarget();
- this.handler.resetConnectionPoints();
- _super.prototype.finish.call(this);
- };
- MouseHandlerMoveConnectorPointStateBase.prototype.onMouseMove = function (evt) {
- _super.prototype.onMouseMove.call(this, evt);
- var item = this.connector.getExtremeItem(this.pointPosition);
- this.handler.setConnectionTarget(item, evt.source.type);
- var pointIndex = this.connector.getExtremeConnectionPointIndex(this.pointPosition);
- if (!item && this.connector.getExtremeConnectionPointIndex(this.oppositePointPosition) !== -1)
- item = this.model.findItem(evt.source.key);
- this.handler.setConnectionPoints(item, evt.source.type, pointIndex);
- };
- MouseHandlerMoveConnectorPointStateBase.prototype.onApplyChanges = function (evt) {
- var point = this.getSnappedPoint(evt, evt.layoutPoint);
- if (this.pointPosition !== undefined) {
- var item = this.model.findItem(evt.source.key);
- var connectionPointIndex = -1;
- if (evt.source.type === Event_1.MouseEventElementType.ShapeConnectionPoint)
- connectionPointIndex = parseInt(evt.source.value);
- if (item && !item.locked && (evt.source.type === Event_1.MouseEventElementType.Shape || evt.source.type === Event_1.MouseEventElementType.ShapeConnectionPoint) &&
- (this.connector.getExtremeItem(this.oppositePointPosition) !== item ||
- (connectionPointIndex !== -1 && this.connector.getExtremeConnectionPointIndex(this.oppositePointPosition) !== -1 &&
- connectionPointIndex !== this.connector.getExtremeConnectionPointIndex(this.oppositePointPosition)))) {
- if (this.connector.getExtremeItem(this.pointPosition) !== item ||
- this.connector.getExtremeConnectionPointIndex(this.pointPosition) !== connectionPointIndex) {
- if (this.connector.getExtremeItem(this.pointPosition))
- this.history.addOrModifyAndRedo(new DeleteConnectionHistoryItem_1.DeleteConnectionHistoryItem(this.connector, this.pointPosition));
- this.history.addOrModifyAndRedo(new AddConnectionHistoryItem_1.AddConnectionHistoryItem(this.connector, item, connectionPointIndex, this.pointPosition));
- }
- point = item.getConnectionPoint(connectionPointIndex, this.connector.points[this.pointIndex + (this.pointPosition === Connector_1.ConnectorPosition.End ? -1 : 1)]);
- this.handler.setConnectionPointIndex(connectionPointIndex);
- }
- else if (this.connector.getExtremeItem(this.pointPosition)) {
- this.history.addOrModifyAndRedo(new DeleteConnectionHistoryItem_1.DeleteConnectionHistoryItem(this.connector, this.pointPosition));
- }
- }
- this.history.addOrModifyAndRedo(new MoveConnectorPointHistoryItem_1.MoveConnectorPointHistoryItem(this.connector.key, this.pointIndex, point));
- ModelUtils_1.ModelUtils.updateConnectorAttachedPoints(this.history, this.connector, this.history.addOrModifyAndRedo);
- this.handler.tryUpdateModelSize();
- };
- MouseHandlerMoveConnectorPointStateBase.prototype.onFinishWithChanges = function () {
- ModelUtils_1.ModelUtils.removeUnnecessaryConnectorPoints(this.history, this.connector);
- };
- MouseHandlerMoveConnectorPointStateBase.prototype.getDraggingElementKeys = function () {
- return this.connector ? [this.connector.key] : [];
- };
- Object.defineProperty(MouseHandlerMoveConnectorPointStateBase.prototype, "oppositePointPosition", {
- get: function () {
- return this.pointPosition === Connector_1.ConnectorPosition.Begin ? Connector_1.ConnectorPosition.End : Connector_1.ConnectorPosition.Begin;
- },
- enumerable: true,
- configurable: true
- });
- return MouseHandlerMoveConnectorPointStateBase;
- }(MouseHandlerDraggingState_1.MouseHandlerDraggingState));
- exports.MouseHandlerMoveConnectorPointStateBase = MouseHandlerMoveConnectorPointStateBase;
- /***/ }),
- /* 97 */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- var __extends = (this && this.__extends) || (function () {
- var extendStatics = function (d, b) {
- extendStatics = Object.setPrototypeOf ||
- ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
- function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
- return extendStatics(d, b);
- };
- return function (d, b) {
- extendStatics(d, b);
- function __() { this.constructor = d; }
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
- };
- })();
- Object.defineProperty(exports, "__esModule", { value: true });
- var HistoryItem_1 = __webpack_require__(4);
- var AddConnectorPointHistoryItem = /** @class */ (function (_super) {
- __extends(AddConnectorPointHistoryItem, _super);
- function AddConnectorPointHistoryItem(connectorKey, pointIndex, point) {
- var _this = _super.call(this) || this;
- _this.connectorKey = connectorKey;
- _this.pointIndex = pointIndex;
- _this.point = point;
- return _this;
- }
- AddConnectorPointHistoryItem.prototype.redo = function (manipulator) {
- var connector = manipulator.model.findConnector(this.connectorKey);
- manipulator.addConnectorPoint(connector, this.pointIndex, this.point.clone());
- };
- AddConnectorPointHistoryItem.prototype.undo = function (manipulator) {
- var connector = manipulator.model.findConnector(this.connectorKey);
- manipulator.deleteConnectorPoint(connector, this.pointIndex);
- };
- return AddConnectorPointHistoryItem;
- }(HistoryItem_1.HistoryItem));
- exports.AddConnectorPointHistoryItem = AddConnectorPointHistoryItem;
- /***/ }),
- /* 98 */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- var __extends = (this && this.__extends) || (function () {
- var extendStatics = function (d, b) {
- extendStatics = Object.setPrototypeOf ||
- ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
- function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
- return extendStatics(d, b);
- };
- return function (d, b) {
- extendStatics(d, b);
- function __() { this.constructor = d; }
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
- };
- })();
- Object.defineProperty(exports, "__esModule", { value: true });
- var HistoryItem_1 = __webpack_require__(4);
- var ChangeConnectorTextHistoryItem = /** @class */ (function (_super) {
- __extends(ChangeConnectorTextHistoryItem, _super);
- function ChangeConnectorTextHistoryItem(connector, position, text) {
- var _this = _super.call(this) || this;
- _this.connectorKey = connector.key;
- _this.text = text;
- _this.position = position;
- return _this;
- }
- ChangeConnectorTextHistoryItem.prototype.redo = function (manipulator) {
- var connector = manipulator.model.findConnector(this.connectorKey);
- this.oldText = connector.getText(this.position);
- manipulator.changeConnectorText(connector, this.position, this.text);
- };
- ChangeConnectorTextHistoryItem.prototype.undo = function (manipulator) {
- var connector = manipulator.model.findConnector(this.connectorKey);
- manipulator.changeConnectorText(connector, this.position, this.oldText);
- };
- return ChangeConnectorTextHistoryItem;
- }(HistoryItem_1.HistoryItem));
- exports.ChangeConnectorTextHistoryItem = ChangeConnectorTextHistoryItem;
- /***/ }),
- /* 99 */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- Object.defineProperty(exports, "__esModule", { value: true });
- var Utils_1 = __webpack_require__(0);
- var Evt_1 = __webpack_require__(49);
- var Base_1 = __webpack_require__(19);
- var Toolbox = /** @class */ (function () {
- function Toolbox() {
- this.dragStartLimit = 3;
- this.onDragOperation = new Utils_1.EventDispatcher();
- }
- Toolbox.prototype.initialize = function (element, option) {
- element.addEventListener("mousedown", this.onMouseDown.bind(this));
- document.addEventListener("mousemove", this.onMouseMove.bind(this));
- document.addEventListener("mouseup", this.onMouseUp.bind(this));
- };
- Toolbox.prototype.onMouseDown = function (evt) {
- this.mouseDownPoint = new Utils_1.Point(evt.pageX, evt.pageY);
- this.draggingObject = this.createDraggingObject(evt.target);
- if (this.draggingObject) {
- this.draggingObject.evt.onFinishDragging = this.finishDragging.bind(this);
- this.draggingObject.evt.onCaptured = this.capture.bind(this);
- this.onDragStart();
- }
- };
- Toolbox.prototype.onMouseMove = function (evt) {
- if (!Evt_1.Evt.IsLeftButtonPressed(evt))
- this.finishDragging();
- else if (this.draggingObject) {
- if (!this.draggingObject.element &&
- (Math.abs(evt.pageX - this.mouseDownPoint.x) > this.dragStartLimit ||
- Math.abs(evt.pageY - this.mouseDownPoint.y) > this.dragStartLimit)) {
- this.draggingObject.element = this.createDraggingElement(this.draggingObject);
- if (this.draggingObject.captured !== undefined)
- this.capture(this.draggingObject.captured, true);
- }
- if (this.draggingObject.element)
- this.updateDraggingElementPosition(evt);
- }
- };
- Toolbox.prototype.onMouseUp = function (evt) {
- this.finishDragging();
- };
- Toolbox.prototype.updateDraggingElementPosition = function (evt) {
- var element = this.draggingObject.element;
- var xPos = (evt.pageX - element.offsetWidth / 2);
- var yPos = (evt.pageY - element.offsetHeight / 2);
- Base_1.SetAbsoluteX(element, xPos);
- Base_1.SetAbsoluteY(element, yPos);
- };
- Toolbox.prototype.finishDragging = function () {
- if (this.draggingObject) {
- this.onDragEnd();
- var element = this.draggingObject.element;
- if (element)
- element.parentNode.removeChild(element);
- }
- delete this.draggingObject;
- };
- Toolbox.prototype.capture = function (captured, forced) {
- if (this.draggingObject && (this.draggingObject.captured !== captured || forced)) {
- this.draggingObject.captured = captured;
- if (this.draggingObject.element)
- this.draggingObject.element.classList.toggle("dxdi-tb-drag-captured", captured);
- }
- };
- Toolbox.prototype.onDragEnd = function () {
- this.onDragOperation.raise("NotifyToolboxDragEnd");
- };
- Toolbox.prototype.onDragStart = function () {
- this.onDragOperation.raise("NotifyToolboxDragStart");
- };
- return Toolbox;
- }());
- exports.Toolbox = Toolbox;
- var ToolboxDraggingObject = /** @class */ (function () {
- function ToolboxDraggingObject(evt) {
- this.evt = evt;
- }
- return ToolboxDraggingObject;
- }());
- exports.ToolboxDraggingObject = ToolboxDraggingObject;
- var DiagramDraggingEvent = /** @class */ (function () {
- function DiagramDraggingEvent() {
- }
- return DiagramDraggingEvent;
- }());
- exports.DiagramDraggingEvent = DiagramDraggingEvent;
- /***/ }),
- /* 100 */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- var __extends = (this && this.__extends) || (function () {
- var extendStatics = function (d, b) {
- extendStatics = Object.setPrototypeOf ||
- ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
- function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
- return extendStatics(d, b);
- };
- return function (d, b) {
- extendStatics(d, b);
- function __() { this.constructor = d; }
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
- };
- })();
- Object.defineProperty(exports, "__esModule", { value: true });
- var CommandBase_1 = __webpack_require__(7);
- var CommandStates_1 = __webpack_require__(6);
- var ModelUtils_1 = __webpack_require__(8);
- var DeleteCommand = /** @class */ (function (_super) {
- __extends(DeleteCommand, _super);
- function DeleteCommand() {
- return _super !== null && _super.apply(this, arguments) || this;
- }
- DeleteCommand.prototype.getState = function () {
- return new CommandStates_1.SimpleCommandState(!this.control.selection.isEmpty());
- };
- DeleteCommand.prototype.executeCore = function (state) {
- ModelUtils_1.ModelUtils.deleteSelection(this.control.history, this.control.model, this.control.selection);
- return true;
- };
- return DeleteCommand;
- }(CommandBase_1.CommandBase));
- exports.DeleteCommand = DeleteCommand;
- /***/ }),
- /* 101 */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- var __extends = (this && this.__extends) || (function () {
- var extendStatics = function (d, b) {
- extendStatics = Object.setPrototypeOf ||
- ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
- function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
- return extendStatics(d, b);
- };
- return function (d, b) {
- extendStatics(d, b);
- function __() { this.constructor = d; }
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
- };
- })();
- Object.defineProperty(exports, "__esModule", { value: true });
- var HistoryItem_1 = __webpack_require__(4);
- var MoveShapeHistoryItem = /** @class */ (function (_super) {
- __extends(MoveShapeHistoryItem, _super);
- function MoveShapeHistoryItem(shapeKey, position) {
- var _this = _super.call(this) || this;
- _this.shapeKey = shapeKey;
- _this.position = position;
- return _this;
- }
- MoveShapeHistoryItem.prototype.redo = function (manipulator) {
- var shape = manipulator.model.findShape(this.shapeKey);
- this.oldPosition = shape.position.clone();
- manipulator.moveShape(shape, this.position);
- };
- MoveShapeHistoryItem.prototype.undo = function (manipulator) {
- var shape = manipulator.model.findShape(this.shapeKey);
- manipulator.moveShape(shape, this.oldPosition);
- };
- return MoveShapeHistoryItem;
- }(HistoryItem_1.HistoryItem));
- exports.MoveShapeHistoryItem = MoveShapeHistoryItem;
- /***/ }),
- /* 102 */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- Object.defineProperty(exports, "__esModule", { value: true });
- var Base_1 = __webpack_require__(19);
- var Data = /** @class */ (function () {
- function Data() {
- }
- Data.ArrayInsert = function (array, element, position) {
- if (0 <= position && position < array.length) {
- for (var i = array.length; i > position; i--)
- array[i] = array[i - 1];
- array[position] = element;
- }
- else
- array.push(element);
- };
- Data.ArrayRemove = function (array, element) {
- var index = Data.ArrayIndexOf(array, element);
- if (index > -1)
- Data.ArrayRemoveAt(array, index);
- };
- Data.ArrayRemoveAt = function (array, index) {
- if (index >= 0 && index < array.length) {
- for (var i = index; i < array.length - 1; i++)
- array[i] = array[i + 1];
- array.pop();
- }
- };
- Data.ArrayClear = function (array) {
- while (array.length > 0)
- array.pop();
- };
- Data.ArrayIndexOf = function (array, element, comparer) {
- if (!comparer) {
- for (var i = 0; i < array.length; i++) {
- if (array[i] == element)
- return i;
- }
- }
- else {
- for (var i = 0; i < array.length; i++) {
- if (comparer(array[i], element))
- return i;
- }
- }
- return -1;
- };
- Data.ArrayContains = function (array, element) {
- return Data.ArrayIndexOf(array, element) >= 0;
- };
- Data.ArrayEqual = function (array1, array2) {
- var count1 = array1.length;
- var count2 = array2.length;
- if (count1 != count2)
- return false;
- for (var i = 0; i < count1; i++)
- if (array1[i] != array2[i])
- return false;
- return true;
- };
- Data.ArraySame = function (array1, array2) {
- if (array1.length !== array2.length)
- return false;
- return array1.every(function (elem) { return Data.ArrayContains(array2, elem); });
- };
- Data.ArrayGetIntegerEdgeValues = function (array) {
- var arrayToSort = Data.CollectionToArray(array);
- Data.ArrayIntegerAscendingSort(arrayToSort);
- return {
- start: arrayToSort[0],
- end: arrayToSort[arrayToSort.length - 1]
- };
- };
- Data.ArrayIntegerAscendingSort = function (array) {
- Data.ArrayIntegerSort(array, false);
- };
- Data.ArrayIntegerSort = function (array, desc) {
- array.sort(function (i1, i2) {
- var res = 0;
- if (i1 > i2)
- res = 1;
- else if (i1 < i2)
- res = -1;
- if (desc)
- res *= -1;
- return res;
- });
- };
- Data.CollectionsUnionToArray = function (firstCollection, secondCollection) {
- var result = [];
- var firstCollectionLength = firstCollection.length;
- var secondCollectionLength = secondCollection.length;
- for (var i = 0; i < firstCollectionLength + secondCollectionLength; i++) {
- if (i < firstCollectionLength)
- result.push(firstCollection[i]);
- else
- result.push(secondCollection[i - firstCollectionLength]);
- }
- return result;
- };
- Data.CollectionToArray = function (collection) {
- var array = [];
- for (var i = 0; i < collection.length; i++)
- array.push(collection[i]);
- return array;
- };
- Data.CreateHashTableFromArray = function (array) {
- var hash = [];
- for (var i = 0; i < array.length; i++)
- hash[array[i]] = 1;
- return hash;
- };
- Data.CreateIndexHashTableFromArray = function (array) {
- var hash = [];
- for (var i = 0; i < array.length; i++)
- hash[array[i]] = i;
- return hash;
- };
- Data.ArrayToHash = function (array, getKeyFunc, getValueFunc) {
- if (!(array instanceof Array))
- return {};
- return array.reduce(function (map, element, index) {
- var key = getKeyFunc(element, index);
- var value = getValueFunc(element, index);
- map[key] = value;
- return map;
- }, {});
- };
- Data.Sum = function (array, getValueFunc) {
- if (!(array instanceof Array))
- return 0;
- return array.reduce(function (prevValue, item) {
- var value = getValueFunc ? getValueFunc(item) : item;
- if (!Base_1.IsNumber(value))
- value = 0;
- return prevValue + value;
- }, 0);
- };
- Data.Min = function (array, getValueFunc) { return Data.CalculateArrayMinMax(array, getValueFunc, false); };
- ;
- Data.Max = function (array, getValueFunc) { return Data.CalculateArrayMinMax(array, getValueFunc, true); };
- ;
- Data.NearestLeftBinarySearchComparer = function (array, index, value) {
- var arrayElement = array[index];
- var leftPoint = arrayElement < value;
- var lastLeftPoint = leftPoint && index == array.length - 1;
- var nearestLeftPoint = lastLeftPoint || (leftPoint && array[index + 1] >= value);
- if (nearestLeftPoint)
- return 0;
- else
- return arrayElement < value ? -1 : 1;
- };
- Data.ArrayBinarySearch = function (array, value, binarySearchComparer, startIndex, length) {
- if (!binarySearchComparer)
- binarySearchComparer = Data.defaultBinarySearchComparer;
- if (!Base_1.IsExists(startIndex))
- startIndex = 0;
- if (!Base_1.IsExists(length))
- length = array.length - startIndex;
- var endIndex = (startIndex + length) - 1;
- while (startIndex <= endIndex) {
- var middle = (startIndex + ((endIndex - startIndex) >> 1));
- var compareResult = binarySearchComparer(array, middle, value);
- if (compareResult == 0)
- return middle;
- if (compareResult < 0)
- startIndex = middle + 1;
- else
- endIndex = middle - 1;
- }
- return -(startIndex + 1);
- };
- Data.ArrayFlatten = function (arrayOfArrays) {
- return [].concat.apply([], arrayOfArrays);
- };
- Data.GetDistinctArray = function (array) {
- var resultArray = [];
- for (var i = 0; i < array.length; i++) {
- var currentEntry = array[i];
- if (Data.ArrayIndexOf(resultArray, currentEntry) == -1) {
- resultArray.push(currentEntry);
- }
- }
- return resultArray;
- };
- Data.ForEach = function (arr, callback) {
- if (Array.prototype.forEach) {
- Array.prototype.forEach.call(arr, callback);
- }
- else {
- for (var i = 0, len = arr.length; i < len; i++) {
- callback(arr[i], i, arr);
- }
- }
- };
- Data.MergeHashTables = function (target, object) {
- if (!object || typeof (object) == "string")
- return target;
- if (!target)
- target = {};
- for (var key in object)
- if (key && !(key in target))
- target[key] = object[key];
- return target;
- };
- Data.Range = function (count, start) {
- count = parseInt(count) || 0;
- start = parseInt(start) || 0;
- if (count < 0)
- count = 0;
- if (start < 0)
- start = 0;
- return Array.apply(null, Array(count)).map(function (_val, i) { return start + i; });
- };
- Data.CalculateArrayMinMax = function (array, getValueFunc, isMax) {
- if (!(array instanceof Array))
- return 0;
- var startValue = isMax ? Number.NEGATIVE_INFINITY : Number.POSITIVE_INFINITY;
- return array.reduce(function (prevValue, item) {
- var value = getValueFunc ? getValueFunc(item) : item;
- if (!Base_1.IsNumber(value))
- value = startValue;
- var func = isMax ? Math.max : Math.min;
- return func(value, prevValue);
- }, startValue);
- };
- Data.defaultBinarySearchComparer = function (array, index, value) {
- var arrayElement = array[index];
- if (arrayElement == value)
- return 0;
- else
- return arrayElement < value ? -1 : 1;
- };
- return Data;
- }());
- exports.Data = Data;
- /***/ }),
- /* 103 */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- Object.defineProperty(exports, "__esModule", { value: true });
- var Base_1 = __webpack_require__(19);
- var Str = /** @class */ (function () {
- function Str() {
- }
- Str.TrimStart = function (str) {
- return Str.trimInternal(str, true, false);
- };
- Str.TrimEnd = function (str) {
- return Str.trimInternal(str, false, true);
- };
- Str.Trim = function (str) {
- return Str.trimInternal(str, true, true);
- };
- Str.EncodeHtml = function (html) {
- return Str.ApplyReplacement(html, [
- [/&/g, '&x;'], [/&/g, '&'],
- [/"/g, '"x;'], [/"/g, '"'],
- [/</g, '<x;'], [/</g, '<'],
- [/>/g, '>x;'], [/>/g, '>']
- ]);
- };
- Str.trimInternal = function (source, trimStart, trimEnd) {
- var len = source.length;
- if (!len)
- return source;
- if (len < 0xBABA1) { // B181394
- var result = source;
- if (trimStart) {
- result = result.replace(/^\s+/, "");
- }
- if (trimEnd) {
- result = result.replace(/\s+$/, "");
- }
- return result;
- }
- else {
- var start = 0;
- if (trimEnd) {
- while (len > 0 && Str.whiteSpaces[source.charCodeAt(len - 1)]) {
- len--;
- }
- }
- if (trimStart && len > 0) {
- while (start < len && Str.whiteSpaces[source.charCodeAt(start)]) {
- start++;
- }
- }
- return source.substring(start, len);
- }
- };
- Str.ApplyReplacement = function (text, replecementTable) {
- //if (typeof (text) != "string")
- // text = text.toString();
- for (var i = 0; i < replecementTable.length; i++) {
- var replacement = replecementTable[i];
- text = text.replace(replacement[0], replacement[1]);
- }
- return text;
- };
- Str.DecodeHtmlViaTextArea = function (html) {
- var textArea = document.createElement("TEXTAREA");
- Base_1.setInnerHtmlInternal(textArea, html);
- return textArea.value;
- };
- Str.whiteSpaces = {
- 0x0009: 1, 0x000a: 1, 0x000b: 1, 0x000c: 1, 0x000d: 1, 0x0020: 1, 0x0085: 1,
- 0x00a0: 1, 0x1680: 1, 0x180e: 1, 0x2000: 1, 0x2001: 1, 0x2002: 1, 0x2003: 1,
- 0x2004: 1, 0x2005: 1, 0x2006: 1, 0x2007: 1, 0x2008: 1, 0x2009: 1, 0x200a: 1,
- 0x200b: 1, 0x2028: 1, 0x2029: 1, 0x202f: 1, 0x205f: 1, 0x3000: 1
- };
- return Str;
- }());
- exports.Str = Str;
- /***/ }),
- /* 104 */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- Object.defineProperty(exports, "__esModule", { value: true });
- var Browser_1 = __webpack_require__(20);
- var Attr = /** @class */ (function () {
- function Attr() {
- }
- Attr.SetAttribute = function (obj, attrName, value) {
- if (obj.setAttribute) {
- if (Attr.isSourceResetRequired() && attrName.toLowerCase() === "src") // T481593
- obj.setAttribute(attrName, "");
- obj.setAttribute(attrName, value);
- }
- else if (obj.setProperty)
- obj.setProperty(attrName, value, "");
- };
- Attr.GetAttribute = function (obj, attrName) {
- if (obj.getAttribute)
- return obj.getAttribute(attrName);
- else if (obj.getPropertyValue) {
- if (Browser_1.Browser.Firefox) { //T644613
- try {
- return obj.getPropertyValue(attrName);
- }
- catch (e) {
- return obj[attrName];
- }
- }
- return obj.getPropertyValue(attrName);
- }
- return null;
- };
- Attr.GetTabIndexAttributeName = function () {
- return Browser_1.Browser.IE ? "tabIndex" : "tabindex";
- };
- Attr.ChangeStyleAttribute = function (obj, attrName, newValue) {
- Attr.ChangeAttributeExtended(obj.style, attrName, obj, "saved" + attrName, newValue);
- };
- Attr.ChangeAttributeExtended = function (obj, attrName, savedObj, savedAttrName, newValue) {
- Attr.SaveAttribute(obj, attrName, savedObj, savedAttrName);
- Attr.SetAttribute(obj, attrName, newValue);
- };
- Attr.SaveAttribute = function (obj, attrName, savedObj, savedAttrName) {
- if (!Attr.IsExistsAttribute(savedObj, savedAttrName)) {
- var oldValue = Attr.IsExistsAttribute(obj, attrName) ? Attr.GetAttribute(obj, attrName) : Attr.EmptyObject;
- Attr.SetAttribute(savedObj, savedAttrName, oldValue);
- }
- };
- Attr.RestoreAttributeExtended = function (obj, attrName, savedObj, savedAttrName) {
- if (Attr.IsExistsAttribute(savedObj, savedAttrName)) {
- var oldValue = Attr.GetAttribute(savedObj, savedAttrName);
- if (oldValue != Attr.EmptyObject)
- Attr.SetAttribute(obj, attrName, oldValue);
- else
- Attr.RemoveAttribute(obj, attrName);
- Attr.RemoveAttribute(savedObj, savedAttrName);
- return true;
- }
- return false;
- };
- Attr.RemoveAttribute = function (obj, attrName) {
- if (obj.removeAttribute)
- obj.removeAttribute(attrName);
- else if (obj.removeProperty)
- obj.removeProperty(attrName);
- };
- Attr.IsExistsAttribute = function (obj, attrName) {
- var value = Attr.GetAttribute(obj, attrName);
- return (value != null) && (value !== "");
- };
- Attr.isSourceResetRequired = function () {
- return Browser_1.Browser.IE && Browser_1.Browser.MajorVersion >= 11;
- };
- Attr.EmptyObject = {};
- Attr.RestoreStyleAttribute = function (obj, attrName) {
- return Attr.RestoreAttributeExtended(obj.style, attrName, obj, "saved" + attrName);
- };
- return Attr;
- }());
- exports.Attr = Attr;
- /***/ }),
- /* 105 */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- var __extends = (this && this.__extends) || (function () {
- var extendStatics = function (d, b) {
- extendStatics = Object.setPrototypeOf ||
- ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
- function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
- return extendStatics(d, b);
- };
- return function (d, b) {
- extendStatics(d, b);
- function __() { this.constructor = d; }
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
- };
- })();
- Object.defineProperty(exports, "__esModule", { value: true });
- var ConnectorPointsCalculatorBase_1 = __webpack_require__(71);
- var ConnectorRenderPoint_1 = __webpack_require__(27);
- var ConnectorPointsCalculator = /** @class */ (function (_super) {
- __extends(ConnectorPointsCalculator, _super);
- function ConnectorPointsCalculator() {
- return _super !== null && _super.apply(this, arguments) || this;
- }
- ConnectorPointsCalculator.prototype.getPoints = function () {
- return this.connector.points.map(function (pt, index) { return new ConnectorRenderPoint_1.ConnectorRenderPoint(pt.x, pt.y, index); });
- };
- return ConnectorPointsCalculator;
- }(ConnectorPointsCalculatorBase_1.ConnectorPointsCalculatorBase));
- exports.ConnectorPointsCalculator = ConnectorPointsCalculator;
- /***/ }),
- /* 106 */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- var __extends = (this && this.__extends) || (function () {
- var extendStatics = function (d, b) {
- extendStatics = Object.setPrototypeOf ||
- ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
- function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
- return extendStatics(d, b);
- };
- return function (d, b) {
- extendStatics(d, b);
- function __() { this.constructor = d; }
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
- };
- })();
- Object.defineProperty(exports, "__esModule", { value: true });
- var Utils_1 = __webpack_require__(0);
- var DiagramItem_1 = __webpack_require__(3);
- var ConnectorPointsCalculatorBase_1 = __webpack_require__(71);
- var ConnectorPointsOrthogonalUndefinedSideCalculator_1 = __webpack_require__(107);
- var ConnectorPointsOrthogonalSouthSideCalculator_1 = __webpack_require__(108);
- var ConnectorPointsOrthogonalNorthSideCalculator_1 = __webpack_require__(109);
- var ConnectorPointsOrthogonalEastSideCalculator_1 = __webpack_require__(110);
- var ConnectorPointsOrthogonalWestSideCalculator_1 = __webpack_require__(111);
- var ConnectorRenderPoint_1 = __webpack_require__(27);
- var ConnectorPointsOrthogonalCalculator = /** @class */ (function (_super) {
- __extends(ConnectorPointsOrthogonalCalculator, _super);
- function ConnectorPointsOrthogonalCalculator(connector) {
- var _this = _super.call(this, connector) || this;
- _this.sideCalculators = {};
- _this.sideCalculators[DiagramItem_1.ConnectionPointSide.Undefined] = new ConnectorPointsOrthogonalUndefinedSideCalculator_1.ConnectorPointsOrthogonalUndefinedSideCalculator(_this);
- _this.sideCalculators[DiagramItem_1.ConnectionPointSide.South] = new ConnectorPointsOrthogonalSouthSideCalculator_1.ConnectorPointsOrthogonalSouthSideCalculator(_this);
- _this.sideCalculators[DiagramItem_1.ConnectionPointSide.North] = new ConnectorPointsOrthogonalNorthSideCalculator_1.ConnectorPointsOrthogonalNorthSideCalculator(_this);
- _this.sideCalculators[DiagramItem_1.ConnectionPointSide.East] = new ConnectorPointsOrthogonalEastSideCalculator_1.ConnectorPointsOrthogonalEastSideCalculator(_this);
- _this.sideCalculators[DiagramItem_1.ConnectionPointSide.West] = new ConnectorPointsOrthogonalWestSideCalculator_1.ConnectorPointsOrthogonalWestSideCalculator(_this);
- return _this;
- }
- Object.defineProperty(ConnectorPointsOrthogonalCalculator.prototype, "beginRect", {
- get: function () { return this.connector.beginItem ? this.connector.beginItem.rectangle : undefined; },
- enumerable: true,
- configurable: true
- });
- Object.defineProperty(ConnectorPointsOrthogonalCalculator.prototype, "endRect", {
- get: function () { return this.connector.endItem ? this.connector.endItem.rectangle : undefined; },
- enumerable: true,
- configurable: true
- });
- ConnectorPointsOrthogonalCalculator.prototype.getPoints = function () {
- var points = this.connector.points.map(function (pt, index) { return new ConnectorRenderPoint_1.ConnectorRenderPoint(pt.x, pt.y, index); });
- this.removeUnnecessaryLinePoints(points);
- var beginIndex = 0, endIndex = points.length - 1;
- var beginSide = this.getPointSide(points, 0);
- var beginNextSide = this.getPointSide(points, 1);
- var endSide = this.getPointSide(points, points.length - 1);
- var endPrevSide = this.getPointSide(points, points.length - 1 - 1);
- var beginSideCalculator = this.getSideCalculator(beginSide);
- var endSideCalculator = this.getSideCalculator(endSide);
- var originRect = this.beginRect;
- var originPoint = beginSideCalculator.getCorrectOriginPoint(points[beginIndex], originRect);
- var targetPoint = points[beginIndex + 1];
- if (points.length === 2 && beginSideCalculator.isOnSidePoint(originPoint, targetPoint) &&
- beginSideCalculator.isDirectConnectionAllowed(beginNextSide, originPoint, targetPoint)) {
- var directConnectionPoints = beginSideCalculator.getDirectConnectionPoints(originPoint, targetPoint);
- directConnectionPoints.forEach(function (pt) {
- points.splice(beginIndex + 1, 0, pt);
- beginIndex++;
- endIndex++;
- });
- }
- else {
- var bOffsetPoints = beginSideCalculator.getBeginOffsetPoints(beginNextSide, points[beginIndex], points[beginIndex + 1], this.beginRect);
- bOffsetPoints.forEach(function (pt) {
- points.splice(beginIndex + 1, 0, pt);
- });
- beginIndex += bOffsetPoints.length;
- endIndex += bOffsetPoints.length;
- var eOffsetPoints = endSideCalculator.getEndOffsetPoints(endPrevSide, points[endIndex], points[endIndex - 1], this.endRect);
- eOffsetPoints.forEach(function (pt, index) {
- points.splice(endIndex + index, 0, pt);
- });
- for (var index = beginIndex; index < endIndex; index++) {
- var nextIndex = index + 1;
- var middlePoint = this.getMiddlePoint(points[index], points[index - 1], index - 1 === 0, points[nextIndex], points[nextIndex + 1], nextIndex + 1 === points.length - 1);
- if (middlePoint !== undefined) {
- points.splice(index + 1, 0, middlePoint);
- index++;
- endIndex++;
- }
- }
- }
- this.removeUnnecessaryLinePoints(points);
- return points;
- };
- ConnectorPointsOrthogonalCalculator.prototype.getSideCalculator = function (side) {
- return this.sideCalculators[side];
- };
- ConnectorPointsOrthogonalCalculator.prototype.getPointSide = function (points, index) {
- if (index === 0 && this.connector.beginItem) {
- var connectionPointIndex = this.connector.beginConnectionPointIndex;
- return this.connector.beginItem.getConnectionPointSide(connectionPointIndex, points[1]);
- }
- if (index === points.length - 1 && this.connector.endItem) {
- var connectionPointIndex = this.connector.endConnectionPointIndex;
- return this.connector.endItem.getConnectionPointSide(connectionPointIndex, points[points.length - 2]);
- }
- return DiagramItem_1.ConnectionPointSide.Undefined;
- };
- ConnectorPointsOrthogonalCalculator.prototype.getMiddlePoints = function (point1, point2) {
- if (point1.x === point2.x || point1.y === point2.y)
- return [];
- return [
- new ConnectorRenderPoint_1.ConnectorRenderPoint(point1.x, point2.y),
- new ConnectorRenderPoint_1.ConnectorRenderPoint(point2.x, point1.y)
- ];
- };
- ConnectorPointsOrthogonalCalculator.prototype.getMiddlePoint = function (point1, directionPoint1, nextToBegin, point2, directionPoint2, nextToEnd) {
- var _this = this;
- var point;
- var points = this.getMiddlePoints(point1, point2);
- points.forEach(function (pt) {
- var rect1 = _this.createPointsRect(point1, pt);
- var rect2 = _this.createPointsRect(pt, point2);
- var itemRect1 = _this.connector.beginItem ? _this.connector.beginItem.rectangle : undefined;
- var itemRect2 = _this.connector.endItem ? _this.connector.endItem.rectangle : undefined;
- if (itemRect1) {
- if (itemRect1.intersect(rect1) || itemRect1.intersect(rect2))
- return;
- }
- if (itemRect2) {
- if (itemRect2.intersect(rect1) || itemRect2.intersect(rect2))
- return;
- }
- if ((!_this.isReturnPoint(pt, point1, directionPoint1) || _this.isIntermediatePoints(point1, directionPoint1)) &&
- (!_this.isReturnPoint(pt, point2, directionPoint2) || _this.isIntermediatePoints(point2, directionPoint2))) {
- if (point === undefined)
- point = pt;
- else if (_this.isPriorMiddlePoint(pt, point1, directionPoint1, point2, directionPoint2))
- point = pt;
- }
- });
- if (point === undefined && points.length > 0)
- point = points[0];
- return point;
- };
- ConnectorPointsOrthogonalCalculator.prototype.createPointsRect = function (point1, point2) {
- var result = Utils_1.Rectangle.createByPoints(point1, point2);
- if (result.width > 0)
- result = result.inflate(-1, 0);
- if (result.height > 0)
- result = result.inflate(0, -1);
- return result;
- };
- ConnectorPointsOrthogonalCalculator.prototype.isPriorMiddlePoint = function (point, point1, directionPoint1, point2, directionPoint2) {
- if (directionPoint1) {
- if (point.x === directionPoint1.x || point.y === directionPoint1.y)
- return true;
- }
- if (directionPoint2) {
- if (point.x === directionPoint2.x || point.y === directionPoint2.y)
- return true;
- }
- return false;
- };
- ConnectorPointsOrthogonalCalculator.prototype.isReturnPoint = function (point, point1, point2) {
- if (point1 !== undefined && point2 !== undefined) {
- if (point.x === point2.x)
- if (point1.y < point.y && point.y < point2.y || point1.y > point.y && point.y > point2.y)
- return true;
- if (point.y === point2.y)
- if (point1.x < point.x && point.x < point2.x || point1.x > point.x && point.x > point2.x)
- return true;
- }
- return false;
- };
- ConnectorPointsOrthogonalCalculator.prototype.isIntermediatePoints = function (point1, point2) {
- return 0 < point1.pointIndex && point1.pointIndex < this.connector.points.length - 1 &&
- 0 < point2.pointIndex && point2.pointIndex < this.connector.points.length - 1;
- };
- ConnectorPointsOrthogonalCalculator.prototype.removeUnnecessaryLinePoints = function (points) {
- Utils_1.GeometryUtils.removeUnnecessaryLinePoints(points, function (pt, index) {
- if (pt.pointIndex === -1) {
- points.splice(index, 1);
- return true;
- }
- else {
- pt.skipped = true;
- return false;
- }
- }, function (pt) {
- return pt !== undefined && !pt.skipped;
- });
- };
- return ConnectorPointsOrthogonalCalculator;
- }(ConnectorPointsCalculatorBase_1.ConnectorPointsCalculatorBase));
- exports.ConnectorPointsOrthogonalCalculator = ConnectorPointsOrthogonalCalculator;
- /***/ }),
- /* 107 */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- var __extends = (this && this.__extends) || (function () {
- var extendStatics = function (d, b) {
- extendStatics = Object.setPrototypeOf ||
- ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
- function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
- return extendStatics(d, b);
- };
- return function (d, b) {
- extendStatics(d, b);
- function __() { this.constructor = d; }
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
- };
- })();
- Object.defineProperty(exports, "__esModule", { value: true });
- var ConnectorPointsOrthogonalSideCalculatorBase_1 = __webpack_require__(33);
- var ConnectorRenderPoint_1 = __webpack_require__(27);
- var ConnectorPointsOrthogonalUndefinedSideCalculator = /** @class */ (function (_super) {
- __extends(ConnectorPointsOrthogonalUndefinedSideCalculator, _super);
- function ConnectorPointsOrthogonalUndefinedSideCalculator(parent) {
- return _super.call(this, parent) || this;
- }
- ConnectorPointsOrthogonalUndefinedSideCalculator.prototype.getCorrectOriginPoint = function (originPoint, originRect) {
- return originPoint;
- };
- ConnectorPointsOrthogonalUndefinedSideCalculator.prototype.getSameShapeOffsetPoints = function (targetSide, originPoint, targetPoint, originRect) {
- return [];
- };
- ConnectorPointsOrthogonalUndefinedSideCalculator.prototype.getOverlappedPointsOffsetPoints = function (targetSide, originPoint, targetPoint, originRect) {
- return [];
- };
- ConnectorPointsOrthogonalUndefinedSideCalculator.prototype.getBeginOverlappedShapeOffsetPoints = function (targetSide, originPoint, targetPoint, originRect) {
- return [];
- };
- ConnectorPointsOrthogonalUndefinedSideCalculator.prototype.getEndOverlappedShapeOffsetPoints = function (targetSide, originPoint, targetPoint, originRect) {
- return [];
- };
- ConnectorPointsOrthogonalUndefinedSideCalculator.prototype.getBeginOnSideOffsetPoints = function (targetSide, originPoint, targetPoint, originRect) {
- return [];
- };
- ConnectorPointsOrthogonalUndefinedSideCalculator.prototype.getEndOnSideOffsetPoints = function (targetSide, originPoint, targetPoint, originRect) {
- return [];
- };
- ConnectorPointsOrthogonalUndefinedSideCalculator.prototype.getBeginOffSideOffsetPoints = function (targetSide, originPoint, targetPoint, originRect) {
- return [];
- };
- ConnectorPointsOrthogonalUndefinedSideCalculator.prototype.getEndOffSideOffsetPoints = function (targetSide, originPoint, targetPoint, originRect) {
- return [];
- };
- ConnectorPointsOrthogonalUndefinedSideCalculator.prototype.isOnSidePoint = function (originPoint, targetPoint) {
- return true;
- };
- ConnectorPointsOrthogonalUndefinedSideCalculator.prototype.isDirectConnectionAllowed = function (targetSide, originPoint, targetPoint) {
- var calculator = this.getSideCalculator(originPoint, targetPoint);
- if (calculator !== undefined)
- return calculator.isDirectConnectionAllowed(targetSide, originPoint, targetPoint);
- return true;
- };
- ConnectorPointsOrthogonalUndefinedSideCalculator.prototype.getDirectConnectionPoints = function (originPoint, targetPoint) {
- var diffX = Math.abs(targetPoint.x - originPoint.x);
- var diffY = Math.abs(targetPoint.y - originPoint.y);
- if (diffX > diffY) {
- var minX = Math.min(originPoint.x, targetPoint.x);
- var cx = minX + diffX / 2;
- return [
- new ConnectorRenderPoint_1.ConnectorRenderPoint(cx, originPoint.y),
- new ConnectorRenderPoint_1.ConnectorRenderPoint(cx, targetPoint.y)
- ];
- }
- else {
- var minY = Math.min(originPoint.y, targetPoint.y);
- var cy = minY + diffY / 2;
- return [
- new ConnectorRenderPoint_1.ConnectorRenderPoint(originPoint.x, cy),
- new ConnectorRenderPoint_1.ConnectorRenderPoint(targetPoint.x, cy)
- ];
- }
- };
- return ConnectorPointsOrthogonalUndefinedSideCalculator;
- }(ConnectorPointsOrthogonalSideCalculatorBase_1.ConnectorPointsOrthogonalSideCalculatorBase));
- exports.ConnectorPointsOrthogonalUndefinedSideCalculator = ConnectorPointsOrthogonalUndefinedSideCalculator;
- /***/ }),
- /* 108 */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- var __extends = (this && this.__extends) || (function () {
- var extendStatics = function (d, b) {
- extendStatics = Object.setPrototypeOf ||
- ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
- function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
- return extendStatics(d, b);
- };
- return function (d, b) {
- extendStatics(d, b);
- function __() { this.constructor = d; }
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
- };
- })();
- Object.defineProperty(exports, "__esModule", { value: true });
- var DiagramItem_1 = __webpack_require__(3);
- var ConnectorPointsOrthogonalSideCalculatorBase_1 = __webpack_require__(33);
- var ConnectorRenderPoint_1 = __webpack_require__(27);
- var ConnectorPointsOrthogonalSouthSideCalculator = /** @class */ (function (_super) {
- __extends(ConnectorPointsOrthogonalSouthSideCalculator, _super);
- function ConnectorPointsOrthogonalSouthSideCalculator(parent) {
- return _super.call(this, parent) || this;
- }
- ConnectorPointsOrthogonalSouthSideCalculator.prototype.getCorrectOriginPoint = function (originPoint, originRect) {
- if (originPoint.y < originRect.bottom)
- originPoint = originPoint.offset(0, originRect.bottom - originPoint.y);
- return originPoint;
- };
- ConnectorPointsOrthogonalSouthSideCalculator.prototype.getSameShapeOffsetPoints = function (targetSide, originPoint, targetPoint, originRect) {
- switch (targetSide) {
- case DiagramItem_1.ConnectionPointSide.East:
- case DiagramItem_1.ConnectionPointSide.West:
- case DiagramItem_1.ConnectionPointSide.South:
- return [originPoint.offset(0, this.getMinOffset())];
- case DiagramItem_1.ConnectionPointSide.North:
- return this.getAsideOffsetPoints(originPoint, targetPoint, originRect, this.getMinOffset(), this.getMinOffset());
- }
- };
- ConnectorPointsOrthogonalSouthSideCalculator.prototype.getOverlappedPointsOffsetPoints = function (targetSide, originPoint, targetPoint, originRect) {
- switch (targetSide) {
- case DiagramItem_1.ConnectionPointSide.South:
- return [originPoint.offset(0, this.getMinOffset())];
- case DiagramItem_1.ConnectionPointSide.North:
- return [originPoint.offset(0, -this.getMinOffset())];
- }
- return [];
- };
- ConnectorPointsOrthogonalSouthSideCalculator.prototype.getBeginOverlappedShapeOffsetPoints = function (targetSide, originPoint, targetPoint, originRect) {
- switch (targetSide) {
- case DiagramItem_1.ConnectionPointSide.East:
- if (originPoint.y < targetPoint.y) {
- if (originPoint.x > targetPoint.x)
- return [];
- else
- return [originPoint.offset(0, this.getMinOffset())];
- }
- if (originPoint.y > this.endRect.bottom)
- return this.getAsideOffsetPoints(originPoint, targetPoint, originRect, this.getMinOffset(), this.getMinOffset(), false);
- return [originPoint.offset(0, this.getMinOffset())];
- case DiagramItem_1.ConnectionPointSide.West:
- if (originPoint.y < targetPoint.y) {
- if (originPoint.x < targetPoint.x)
- return [];
- else
- return [originPoint.offset(0, this.getMinOffset())];
- }
- if (originPoint.y > this.endRect.bottom)
- return this.getAsideOffsetPoints(originPoint, targetPoint, originRect, this.getMinOffset(), this.getMinOffset(), true);
- return [originPoint.offset(0, this.getMinOffset())];
- case DiagramItem_1.ConnectionPointSide.South:
- return [originPoint.offset(0, this.getMinOffset())];
- case DiagramItem_1.ConnectionPointSide.North:
- return this.getAsideOffsetPoints(originPoint, targetPoint, originRect, this.getMinOffset(), this.getMinOffset(), originPoint.x < targetPoint.x);
- }
- };
- ConnectorPointsOrthogonalSouthSideCalculator.prototype.getEndOverlappedShapeOffsetPoints = function (targetSide, originPoint, targetPoint, originRect) {
- switch (targetSide) {
- case DiagramItem_1.ConnectionPointSide.East:
- if (targetPoint.y < originPoint.y)
- return this.getAsideOffsetPoints(originPoint, targetPoint, originRect, this.getMinOffset(), this.getMinOffset(), false);
- if (originPoint.x < targetPoint.x)
- return [originPoint.offset(0, this.getMinOffset())];
- return [];
- case DiagramItem_1.ConnectionPointSide.West:
- if (targetPoint.y < originPoint.y)
- return this.getAsideOffsetPoints(originPoint, targetPoint, originRect, this.getMinOffset(), this.getMinOffset(), true);
- if (originPoint.x > targetPoint.x)
- return [originPoint.offset(0, this.getMinOffset())];
- return [];
- case DiagramItem_1.ConnectionPointSide.South:
- return [originPoint.offset(0, this.getMinOffset())];
- case DiagramItem_1.ConnectionPointSide.North:
- var offset = this.getMinOffset();
- if (this.beginRect.bottom > originPoint.y)
- offset += this.beginRect.bottom - originPoint.y;
- return [originPoint.offset(0, offset)];
- }
- };
- ConnectorPointsOrthogonalSouthSideCalculator.prototype.getBeginOnSideOffsetPoints = function (targetSide, originPoint, targetPoint, originRect) {
- return [originPoint.offset(0, this.getScaleableOffsetY(originPoint, targetPoint, false))];
- };
- ConnectorPointsOrthogonalSouthSideCalculator.prototype.getEndOnSideOffsetPoints = function (targetSide, originPoint, targetPoint, originRect) {
- return [originPoint.offset(0, this.getScaleableOffsetY(originPoint, targetPoint, true))];
- };
- ConnectorPointsOrthogonalSouthSideCalculator.prototype.getBeginOffSideOffsetPoints = function (targetSide, originPoint, targetPoint, originRect) {
- switch (targetSide) {
- case DiagramItem_1.ConnectionPointSide.East:
- if (this.isBeginEndOverlappedX())
- return this.getScaleableAsideOffsetPoints(originPoint, targetPoint, originRect, false, false);
- break;
- case DiagramItem_1.ConnectionPointSide.West:
- if (this.isBeginEndOverlappedX())
- return this.getScaleableAsideOffsetPoints(originPoint, targetPoint, originRect, false, true);
- break;
- case DiagramItem_1.ConnectionPointSide.South:
- if (this.isBeginEndOverlappedX())
- return this.getScaleableAsideOffsetPoints(originPoint, targetPoint, originRect, false);
- break;
- case DiagramItem_1.ConnectionPointSide.Undefined:
- case DiagramItem_1.ConnectionPointSide.North:
- return this.getScaleableAsideOffsetPoints(originPoint, targetPoint, originRect, false);
- }
- return [originPoint.offset(0, this.getScaleableOffsetY(originPoint, targetPoint, false))];
- };
- ConnectorPointsOrthogonalSouthSideCalculator.prototype.getEndOffSideOffsetPoints = function (targetSide, originPoint, targetPoint, originRect) {
- if (targetSide === DiagramItem_1.ConnectionPointSide.Undefined)
- return this.getScaleableAsideOffsetPoints(originPoint, targetPoint, originRect, true);
- else if (this.isBeginEndOverlappedX()) {
- var direction = this.beginRect.center.x > this.endRect.center.x;
- return this.getScaleableAsideOffsetPoints(originPoint, targetPoint, originRect, true, direction);
- }
- return [originPoint.offset(0, this.getScaleableOffsetY(originPoint, targetPoint, true))];
- };
- ConnectorPointsOrthogonalSouthSideCalculator.prototype.getAsideOffsetPoints = function (originPoint, targetPoint, originRect, offset, asideOffset, direction) {
- var points = [];
- if (originRect !== undefined) {
- if (direction === undefined)
- direction = targetPoint.x < originPoint.x;
- if (direction)
- points.push(originPoint.offset(-(originPoint.x - originRect.left + asideOffset), offset));
- else
- points.push(originPoint.offset((originRect.right - originPoint.x + asideOffset), offset));
- }
- points.push(originPoint.offset(0, offset));
- return points;
- };
- ConnectorPointsOrthogonalSouthSideCalculator.prototype.getScaleableAsideOffsetPoints = function (originPoint, targetPoint, originRect, isEnd, direction) {
- var offset = this.getScaleableOffsetY(originPoint, targetPoint, isEnd);
- var asideOffset = this.getScaleableOffsetX(originPoint, targetPoint, isEnd);
- return this.getAsideOffsetPoints(originPoint, targetPoint, originRect, offset, asideOffset, direction);
- };
- ConnectorPointsOrthogonalSouthSideCalculator.prototype.getScaleableOffsetX = function (originPoint, targetPoint, isEnd) {
- if (this.beginRect && this.endRect) {
- if (!isEnd && !this.isBeginEndOverlappedX()) {
- var distance = void 0;
- if (targetPoint.x < originPoint.x)
- distance = this.beginRect.left - this.endRect.right;
- else
- distance = this.endRect.left - this.beginRect.right;
- if (distance < this.getMinOffset() * 2)
- return distance / 2;
- }
- }
- return this.getMinOffset();
- };
- ConnectorPointsOrthogonalSouthSideCalculator.prototype.getScaleableOffsetY = function (originPoint, targetPoint, isEnd) {
- if (this.beginRect && this.endRect) {
- var distance = isEnd ? this.beginRect.top - originPoint.y : this.endRect.top - originPoint.y;
- if (distance > 0 && distance < this.getMinOffset() * 2)
- return distance / 2;
- }
- return this.getMinOffset();
- };
- ConnectorPointsOrthogonalSouthSideCalculator.prototype.isOnSidePoint = function (originPoint, targetPoint) {
- return targetPoint.y > originPoint.y;
- };
- ConnectorPointsOrthogonalSouthSideCalculator.prototype.isDirectConnectionAllowed = function (targetSide, originPoint, targetPoint) {
- return targetSide === DiagramItem_1.ConnectionPointSide.North || targetSide === DiagramItem_1.ConnectionPointSide.Undefined;
- };
- ConnectorPointsOrthogonalSouthSideCalculator.prototype.getDirectConnectionPoints = function (originPoint, targetPoint) {
- var cy = originPoint.y + (targetPoint.y - originPoint.y) / 2;
- return [
- new ConnectorRenderPoint_1.ConnectorRenderPoint(originPoint.x, cy),
- new ConnectorRenderPoint_1.ConnectorRenderPoint(targetPoint.x, cy)
- ];
- };
- return ConnectorPointsOrthogonalSouthSideCalculator;
- }(ConnectorPointsOrthogonalSideCalculatorBase_1.ConnectorPointsOrthogonalSideCalculatorBase));
- exports.ConnectorPointsOrthogonalSouthSideCalculator = ConnectorPointsOrthogonalSouthSideCalculator;
- /***/ }),
- /* 109 */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- var __extends = (this && this.__extends) || (function () {
- var extendStatics = function (d, b) {
- extendStatics = Object.setPrototypeOf ||
- ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
- function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
- return extendStatics(d, b);
- };
- return function (d, b) {
- extendStatics(d, b);
- function __() { this.constructor = d; }
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
- };
- })();
- Object.defineProperty(exports, "__esModule", { value: true });
- var DiagramItem_1 = __webpack_require__(3);
- var ConnectorPointsOrthogonalSideCalculatorBase_1 = __webpack_require__(33);
- var ConnectorRenderPoint_1 = __webpack_require__(27);
- var ConnectorPointsOrthogonalNorthSideCalculator = /** @class */ (function (_super) {
- __extends(ConnectorPointsOrthogonalNorthSideCalculator, _super);
- function ConnectorPointsOrthogonalNorthSideCalculator(parent) {
- return _super.call(this, parent) || this;
- }
- ConnectorPointsOrthogonalNorthSideCalculator.prototype.getCorrectOriginPoint = function (originPoint, originRect) {
- if (originPoint.y > originRect.top)
- originPoint = originPoint.offset(0, originRect.top - originPoint.y);
- return originPoint;
- };
- ConnectorPointsOrthogonalNorthSideCalculator.prototype.getSameShapeOffsetPoints = function (targetSide, originPoint, targetPoint, originRect) {
- switch (targetSide) {
- case DiagramItem_1.ConnectionPointSide.East:
- case DiagramItem_1.ConnectionPointSide.West:
- case DiagramItem_1.ConnectionPointSide.North:
- return [originPoint.offset(0, -this.getMinOffset())];
- case DiagramItem_1.ConnectionPointSide.South:
- return this.getAsideOffsetPoints(originPoint, targetPoint, originRect, this.getMinOffset(), this.getMinOffset());
- }
- };
- ConnectorPointsOrthogonalNorthSideCalculator.prototype.getOverlappedPointsOffsetPoints = function (targetSide, originPoint, targetPoint, originRect) {
- switch (targetSide) {
- case DiagramItem_1.ConnectionPointSide.South:
- return [originPoint.offset(0, this.getMinOffset())];
- case DiagramItem_1.ConnectionPointSide.North:
- return [originPoint.offset(0, -this.getMinOffset())];
- }
- return [];
- };
- ConnectorPointsOrthogonalNorthSideCalculator.prototype.getBeginOverlappedShapeOffsetPoints = function (targetSide, originPoint, targetPoint, originRect) {
- switch (targetSide) {
- case DiagramItem_1.ConnectionPointSide.East:
- if (originPoint.y > targetPoint.y) {
- if (originPoint.x > targetPoint.x)
- return [];
- else
- return [originPoint.offset(0, -this.getMinOffset())];
- }
- if (originPoint.y < this.endRect.top)
- return this.getAsideOffsetPoints(originPoint, targetPoint, originRect, this.getMinOffset(), this.getMinOffset(), false);
- return [originPoint.offset(0, -this.getMinOffset())];
- case DiagramItem_1.ConnectionPointSide.West:
- if (originPoint.y > targetPoint.y) {
- if (originPoint.x < targetPoint.x)
- return [];
- else
- return [originPoint.offset(0, -this.getMinOffset())];
- }
- if (originPoint.y < this.endRect.top)
- return this.getAsideOffsetPoints(originPoint, targetPoint, originRect, this.getMinOffset(), this.getMinOffset(), true);
- return [originPoint.offset(0, -this.getMinOffset())];
- case DiagramItem_1.ConnectionPointSide.North:
- return [originPoint.offset(0, -this.getMinOffset())];
- case DiagramItem_1.ConnectionPointSide.South:
- return this.getAsideOffsetPoints(originPoint, targetPoint, originRect, this.getMinOffset(), this.getMinOffset(), originPoint.x < targetPoint.x);
- }
- };
- ConnectorPointsOrthogonalNorthSideCalculator.prototype.getEndOverlappedShapeOffsetPoints = function (targetSide, originPoint, targetPoint, originRect) {
- switch (targetSide) {
- case DiagramItem_1.ConnectionPointSide.East:
- if (targetPoint.y > originPoint.y)
- return this.getAsideOffsetPoints(originPoint, targetPoint, originRect, this.getMinOffset(), this.getMinOffset(), false);
- if (originPoint.x < targetPoint.x)
- return [originPoint.offset(0, -this.getMinOffset())];
- return [];
- case DiagramItem_1.ConnectionPointSide.West:
- if (targetPoint.y > originPoint.y)
- return this.getAsideOffsetPoints(originPoint, targetPoint, originRect, this.getMinOffset(), this.getMinOffset(), true);
- if (originPoint.x > targetPoint.x)
- return [originPoint.offset(0, -this.getMinOffset())];
- return [];
- case DiagramItem_1.ConnectionPointSide.North:
- return [originPoint.offset(0, -this.getMinOffset())];
- case DiagramItem_1.ConnectionPointSide.South:
- var offset = -this.getMinOffset();
- if (this.beginRect.top < originPoint.y)
- offset -= originPoint.y - this.beginRect.top;
- return [originPoint.offset(0, offset)];
- }
- };
- ConnectorPointsOrthogonalNorthSideCalculator.prototype.getBeginOnSideOffsetPoints = function (targetSide, originPoint, targetPoint, originRect) {
- return [originPoint.offset(0, -this.getScaleableOffsetY(originPoint, targetPoint, false))];
- };
- ConnectorPointsOrthogonalNorthSideCalculator.prototype.getEndOnSideOffsetPoints = function (targetSide, originPoint, targetPoint, originRect) {
- return [originPoint.offset(0, -this.getScaleableOffsetY(originPoint, targetPoint, true))];
- };
- ConnectorPointsOrthogonalNorthSideCalculator.prototype.getBeginOffSideOffsetPoints = function (targetSide, originPoint, targetPoint, originRect) {
- switch (targetSide) {
- case DiagramItem_1.ConnectionPointSide.East:
- if (this.isBeginEndOverlappedX())
- return this.getScaleableAsideOffsetPoints(originPoint, targetPoint, originRect, false, false);
- break;
- case DiagramItem_1.ConnectionPointSide.West:
- if (this.isBeginEndOverlappedX())
- return this.getScaleableAsideOffsetPoints(originPoint, targetPoint, originRect, false, true);
- break;
- case DiagramItem_1.ConnectionPointSide.North:
- if (this.isBeginEndOverlappedX())
- return this.getScaleableAsideOffsetPoints(originPoint, targetPoint, originRect, false);
- break;
- case DiagramItem_1.ConnectionPointSide.Undefined:
- case DiagramItem_1.ConnectionPointSide.South:
- return this.getScaleableAsideOffsetPoints(originPoint, targetPoint, originRect, false);
- }
- return [originPoint.offset(0, -this.getScaleableOffsetY(originPoint, targetPoint, false))];
- };
- ConnectorPointsOrthogonalNorthSideCalculator.prototype.getEndOffSideOffsetPoints = function (targetSide, originPoint, targetPoint, originRect) {
- if (targetSide === DiagramItem_1.ConnectionPointSide.Undefined)
- return this.getScaleableAsideOffsetPoints(originPoint, targetPoint, originRect, true);
- else if (this.isBeginEndOverlappedX()) {
- var direction = this.beginRect.center.x > this.endRect.center.x;
- return this.getScaleableAsideOffsetPoints(originPoint, targetPoint, originRect, true, direction);
- }
- return [originPoint.offset(0, -this.getScaleableOffsetY(originPoint, targetPoint, true))];
- };
- ConnectorPointsOrthogonalNorthSideCalculator.prototype.getAsideOffsetPoints = function (originPoint, targetPoint, originRect, offset, asideOffset, direction) {
- var points = [];
- if (originRect !== undefined) {
- if (direction === undefined)
- direction = targetPoint.x < originPoint.x;
- if (direction)
- points.push(originPoint.offset(-(originPoint.x - originRect.left + asideOffset), -offset));
- else
- points.push(originPoint.offset((originRect.right - originPoint.x + asideOffset), -offset));
- }
- points.push(originPoint.offset(0, -offset));
- return points;
- };
- ConnectorPointsOrthogonalNorthSideCalculator.prototype.getScaleableAsideOffsetPoints = function (originPoint, targetPoint, originRect, isEnd, direction) {
- var offset = this.getScaleableOffsetY(originPoint, targetPoint, isEnd);
- var asideOffset = this.getScaleableOffsetX(originPoint, targetPoint, isEnd);
- return this.getAsideOffsetPoints(originPoint, targetPoint, originRect, offset, asideOffset, direction);
- };
- ConnectorPointsOrthogonalNorthSideCalculator.prototype.getScaleableOffsetX = function (originPoint, targetPoint, isEnd) {
- if (this.beginRect && this.endRect) {
- if (!isEnd && !this.isBeginEndOverlappedX()) {
- var distance = void 0;
- if (targetPoint.x < originPoint.x)
- distance = this.beginRect.left - this.endRect.right;
- else
- distance = this.endRect.left - this.beginRect.right;
- if (distance < this.getMinOffset() * 2)
- return distance / 2;
- }
- }
- return this.getMinOffset();
- };
- ConnectorPointsOrthogonalNorthSideCalculator.prototype.getScaleableOffsetY = function (originPoint, targetPoint, isEnd) {
- if (this.beginRect && this.endRect) {
- var distance = isEnd ? originPoint.y - this.beginRect.bottom : originPoint.y - this.endRect.bottom;
- if (distance > 0 && distance < this.getMinOffset() * 2)
- return distance / 2;
- }
- return this.getMinOffset();
- };
- ConnectorPointsOrthogonalNorthSideCalculator.prototype.isOnSidePoint = function (originPoint, targetPoint) {
- return targetPoint.y < originPoint.y;
- };
- ConnectorPointsOrthogonalNorthSideCalculator.prototype.isDirectConnectionAllowed = function (targetSide, originPoint, targetPoint) {
- return targetSide === DiagramItem_1.ConnectionPointSide.South || targetSide === DiagramItem_1.ConnectionPointSide.Undefined;
- };
- ConnectorPointsOrthogonalNorthSideCalculator.prototype.getDirectConnectionPoints = function (originPoint, targetPoint) {
- var cy = targetPoint.y + (originPoint.y - targetPoint.y) / 2;
- return [
- new ConnectorRenderPoint_1.ConnectorRenderPoint(originPoint.x, cy),
- new ConnectorRenderPoint_1.ConnectorRenderPoint(targetPoint.x, cy)
- ];
- };
- return ConnectorPointsOrthogonalNorthSideCalculator;
- }(ConnectorPointsOrthogonalSideCalculatorBase_1.ConnectorPointsOrthogonalSideCalculatorBase));
- exports.ConnectorPointsOrthogonalNorthSideCalculator = ConnectorPointsOrthogonalNorthSideCalculator;
- /***/ }),
- /* 110 */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- var __extends = (this && this.__extends) || (function () {
- var extendStatics = function (d, b) {
- extendStatics = Object.setPrototypeOf ||
- ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
- function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
- return extendStatics(d, b);
- };
- return function (d, b) {
- extendStatics(d, b);
- function __() { this.constructor = d; }
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
- };
- })();
- Object.defineProperty(exports, "__esModule", { value: true });
- var DiagramItem_1 = __webpack_require__(3);
- var ConnectorPointsOrthogonalSideCalculatorBase_1 = __webpack_require__(33);
- var ConnectorRenderPoint_1 = __webpack_require__(27);
- var ConnectorPointsOrthogonalEastSideCalculator = /** @class */ (function (_super) {
- __extends(ConnectorPointsOrthogonalEastSideCalculator, _super);
- function ConnectorPointsOrthogonalEastSideCalculator(parent) {
- return _super.call(this, parent) || this;
- }
- ConnectorPointsOrthogonalEastSideCalculator.prototype.getCorrectOriginPoint = function (originPoint, originRect) {
- if (originPoint.x < originRect.right)
- originPoint = originPoint.offset(originRect.right - originPoint.x, 0);
- return originPoint;
- };
- ConnectorPointsOrthogonalEastSideCalculator.prototype.getSameShapeOffsetPoints = function (targetSide, originPoint, targetPoint, originRect) {
- switch (targetSide) {
- case DiagramItem_1.ConnectionPointSide.North:
- case DiagramItem_1.ConnectionPointSide.South:
- case DiagramItem_1.ConnectionPointSide.East:
- return [originPoint.offset(this.getMinOffset(), 0)];
- case DiagramItem_1.ConnectionPointSide.West:
- return this.getAsideOffsetPoints(originPoint, targetPoint, originRect, this.getMinOffset(), this.getMinOffset());
- }
- };
- ConnectorPointsOrthogonalEastSideCalculator.prototype.getOverlappedPointsOffsetPoints = function (targetSide, originPoint, targetPoint, originRect) {
- switch (targetSide) {
- case DiagramItem_1.ConnectionPointSide.East:
- return [originPoint.offset(this.getMinOffset(), 0)];
- case DiagramItem_1.ConnectionPointSide.West:
- return [originPoint.offset(-this.getMinOffset(), 0)];
- }
- return [];
- };
- ConnectorPointsOrthogonalEastSideCalculator.prototype.getBeginOverlappedShapeOffsetPoints = function (targetSide, originPoint, targetPoint, originRect) {
- switch (targetSide) {
- case DiagramItem_1.ConnectionPointSide.North:
- if (originPoint.x < targetPoint.x) {
- if (originPoint.y < targetPoint.y)
- return [];
- else
- return [originPoint.offset(this.getMinOffset(), 0)];
- }
- if (originPoint.x > this.endRect.right)
- return this.getAsideOffsetPoints(originPoint, targetPoint, originRect, this.getMinOffset(), this.getMinOffset(), true);
- return [originPoint.offset(this.getMinOffset(), 0)];
- case DiagramItem_1.ConnectionPointSide.South:
- if (originPoint.x < targetPoint.x) {
- if (originPoint.y > targetPoint.y)
- return [];
- else
- return [originPoint.offset(this.getMinOffset(), 0)];
- }
- if (originPoint.x > this.endRect.right)
- return this.getAsideOffsetPoints(originPoint, targetPoint, originRect, this.getMinOffset(), this.getMinOffset(), false);
- return [originPoint.offset(this.getMinOffset(), 0)];
- case DiagramItem_1.ConnectionPointSide.East:
- return [originPoint.offset(this.getMinOffset(), 0)];
- case DiagramItem_1.ConnectionPointSide.West:
- return this.getAsideOffsetPoints(originPoint, targetPoint, originRect, this.getMinOffset(), this.getMinOffset(), originPoint.y < targetPoint.y);
- }
- };
- ConnectorPointsOrthogonalEastSideCalculator.prototype.getEndOverlappedShapeOffsetPoints = function (targetSide, originPoint, targetPoint, originRect) {
- switch (targetSide) {
- case DiagramItem_1.ConnectionPointSide.East:
- return [originPoint.offset(this.getMinOffset(), 0)];
- case DiagramItem_1.ConnectionPointSide.West:
- var offset = this.getMinOffset();
- if (this.beginRect.right > originPoint.x)
- offset += this.beginRect.right - originPoint.x;
- return [originPoint.offset(offset, 0)];
- case DiagramItem_1.ConnectionPointSide.North:
- if (targetPoint.x < originPoint.x)
- return this.getAsideOffsetPoints(originPoint, targetPoint, originRect, this.getMinOffset(), this.getMinOffset(), true);
- if (originPoint.y > targetPoint.y)
- return [originPoint.offset(this.getMinOffset(), 0)];
- return [];
- case DiagramItem_1.ConnectionPointSide.South:
- if (targetPoint.x < originPoint.x)
- return this.getAsideOffsetPoints(originPoint, targetPoint, originRect, this.getMinOffset(), this.getMinOffset(), false);
- if (originPoint.y < targetPoint.y)
- return [originPoint.offset(this.getMinOffset(), 0)];
- return [];
- }
- };
- ConnectorPointsOrthogonalEastSideCalculator.prototype.getBeginOnSideOffsetPoints = function (targetSide, originPoint, targetPoint, originRect) {
- return [originPoint.offset(this.getScaleableOffsetX(originPoint, targetPoint, false), 0)];
- };
- ConnectorPointsOrthogonalEastSideCalculator.prototype.getEndOnSideOffsetPoints = function (targetSide, originPoint, targetPoint, originRect) {
- return [originPoint.offset(this.getScaleableOffsetX(originPoint, targetPoint, true), 0)];
- };
- ConnectorPointsOrthogonalEastSideCalculator.prototype.getBeginOffSideOffsetPoints = function (targetSide, originPoint, targetPoint, originRect) {
- switch (targetSide) {
- case DiagramItem_1.ConnectionPointSide.South:
- if (this.isBeginEndOverlappedY())
- return this.getScaleableAsideOffsetPoints(originPoint, targetPoint, originRect, false, false);
- break;
- case DiagramItem_1.ConnectionPointSide.North:
- if (this.isBeginEndOverlappedY())
- return this.getScaleableAsideOffsetPoints(originPoint, targetPoint, originRect, false, true);
- break;
- case DiagramItem_1.ConnectionPointSide.East:
- if (this.isBeginEndOverlappedY())
- return this.getScaleableAsideOffsetPoints(originPoint, targetPoint, originRect, false);
- break;
- case DiagramItem_1.ConnectionPointSide.Undefined:
- case DiagramItem_1.ConnectionPointSide.West:
- return this.getScaleableAsideOffsetPoints(originPoint, targetPoint, originRect, false);
- }
- return [originPoint.offset(this.getScaleableOffsetX(originPoint, targetPoint, false), 0)];
- };
- ConnectorPointsOrthogonalEastSideCalculator.prototype.getEndOffSideOffsetPoints = function (targetSide, originPoint, targetPoint, originRect) {
- if (targetSide === DiagramItem_1.ConnectionPointSide.Undefined)
- return this.getScaleableAsideOffsetPoints(originPoint, targetPoint, originRect, true);
- else if (this.isBeginEndOverlappedY()) {
- var direction = this.beginRect.center.y > this.endRect.center.y;
- return this.getScaleableAsideOffsetPoints(originPoint, targetPoint, originRect, true, direction);
- }
- return [originPoint.offset(this.getScaleableOffsetX(originPoint, targetPoint, true), 0)];
- };
- ConnectorPointsOrthogonalEastSideCalculator.prototype.getAsideOffsetPoints = function (originPoint, targetPoint, originRect, offset, asideOffset, direction) {
- var points = [];
- if (originRect !== undefined) {
- if (direction === undefined)
- direction = targetPoint.y < originPoint.y;
- if (direction)
- points.push(originPoint.offset(offset, -(originPoint.y - originRect.top + asideOffset)));
- else
- points.push(originPoint.offset(offset, (originRect.bottom - originPoint.y + asideOffset)));
- }
- points.push(originPoint.offset(offset, 0));
- return points;
- };
- ConnectorPointsOrthogonalEastSideCalculator.prototype.getScaleableAsideOffsetPoints = function (originPoint, targetPoint, originRect, isEnd, direction) {
- var offset = this.getScaleableOffsetX(originPoint, targetPoint, isEnd);
- var asideOffset = this.getScaleableOffsetY(originPoint, targetPoint, isEnd);
- return this.getAsideOffsetPoints(originPoint, targetPoint, originRect, offset, asideOffset, direction);
- };
- ConnectorPointsOrthogonalEastSideCalculator.prototype.getScaleableOffsetX = function (originPoint, targetPoint, isEnd) {
- if (this.beginRect && this.endRect) {
- var distance = isEnd ? this.beginRect.left - originPoint.x : this.endRect.left - originPoint.x;
- if (distance > 0 && distance < this.getMinOffset() * 2)
- return distance / 2;
- }
- return this.getMinOffset();
- };
- ConnectorPointsOrthogonalEastSideCalculator.prototype.getScaleableOffsetY = function (originPoint, targetPoint, isEnd) {
- if (this.beginRect && this.endRect) {
- if (!isEnd && !this.isBeginEndOverlappedY()) {
- var distance = void 0;
- if (targetPoint.y < originPoint.y)
- distance = this.beginRect.top - this.endRect.bottom;
- else
- distance = this.endRect.top - this.beginRect.bottom;
- if (distance < this.getMinOffset() * 2)
- return distance / 2;
- }
- }
- return this.getMinOffset();
- };
- ConnectorPointsOrthogonalEastSideCalculator.prototype.isOnSidePoint = function (originPoint, targetPoint) {
- return targetPoint.x > originPoint.x;
- };
- ConnectorPointsOrthogonalEastSideCalculator.prototype.isDirectConnectionAllowed = function (targetSide, originPoint, targetPoint) {
- return targetSide === DiagramItem_1.ConnectionPointSide.West || targetSide === DiagramItem_1.ConnectionPointSide.Undefined;
- };
- ConnectorPointsOrthogonalEastSideCalculator.prototype.getDirectConnectionPoints = function (originPoint, targetPoint) {
- var cx = originPoint.x + (targetPoint.x - originPoint.x) / 2;
- return [
- new ConnectorRenderPoint_1.ConnectorRenderPoint(cx, originPoint.y),
- new ConnectorRenderPoint_1.ConnectorRenderPoint(cx, targetPoint.y)
- ];
- };
- return ConnectorPointsOrthogonalEastSideCalculator;
- }(ConnectorPointsOrthogonalSideCalculatorBase_1.ConnectorPointsOrthogonalSideCalculatorBase));
- exports.ConnectorPointsOrthogonalEastSideCalculator = ConnectorPointsOrthogonalEastSideCalculator;
- /***/ }),
- /* 111 */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- var __extends = (this && this.__extends) || (function () {
- var extendStatics = function (d, b) {
- extendStatics = Object.setPrototypeOf ||
- ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
- function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
- return extendStatics(d, b);
- };
- return function (d, b) {
- extendStatics(d, b);
- function __() { this.constructor = d; }
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
- };
- })();
- Object.defineProperty(exports, "__esModule", { value: true });
- var DiagramItem_1 = __webpack_require__(3);
- var ConnectorPointsOrthogonalSideCalculatorBase_1 = __webpack_require__(33);
- var ConnectorRenderPoint_1 = __webpack_require__(27);
- var ConnectorPointsOrthogonalWestSideCalculator = /** @class */ (function (_super) {
- __extends(ConnectorPointsOrthogonalWestSideCalculator, _super);
- function ConnectorPointsOrthogonalWestSideCalculator(parent) {
- return _super.call(this, parent) || this;
- }
- ConnectorPointsOrthogonalWestSideCalculator.prototype.getCorrectOriginPoint = function (originPoint, originRect) {
- if (originPoint.x > originRect.left)
- originPoint = originPoint.offset(originRect.left - originPoint.x, 0);
- return originPoint;
- };
- ConnectorPointsOrthogonalWestSideCalculator.prototype.getSameShapeOffsetPoints = function (targetSide, originPoint, targetPoint, originRect) {
- switch (targetSide) {
- case DiagramItem_1.ConnectionPointSide.North:
- case DiagramItem_1.ConnectionPointSide.South:
- case DiagramItem_1.ConnectionPointSide.West:
- return [originPoint.offset(-this.getMinOffset(), 0)];
- case DiagramItem_1.ConnectionPointSide.East:
- return this.getAsideOffsetPoints(originPoint, targetPoint, originRect, this.getMinOffset(), this.getMinOffset());
- }
- };
- ConnectorPointsOrthogonalWestSideCalculator.prototype.getOverlappedPointsOffsetPoints = function (targetSide, originPoint, targetPoint, originRect) {
- switch (targetSide) {
- case DiagramItem_1.ConnectionPointSide.East:
- return [originPoint.offset(this.getMinOffset(), 0)];
- case DiagramItem_1.ConnectionPointSide.West:
- return [originPoint.offset(-this.getMinOffset(), 0)];
- }
- return [];
- };
- ConnectorPointsOrthogonalWestSideCalculator.prototype.getBeginOverlappedShapeOffsetPoints = function (targetSide, originPoint, targetPoint, originRect) {
- switch (targetSide) {
- case DiagramItem_1.ConnectionPointSide.North:
- if (originPoint.x > targetPoint.x) {
- if (originPoint.y < targetPoint.y)
- return [];
- else
- return [originPoint.offset(-this.getMinOffset(), 0)];
- }
- if (originPoint.x < this.endRect.left)
- return this.getAsideOffsetPoints(originPoint, targetPoint, originRect, this.getMinOffset(), this.getMinOffset(), true);
- return [originPoint.offset(-this.getMinOffset(), 0)];
- case DiagramItem_1.ConnectionPointSide.South:
- if (originPoint.x > targetPoint.x) {
- if (originPoint.y > targetPoint.y)
- return [];
- else
- return [originPoint.offset(-this.getMinOffset(), 0)];
- }
- if (originPoint.x < this.endRect.left)
- return this.getAsideOffsetPoints(originPoint, targetPoint, originRect, this.getMinOffset(), this.getMinOffset(), false);
- return [originPoint.offset(-this.getMinOffset(), 0)];
- case DiagramItem_1.ConnectionPointSide.West:
- return [originPoint.offset(-this.getMinOffset(), 0)];
- case DiagramItem_1.ConnectionPointSide.East:
- return this.getAsideOffsetPoints(originPoint, targetPoint, originRect, this.getMinOffset(), this.getMinOffset(), originPoint.y < targetPoint.y);
- }
- };
- ConnectorPointsOrthogonalWestSideCalculator.prototype.getEndOverlappedShapeOffsetPoints = function (targetSide, originPoint, targetPoint, originRect) {
- switch (targetSide) {
- case DiagramItem_1.ConnectionPointSide.East:
- var offset = -this.getMinOffset();
- if (this.beginRect.left < originPoint.x)
- offset -= originPoint.x - this.beginRect.left;
- return [originPoint.offset(offset, 0)];
- case DiagramItem_1.ConnectionPointSide.West:
- return [originPoint.offset(-this.getMinOffset(), 0)];
- case DiagramItem_1.ConnectionPointSide.North:
- if (targetPoint.x > originPoint.x)
- return this.getAsideOffsetPoints(originPoint, targetPoint, originRect, this.getMinOffset(), this.getMinOffset(), true);
- if (originPoint.y > targetPoint.y)
- return [originPoint.offset(-this.getMinOffset(), 0)];
- return [];
- case DiagramItem_1.ConnectionPointSide.South:
- if (targetPoint.x > originPoint.x)
- return this.getAsideOffsetPoints(originPoint, targetPoint, originRect, this.getMinOffset(), this.getMinOffset(), false);
- if (originPoint.y < targetPoint.y)
- return [originPoint.offset(-this.getMinOffset(), 0)];
- return [];
- }
- };
- ConnectorPointsOrthogonalWestSideCalculator.prototype.getBeginOnSideOffsetPoints = function (targetSide, originPoint, targetPoint, originRect) {
- return [originPoint.offset(-this.getScaleableOffsetX(originPoint, targetPoint, false), 0)];
- };
- ConnectorPointsOrthogonalWestSideCalculator.prototype.getEndOnSideOffsetPoints = function (targetSide, originPoint, targetPoint, originRect) {
- return [originPoint.offset(-this.getScaleableOffsetX(originPoint, targetPoint, true), 0)];
- };
- ConnectorPointsOrthogonalWestSideCalculator.prototype.getBeginOffSideOffsetPoints = function (targetSide, originPoint, targetPoint, originRect) {
- switch (targetSide) {
- case DiagramItem_1.ConnectionPointSide.South:
- if (this.isBeginEndOverlappedY())
- return this.getScaleableAsideOffsetPoints(originPoint, targetPoint, originRect, false, false);
- break;
- case DiagramItem_1.ConnectionPointSide.North:
- if (this.isBeginEndOverlappedY())
- return this.getScaleableAsideOffsetPoints(originPoint, targetPoint, originRect, false, true);
- break;
- case DiagramItem_1.ConnectionPointSide.West:
- if (this.isBeginEndOverlappedY())
- return this.getScaleableAsideOffsetPoints(originPoint, targetPoint, originRect, false);
- break;
- case DiagramItem_1.ConnectionPointSide.Undefined:
- case DiagramItem_1.ConnectionPointSide.East:
- return this.getScaleableAsideOffsetPoints(originPoint, targetPoint, originRect, false);
- }
- return [originPoint.offset(-this.getScaleableOffsetX(originPoint, targetPoint, false), 0)];
- };
- ConnectorPointsOrthogonalWestSideCalculator.prototype.getEndOffSideOffsetPoints = function (targetSide, originPoint, targetPoint, originRect) {
- if (targetSide === DiagramItem_1.ConnectionPointSide.Undefined)
- return this.getScaleableAsideOffsetPoints(originPoint, targetPoint, originRect, true);
- else if (this.isBeginEndOverlappedY()) {
- var direction = this.beginRect.center.y > this.endRect.center.y;
- return this.getScaleableAsideOffsetPoints(originPoint, targetPoint, originRect, true, direction);
- }
- return [originPoint.offset(-this.getScaleableOffsetX(originPoint, targetPoint, true), 0)];
- };
- ConnectorPointsOrthogonalWestSideCalculator.prototype.getAsideOffsetPoints = function (originPoint, targetPoint, originRect, offset, asideOffset, direction) {
- var points = [];
- if (originRect !== undefined) {
- if (direction === undefined)
- direction = targetPoint.y < originPoint.y;
- if (direction)
- points.push(originPoint.offset(-offset, -(originPoint.y - originRect.top + asideOffset)));
- else
- points.push(originPoint.offset(-offset, (originRect.bottom - originPoint.y + asideOffset)));
- }
- points.push(originPoint.offset(-offset, 0));
- return points;
- };
- ConnectorPointsOrthogonalWestSideCalculator.prototype.getScaleableAsideOffsetPoints = function (originPoint, targetPoint, originRect, isEnd, direction) {
- var offset = this.getScaleableOffsetX(originPoint, targetPoint, isEnd);
- var asideOffset = this.getScaleableOffsetY(originPoint, targetPoint, isEnd);
- return this.getAsideOffsetPoints(originPoint, targetPoint, originRect, offset, asideOffset, direction);
- };
- ConnectorPointsOrthogonalWestSideCalculator.prototype.getScaleableOffsetX = function (originPoint, targetPoint, isEnd) {
- if (this.beginRect && this.endRect) {
- var distance = isEnd ? originPoint.x - this.beginRect.right : originPoint.x - this.endRect.right;
- if (distance > 0 && distance < this.getMinOffset() * 2)
- return distance / 2;
- }
- return this.getMinOffset();
- };
- ConnectorPointsOrthogonalWestSideCalculator.prototype.getScaleableOffsetY = function (originPoint, targetPoint, isEnd) {
- if (this.beginRect && this.endRect) {
- if (!isEnd && !this.isBeginEndOverlappedY()) {
- var distance = void 0;
- if (targetPoint.y < originPoint.y)
- distance = this.beginRect.top - this.endRect.bottom;
- else
- distance = this.endRect.top - this.beginRect.bottom;
- if (distance < this.getMinOffset() * 2)
- return distance / 2;
- }
- }
- return this.getMinOffset();
- };
- ConnectorPointsOrthogonalWestSideCalculator.prototype.isOnSidePoint = function (originPoint, targetPoint) {
- return targetPoint.x < originPoint.x;
- };
- ConnectorPointsOrthogonalWestSideCalculator.prototype.isDirectConnectionAllowed = function (targetSide, originPoint, targetPoint) {
- return targetSide === DiagramItem_1.ConnectionPointSide.East || targetSide === DiagramItem_1.ConnectionPointSide.Undefined;
- };
- ConnectorPointsOrthogonalWestSideCalculator.prototype.getDirectConnectionPoints = function (originPoint, targetPoint) {
- var cx = targetPoint.x + (originPoint.x - targetPoint.x) / 2;
- return [
- new ConnectorRenderPoint_1.ConnectorRenderPoint(cx, originPoint.y),
- new ConnectorRenderPoint_1.ConnectorRenderPoint(cx, targetPoint.y)
- ];
- };
- return ConnectorPointsOrthogonalWestSideCalculator;
- }(ConnectorPointsOrthogonalSideCalculatorBase_1.ConnectorPointsOrthogonalSideCalculatorBase));
- exports.ConnectorPointsOrthogonalWestSideCalculator = ConnectorPointsOrthogonalWestSideCalculator;
- /***/ }),
- /* 112 */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- Object.defineProperty(exports, "__esModule", { value: true });
- var ConnectorText = /** @class */ (function () {
- function ConnectorText(position, value) {
- this.position = position;
- this.value = value;
- }
- return ConnectorText;
- }());
- exports.ConnectorText = ConnectorText;
- var ConnectorTexts = /** @class */ (function () {
- function ConnectorTexts() {
- this.items = {};
- }
- ConnectorTexts.prototype.get = function (position) {
- return this.items[position];
- };
- ConnectorTexts.prototype.set = function (position, text) {
- this.items[position] = text;
- };
- ConnectorTexts.prototype.remove = function (position) {
- delete this.items[position];
- };
- ConnectorTexts.prototype.forEach = function (callback) {
- for (var key in this.items)
- if (this.items.hasOwnProperty(key))
- callback(this.items[key]);
- };
- ConnectorTexts.prototype.clone = function () {
- var result = new ConnectorTexts();
- this.forEach(function (t) { result.set(t.position, new ConnectorText(t.position, t.value)); });
- return result;
- };
- ConnectorTexts.prototype.toObject = function () {
- var result = {};
- var modified = false;
- this.forEach(function (t) {
- result[t.position] = t.value;
- modified = true;
- });
- return modified ? result : null;
- };
- ConnectorTexts.prototype.fromObject = function (obj) {
- for (var key in obj) {
- if (obj.hasOwnProperty(key)) {
- var position = parseFloat(key);
- if (!isNaN(position) && typeof obj[key] === "string") {
- this.set(position, new ConnectorText(position, obj[key]));
- }
- }
- }
- };
- return ConnectorTexts;
- }());
- exports.ConnectorTexts = ConnectorTexts;
- /***/ }),
- /* 113 */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- var __extends = (this && this.__extends) || (function () {
- var extendStatics = function (d, b) {
- extendStatics = Object.setPrototypeOf ||
- ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
- function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
- return extendStatics(d, b);
- };
- return function (d, b) {
- extendStatics(d, b);
- function __() { this.constructor = d; }
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
- };
- })();
- Object.defineProperty(exports, "__esModule", { value: true });
- var RenderManager_1 = __webpack_require__(10);
- var Primitive_1 = __webpack_require__(15);
- var FilterPrimitive = /** @class */ (function (_super) {
- __extends(FilterPrimitive, _super);
- function FilterPrimitive(id, x, y, width, height) {
- var _this = _super.call(this) || this;
- _this.id = id;
- _this.x = x;
- _this.y = y;
- _this.width = width;
- _this.height = height;
- return _this;
- }
- FilterPrimitive.prototype.createMainElement = function () {
- return document.createElementNS(RenderManager_1.svgNS, "filter");
- };
- FilterPrimitive.prototype.applyElementProperties = function (element) {
- if (this.id)
- element.setAttribute("id", this.id);
- this.setUnitAttribute(element, "x", this.x);
- this.setUnitAttribute(element, "y", this.y);
- this.setUnitAttribute(element, "width", this.width);
- this.setUnitAttribute(element, "height", this.height);
- _super.prototype.applyElementProperties.call(this, element);
- };
- return FilterPrimitive;
- }(Primitive_1.SvgPrimitive));
- exports.FilterPrimitive = FilterPrimitive;
- /***/ }),
- /* 114 */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- var __extends = (this && this.__extends) || (function () {
- var extendStatics = function (d, b) {
- extendStatics = Object.setPrototypeOf ||
- ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
- function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
- return extendStatics(d, b);
- };
- return function (d, b) {
- extendStatics(d, b);
- function __() { this.constructor = d; }
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
- };
- })();
- Object.defineProperty(exports, "__esModule", { value: true });
- var HistoryItem_1 = __webpack_require__(4);
- var Utils_1 = __webpack_require__(0);
- var ModelResizeHistoryItem = /** @class */ (function (_super) {
- __extends(ModelResizeHistoryItem, _super);
- function ModelResizeHistoryItem(offset) {
- var _this = _super.call(this) || this;
- _this.offset = offset;
- return _this;
- }
- ModelResizeHistoryItem.prototype.redo = function (manipulator) {
- this.oldSize = manipulator.model.size.clone();
- this.backOffset = new Utils_1.Offset(-this.offset.left, -this.offset.top, -this.offset.right, -this.offset.bottom);
- var newWidth = Math.max(this.oldSize.width + this.offset.left + this.offset.right, manipulator.model.pageWidth);
- var newHeight = Math.max(this.oldSize.height + this.offset.top + this.offset.bottom, manipulator.model.pageHeight);
- manipulator.changeModelSize(new Utils_1.Size(newWidth, newHeight), this.offset);
- };
- ModelResizeHistoryItem.prototype.undo = function (manipulator) {
- manipulator.changeModelSize(this.oldSize, this.backOffset);
- };
- return ModelResizeHistoryItem;
- }(HistoryItem_1.HistoryItem));
- exports.ModelResizeHistoryItem = ModelResizeHistoryItem;
- /***/ }),
- /* 115 */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- var __extends = (this && this.__extends) || (function () {
- var extendStatics = function (d, b) {
- extendStatics = Object.setPrototypeOf ||
- ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
- function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
- return extendStatics(d, b);
- };
- return function (d, b) {
- extendStatics(d, b);
- function __() { this.constructor = d; }
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
- };
- })();
- Object.defineProperty(exports, "__esModule", { value: true });
- var HistoryItem_1 = __webpack_require__(4);
- var Shape_1 = __webpack_require__(9);
- var Connector_1 = __webpack_require__(5);
- var UpdatePositionsOnPageResizeHistoryItem = /** @class */ (function (_super) {
- __extends(UpdatePositionsOnPageResizeHistoryItem, _super);
- function UpdatePositionsOnPageResizeHistoryItem(offsetX, offsetY) {
- var _this = _super.call(this) || this;
- _this.offsetX = offsetX;
- _this.offsetY = offsetY;
- return _this;
- }
- UpdatePositionsOnPageResizeHistoryItem.prototype.redo = function (manipulator) {
- var _this = this;
- manipulator.model.iterateItems(function (item) {
- if (item instanceof Shape_1.Shape)
- manipulator.moveShape(item, item.position.offset(_this.offsetX, _this.offsetY));
- if (item instanceof Connector_1.Connector)
- item.points.forEach(function (p, index) { return manipulator.moveConnectorPoint(item, index, p.offset(_this.offsetX, _this.offsetY)); });
- });
- };
- UpdatePositionsOnPageResizeHistoryItem.prototype.undo = function (manipulator) {
- var _this = this;
- manipulator.model.iterateItems(function (item) {
- if (item instanceof Shape_1.Shape)
- manipulator.moveShape(item, item.position.offset(-_this.offsetX, -_this.offsetY));
- if (item instanceof Connector_1.Connector)
- item.points.forEach(function (p, index) { return manipulator.moveConnectorPoint(item, index, p.offset(-_this.offsetX, -_this.offsetY)); });
- });
- };
- return UpdatePositionsOnPageResizeHistoryItem;
- }(HistoryItem_1.HistoryItem));
- exports.UpdatePositionsOnPageResizeHistoryItem = UpdatePositionsOnPageResizeHistoryItem;
- /***/ }),
- /* 116 */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- var __extends = (this && this.__extends) || (function () {
- var extendStatics = function (d, b) {
- extendStatics = Object.setPrototypeOf ||
- ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
- function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
- return extendStatics(d, b);
- };
- return function (d, b) {
- extendStatics(d, b);
- function __() { this.constructor = d; }
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
- };
- })();
- Object.defineProperty(exports, "__esModule", { value: true });
- var HistoryItem_1 = __webpack_require__(4);
- var DeleteConnectorPointHistoryItem = /** @class */ (function (_super) {
- __extends(DeleteConnectorPointHistoryItem, _super);
- function DeleteConnectorPointHistoryItem(connectorKey, pointIndex) {
- var _this = _super.call(this) || this;
- _this.connectorKey = connectorKey;
- _this.pointIndex = pointIndex;
- return _this;
- }
- DeleteConnectorPointHistoryItem.prototype.redo = function (manipulator) {
- var connector = manipulator.model.findConnector(this.connectorKey);
- this.point = connector.points[this.pointIndex].clone();
- manipulator.deleteConnectorPoint(connector, this.pointIndex);
- };
- DeleteConnectorPointHistoryItem.prototype.undo = function (manipulator) {
- var connector = manipulator.model.findConnector(this.connectorKey);
- manipulator.addConnectorPoint(connector, this.pointIndex, this.point);
- };
- return DeleteConnectorPointHistoryItem;
- }(HistoryItem_1.HistoryItem));
- exports.DeleteConnectorPointHistoryItem = DeleteConnectorPointHistoryItem;
- /***/ }),
- /* 117 */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- var __extends = (this && this.__extends) || (function () {
- var extendStatics = function (d, b) {
- extendStatics = Object.setPrototypeOf ||
- ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
- function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
- return extendStatics(d, b);
- };
- return function (d, b) {
- extendStatics(d, b);
- function __() { this.constructor = d; }
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
- };
- })();
- Object.defineProperty(exports, "__esModule", { value: true });
- var HistoryItem_1 = __webpack_require__(4);
- var ResizeShapeHistoryItem = /** @class */ (function (_super) {
- __extends(ResizeShapeHistoryItem, _super);
- function ResizeShapeHistoryItem(shapeKey, position, size) {
- var _this = _super.call(this) || this;
- _this.shapeKey = shapeKey;
- _this.position = position;
- _this.size = size;
- return _this;
- }
- ResizeShapeHistoryItem.prototype.redo = function (manipulator) {
- var shape = manipulator.model.findShape(this.shapeKey);
- this.oldPosition = shape.position.clone();
- this.oldSize = shape.size.clone();
- manipulator.resizeShape(shape, this.position, this.size);
- };
- ResizeShapeHistoryItem.prototype.undo = function (manipulator) {
- var shape = manipulator.model.findShape(this.shapeKey);
- manipulator.resizeShape(shape, this.oldPosition, this.oldSize);
- };
- return ResizeShapeHistoryItem;
- }(HistoryItem_1.HistoryItem));
- exports.ResizeShapeHistoryItem = ResizeShapeHistoryItem;
- /***/ }),
- /* 118 */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- var __extends = (this && this.__extends) || (function () {
- var extendStatics = function (d, b) {
- extendStatics = Object.setPrototypeOf ||
- ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
- function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
- return extendStatics(d, b);
- };
- return function (d, b) {
- extendStatics(d, b);
- function __() { this.constructor = d; }
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
- };
- })();
- Object.defineProperty(exports, "__esModule", { value: true });
- var HistoryItem_1 = __webpack_require__(4);
- var DeleteConnectorHistoryItem = /** @class */ (function (_super) {
- __extends(DeleteConnectorHistoryItem, _super);
- function DeleteConnectorHistoryItem(connectorKey) {
- var _this = _super.call(this) || this;
- _this.connectorKey = connectorKey;
- return _this;
- }
- DeleteConnectorHistoryItem.prototype.redo = function (manipulator) {
- var connector = manipulator.model.findConnector(this.connectorKey);
- this.connector = connector.clone();
- manipulator.deleteConnector(connector);
- };
- DeleteConnectorHistoryItem.prototype.undo = function (manipulator) {
- manipulator.addConnector(this.connector, this.connector.key);
- };
- return DeleteConnectorHistoryItem;
- }(HistoryItem_1.HistoryItem));
- exports.DeleteConnectorHistoryItem = DeleteConnectorHistoryItem;
- /***/ }),
- /* 119 */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- Object.defineProperty(exports, "__esModule", { value: true });
- var DataSourceNodeDataImporter = /** @class */ (function () {
- function DataSourceNodeDataImporter() {
- this.getKey = function (obj) { return obj["id"]; };
- this.setKey = function (obj, value) { obj["id"] = value; };
- this.getText = function (obj) { return obj["text"]; };
- this.setText = function (obj, value) { obj["text"] = value; };
- this.getType = function (obj) { return obj["type"]; };
- this.setType = function (obj, value) { obj["type"] = value; };
- this.getParentKey = function (obj) { return obj["parentId"]; };
- this.setParentKey = function (obj, value) { obj["parentId"] = value; };
- this.getItems = function (obj) { return obj["items"]; };
- this.setItems = function (obj, value) { obj["items"] = value; };
- }
- return DataSourceNodeDataImporter;
- }());
- exports.DataSourceNodeDataImporter = DataSourceNodeDataImporter;
- var DataSourceEdgeDataImporter = /** @class */ (function () {
- function DataSourceEdgeDataImporter() {
- this.getKey = function (obj) { return obj["id"]; };
- this.setKey = function (obj, value) { obj["id"] = value; };
- this.getFrom = function (obj) { return obj["from"]; };
- this.setFrom = function (obj, value) { obj["from"] = value; };
- this.getTo = function (obj) { return obj["to"]; };
- this.setTo = function (obj, value) { obj["to"] = value; };
- }
- return DataSourceEdgeDataImporter;
- }());
- exports.DataSourceEdgeDataImporter = DataSourceEdgeDataImporter;
- /***/ }),
- /* 120 */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- var __extends = (this && this.__extends) || (function () {
- var extendStatics = function (d, b) {
- extendStatics = Object.setPrototypeOf ||
- ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
- function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
- return extendStatics(d, b);
- };
- return function (d, b) {
- extendStatics(d, b);
- function __() { this.constructor = d; }
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
- };
- })();
- Object.defineProperty(exports, "__esModule", { value: true });
- var RectangleShapeDescription_1 = __webpack_require__(12);
- var ShapeType_1 = __webpack_require__(1);
- var ProcessShapeDescription = /** @class */ (function (_super) {
- __extends(ProcessShapeDescription, _super);
- function ProcessShapeDescription() {
- return _super.call(this, "Process", "Process") || this;
- }
- Object.defineProperty(ProcessShapeDescription.prototype, "key", {
- get: function () { return ShapeType_1.ShapeType.Process; },
- enumerable: true,
- configurable: true
- });
- Object.defineProperty(ProcessShapeDescription.prototype, "category", {
- get: function () { return ShapeType_1.ShapeCategory.Flowchart; },
- enumerable: true,
- configurable: true
- });
- return ProcessShapeDescription;
- }(RectangleShapeDescription_1.RectangleShapeDescription));
- exports.ProcessShapeDescription = ProcessShapeDescription;
- /***/ }),
- /* 121 */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- var __extends = (this && this.__extends) || (function () {
- var extendStatics = function (d, b) {
- extendStatics = Object.setPrototypeOf ||
- ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
- function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
- return extendStatics(d, b);
- };
- return function (d, b) {
- extendStatics(d, b);
- function __() { this.constructor = d; }
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
- };
- })();
- Object.defineProperty(exports, "__esModule", { value: true });
- var DiamondShapeDescription_1 = __webpack_require__(75);
- var ShapeType_1 = __webpack_require__(1);
- var Utils_1 = __webpack_require__(0);
- var ShapeDescription_1 = __webpack_require__(11);
- var DecisionShapeDescription = /** @class */ (function (_super) {
- __extends(DecisionShapeDescription, _super);
- function DecisionShapeDescription() {
- return _super.call(this, "Decision", "Decision", new Utils_1.Size(ShapeDescription_1.ShapeDefaultDimension, ShapeDescription_1.ShapeDefaultDimension * 0.75)) || this;
- }
- Object.defineProperty(DecisionShapeDescription.prototype, "key", {
- get: function () { return ShapeType_1.ShapeType.Decision; },
- enumerable: true,
- configurable: true
- });
- Object.defineProperty(DecisionShapeDescription.prototype, "category", {
- get: function () { return ShapeType_1.ShapeCategory.Flowchart; },
- enumerable: true,
- configurable: true
- });
- return DecisionShapeDescription;
- }(DiamondShapeDescription_1.DiamondShapeDescription));
- exports.DecisionShapeDescription = DecisionShapeDescription;
- /***/ }),
- /* 122 */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- var __extends = (this && this.__extends) || (function () {
- var extendStatics = function (d, b) {
- extendStatics = Object.setPrototypeOf ||
- ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
- function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
- return extendStatics(d, b);
- };
- return function (d, b) {
- extendStatics(d, b);
- function __() { this.constructor = d; }
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
- };
- })();
- Object.defineProperty(exports, "__esModule", { value: true });
- var RectangleShapeDescription_1 = __webpack_require__(12);
- var ShapeType_1 = __webpack_require__(1);
- var PathPrimitive_1 = __webpack_require__(2);
- var DiagramItem_1 = __webpack_require__(3);
- var ManualInputShapeDescription = /** @class */ (function (_super) {
- __extends(ManualInputShapeDescription, _super);
- function ManualInputShapeDescription() {
- return _super.call(this, "Manual Input", "Manual Input") || this;
- }
- Object.defineProperty(ManualInputShapeDescription.prototype, "key", {
- get: function () { return ShapeType_1.ShapeType.ManualInput; },
- enumerable: true,
- configurable: true
- });
- Object.defineProperty(ManualInputShapeDescription.prototype, "category", {
- get: function () { return ShapeType_1.ShapeCategory.Flowchart; },
- enumerable: true,
- configurable: true
- });
- ManualInputShapeDescription.prototype.createPrimitives = function (shape) {
- var _a = shape.rectangle, left = _a.left, top = _a.top, right = _a.right, bottom = _a.bottom, width = _a.width, height = _a.height;
- var y1 = top + height * ManualInputShapeDescription.slopeHeightRatio;
- var primitives = [];
- return primitives.concat([
- new PathPrimitive_1.PathPrimitive([
- new PathPrimitive_1.PathPrimitiveMoveToCommand(left, y1),
- new PathPrimitive_1.PathPrimitiveLineToCommand(right, top),
- new PathPrimitive_1.PathPrimitiveLineToCommand(right, bottom),
- new PathPrimitive_1.PathPrimitiveLineToCommand(left, bottom),
- new PathPrimitive_1.PathPrimitiveClosePathCommand()
- ], shape.style)
- ])
- .concat(this.createTextPrimitives(shape));
- };
- ManualInputShapeDescription.prototype.processConnectionPoint = function (shape, point, index) {
- var side = shape.getConnectionPointSide(index);
- if (side === DiagramItem_1.ConnectionPointSide.North)
- point.y += ManualInputShapeDescription.slopeHeightRatio / 2 * shape.size.height;
- };
- ManualInputShapeDescription.slopeHeightRatio = 0.1;
- return ManualInputShapeDescription;
- }(RectangleShapeDescription_1.RectangleShapeDescription));
- exports.ManualInputShapeDescription = ManualInputShapeDescription;
- /***/ }),
- /* 123 */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- var __extends = (this && this.__extends) || (function () {
- var extendStatics = function (d, b) {
- extendStatics = Object.setPrototypeOf ||
- ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
- function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
- return extendStatics(d, b);
- };
- return function (d, b) {
- extendStatics(d, b);
- function __() { this.constructor = d; }
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
- };
- })();
- Object.defineProperty(exports, "__esModule", { value: true });
- var RectangleShapeDescription_1 = __webpack_require__(12);
- var ShapeType_1 = __webpack_require__(1);
- var PathPrimitive_1 = __webpack_require__(2);
- var DiagramItem_1 = __webpack_require__(3);
- var DataShapeDescription = /** @class */ (function (_super) {
- __extends(DataShapeDescription, _super);
- function DataShapeDescription() {
- return _super.call(this, "Data", "Data") || this;
- }
- Object.defineProperty(DataShapeDescription.prototype, "key", {
- get: function () { return ShapeType_1.ShapeType.Data; },
- enumerable: true,
- configurable: true
- });
- Object.defineProperty(DataShapeDescription.prototype, "category", {
- get: function () { return ShapeType_1.ShapeCategory.Flowchart; },
- enumerable: true,
- configurable: true
- });
- DataShapeDescription.prototype.createPrimitives = function (shape) {
- var _a = shape.rectangle, left = _a.left, top = _a.top, right = _a.right, bottom = _a.bottom, width = _a.width, height = _a.height;
- var px = Math.min(Math.max(0, height / Math.tan(DataShapeDescription.slopeAngle)), width);
- var x1 = left + px;
- var x2 = right - px;
- var primitives = [];
- return primitives.concat([
- new PathPrimitive_1.PathPrimitive([
- new PathPrimitive_1.PathPrimitiveMoveToCommand(x1, top),
- new PathPrimitive_1.PathPrimitiveLineToCommand(right, top),
- new PathPrimitive_1.PathPrimitiveLineToCommand(x2, bottom),
- new PathPrimitive_1.PathPrimitiveLineToCommand(left, bottom),
- new PathPrimitive_1.PathPrimitiveClosePathCommand()
- ], shape.style)
- ])
- .concat(this.createTextPrimitives(shape));
- };
- DataShapeDescription.prototype.processConnectionPoint = function (shape, point, index) {
- var offset = shape.size.height / Math.tan(DataShapeDescription.slopeAngle);
- var side = shape.getConnectionPointSide(index);
- if (side === DiagramItem_1.ConnectionPointSide.East)
- point.x -= offset / 2;
- else if (side === DiagramItem_1.ConnectionPointSide.West)
- point.x += offset / 2;
- };
- DataShapeDescription.slopeAngle = 81 * Math.PI / 180;
- return DataShapeDescription;
- }(RectangleShapeDescription_1.RectangleShapeDescription));
- exports.DataShapeDescription = DataShapeDescription;
- /***/ }),
- /* 124 */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- var __extends = (this && this.__extends) || (function () {
- var extendStatics = function (d, b) {
- extendStatics = Object.setPrototypeOf ||
- ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
- function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
- return extendStatics(d, b);
- };
- return function (d, b) {
- extendStatics(d, b);
- function __() { this.constructor = d; }
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
- };
- })();
- Object.defineProperty(exports, "__esModule", { value: true });
- var RectangleShapeDescription_1 = __webpack_require__(12);
- var ShapeType_1 = __webpack_require__(1);
- var PathPrimitive_1 = __webpack_require__(2);
- var Utils_1 = __webpack_require__(0);
- var ShapeDescription_1 = __webpack_require__(11);
- var TerminatorShapeDescription = /** @class */ (function (_super) {
- __extends(TerminatorShapeDescription, _super);
- function TerminatorShapeDescription() {
- return _super.call(this, "Terminator", "Terminator", new Utils_1.Size(ShapeDescription_1.ShapeDefaultDimension, ShapeDescription_1.ShapeDefaultDimension * 0.5)) || this;
- }
- Object.defineProperty(TerminatorShapeDescription.prototype, "key", {
- get: function () { return ShapeType_1.ShapeType.Terminator; },
- enumerable: true,
- configurable: true
- });
- Object.defineProperty(TerminatorShapeDescription.prototype, "category", {
- get: function () { return ShapeType_1.ShapeCategory.Flowchart; },
- enumerable: true,
- configurable: true
- });
- TerminatorShapeDescription.prototype.createPrimitives = function (shape) {
- var rect = shape.rectangle;
- var left = rect.left, top = rect.top, right = rect.right, bottom = rect.bottom, width = rect.width, height = rect.height;
- var cy = rect.center.y;
- var x1 = left + width * TerminatorShapeDescription.curveWidthRatio;
- var x2 = left + width * (1 - TerminatorShapeDescription.curveWidthRatio);
- var ratio = height / width;
- var primitives = [];
- return primitives.concat([
- new PathPrimitive_1.PathPrimitive([
- new PathPrimitive_1.PathPrimitiveMoveToCommand(x1, top),
- new PathPrimitive_1.PathPrimitiveLineToCommand(x2, top),
- new PathPrimitive_1.PathPrimitiveQuadraticCurveToCommand(right, top, right, cy),
- new PathPrimitive_1.PathPrimitiveQuadraticCurveToCommand(right, bottom, x2, bottom),
- new PathPrimitive_1.PathPrimitiveLineToCommand(x1, bottom),
- new PathPrimitive_1.PathPrimitiveQuadraticCurveToCommand(left, bottom, left, cy),
- new PathPrimitive_1.PathPrimitiveQuadraticCurveToCommand(left, top, x1, top),
- new PathPrimitive_1.PathPrimitiveClosePathCommand()
- ], shape.style)
- ])
- .concat(this.createTextPrimitives(shape));
- };
- TerminatorShapeDescription.curveWidthRatio = 0.3;
- return TerminatorShapeDescription;
- }(RectangleShapeDescription_1.RectangleShapeDescription));
- exports.TerminatorShapeDescription = TerminatorShapeDescription;
- /***/ }),
- /* 125 */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- var __extends = (this && this.__extends) || (function () {
- var extendStatics = function (d, b) {
- extendStatics = Object.setPrototypeOf ||
- ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
- function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
- return extendStatics(d, b);
- };
- return function (d, b) {
- extendStatics(d, b);
- function __() { this.constructor = d; }
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
- };
- })();
- Object.defineProperty(exports, "__esModule", { value: true });
- var RectangleShapeDescription_1 = __webpack_require__(12);
- var ShapeType_1 = __webpack_require__(1);
- var ShapeParameters_1 = __webpack_require__(25);
- var ShapeParameterPoint_1 = __webpack_require__(17);
- var Utils_1 = __webpack_require__(0);
- var PathPrimitive_1 = __webpack_require__(2);
- exports.PredefinedProcessEdgeParameterName = "e";
- var PredefinedProcessShapeDescription = /** @class */ (function (_super) {
- __extends(PredefinedProcessShapeDescription, _super);
- function PredefinedProcessShapeDescription() {
- return _super.call(this, "Predefined Process", "Predefined\nProcess") || this;
- }
- Object.defineProperty(PredefinedProcessShapeDescription.prototype, "key", {
- get: function () { return ShapeType_1.ShapeType.PredefinedProcess; },
- enumerable: true,
- configurable: true
- });
- Object.defineProperty(PredefinedProcessShapeDescription.prototype, "category", {
- get: function () { return ShapeType_1.ShapeCategory.Flowchart; },
- enumerable: true,
- configurable: true
- });
- PredefinedProcessShapeDescription.prototype.createPrimitives = function (shape) {
- var rect = shape.rectangle;
- var left = rect.left, top = rect.top, right = rect.right, bottom = rect.bottom, width = rect.width, height = rect.height;
- var x1 = left + shape.parameters.get(exports.PredefinedProcessEdgeParameterName).value;
- var x2 = right - shape.parameters.get(exports.PredefinedProcessEdgeParameterName).value;
- var primitives = _super.prototype.createPrimitives.call(this, shape);
- return primitives.concat([
- new PathPrimitive_1.PathPrimitive([
- new PathPrimitive_1.PathPrimitiveMoveToCommand(x1, top),
- new PathPrimitive_1.PathPrimitiveLineToCommand(x1, bottom),
- new PathPrimitive_1.PathPrimitiveMoveToCommand(x2, top),
- new PathPrimitive_1.PathPrimitiveLineToCommand(x2, bottom)
- ], shape.style)
- ]);
- };
- PredefinedProcessShapeDescription.prototype.createParameters = function (parameters) {
- parameters.add(new ShapeParameters_1.ShapeParameter(exports.PredefinedProcessEdgeParameterName, this.defaultSize.width * 0.1));
- };
- PredefinedProcessShapeDescription.prototype.normalizeParameters = function (shape, parameters) {
- this.changeParameterValue(parameters, exports.PredefinedProcessEdgeParameterName, function (p) { return Math.max(PredefinedProcessShapeDescription.minEdge, Math.min(shape.size.width * 0.3, p.value)); });
- };
- PredefinedProcessShapeDescription.prototype.modifyParameters = function (shape, parameters, deltaX, deltaY) {
- this.changeParameterValue(parameters, exports.PredefinedProcessEdgeParameterName, function (p) { return p.value + deltaX; });
- this.normalizeParameters(shape, parameters);
- };
- PredefinedProcessShapeDescription.prototype.getParameterPoints = function (shape) {
- return [
- new ShapeParameterPoint_1.ShapeParameterPoint("c", new Utils_1.Point(shape.normalizeX(shape.position.x + shape.parameters.get(exports.PredefinedProcessEdgeParameterName).value), shape.position.y))
- ];
- };
- PredefinedProcessShapeDescription.minEdge = 72;
- return PredefinedProcessShapeDescription;
- }(RectangleShapeDescription_1.RectangleShapeDescription));
- exports.PredefinedProcessShapeDescription = PredefinedProcessShapeDescription;
- /***/ }),
- /* 126 */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- var __extends = (this && this.__extends) || (function () {
- var extendStatics = function (d, b) {
- extendStatics = Object.setPrototypeOf ||
- ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
- function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
- return extendStatics(d, b);
- };
- return function (d, b) {
- extendStatics(d, b);
- function __() { this.constructor = d; }
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
- };
- })();
- Object.defineProperty(exports, "__esModule", { value: true });
- var Shape_1 = __webpack_require__(9);
- var PathPrimitive_1 = __webpack_require__(2);
- var ShapeParameterPoint_1 = __webpack_require__(17);
- var Utils_1 = __webpack_require__(0);
- var ArrowVerticalShapeDescription_1 = __webpack_require__(54);
- var ShapeType_1 = __webpack_require__(1);
- var ArrowNorthSouthShapeDescription = /** @class */ (function (_super) {
- __extends(ArrowNorthSouthShapeDescription, _super);
- function ArrowNorthSouthShapeDescription() {
- return _super.call(this, "North-South Arrow") || this;
- }
- Object.defineProperty(ArrowNorthSouthShapeDescription.prototype, "key", {
- get: function () { return ShapeType_1.ShapeType.ArrowNorthSouth; },
- enumerable: true,
- configurable: true
- });
- ArrowNorthSouthShapeDescription.prototype.createPrimitives = function (shape) {
- var rect = shape.rectangle;
- var left = rect.left, top = rect.top, right = rect.right, bottom = rect.bottom, width = rect.width, height = rect.height;
- var cx = rect.center.x;
- var p1dx = (width - shape.parameters.get(ArrowVerticalShapeDescription_1.ArrowVerticalLineWidthParameterName).value) / 2;
- var p0dy = shape.parameters.get(ArrowVerticalShapeDescription_1.ArrowVerticalTriangleHeightParameterName).value;
- var p1x1 = shape.normalizeX(left + p1dx);
- var p0y1 = shape.normalizeY(top + p0dy);
- var p1x2 = shape.normalizeX(right - p1dx);
- var p0y2 = shape.normalizeY(bottom - p0dy);
- var primitives = [];
- return primitives.concat([
- new PathPrimitive_1.PathPrimitive([
- new PathPrimitive_1.PathPrimitiveMoveToCommand(cx, top),
- new PathPrimitive_1.PathPrimitiveLineToCommand(right, p0y1),
- new PathPrimitive_1.PathPrimitiveLineToCommand(p1x2, p0y1),
- new PathPrimitive_1.PathPrimitiveLineToCommand(p1x2, p0y2),
- new PathPrimitive_1.PathPrimitiveLineToCommand(right, p0y2),
- new PathPrimitive_1.PathPrimitiveLineToCommand(cx, bottom),
- new PathPrimitive_1.PathPrimitiveLineToCommand(left, p0y2),
- new PathPrimitive_1.PathPrimitiveLineToCommand(p1x1, p0y2),
- new PathPrimitive_1.PathPrimitiveLineToCommand(p1x1, p0y1),
- new PathPrimitive_1.PathPrimitiveLineToCommand(left, p0y1),
- new PathPrimitive_1.PathPrimitiveClosePathCommand()
- ], shape.style)
- ])
- .concat(this.createTextPrimitives(shape));
- };
- ArrowNorthSouthShapeDescription.prototype.normalizeParameters = function (shape, parameters) {
- this.changeParameterValue(parameters, ArrowVerticalShapeDescription_1.ArrowVerticalTriangleHeightParameterName, function (p) { return Math.max(0, Math.min(shape.size.height / 2 - 2 * Shape_1.Shape.lineWidth, p.value)); });
- this.changeParameterValue(parameters, ArrowVerticalShapeDescription_1.ArrowVerticalLineWidthParameterName, function (p) { return Math.max(0, Math.min(shape.size.width, p.value)); });
- };
- ArrowNorthSouthShapeDescription.prototype.modifyParameters = function (shape, parameters, deltaX, deltaY) {
- this.changeParameterValue(parameters, ArrowVerticalShapeDescription_1.ArrowVerticalTriangleHeightParameterName, function (p) { return p.value + deltaY; });
- this.changeParameterValue(parameters, ArrowVerticalShapeDescription_1.ArrowVerticalLineWidthParameterName, function (p) { return p.value - deltaX * 2; });
- this.normalizeParameters(shape, parameters);
- };
- ArrowNorthSouthShapeDescription.prototype.getParameterPoints = function (shape) {
- return [
- new ShapeParameterPoint_1.ShapeParameterPoint("c", new Utils_1.Point(shape.normalizeX(shape.position.x + (shape.size.width - shape.parameters.get(ArrowVerticalShapeDescription_1.ArrowVerticalLineWidthParameterName).value) / 2), shape.normalizeY(shape.position.y + shape.parameters.get(ArrowVerticalShapeDescription_1.ArrowVerticalTriangleHeightParameterName).value)))
- ];
- };
- return ArrowNorthSouthShapeDescription;
- }(ArrowVerticalShapeDescription_1.ArrowVerticalShapeDescription));
- exports.ArrowNorthSouthShapeDescription = ArrowNorthSouthShapeDescription;
- /***/ }),
- /* 127 */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- var __extends = (this && this.__extends) || (function () {
- var extendStatics = function (d, b) {
- extendStatics = Object.setPrototypeOf ||
- ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
- function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
- return extendStatics(d, b);
- };
- return function (d, b) {
- extendStatics(d, b);
- function __() { this.constructor = d; }
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
- };
- })();
- Object.defineProperty(exports, "__esModule", { value: true });
- var PathPrimitive_1 = __webpack_require__(2);
- var ArrowHorizontalShapeDescription_1 = __webpack_require__(55);
- var ShapeParameterPoint_1 = __webpack_require__(17);
- var Utils_1 = __webpack_require__(0);
- var ShapeType_1 = __webpack_require__(1);
- var DiagramItem_1 = __webpack_require__(3);
- var ArrowRightShapeDescription = /** @class */ (function (_super) {
- __extends(ArrowRightShapeDescription, _super);
- function ArrowRightShapeDescription() {
- return _super.call(this, "Right Arrow") || this;
- }
- Object.defineProperty(ArrowRightShapeDescription.prototype, "key", {
- get: function () { return ShapeType_1.ShapeType.ArrowRight; },
- enumerable: true,
- configurable: true
- });
- ArrowRightShapeDescription.prototype.createPrimitives = function (shape) {
- var rect = shape.rectangle;
- var left = rect.left, top = rect.top, right = rect.right, bottom = rect.bottom, width = rect.width, height = rect.height;
- var cy = rect.center.y;
- var p0dx = width - shape.parameters.get(ArrowHorizontalShapeDescription_1.ArrowVerticalTriangleWidthParameterName).value;
- var p1dy = (height - shape.parameters.get(ArrowHorizontalShapeDescription_1.ArrowVerticalLineHeightParameterName).value) / 2;
- var p0x1 = shape.normalizeX(left + p0dx);
- var p1y1 = shape.normalizeY(top + p1dy);
- var p1y2 = shape.normalizeY(bottom - p1dy);
- var primitives = [];
- return primitives.concat([
- new PathPrimitive_1.PathPrimitive([
- new PathPrimitive_1.PathPrimitiveMoveToCommand(left, p1y1),
- new PathPrimitive_1.PathPrimitiveLineToCommand(p0x1, p1y1),
- new PathPrimitive_1.PathPrimitiveLineToCommand(p0x1, top),
- new PathPrimitive_1.PathPrimitiveLineToCommand(right, cy),
- new PathPrimitive_1.PathPrimitiveLineToCommand(p0x1, bottom),
- new PathPrimitive_1.PathPrimitiveLineToCommand(p0x1, p1y2),
- new PathPrimitive_1.PathPrimitiveLineToCommand(left, p1y2),
- new PathPrimitive_1.PathPrimitiveClosePathCommand()
- ], shape.style)
- ])
- .concat(this.createTextPrimitives(shape));
- };
- ArrowRightShapeDescription.prototype.modifyParameters = function (shape, parameters, deltaX, deltaY) {
- this.changeParameterValue(parameters, ArrowHorizontalShapeDescription_1.ArrowVerticalTriangleWidthParameterName, function (p) { return p.value - deltaX; });
- this.changeParameterValue(parameters, ArrowHorizontalShapeDescription_1.ArrowVerticalLineHeightParameterName, function (p) { return p.value - deltaY * 2; });
- this.normalizeParameters(shape, parameters);
- };
- ArrowRightShapeDescription.prototype.getParameterPoints = function (shape) {
- return [
- new ShapeParameterPoint_1.ShapeParameterPoint("c", new Utils_1.Point(shape.normalizeX(shape.position.x + shape.size.width - shape.parameters.get(ArrowHorizontalShapeDescription_1.ArrowVerticalTriangleWidthParameterName).value), shape.normalizeY(shape.position.y + (shape.size.height - shape.parameters.get(ArrowHorizontalShapeDescription_1.ArrowVerticalLineHeightParameterName).value) / 2)))
- ];
- };
- ArrowRightShapeDescription.prototype.processConnectionPoint = function (shape, point, index) {
- var triangleWidth = shape.parameters.get(ArrowHorizontalShapeDescription_1.ArrowVerticalTriangleWidthParameterName).value;
- if (point.x > shape.position.x + shape.size.width - triangleWidth) {
- var tg = shape.size.height / 2 / triangleWidth;
- var delta = (point.x - (shape.position.x + shape.size.width - triangleWidth)) * tg;
- var side = shape.getConnectionPointSide(index);
- if (side === DiagramItem_1.ConnectionPointSide.North)
- point.y += delta;
- else if (side === DiagramItem_1.ConnectionPointSide.South)
- point.y -= delta;
- }
- else
- _super.prototype.processConnectionPoint.call(this, shape, point, index);
- };
- return ArrowRightShapeDescription;
- }(ArrowHorizontalShapeDescription_1.ArrowHorizontalShapeDescription));
- exports.ArrowRightShapeDescription = ArrowRightShapeDescription;
- /***/ }),
- /* 128 */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- var __extends = (this && this.__extends) || (function () {
- var extendStatics = function (d, b) {
- extendStatics = Object.setPrototypeOf ||
- ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
- function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
- return extendStatics(d, b);
- };
- return function (d, b) {
- extendStatics(d, b);
- function __() { this.constructor = d; }
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
- };
- })();
- Object.defineProperty(exports, "__esModule", { value: true });
- var PathPrimitive_1 = __webpack_require__(2);
- var ShapeParameterPoint_1 = __webpack_require__(17);
- var Utils_1 = __webpack_require__(0);
- var ArrowVerticalShapeDescription_1 = __webpack_require__(54);
- var ShapeType_1 = __webpack_require__(1);
- var DiagramItem_1 = __webpack_require__(3);
- var ArrowTopShapeDescription = /** @class */ (function (_super) {
- __extends(ArrowTopShapeDescription, _super);
- function ArrowTopShapeDescription() {
- return _super.call(this, "Top Arrow") || this;
- }
- Object.defineProperty(ArrowTopShapeDescription.prototype, "key", {
- get: function () { return ShapeType_1.ShapeType.ArrowTop; },
- enumerable: true,
- configurable: true
- });
- ArrowTopShapeDescription.prototype.createPrimitives = function (shape) {
- var rect = shape.rectangle;
- var left = rect.left, top = rect.top, right = rect.right, bottom = rect.bottom, width = rect.width, height = rect.height;
- var cx = rect.center.x;
- var p1dx = (width - shape.parameters.get(ArrowVerticalShapeDescription_1.ArrowVerticalLineWidthParameterName).value) / 2;
- var p0dy = shape.parameters.get(ArrowVerticalShapeDescription_1.ArrowVerticalTriangleHeightParameterName).value;
- var p1x1 = shape.normalizeX(left + p1dx);
- var p0y1 = shape.normalizeY(top + p0dy);
- var p1x2 = shape.normalizeX(right - p1dx);
- var primitives = [];
- return primitives.concat([
- new PathPrimitive_1.PathPrimitive([
- new PathPrimitive_1.PathPrimitiveMoveToCommand(cx, top),
- new PathPrimitive_1.PathPrimitiveLineToCommand(right, p0y1),
- new PathPrimitive_1.PathPrimitiveLineToCommand(p1x2, p0y1),
- new PathPrimitive_1.PathPrimitiveLineToCommand(p1x2, bottom),
- new PathPrimitive_1.PathPrimitiveLineToCommand(p1x1, bottom),
- new PathPrimitive_1.PathPrimitiveLineToCommand(p1x1, p0y1),
- new PathPrimitive_1.PathPrimitiveLineToCommand(left, p0y1),
- new PathPrimitive_1.PathPrimitiveClosePathCommand()
- ], shape.style)
- ])
- .concat(this.createTextPrimitives(shape));
- };
- ArrowTopShapeDescription.prototype.modifyParameters = function (shape, parameters, deltaX, deltaY) {
- this.changeParameterValue(parameters, ArrowVerticalShapeDescription_1.ArrowVerticalTriangleHeightParameterName, function (p) { return p.value + deltaY; });
- this.changeParameterValue(parameters, ArrowVerticalShapeDescription_1.ArrowVerticalLineWidthParameterName, function (p) { return p.value - deltaX * 2; });
- this.normalizeParameters(shape, parameters);
- };
- ArrowTopShapeDescription.prototype.getParameterPoints = function (shape) {
- return [
- new ShapeParameterPoint_1.ShapeParameterPoint("c", new Utils_1.Point(shape.normalizeX(shape.position.x + (shape.size.width - shape.parameters.get(ArrowVerticalShapeDescription_1.ArrowVerticalLineWidthParameterName).value) / 2), shape.normalizeY(shape.position.y + shape.parameters.get(ArrowVerticalShapeDescription_1.ArrowVerticalTriangleHeightParameterName).value)))
- ];
- };
- ArrowTopShapeDescription.prototype.processConnectionPoint = function (shape, point, index) {
- var triangleHeight = shape.parameters.get(ArrowVerticalShapeDescription_1.ArrowVerticalTriangleHeightParameterName).value;
- if (point.y < shape.position.y + triangleHeight) {
- var tg = shape.size.width / 2 / triangleHeight;
- var delta = (shape.position.y + triangleHeight - point.y) * tg;
- var side = shape.getConnectionPointSide(index);
- if (side === DiagramItem_1.ConnectionPointSide.East)
- point.x -= delta;
- else if (side === DiagramItem_1.ConnectionPointSide.West)
- point.x += delta;
- }
- else
- _super.prototype.processConnectionPoint.call(this, shape, point, index);
- };
- return ArrowTopShapeDescription;
- }(ArrowVerticalShapeDescription_1.ArrowVerticalShapeDescription));
- exports.ArrowTopShapeDescription = ArrowTopShapeDescription;
- /***/ }),
- /* 129 */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- var __extends = (this && this.__extends) || (function () {
- var extendStatics = function (d, b) {
- extendStatics = Object.setPrototypeOf ||
- ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
- function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
- return extendStatics(d, b);
- };
- return function (d, b) {
- extendStatics(d, b);
- function __() { this.constructor = d; }
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
- };
- })();
- Object.defineProperty(exports, "__esModule", { value: true });
- var ShapeDescription_1 = __webpack_require__(11);
- var Utils_1 = __webpack_require__(0);
- var ShapeParameters_1 = __webpack_require__(25);
- var ShapeParameterPoint_1 = __webpack_require__(17);
- var PathPrimitive_1 = __webpack_require__(2);
- var ShapeType_1 = __webpack_require__(1);
- exports.CrossHorizontalWidthParameterName = "chw";
- exports.CrossVerticalWidthParameterName = "cvw";
- var CrossShapeDescription = /** @class */ (function (_super) {
- __extends(CrossShapeDescription, _super);
- function CrossShapeDescription() {
- return _super.call(this, "Cross", "") || this;
- }
- Object.defineProperty(CrossShapeDescription.prototype, "key", {
- get: function () { return ShapeType_1.ShapeType.Cross; },
- enumerable: true,
- configurable: true
- });
- Object.defineProperty(CrossShapeDescription.prototype, "category", {
- get: function () { return ShapeType_1.ShapeCategory.General; },
- enumerable: true,
- configurable: true
- });
- CrossShapeDescription.prototype.createPrimitives = function (shape) {
- var rect = shape.rectangle;
- var left = rect.left, top = rect.top, right = rect.right, bottom = rect.bottom, width = rect.width, height = rect.height;
- var p0dx = (width - shape.parameters.get(exports.CrossHorizontalWidthParameterName).value) / 2;
- var p1dy = (height - shape.parameters.get(exports.CrossVerticalWidthParameterName).value) / 2;
- var p0x1 = shape.normalizeX(left + p0dx);
- var p1y1 = shape.normalizeY(top + p1dy);
- var p0x2 = shape.normalizeX(right - p0dx);
- var p1y2 = shape.normalizeY(bottom - p1dy);
- var primitives = [];
- return primitives.concat([
- new PathPrimitive_1.PathPrimitive([
- new PathPrimitive_1.PathPrimitiveMoveToCommand(left, p1y1),
- new PathPrimitive_1.PathPrimitiveLineToCommand(p0x1, p1y1),
- new PathPrimitive_1.PathPrimitiveLineToCommand(p0x1, top),
- new PathPrimitive_1.PathPrimitiveLineToCommand(p0x2, top),
- new PathPrimitive_1.PathPrimitiveLineToCommand(p0x2, p1y1),
- new PathPrimitive_1.PathPrimitiveLineToCommand(right, p1y1),
- new PathPrimitive_1.PathPrimitiveLineToCommand(right, p1y2),
- new PathPrimitive_1.PathPrimitiveLineToCommand(p0x2, p1y2),
- new PathPrimitive_1.PathPrimitiveLineToCommand(p0x2, bottom),
- new PathPrimitive_1.PathPrimitiveLineToCommand(p0x1, bottom),
- new PathPrimitive_1.PathPrimitiveLineToCommand(p0x1, p1y2),
- new PathPrimitive_1.PathPrimitiveLineToCommand(left, p1y2),
- new PathPrimitive_1.PathPrimitiveClosePathCommand()
- ], shape.style)
- ])
- .concat(this.createTextPrimitives(shape));
- };
- CrossShapeDescription.prototype.createParameters = function (parameters) {
- parameters.addRange([
- new ShapeParameters_1.ShapeParameter(exports.CrossHorizontalWidthParameterName, this.defaultSize.width * 0.2),
- new ShapeParameters_1.ShapeParameter(exports.CrossVerticalWidthParameterName, this.defaultSize.height * 0.2)
- ]);
- };
- CrossShapeDescription.prototype.normalizeParameters = function (shape, parameters) {
- this.changeParameterValue(parameters, exports.CrossHorizontalWidthParameterName, function (p) { return Math.max(0, Math.min(shape.size.width, p.value)); });
- this.changeParameterValue(parameters, exports.CrossVerticalWidthParameterName, function (p) { return Math.max(0, Math.min(shape.size.height, p.value)); });
- };
- CrossShapeDescription.prototype.modifyParameters = function (shape, parameters, deltaX, deltaY) {
- this.changeParameterValue(parameters, exports.CrossHorizontalWidthParameterName, function (p) { return p.value - deltaX * 2; });
- this.changeParameterValue(parameters, exports.CrossVerticalWidthParameterName, function (p) { return p.value - deltaY * 2; });
- this.normalizeParameters(shape, parameters);
- };
- CrossShapeDescription.prototype.getParameterPoints = function (shape) {
- return [
- new ShapeParameterPoint_1.ShapeParameterPoint("c", new Utils_1.Point(shape.normalizeX(shape.position.x + (shape.size.width - shape.parameters.get(exports.CrossHorizontalWidthParameterName).value) / 2), shape.normalizeY(shape.position.y + (shape.size.height - shape.parameters.get(exports.CrossVerticalWidthParameterName).value) / 2)))
- ];
- };
- return CrossShapeDescription;
- }(ShapeDescription_1.ShapeDescription));
- exports.CrossShapeDescription = CrossShapeDescription;
- /***/ }),
- /* 130 */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- var __extends = (this && this.__extends) || (function () {
- var extendStatics = function (d, b) {
- extendStatics = Object.setPrototypeOf ||
- ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
- function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
- return extendStatics(d, b);
- };
- return function (d, b) {
- extendStatics(d, b);
- function __() { this.constructor = d; }
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
- };
- })();
- Object.defineProperty(exports, "__esModule", { value: true });
- var ShapeDescription_1 = __webpack_require__(11);
- var PathPrimitive_1 = __webpack_require__(2);
- var ShapeType_1 = __webpack_require__(1);
- var ConnectionPoint_1 = __webpack_require__(32);
- var DiagramItem_1 = __webpack_require__(3);
- var HeartShapeDescription = /** @class */ (function (_super) {
- __extends(HeartShapeDescription, _super);
- function HeartShapeDescription() {
- return _super.call(this, "Heart", "") || this;
- }
- Object.defineProperty(HeartShapeDescription.prototype, "key", {
- get: function () { return ShapeType_1.ShapeType.Heart; },
- enumerable: true,
- configurable: true
- });
- Object.defineProperty(HeartShapeDescription.prototype, "category", {
- get: function () { return ShapeType_1.ShapeCategory.General; },
- enumerable: true,
- configurable: true
- });
- HeartShapeDescription.prototype.createConnectionPoints = function () {
- return [
- new ConnectionPoint_1.ConnectionPoint(0.5, 0.15, DiagramItem_1.ConnectionPointSide.North),
- new ConnectionPoint_1.ConnectionPoint(1, 0.25, DiagramItem_1.ConnectionPointSide.East),
- new ConnectionPoint_1.ConnectionPoint(0.5, 1, DiagramItem_1.ConnectionPointSide.South),
- new ConnectionPoint_1.ConnectionPoint(0, 0.25, DiagramItem_1.ConnectionPointSide.West)
- ];
- };
- HeartShapeDescription.prototype.createPrimitives = function (shape) {
- var rect = shape.rectangle;
- var left = rect.left, top = rect.top, right = rect.right, bottom = rect.bottom, width = rect.width, height = rect.height;
- var primitives = [];
- return primitives.concat([
- new PathPrimitive_1.PathPrimitive([
- new PathPrimitive_1.PathPrimitiveMoveToCommand(right - width * 0.25, top),
- new PathPrimitive_1.PathPrimitiveCubicCurveToCommand(right - width * 0.15, top, right, top + height * 0.1, right, top + height * 0.25),
- new PathPrimitive_1.PathPrimitiveCubicCurveToCommand(right, top + height * 0.3, right - width * 0.02, top + height * 0.35, right - width * 0.05, top + height * 0.4),
- new PathPrimitive_1.PathPrimitiveLineToCommand(rect.center.x, bottom),
- new PathPrimitive_1.PathPrimitiveLineToCommand(left + width * 0.05, top + height * 0.4),
- new PathPrimitive_1.PathPrimitiveCubicCurveToCommand(left + width * 0.02, top + height * 0.35, left, top + height * 0.3, left, top + height * 0.25),
- new PathPrimitive_1.PathPrimitiveCubicCurveToCommand(left, top + height * 0.1, left + width * 0.15, top, left + width * 0.25, top),
- new PathPrimitive_1.PathPrimitiveCubicCurveToCommand(left + width * 0.3, top, left + width * 0.45, top + height * 0.03, left + width * 0.5, top + height * 0.15),
- new PathPrimitive_1.PathPrimitiveCubicCurveToCommand(right - width * 0.45, top + height * 0.03, right - width * 0.3, top, right - width * 0.25, top),
- new PathPrimitive_1.PathPrimitiveClosePathCommand()
- ], shape.style)
- ])
- .concat(this.createTextPrimitives(shape));
- };
- return HeartShapeDescription;
- }(ShapeDescription_1.ShapeDescription));
- exports.HeartShapeDescription = HeartShapeDescription;
- /***/ }),
- /* 131 */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- var __extends = (this && this.__extends) || (function () {
- var extendStatics = function (d, b) {
- extendStatics = Object.setPrototypeOf ||
- ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
- function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
- return extendStatics(d, b);
- };
- return function (d, b) {
- extendStatics(d, b);
- function __() { this.constructor = d; }
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
- };
- })();
- Object.defineProperty(exports, "__esModule", { value: true });
- var PathPrimitive_1 = __webpack_require__(2);
- var ShapeType_1 = __webpack_require__(1);
- var PolygonShapeDescription_1 = __webpack_require__(57);
- var OctagonShapeDescription = /** @class */ (function (_super) {
- __extends(OctagonShapeDescription, _super);
- function OctagonShapeDescription() {
- return _super.call(this, "Octagon", "") || this;
- }
- Object.defineProperty(OctagonShapeDescription.prototype, "key", {
- get: function () { return ShapeType_1.ShapeType.Octagon; },
- enumerable: true,
- configurable: true
- });
- Object.defineProperty(OctagonShapeDescription.prototype, "angleCount", {
- get: function () { return 8; },
- enumerable: true,
- configurable: true
- });
- OctagonShapeDescription.prototype.createPrimitives = function (shape) {
- var rect = shape.rectangle;
- var left = rect.left, top = rect.top, right = rect.right, bottom = rect.bottom, width = rect.width, height = rect.height;
- var angle = Math.PI - this.angle;
- var sideX = width / (1 + 2 * Math.cos(angle));
- var sideY = height / (1 + 2 * Math.cos(angle));
- var x1 = left + (width - sideX) / 2;
- var x2 = x1 + sideX;
- var y1 = top + (height - sideY) / 2;
- var y2 = y1 + sideY;
- var primitives = [];
- return primitives.concat([
- new PathPrimitive_1.PathPrimitive([
- new PathPrimitive_1.PathPrimitiveMoveToCommand(x1, top),
- new PathPrimitive_1.PathPrimitiveLineToCommand(x2, top),
- new PathPrimitive_1.PathPrimitiveLineToCommand(right, y1),
- new PathPrimitive_1.PathPrimitiveLineToCommand(right, y2),
- new PathPrimitive_1.PathPrimitiveLineToCommand(x2, bottom),
- new PathPrimitive_1.PathPrimitiveLineToCommand(x1, bottom),
- new PathPrimitive_1.PathPrimitiveLineToCommand(left, y2),
- new PathPrimitive_1.PathPrimitiveLineToCommand(left, y1),
- new PathPrimitive_1.PathPrimitiveClosePathCommand()
- ], shape.style)
- ])
- .concat(this.createTextPrimitives(shape));
- };
- OctagonShapeDescription.prototype.calculateHeight = function (width) {
- return width;
- };
- return OctagonShapeDescription;
- }(PolygonShapeDescription_1.PolygonShapeDescription));
- exports.OctagonShapeDescription = OctagonShapeDescription;
- /***/ }),
- /* 132 */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- var __extends = (this && this.__extends) || (function () {
- var extendStatics = function (d, b) {
- extendStatics = Object.setPrototypeOf ||
- ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
- function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
- return extendStatics(d, b);
- };
- return function (d, b) {
- extendStatics(d, b);
- function __() { this.constructor = d; }
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
- };
- })();
- Object.defineProperty(exports, "__esModule", { value: true });
- var PathPrimitive_1 = __webpack_require__(2);
- var ShapeType_1 = __webpack_require__(1);
- var PentagonShapeDescription_1 = __webpack_require__(77);
- var ShapeParameters_1 = __webpack_require__(25);
- var ShapeParameterPoint_1 = __webpack_require__(17);
- var Utils_1 = __webpack_require__(0);
- var DiagramItem_1 = __webpack_require__(3);
- exports.StarConvexParameterName = "sc";
- var StarShapeDescription = /** @class */ (function (_super) {
- __extends(StarShapeDescription, _super);
- function StarShapeDescription() {
- return _super.call(this, "Star", "") || this;
- }
- Object.defineProperty(StarShapeDescription.prototype, "key", {
- get: function () { return ShapeType_1.ShapeType.Star; },
- enumerable: true,
- configurable: true
- });
- StarShapeDescription.prototype.createPrimitives = function (shape) {
- var rect = shape.rectangle;
- var left = rect.left, top = rect.top, right = rect.right, bottom = rect.bottom, width = rect.width, height = rect.height;
- bottom = this.getActualBottom(top, bottom, width, height);
- var cx = rect.center.x;
- var cy = top + (bottom - top) / 2;
- var ratio = height / width;
- var angle = Math.PI - this.angle;
- var py = width / 2 * Math.tan(angle / 2) * ratio;
- var y = top + py;
- var px = (height - py) / Math.tan(angle) / ratio;
- var x1 = left + px;
- var x2 = right - px;
- var pDistance = shape.parameters.get(exports.StarConvexParameterName).value;
- var distance = this.getInnerPointDistance(cx, cx, right, cy, top, y);
- var primitives = [];
- return primitives.concat([
- new PathPrimitive_1.PathPrimitive([
- new PathPrimitive_1.PathPrimitiveMoveToCommand(cx, top),
- new PathPrimitive_1.PathPrimitiveLineToCommand(this.getInnerPointPos(cx, cx, right, pDistance, distance), this.getInnerPointPos(cy, top, y, pDistance, distance)),
- new PathPrimitive_1.PathPrimitiveLineToCommand(right, y),
- new PathPrimitive_1.PathPrimitiveLineToCommand(this.getInnerPointPos(cx, right, x2, pDistance, distance), this.getInnerPointPos(cy, y, bottom, pDistance, distance)),
- new PathPrimitive_1.PathPrimitiveLineToCommand(x2, bottom),
- new PathPrimitive_1.PathPrimitiveLineToCommand(this.getInnerPointPos(cx, x2, x1, pDistance, distance), this.getInnerPointPos(cy, bottom, bottom, pDistance, distance)),
- new PathPrimitive_1.PathPrimitiveLineToCommand(x1, bottom),
- new PathPrimitive_1.PathPrimitiveLineToCommand(this.getInnerPointPos(cx, x1, left, pDistance, distance), this.getInnerPointPos(cy, bottom, y, pDistance, distance)),
- new PathPrimitive_1.PathPrimitiveLineToCommand(left, y),
- new PathPrimitive_1.PathPrimitiveLineToCommand(this.getInnerPointPos(cx, left, cx, pDistance, distance), this.getInnerPointPos(cy, y, top, pDistance, distance)),
- new PathPrimitive_1.PathPrimitiveClosePathCommand()
- ], shape.style)
- ])
- .concat(this.createTextPrimitives(shape));
- };
- StarShapeDescription.prototype.createParameters = function (parameters) {
- parameters.addRange([
- new ShapeParameters_1.ShapeParameter(exports.StarConvexParameterName, 300)
- ]);
- };
- StarShapeDescription.prototype.normalizeParameters = function (shape, parameters) {
- var rect = shape.rectangle;
- var top = rect.top, right = rect.right, bottom = rect.bottom, width = rect.width, height = rect.height;
- bottom = this.getActualBottom(top, bottom, width, height);
- var cx = rect.center.x;
- var cy = top + (bottom - top) / 2;
- var ratio = height / width;
- var angle = Math.PI - this.angle;
- var py = width / 2 * Math.tan(angle / 2) * ratio;
- var y = top + py;
- var distance = this.getInnerPointDistance(cx, cx, right, cy, top, y);
- this.changeParameterValue(parameters, exports.StarConvexParameterName, function (p) { return Math.max(0, Math.min(distance, p.value)); });
- };
- StarShapeDescription.prototype.modifyParameters = function (shape, parameters, deltaX, deltaY) {
- var distance = Math.sqrt(Math.pow(deltaX, 2) + Math.pow(deltaY, 2));
- if (deltaX < 0 || deltaY > 0)
- distance = -distance;
- this.changeParameterValue(parameters, exports.StarConvexParameterName, function (p) { return p.value + distance; });
- this.normalizeParameters(shape, parameters);
- };
- StarShapeDescription.prototype.getParameterPoints = function (shape) {
- var rect = shape.rectangle;
- var top = rect.top, right = rect.right, bottom = rect.bottom, width = rect.width, height = rect.height;
- bottom = this.getActualBottom(top, bottom, width, height);
- var cx = rect.center.x;
- var cy = top + (bottom - top) / 2;
- var ratio = height / width;
- var angle = Math.PI - this.angle;
- var py = width / 2 * Math.tan(angle / 2) * ratio;
- var y = top + py;
- var pDistance = shape.parameters.get(exports.StarConvexParameterName).value;
- var distance = this.getInnerPointDistance(cx, cx, right, cy, top, y);
- var innerPointX = this.getInnerPointPos(cx, cx, right, pDistance, distance);
- var innerPointY = this.getInnerPointPos(cy, top, y, pDistance, distance);
- return [
- new ShapeParameterPoint_1.ShapeParameterPoint("c", new Utils_1.Point(innerPointX, innerPointY))
- ];
- };
- StarShapeDescription.prototype.processConnectionPoint = function (shape, point, index) {
- _super.prototype.processConnectionPoint.call(this, shape, point, index);
- var side = shape.getConnectionPointSide(index);
- if (side === DiagramItem_1.ConnectionPointSide.South) {
- var rect = shape.rectangle;
- var top_1 = rect.top, right = rect.right, bottom = rect.bottom, width = rect.width, height = rect.height;
- bottom = this.getActualBottom(top_1, bottom, width, height);
- var cx = rect.center.x;
- var cy = top_1 + (bottom - top_1) / 2;
- var ratio = height / width;
- var angle = Math.PI - this.angle;
- var py = width / 2 * Math.tan(angle / 2) * ratio;
- var y = top_1 + py;
- var pDistance = shape.parameters.get(exports.StarConvexParameterName).value;
- var distance = this.getInnerPointDistance(cx, cx, right, cy, top_1, y);
- point.y = this.getInnerPointPos(cy, bottom, bottom, pDistance, distance);
- }
- };
- StarShapeDescription.prototype.getInnerPointDistanceByAxis = function (center, edge1, edge2) {
- var edgeX = Math.min(edge1, edge2) + Math.abs(edge1 - edge2) / 2;
- return edgeX - center;
- };
- StarShapeDescription.prototype.getInnerPointPos = function (center, edge1, edge2, pDistance, distance) {
- var ratio = Math.min(1, pDistance / distance);
- return center + this.getInnerPointDistanceByAxis(center, edge1, edge2) * ratio;
- };
- StarShapeDescription.prototype.getInnerPointDistance = function (centerX, edgeX1, edgeX2, centerY, edgeY1, edgeY2) {
- var disX = this.getInnerPointDistanceByAxis(centerX, edgeX1, edgeX2);
- var disY = this.getInnerPointDistanceByAxis(centerY, edgeY1, edgeY2);
- return Math.sqrt(Math.pow(disX, 2) + Math.pow(disY, 2));
- };
- StarShapeDescription.prototype.getActualBottom = function (top, bottom, width, height) {
- var result = top + _super.prototype.calculateHeight.call(this, width) * height / width;
- return result < bottom ? result : bottom;
- };
- StarShapeDescription.prototype.calculateHeight = function (width) {
- return width;
- };
- return StarShapeDescription;
- }(PentagonShapeDescription_1.PentagonShapeDescription));
- exports.StarShapeDescription = StarShapeDescription;
- /***/ }),
- /* 133 */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- var __extends = (this && this.__extends) || (function () {
- var extendStatics = function (d, b) {
- extendStatics = Object.setPrototypeOf ||
- ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
- function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
- return extendStatics(d, b);
- };
- return function (d, b) {
- extendStatics(d, b);
- function __() { this.constructor = d; }
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
- };
- })();
- Object.defineProperty(exports, "__esModule", { value: true });
- var PathPrimitive_1 = __webpack_require__(2);
- var ShapeParameterPoint_1 = __webpack_require__(17);
- var Utils_1 = __webpack_require__(0);
- var ArrowVerticalShapeDescription_1 = __webpack_require__(54);
- var ShapeType_1 = __webpack_require__(1);
- var DiagramItem_1 = __webpack_require__(3);
- var ArrowBottomShapeDescription = /** @class */ (function (_super) {
- __extends(ArrowBottomShapeDescription, _super);
- function ArrowBottomShapeDescription() {
- return _super.call(this, "Bottom Arrow") || this;
- }
- Object.defineProperty(ArrowBottomShapeDescription.prototype, "key", {
- get: function () { return ShapeType_1.ShapeType.ArrowBottom; },
- enumerable: true,
- configurable: true
- });
- ArrowBottomShapeDescription.prototype.createPrimitives = function (shape) {
- var rect = shape.rectangle;
- var left = rect.left, top = rect.top, right = rect.right, bottom = rect.bottom, width = rect.width, height = rect.height;
- var cx = rect.center.x;
- var p1dx = (width - shape.parameters.get(ArrowVerticalShapeDescription_1.ArrowVerticalLineWidthParameterName).value) / 2;
- var p0dy = height - shape.parameters.get(ArrowVerticalShapeDescription_1.ArrowVerticalTriangleHeightParameterName).value;
- var p1x1 = shape.normalizeX(left + p1dx);
- var p0y1 = shape.normalizeY(top + p0dy);
- var p1x2 = shape.normalizeX(right - p1dx);
- var primitives = [];
- return primitives.concat([
- new PathPrimitive_1.PathPrimitive([
- new PathPrimitive_1.PathPrimitiveMoveToCommand(p1x1, top),
- new PathPrimitive_1.PathPrimitiveLineToCommand(p1x2, top),
- new PathPrimitive_1.PathPrimitiveLineToCommand(p1x2, p0y1),
- new PathPrimitive_1.PathPrimitiveLineToCommand(right, p0y1),
- new PathPrimitive_1.PathPrimitiveLineToCommand(cx, bottom),
- new PathPrimitive_1.PathPrimitiveLineToCommand(left, p0y1),
- new PathPrimitive_1.PathPrimitiveLineToCommand(p1x1, p0y1),
- new PathPrimitive_1.PathPrimitiveClosePathCommand()
- ], shape.style)
- ])
- .concat(this.createTextPrimitives(shape));
- };
- ArrowBottomShapeDescription.prototype.modifyParameters = function (shape, parameters, deltaX, deltaY) {
- this.changeParameterValue(parameters, ArrowVerticalShapeDescription_1.ArrowVerticalTriangleHeightParameterName, function (p) { return p.value - deltaY; });
- this.changeParameterValue(parameters, ArrowVerticalShapeDescription_1.ArrowVerticalLineWidthParameterName, function (p) { return p.value - deltaX * 2; });
- this.normalizeParameters(shape, parameters);
- };
- ArrowBottomShapeDescription.prototype.getParameterPoints = function (shape) {
- return [
- new ShapeParameterPoint_1.ShapeParameterPoint("c", new Utils_1.Point(shape.normalizeX(shape.position.x + (shape.size.width - shape.parameters.get(ArrowVerticalShapeDescription_1.ArrowVerticalLineWidthParameterName).value) / 2), shape.normalizeY(shape.position.y + shape.size.height - shape.parameters.get(ArrowVerticalShapeDescription_1.ArrowVerticalTriangleHeightParameterName).value)))
- ];
- };
- ArrowBottomShapeDescription.prototype.processConnectionPoint = function (shape, point, index) {
- var triangleHeight = shape.parameters.get(ArrowVerticalShapeDescription_1.ArrowVerticalTriangleHeightParameterName).value;
- if (point.y > shape.position.y + shape.size.height - triangleHeight) {
- var tg = shape.size.width / 2 / triangleHeight;
- var delta = (point.y - (shape.position.y + shape.size.height - triangleHeight)) * tg;
- var side = shape.getConnectionPointSide(index);
- if (side === DiagramItem_1.ConnectionPointSide.East)
- point.x -= delta;
- else if (side === DiagramItem_1.ConnectionPointSide.West)
- point.x += delta;
- }
- else
- _super.prototype.processConnectionPoint.call(this, shape, point, index);
- };
- return ArrowBottomShapeDescription;
- }(ArrowVerticalShapeDescription_1.ArrowVerticalShapeDescription));
- exports.ArrowBottomShapeDescription = ArrowBottomShapeDescription;
- /***/ }),
- /* 134 */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- var __extends = (this && this.__extends) || (function () {
- var extendStatics = function (d, b) {
- extendStatics = Object.setPrototypeOf ||
- ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
- function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
- return extendStatics(d, b);
- };
- return function (d, b) {
- extendStatics(d, b);
- function __() { this.constructor = d; }
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
- };
- })();
- Object.defineProperty(exports, "__esModule", { value: true });
- var Shape_1 = __webpack_require__(9);
- var PathPrimitive_1 = __webpack_require__(2);
- var ArrowHorizontalShapeDescription_1 = __webpack_require__(55);
- var ShapeParameterPoint_1 = __webpack_require__(17);
- var Utils_1 = __webpack_require__(0);
- var ShapeType_1 = __webpack_require__(1);
- var ArrowEastWestShapeDescription = /** @class */ (function (_super) {
- __extends(ArrowEastWestShapeDescription, _super);
- function ArrowEastWestShapeDescription() {
- return _super.call(this, "East-West Arrow") || this;
- }
- Object.defineProperty(ArrowEastWestShapeDescription.prototype, "key", {
- get: function () { return ShapeType_1.ShapeType.ArrowEastWest; },
- enumerable: true,
- configurable: true
- });
- ArrowEastWestShapeDescription.prototype.createPrimitives = function (shape) {
- var rect = shape.rectangle;
- var left = rect.left, top = rect.top, right = rect.right, bottom = rect.bottom, width = rect.width, height = rect.height;
- var cy = rect.center.y;
- var p0dx = shape.parameters.get(ArrowHorizontalShapeDescription_1.ArrowVerticalTriangleWidthParameterName).value;
- var p1dy = (height - shape.parameters.get(ArrowHorizontalShapeDescription_1.ArrowVerticalLineHeightParameterName).value) / 2;
- var p0x1 = shape.normalizeX(left + p0dx);
- var p1y1 = shape.normalizeY(top + p1dy);
- var p0x2 = shape.normalizeX(right - p0dx);
- var p1y2 = shape.normalizeY(bottom - p1dy);
- var primitives = [];
- return primitives.concat([
- new PathPrimitive_1.PathPrimitive([
- new PathPrimitive_1.PathPrimitiveMoveToCommand(left, cy),
- new PathPrimitive_1.PathPrimitiveLineToCommand(p0x1, top),
- new PathPrimitive_1.PathPrimitiveLineToCommand(p0x1, p1y1),
- new PathPrimitive_1.PathPrimitiveLineToCommand(p0x2, p1y1),
- new PathPrimitive_1.PathPrimitiveLineToCommand(p0x2, top),
- new PathPrimitive_1.PathPrimitiveLineToCommand(right, cy),
- new PathPrimitive_1.PathPrimitiveLineToCommand(p0x2, bottom),
- new PathPrimitive_1.PathPrimitiveLineToCommand(p0x2, p1y2),
- new PathPrimitive_1.PathPrimitiveLineToCommand(p0x1, p1y2),
- new PathPrimitive_1.PathPrimitiveLineToCommand(p0x1, bottom),
- new PathPrimitive_1.PathPrimitiveClosePathCommand()
- ], shape.style)
- ])
- .concat(this.createTextPrimitives(shape));
- };
- ArrowEastWestShapeDescription.prototype.normalizeParameters = function (shape, parameters) {
- this.changeParameterValue(parameters, ArrowHorizontalShapeDescription_1.ArrowVerticalTriangleWidthParameterName, function (p) { return Math.max(0, Math.min(shape.size.width / 2 - 2 * Shape_1.Shape.lineWidth, p.value)); });
- this.changeParameterValue(parameters, ArrowHorizontalShapeDescription_1.ArrowVerticalLineHeightParameterName, function (p) { return Math.max(0, Math.min(shape.size.height, p.value)); });
- };
- ArrowEastWestShapeDescription.prototype.modifyParameters = function (shape, parameters, deltaX, deltaY) {
- this.changeParameterValue(parameters, ArrowHorizontalShapeDescription_1.ArrowVerticalTriangleWidthParameterName, function (p) { return p.value + deltaX; });
- this.changeParameterValue(parameters, ArrowHorizontalShapeDescription_1.ArrowVerticalLineHeightParameterName, function (p) { return p.value - deltaY * 2; });
- this.normalizeParameters(shape, parameters);
- };
- ArrowEastWestShapeDescription.prototype.getParameterPoints = function (shape) {
- return [
- new ShapeParameterPoint_1.ShapeParameterPoint("c", new Utils_1.Point(shape.normalizeX(shape.position.x + shape.parameters.get(ArrowHorizontalShapeDescription_1.ArrowVerticalTriangleWidthParameterName).value), shape.normalizeY(shape.position.y + (shape.size.height - shape.parameters.get(ArrowHorizontalShapeDescription_1.ArrowVerticalLineHeightParameterName).value) / 2)))
- ];
- };
- return ArrowEastWestShapeDescription;
- }(ArrowHorizontalShapeDescription_1.ArrowHorizontalShapeDescription));
- exports.ArrowEastWestShapeDescription = ArrowEastWestShapeDescription;
- /***/ }),
- /* 135 */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- var __extends = (this && this.__extends) || (function () {
- var extendStatics = function (d, b) {
- extendStatics = Object.setPrototypeOf ||
- ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
- function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
- return extendStatics(d, b);
- };
- return function (d, b) {
- extendStatics(d, b);
- function __() { this.constructor = d; }
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
- };
- })();
- Object.defineProperty(exports, "__esModule", { value: true });
- var PathPrimitive_1 = __webpack_require__(2);
- var ArrowHorizontalShapeDescription_1 = __webpack_require__(55);
- var ShapeParameterPoint_1 = __webpack_require__(17);
- var Utils_1 = __webpack_require__(0);
- var ShapeType_1 = __webpack_require__(1);
- var DiagramItem_1 = __webpack_require__(3);
- var ArrowLeftShapeDescription = /** @class */ (function (_super) {
- __extends(ArrowLeftShapeDescription, _super);
- function ArrowLeftShapeDescription() {
- return _super.call(this, "Left Arrow") || this;
- }
- Object.defineProperty(ArrowLeftShapeDescription.prototype, "key", {
- get: function () { return ShapeType_1.ShapeType.ArrowLeft; },
- enumerable: true,
- configurable: true
- });
- ArrowLeftShapeDescription.prototype.createPrimitives = function (shape) {
- var rect = shape.rectangle;
- var left = rect.left, top = rect.top, right = rect.right, bottom = rect.bottom, width = rect.width, height = rect.height;
- var cy = rect.center.y;
- var p0dx = shape.parameters.get(ArrowHorizontalShapeDescription_1.ArrowVerticalTriangleWidthParameterName).value;
- var p1dy = (height - shape.parameters.get(ArrowHorizontalShapeDescription_1.ArrowVerticalLineHeightParameterName).value) / 2;
- var p0x1 = shape.normalizeX(left + p0dx);
- var p1y1 = shape.normalizeY(top + p1dy);
- var p1y2 = shape.normalizeY(bottom - p1dy);
- var primitives = [];
- return primitives.concat([
- new PathPrimitive_1.PathPrimitive([
- new PathPrimitive_1.PathPrimitiveMoveToCommand(left, cy),
- new PathPrimitive_1.PathPrimitiveLineToCommand(p0x1, top),
- new PathPrimitive_1.PathPrimitiveLineToCommand(p0x1, p1y1),
- new PathPrimitive_1.PathPrimitiveLineToCommand(right, p1y1),
- new PathPrimitive_1.PathPrimitiveLineToCommand(right, p1y2),
- new PathPrimitive_1.PathPrimitiveLineToCommand(p0x1, p1y2),
- new PathPrimitive_1.PathPrimitiveLineToCommand(p0x1, bottom),
- new PathPrimitive_1.PathPrimitiveClosePathCommand()
- ], shape.style)
- ])
- .concat(this.createTextPrimitives(shape));
- };
- ArrowLeftShapeDescription.prototype.modifyParameters = function (shape, parameters, deltaX, deltaY) {
- this.changeParameterValue(parameters, ArrowHorizontalShapeDescription_1.ArrowVerticalTriangleWidthParameterName, function (p) { return p.value + deltaX; });
- this.changeParameterValue(parameters, ArrowHorizontalShapeDescription_1.ArrowVerticalLineHeightParameterName, function (p) { return p.value - deltaY * 2; });
- this.normalizeParameters(shape, parameters);
- };
- ArrowLeftShapeDescription.prototype.getParameterPoints = function (shape) {
- return [
- new ShapeParameterPoint_1.ShapeParameterPoint("c", new Utils_1.Point(shape.normalizeX(shape.position.x + shape.parameters.get(ArrowHorizontalShapeDescription_1.ArrowVerticalTriangleWidthParameterName).value), shape.normalizeY(shape.position.y + (shape.size.height - shape.parameters.get(ArrowHorizontalShapeDescription_1.ArrowVerticalLineHeightParameterName).value) / 2)))
- ];
- };
- ArrowLeftShapeDescription.prototype.processConnectionPoint = function (shape, point, index) {
- var triangleWidth = shape.parameters.get(ArrowHorizontalShapeDescription_1.ArrowVerticalTriangleWidthParameterName).value;
- if (point.x < shape.position.x + triangleWidth) {
- var tg = shape.size.height / 2 / triangleWidth;
- var delta = (shape.position.x + triangleWidth - point.x) * tg;
- var side = shape.getConnectionPointSide(index);
- if (side === DiagramItem_1.ConnectionPointSide.North)
- point.y += delta;
- else if (side === DiagramItem_1.ConnectionPointSide.South)
- point.y -= delta;
- }
- else
- _super.prototype.processConnectionPoint.call(this, shape, point, index);
- };
- return ArrowLeftShapeDescription;
- }(ArrowHorizontalShapeDescription_1.ArrowHorizontalShapeDescription));
- exports.ArrowLeftShapeDescription = ArrowLeftShapeDescription;
- /***/ }),
- /* 136 */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- var __extends = (this && this.__extends) || (function () {
- var extendStatics = function (d, b) {
- extendStatics = Object.setPrototypeOf ||
- ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
- function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
- return extendStatics(d, b);
- };
- return function (d, b) {
- extendStatics(d, b);
- function __() { this.constructor = d; }
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
- };
- })();
- Object.defineProperty(exports, "__esModule", { value: true });
- var ShapeType_1 = __webpack_require__(1);
- var Shape_1 = __webpack_require__(9);
- var PathPrimitive_1 = __webpack_require__(2);
- var DocumentShapeDescription_1 = __webpack_require__(80);
- var ClipPathPrimitive_1 = __webpack_require__(52);
- var Utils_1 = __webpack_require__(26);
- var MultipleDocumentsShapeDescription = /** @class */ (function (_super) {
- __extends(MultipleDocumentsShapeDescription, _super);
- function MultipleDocumentsShapeDescription() {
- return _super.call(this, "Multiple Documents", "Multiple\nDocuments") || this;
- }
- Object.defineProperty(MultipleDocumentsShapeDescription.prototype, "key", {
- get: function () { return ShapeType_1.ShapeType.MultipleDocuments; },
- enumerable: true,
- configurable: true
- });
- MultipleDocumentsShapeDescription.prototype.createPrimitives = function (shape) {
- var rect = shape.rectangle;
- var _a = shape.rectangle, left = _a.left, top = _a.top, right = _a.right, bottom = _a.bottom, width = _a.width, height = _a.height;
- var documentOffsetX = width * MultipleDocumentsShapeDescription.documentsOffsetRatio;
- var documentOffsetY = height * MultipleDocumentsShapeDescription.documentsOffsetRatio;
- rect = rect.inflate(-documentOffsetX, -documentOffsetY).offset(-documentOffsetX, -documentOffsetY);
- var rect1 = rect.offset(documentOffsetX, documentOffsetY);
- var rect2 = rect.offset(2 * documentOffsetX, 2 * documentOffsetY);
- var clipPathId = Utils_1.RenderUtils.generateSvgElementId("clipRect");
- var primitives = [];
- return primitives
- .concat(this.createDocumentPrimitives(rect, shape.style, clipPathId + "1", rect1))
- .concat(this.createDocumentPrimitives(rect1, shape.style, clipPathId + "2", rect2))
- .concat(this.createDocumentPrimitives(rect2, shape.style))
- .concat(this.createTextPrimitives(shape));
- };
- MultipleDocumentsShapeDescription.prototype.createDocumentPrimitives = function (rect, style, clipPathId, clipRect) {
- var left = rect.left, top = rect.top, right = rect.right, bottom = rect.bottom, width = rect.width, height = rect.height;
- var cx = rect.center.x;
- var dy = height * DocumentShapeDescription_1.DocumentShapeDescription.curveOffsetRatio;
- var primitives = [];
- primitives = primitives.concat([
- new PathPrimitive_1.PathPrimitive([
- new PathPrimitive_1.PathPrimitiveMoveToCommand(left, top),
- new PathPrimitive_1.PathPrimitiveLineToCommand(right, top),
- new PathPrimitive_1.PathPrimitiveLineToCommand(right, bottom),
- new PathPrimitive_1.PathPrimitiveQuadraticCurveToCommand(right - width * 0.25, bottom - 2 * dy, cx, bottom - dy),
- new PathPrimitive_1.PathPrimitiveQuadraticCurveToCommand(left + width * 0.25, bottom + dy, left, bottom - dy),
- new PathPrimitive_1.PathPrimitiveClosePathCommand()
- ], style, undefined, clipRect && clipPathId)
- ]);
- if (clipRect && clipPathId) {
- primitives = primitives.concat([
- new ClipPathPrimitive_1.ClipPathPrimitive(clipPathId, [
- new PathPrimitive_1.PathPrimitive([
- new PathPrimitive_1.PathPrimitiveMoveToCommand(left - Shape_1.Shape.lineWidth, top - Shape_1.Shape.lineWidth),
- new PathPrimitive_1.PathPrimitiveLineToCommand(right + Shape_1.Shape.lineWidth, top - Shape_1.Shape.lineWidth),
- new PathPrimitive_1.PathPrimitiveLineToCommand(right + Shape_1.Shape.lineWidth, clipRect.top),
- new PathPrimitive_1.PathPrimitiveLineToCommand(clipRect.left, clipRect.top),
- new PathPrimitive_1.PathPrimitiveLineToCommand(clipRect.left, bottom + Shape_1.Shape.lineWidth),
- new PathPrimitive_1.PathPrimitiveLineToCommand(left - Shape_1.Shape.lineWidth, bottom + Shape_1.Shape.lineWidth),
- new PathPrimitive_1.PathPrimitiveClosePathCommand()
- ])
- ])
- ]);
- }
- return primitives;
- };
- MultipleDocumentsShapeDescription.prototype.getTextRectangle = function (rect) {
- var documentOffsetX = rect.width * MultipleDocumentsShapeDescription.documentsOffsetRatio;
- var documentOffsetY = rect.height * MultipleDocumentsShapeDescription.documentsOffsetRatio;
- rect = rect.inflate(-documentOffsetX, -documentOffsetY).offset(-documentOffsetX, -documentOffsetY);
- var innerRect = rect.offset(2 * documentOffsetX, 2 * documentOffsetY);
- return innerRect.resize(0, -rect.height * DocumentShapeDescription_1.DocumentShapeDescription.curveOffsetRatio);
- };
- MultipleDocumentsShapeDescription.documentsOffsetRatio = 0.1;
- return MultipleDocumentsShapeDescription;
- }(DocumentShapeDescription_1.DocumentShapeDescription));
- exports.MultipleDocumentsShapeDescription = MultipleDocumentsShapeDescription;
- /***/ }),
- /* 137 */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- var __extends = (this && this.__extends) || (function () {
- var extendStatics = function (d, b) {
- extendStatics = Object.setPrototypeOf ||
- ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
- function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
- return extendStatics(d, b);
- };
- return function (d, b) {
- extendStatics(d, b);
- function __() { this.constructor = d; }
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
- };
- })();
- Object.defineProperty(exports, "__esModule", { value: true });
- var ShapeType_1 = __webpack_require__(1);
- var Utils_1 = __webpack_require__(0);
- var ShapeDescription_1 = __webpack_require__(11);
- var HexagonShapeDescription_1 = __webpack_require__(78);
- var PreparationShapeDescription = /** @class */ (function (_super) {
- __extends(PreparationShapeDescription, _super);
- function PreparationShapeDescription() {
- var _this = _super.call(this, "Preparation", "Preparation") || this;
- _this.defaultSize = new Utils_1.Size(ShapeDescription_1.ShapeDefaultDimension, ShapeDescription_1.ShapeDefaultDimension * 0.75);
- return _this;
- }
- Object.defineProperty(PreparationShapeDescription.prototype, "key", {
- get: function () { return ShapeType_1.ShapeType.Preparation; },
- enumerable: true,
- configurable: true
- });
- Object.defineProperty(PreparationShapeDescription.prototype, "category", {
- get: function () { return ShapeType_1.ShapeCategory.Flowchart; },
- enumerable: true,
- configurable: true
- });
- return PreparationShapeDescription;
- }(HexagonShapeDescription_1.HexagonShapeDescription));
- exports.PreparationShapeDescription = PreparationShapeDescription;
- /***/ }),
- /* 138 */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- var __extends = (this && this.__extends) || (function () {
- var extendStatics = function (d, b) {
- extendStatics = Object.setPrototypeOf ||
- ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
- function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
- return extendStatics(d, b);
- };
- return function (d, b) {
- extendStatics(d, b);
- function __() { this.constructor = d; }
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
- };
- })();
- Object.defineProperty(exports, "__esModule", { value: true });
- var RectangleShapeDescription_1 = __webpack_require__(12);
- var ShapeType_1 = __webpack_require__(1);
- var PathPrimitive_1 = __webpack_require__(2);
- var EllipsePrimitive_1 = __webpack_require__(38);
- var HardDiskShapeDescription = /** @class */ (function (_super) {
- __extends(HardDiskShapeDescription, _super);
- function HardDiskShapeDescription() {
- return _super.call(this, "Hard Disk", "Hard Disk") || this;
- }
- Object.defineProperty(HardDiskShapeDescription.prototype, "key", {
- get: function () { return ShapeType_1.ShapeType.HardDisk; },
- enumerable: true,
- configurable: true
- });
- Object.defineProperty(HardDiskShapeDescription.prototype, "category", {
- get: function () { return ShapeType_1.ShapeCategory.Flowchart; },
- enumerable: true,
- configurable: true
- });
- HardDiskShapeDescription.prototype.createPrimitives = function (shape) {
- var rect = shape.rectangle;
- var left = rect.left, top = rect.top, right = rect.right, bottom = rect.bottom, width = rect.width, height = rect.height;
- var cy = rect.center.y;
- var dx = width * HardDiskShapeDescription.arcWidthRatio;
- var primitives = [];
- return primitives.concat([
- new PathPrimitive_1.PathPrimitive([
- new PathPrimitive_1.PathPrimitiveMoveToCommand(right - dx / 2, top),
- new PathPrimitive_1.PathPrimitiveLineToCommand(left + dx / 2, top),
- new PathPrimitive_1.PathPrimitiveArcToCommand(dx / 2, (bottom - top) / 2, 0, false, false, left + dx / 2, bottom),
- new PathPrimitive_1.PathPrimitiveLineToCommand(right - dx / 2, bottom),
- ], shape.style),
- new EllipsePrimitive_1.EllipsePrimitive(right - dx / 2, cy, dx / 2, (bottom - top) / 2, shape.style)
- ])
- .concat(this.createTextPrimitives(shape));
- };
- HardDiskShapeDescription.prototype.getTextRectangle = function (rect) {
- var dx = rect.width * HardDiskShapeDescription.arcWidthRatio;
- return rect.resize(-dx, 0);
- };
- HardDiskShapeDescription.arcWidthRatio = 0.2;
- return HardDiskShapeDescription;
- }(RectangleShapeDescription_1.RectangleShapeDescription));
- exports.HardDiskShapeDescription = HardDiskShapeDescription;
- /***/ }),
- /* 139 */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- var __extends = (this && this.__extends) || (function () {
- var extendStatics = function (d, b) {
- extendStatics = Object.setPrototypeOf ||
- ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
- function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
- return extendStatics(d, b);
- };
- return function (d, b) {
- extendStatics(d, b);
- function __() { this.constructor = d; }
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
- };
- })();
- Object.defineProperty(exports, "__esModule", { value: true });
- var RectangleShapeDescription_1 = __webpack_require__(12);
- var ShapeType_1 = __webpack_require__(1);
- var PathPrimitive_1 = __webpack_require__(2);
- var EllipsePrimitive_1 = __webpack_require__(38);
- var DatabaseShapeDescription = /** @class */ (function (_super) {
- __extends(DatabaseShapeDescription, _super);
- function DatabaseShapeDescription() {
- var _this = _super.call(this, "Database", "Database") || this;
- _this.defaultSize.width = _this.defaultSize.height;
- return _this;
- }
- Object.defineProperty(DatabaseShapeDescription.prototype, "key", {
- get: function () { return ShapeType_1.ShapeType.Database; },
- enumerable: true,
- configurable: true
- });
- Object.defineProperty(DatabaseShapeDescription.prototype, "category", {
- get: function () { return ShapeType_1.ShapeCategory.Flowchart; },
- enumerable: true,
- configurable: true
- });
- DatabaseShapeDescription.prototype.createPrimitives = function (shape) {
- var rect = shape.rectangle;
- var left = rect.left, top = rect.top, right = rect.right, bottom = rect.bottom, width = rect.width, height = rect.height;
- var cx = rect.center.x;
- var dy = height * DatabaseShapeDescription.arcWidthRatio;
- var primitives = [];
- return primitives.concat([
- new PathPrimitive_1.PathPrimitive([
- new PathPrimitive_1.PathPrimitiveMoveToCommand(right, top + dy / 2),
- new PathPrimitive_1.PathPrimitiveLineToCommand(right, bottom - dy / 2),
- new PathPrimitive_1.PathPrimitiveArcToCommand((right - left) / 2, dy / 2, 0, false, true, left, bottom - dy / 2),
- new PathPrimitive_1.PathPrimitiveLineToCommand(left, top + dy / 2),
- ], shape.style),
- new EllipsePrimitive_1.EllipsePrimitive(cx, top + dy / 2, (right - left) / 2, dy / 2, shape.style)
- ])
- .concat(this.createTextPrimitives(shape));
- };
- DatabaseShapeDescription.prototype.getTextRectangle = function (rect) {
- var dy = rect.height * DatabaseShapeDescription.arcWidthRatio;
- return rect.resize(0, -dy).offset(0, dy);
- };
- DatabaseShapeDescription.arcWidthRatio = 0.2;
- return DatabaseShapeDescription;
- }(RectangleShapeDescription_1.RectangleShapeDescription));
- exports.DatabaseShapeDescription = DatabaseShapeDescription;
- /***/ }),
- /* 140 */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- var __extends = (this && this.__extends) || (function () {
- var extendStatics = function (d, b) {
- extendStatics = Object.setPrototypeOf ||
- ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
- function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
- return extendStatics(d, b);
- };
- return function (d, b) {
- extendStatics(d, b);
- function __() { this.constructor = d; }
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
- };
- })();
- Object.defineProperty(exports, "__esModule", { value: true });
- var RectangleShapeDescription_1 = __webpack_require__(12);
- var ShapeType_1 = __webpack_require__(1);
- var ShapeParameters_1 = __webpack_require__(25);
- var ShapeParameterPoint_1 = __webpack_require__(17);
- var Utils_1 = __webpack_require__(0);
- var PathPrimitive_1 = __webpack_require__(2);
- exports.InternalStorageHorizontalEdgeParameterName = "he";
- exports.InternalStorageVerticalEdgeParameterName = "ve";
- var InternalStorageShapeDescription = /** @class */ (function (_super) {
- __extends(InternalStorageShapeDescription, _super);
- function InternalStorageShapeDescription() {
- return _super.call(this, "Internal Storage", "Internal\nStorage") || this;
- }
- Object.defineProperty(InternalStorageShapeDescription.prototype, "key", {
- get: function () { return ShapeType_1.ShapeType.InternalStorage; },
- enumerable: true,
- configurable: true
- });
- Object.defineProperty(InternalStorageShapeDescription.prototype, "category", {
- get: function () { return ShapeType_1.ShapeCategory.Flowchart; },
- enumerable: true,
- configurable: true
- });
- InternalStorageShapeDescription.prototype.createPrimitives = function (shape) {
- var rect = shape.rectangle;
- var left = rect.left, top = rect.top, right = rect.right, bottom = rect.bottom, width = rect.width, height = rect.height;
- var x = left + shape.parameters.get(exports.InternalStorageHorizontalEdgeParameterName).value;
- var y = top + shape.parameters.get(exports.InternalStorageVerticalEdgeParameterName).value;
- var primitives = _super.prototype.createPrimitives.call(this, shape);
- return primitives.concat([
- new PathPrimitive_1.PathPrimitive([
- new PathPrimitive_1.PathPrimitiveMoveToCommand(x, top),
- new PathPrimitive_1.PathPrimitiveLineToCommand(x, bottom),
- new PathPrimitive_1.PathPrimitiveMoveToCommand(left, y),
- new PathPrimitive_1.PathPrimitiveLineToCommand(right, y)
- ], shape.style)
- ]);
- };
- InternalStorageShapeDescription.prototype.createParameters = function (parameters) {
- parameters.addRange([
- new ShapeParameters_1.ShapeParameter(exports.InternalStorageHorizontalEdgeParameterName, this.defaultSize.width * 0.1),
- new ShapeParameters_1.ShapeParameter(exports.InternalStorageVerticalEdgeParameterName, this.defaultSize.width * 0.1)
- ]);
- };
- InternalStorageShapeDescription.prototype.normalizeParameters = function (shape, parameters) {
- this.changeParameterValue(parameters, exports.InternalStorageHorizontalEdgeParameterName, function (p) { return Math.max(InternalStorageShapeDescription.minEdge, Math.min(shape.size.width * 0.3, p.value)); });
- this.changeParameterValue(parameters, exports.InternalStorageVerticalEdgeParameterName, function (p) { return Math.max(InternalStorageShapeDescription.minEdge, Math.min(shape.size.height * 0.3, p.value)); });
- };
- InternalStorageShapeDescription.prototype.modifyParameters = function (shape, parameters, deltaX, deltaY) {
- this.changeParameterValue(parameters, exports.InternalStorageHorizontalEdgeParameterName, function (p) { return p.value + deltaX; });
- this.changeParameterValue(parameters, exports.InternalStorageVerticalEdgeParameterName, function (p) { return p.value + deltaY; });
- this.normalizeParameters(shape, parameters);
- };
- InternalStorageShapeDescription.prototype.getParameterPoints = function (shape) {
- return [
- new ShapeParameterPoint_1.ShapeParameterPoint("c", new Utils_1.Point(shape.normalizeX(shape.position.x + shape.parameters.get(exports.InternalStorageHorizontalEdgeParameterName).value), shape.normalizeY(shape.position.y + shape.parameters.get(exports.InternalStorageVerticalEdgeParameterName).value)))
- ];
- };
- InternalStorageShapeDescription.minEdge = 72;
- return InternalStorageShapeDescription;
- }(RectangleShapeDescription_1.RectangleShapeDescription));
- exports.InternalStorageShapeDescription = InternalStorageShapeDescription;
- /***/ }),
- /* 141 */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- var __extends = (this && this.__extends) || (function () {
- var extendStatics = function (d, b) {
- extendStatics = Object.setPrototypeOf ||
- ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
- function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
- return extendStatics(d, b);
- };
- return function (d, b) {
- extendStatics(d, b);
- function __() { this.constructor = d; }
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
- };
- })();
- Object.defineProperty(exports, "__esModule", { value: true });
- var RectangleShapeDescription_1 = __webpack_require__(12);
- var ShapeType_1 = __webpack_require__(1);
- var PathPrimitive_1 = __webpack_require__(2);
- var DiagramItem_1 = __webpack_require__(3);
- var PaperTapeShapeDescription = /** @class */ (function (_super) {
- __extends(PaperTapeShapeDescription, _super);
- function PaperTapeShapeDescription(title, defaultText) {
- if (title === void 0) { title = "Paper Tape"; }
- if (defaultText === void 0) { defaultText = "Paper Tape"; }
- return _super.call(this, title, defaultText) || this;
- }
- Object.defineProperty(PaperTapeShapeDescription.prototype, "key", {
- get: function () { return ShapeType_1.ShapeType.PaperTape; },
- enumerable: true,
- configurable: true
- });
- Object.defineProperty(PaperTapeShapeDescription.prototype, "category", {
- get: function () { return ShapeType_1.ShapeCategory.Flowchart; },
- enumerable: true,
- configurable: true
- });
- PaperTapeShapeDescription.prototype.createPrimitives = function (shape) {
- var primitives = [];
- return primitives
- .concat(this.createDocumentPrimitives(shape.rectangle, shape.style))
- .concat(this.createTextPrimitives(shape));
- };
- PaperTapeShapeDescription.prototype.createDocumentPrimitives = function (rect, style) {
- var left = rect.left, top = rect.top, right = rect.right, bottom = rect.bottom, width = rect.width, height = rect.height;
- var cx = rect.center.x;
- var dy = height * PaperTapeShapeDescription.curveOffsetRatio;
- var primitives = [];
- return primitives.concat([
- new PathPrimitive_1.PathPrimitive([
- new PathPrimitive_1.PathPrimitiveMoveToCommand(left, top),
- new PathPrimitive_1.PathPrimitiveQuadraticCurveToCommand(left + width * 0.25, top + 2 * dy, cx, top + dy),
- new PathPrimitive_1.PathPrimitiveQuadraticCurveToCommand(right - width * 0.25, top - dy, right, top + dy),
- new PathPrimitive_1.PathPrimitiveLineToCommand(right, bottom),
- new PathPrimitive_1.PathPrimitiveQuadraticCurveToCommand(right - width * 0.25, bottom - 2 * dy, cx, bottom - dy),
- new PathPrimitive_1.PathPrimitiveQuadraticCurveToCommand(left + width * 0.25, bottom + dy, left, bottom - dy),
- new PathPrimitive_1.PathPrimitiveClosePathCommand()
- ], style)
- ]);
- };
- PaperTapeShapeDescription.prototype.processConnectionPoint = function (shape, point, index) {
- var side = shape.getConnectionPointSide(index);
- if (side === DiagramItem_1.ConnectionPointSide.North)
- point.y += shape.size.height * PaperTapeShapeDescription.curveOffsetRatio;
- if (side === DiagramItem_1.ConnectionPointSide.South)
- point.y -= shape.size.height * PaperTapeShapeDescription.curveOffsetRatio;
- };
- PaperTapeShapeDescription.prototype.getTextRectangle = function (rect) {
- return rect.inflate(0, -rect.height * PaperTapeShapeDescription.curveOffsetRatio);
- };
- PaperTapeShapeDescription.curveOffsetRatio = 0.1;
- return PaperTapeShapeDescription;
- }(RectangleShapeDescription_1.RectangleShapeDescription));
- exports.PaperTapeShapeDescription = PaperTapeShapeDescription;
- /***/ }),
- /* 142 */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- var __extends = (this && this.__extends) || (function () {
- var extendStatics = function (d, b) {
- extendStatics = Object.setPrototypeOf ||
- ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
- function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
- return extendStatics(d, b);
- };
- return function (d, b) {
- extendStatics(d, b);
- function __() { this.constructor = d; }
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
- };
- })();
- Object.defineProperty(exports, "__esModule", { value: true });
- var RectangleShapeDescription_1 = __webpack_require__(12);
- var ShapeType_1 = __webpack_require__(1);
- var PathPrimitive_1 = __webpack_require__(2);
- var DiagramItem_1 = __webpack_require__(3);
- var ManualOperationShapeDescription = /** @class */ (function (_super) {
- __extends(ManualOperationShapeDescription, _super);
- function ManualOperationShapeDescription() {
- return _super.call(this, "Manual Operation", "Manual\nOperation") || this;
- }
- Object.defineProperty(ManualOperationShapeDescription.prototype, "key", {
- get: function () { return ShapeType_1.ShapeType.ManualOperation; },
- enumerable: true,
- configurable: true
- });
- Object.defineProperty(ManualOperationShapeDescription.prototype, "category", {
- get: function () { return ShapeType_1.ShapeCategory.Flowchart; },
- enumerable: true,
- configurable: true
- });
- ManualOperationShapeDescription.prototype.createPrimitives = function (shape) {
- var rect = shape.rectangle;
- var _a = shape.rectangle, left = _a.left, top = _a.top, right = _a.right, bottom = _a.bottom, width = _a.width, height = _a.height;
- var px = Math.min(Math.max(0, height / Math.tan(ManualOperationShapeDescription.slopeAngle)), width);
- var cx = rect.center.x;
- var x1 = Math.min(left + px, cx);
- var x2 = Math.max(right - px, cx);
- var primitives = [];
- return primitives.concat([
- new PathPrimitive_1.PathPrimitive([
- new PathPrimitive_1.PathPrimitiveMoveToCommand(left, top),
- new PathPrimitive_1.PathPrimitiveLineToCommand(right, top),
- new PathPrimitive_1.PathPrimitiveLineToCommand(x2, bottom),
- new PathPrimitive_1.PathPrimitiveLineToCommand(x1, bottom),
- new PathPrimitive_1.PathPrimitiveClosePathCommand()
- ], shape.style)
- ])
- .concat(this.createTextPrimitives(shape));
- };
- ManualOperationShapeDescription.prototype.processConnectionPoint = function (shape, point, index) {
- var offset = shape.size.height / Math.tan(ManualOperationShapeDescription.slopeAngle);
- var side = shape.getConnectionPointSide(index);
- if (side === DiagramItem_1.ConnectionPointSide.East)
- point.x -= offset / 2;
- else if (side === DiagramItem_1.ConnectionPointSide.West)
- point.x += offset / 2;
- };
- ManualOperationShapeDescription.slopeAngle = 81 * Math.PI / 180;
- return ManualOperationShapeDescription;
- }(RectangleShapeDescription_1.RectangleShapeDescription));
- exports.ManualOperationShapeDescription = ManualOperationShapeDescription;
- /***/ }),
- /* 143 */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- var __extends = (this && this.__extends) || (function () {
- var extendStatics = function (d, b) {
- extendStatics = Object.setPrototypeOf ||
- ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
- function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
- return extendStatics(d, b);
- };
- return function (d, b) {
- extendStatics(d, b);
- function __() { this.constructor = d; }
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
- };
- })();
- Object.defineProperty(exports, "__esModule", { value: true });
- var RectangleShapeDescription_1 = __webpack_require__(12);
- var ShapeType_1 = __webpack_require__(1);
- var PathPrimitive_1 = __webpack_require__(2);
- var DelayShapeDescription = /** @class */ (function (_super) {
- __extends(DelayShapeDescription, _super);
- function DelayShapeDescription() {
- var _this = _super.call(this, "Delay", "Delay") || this;
- _this.defaultSize.width = _this.defaultSize.height;
- return _this;
- }
- Object.defineProperty(DelayShapeDescription.prototype, "key", {
- get: function () { return ShapeType_1.ShapeType.Delay; },
- enumerable: true,
- configurable: true
- });
- Object.defineProperty(DelayShapeDescription.prototype, "category", {
- get: function () { return ShapeType_1.ShapeCategory.Flowchart; },
- enumerable: true,
- configurable: true
- });
- DelayShapeDescription.prototype.createPrimitives = function (shape) {
- var rect = shape.rectangle;
- var left = rect.left, top = rect.top, right = rect.right, bottom = rect.bottom;
- var cx = rect.center.x;
- var primitives = [];
- return primitives.concat([
- new PathPrimitive_1.PathPrimitive([
- new PathPrimitive_1.PathPrimitiveMoveToCommand(left, top),
- new PathPrimitive_1.PathPrimitiveLineToCommand(cx, top),
- new PathPrimitive_1.PathPrimitiveArcToCommand((right - left) / 2, (bottom - top) / 2, 0, false, true, cx, bottom),
- new PathPrimitive_1.PathPrimitiveLineToCommand(left, bottom),
- new PathPrimitive_1.PathPrimitiveClosePathCommand()
- ], shape.style)
- ])
- .concat(this.createTextPrimitives(shape));
- };
- DelayShapeDescription.arcWidthRatio = 0.2;
- return DelayShapeDescription;
- }(RectangleShapeDescription_1.RectangleShapeDescription));
- exports.DelayShapeDescription = DelayShapeDescription;
- /***/ }),
- /* 144 */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- var __extends = (this && this.__extends) || (function () {
- var extendStatics = function (d, b) {
- extendStatics = Object.setPrototypeOf ||
- ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
- function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
- return extendStatics(d, b);
- };
- return function (d, b) {
- extendStatics(d, b);
- function __() { this.constructor = d; }
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
- };
- })();
- Object.defineProperty(exports, "__esModule", { value: true });
- var RectangleShapeDescription_1 = __webpack_require__(12);
- var ShapeType_1 = __webpack_require__(1);
- var PathPrimitive_1 = __webpack_require__(2);
- var StoredDataShapeDescription = /** @class */ (function (_super) {
- __extends(StoredDataShapeDescription, _super);
- function StoredDataShapeDescription() {
- return _super.call(this, "Stored Data", "Stored Data") || this;
- }
- Object.defineProperty(StoredDataShapeDescription.prototype, "key", {
- get: function () { return ShapeType_1.ShapeType.StoredData; },
- enumerable: true,
- configurable: true
- });
- Object.defineProperty(StoredDataShapeDescription.prototype, "category", {
- get: function () { return ShapeType_1.ShapeCategory.Flowchart; },
- enumerable: true,
- configurable: true
- });
- StoredDataShapeDescription.prototype.createPrimitives = function (shape) {
- var rect = shape.rectangle;
- var left = rect.left, top = rect.top, right = rect.right, bottom = rect.bottom, width = rect.width, height = rect.height;
- var cy = rect.center.y;
- var dx = width * StoredDataShapeDescription.arcWidthRatio;
- var primitives = [];
- return primitives.concat([
- new PathPrimitive_1.PathPrimitive([
- new PathPrimitive_1.PathPrimitiveMoveToCommand(right, top),
- new PathPrimitive_1.PathPrimitiveLineToCommand(left + dx / 2, top),
- new PathPrimitive_1.PathPrimitiveArcToCommand(dx / 2, (bottom - top) / 2, 0, false, false, left + dx / 2, bottom),
- new PathPrimitive_1.PathPrimitiveLineToCommand(right, bottom),
- new PathPrimitive_1.PathPrimitiveArcToCommand(dx / 2, (bottom - top) / 2, 0, false, true, right, top)
- ], shape.style)
- ])
- .concat(this.createTextPrimitives(shape));
- };
- StoredDataShapeDescription.prototype.getTextRectangle = function (rect) {
- var dx = rect.width * StoredDataShapeDescription.arcWidthRatio;
- return rect.resize(-dx, 0);
- };
- StoredDataShapeDescription.arcWidthRatio = 0.2;
- return StoredDataShapeDescription;
- }(RectangleShapeDescription_1.RectangleShapeDescription));
- exports.StoredDataShapeDescription = StoredDataShapeDescription;
- /***/ }),
- /* 145 */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- var __extends = (this && this.__extends) || (function () {
- var extendStatics = function (d, b) {
- extendStatics = Object.setPrototypeOf ||
- ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
- function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
- return extendStatics(d, b);
- };
- return function (d, b) {
- extendStatics(d, b);
- function __() { this.constructor = d; }
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
- };
- })();
- Object.defineProperty(exports, "__esModule", { value: true });
- var ShapeType_1 = __webpack_require__(1);
- var TriangleShapeDescription_1 = __webpack_require__(79);
- var PathPrimitive_1 = __webpack_require__(2);
- var MergeShapeDescription = /** @class */ (function (_super) {
- __extends(MergeShapeDescription, _super);
- function MergeShapeDescription() {
- return _super.call(this, "Merge", "Merge") || this;
- }
- Object.defineProperty(MergeShapeDescription.prototype, "key", {
- get: function () { return ShapeType_1.ShapeType.Merge; },
- enumerable: true,
- configurable: true
- });
- Object.defineProperty(MergeShapeDescription.prototype, "category", {
- get: function () { return ShapeType_1.ShapeCategory.Flowchart; },
- enumerable: true,
- configurable: true
- });
- MergeShapeDescription.prototype.createPrimitives = function (shape) {
- var rect = shape.rectangle;
- var left = rect.left, top = rect.top, right = rect.right, bottom = rect.bottom, width = rect.width;
- var primitives = [];
- return primitives.concat([
- new PathPrimitive_1.PathPrimitive([
- new PathPrimitive_1.PathPrimitiveMoveToCommand(left, top),
- new PathPrimitive_1.PathPrimitiveLineToCommand(right, top),
- new PathPrimitive_1.PathPrimitiveLineToCommand(rect.center.x, bottom),
- new PathPrimitive_1.PathPrimitiveClosePathCommand()
- ], shape.style)
- ])
- .concat(this.createTextPrimitives(shape));
- };
- MergeShapeDescription.prototype.calculateHeight = function (width) {
- return width * 0.75;
- };
- MergeShapeDescription.prototype.getTextRectangle = function (rect) {
- return rect.resize(0, -rect.width * 0.25);
- };
- return MergeShapeDescription;
- }(TriangleShapeDescription_1.TriangleShapeDescription));
- exports.MergeShapeDescription = MergeShapeDescription;
- /***/ }),
- /* 146 */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- var __extends = (this && this.__extends) || (function () {
- var extendStatics = function (d, b) {
- extendStatics = Object.setPrototypeOf ||
- ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
- function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
- return extendStatics(d, b);
- };
- return function (d, b) {
- extendStatics(d, b);
- function __() { this.constructor = d; }
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
- };
- })();
- Object.defineProperty(exports, "__esModule", { value: true });
- var RectangleShapeDescription_1 = __webpack_require__(12);
- var ShapeType_1 = __webpack_require__(1);
- var PathPrimitive_1 = __webpack_require__(2);
- var DisplayShapeDescription = /** @class */ (function (_super) {
- __extends(DisplayShapeDescription, _super);
- function DisplayShapeDescription() {
- return _super.call(this, "Display", "Display") || this;
- }
- Object.defineProperty(DisplayShapeDescription.prototype, "key", {
- get: function () { return ShapeType_1.ShapeType.Display; },
- enumerable: true,
- configurable: true
- });
- Object.defineProperty(DisplayShapeDescription.prototype, "category", {
- get: function () { return ShapeType_1.ShapeCategory.Flowchart; },
- enumerable: true,
- configurable: true
- });
- DisplayShapeDescription.prototype.createPrimitives = function (shape) {
- var rect = shape.rectangle;
- var left = rect.left, top = rect.top, right = rect.right, bottom = rect.bottom, width = rect.width, height = rect.height;
- var cy = rect.center.y;
- var dx = width * DisplayShapeDescription.arcWidthRatio;
- var primitives = [];
- return primitives.concat([
- new PathPrimitive_1.PathPrimitive([
- new PathPrimitive_1.PathPrimitiveMoveToCommand(right - dx / 2, top),
- new PathPrimitive_1.PathPrimitiveLineToCommand(left + dx / 2, top),
- new PathPrimitive_1.PathPrimitiveLineToCommand(left, cy),
- new PathPrimitive_1.PathPrimitiveLineToCommand(left + dx / 2, bottom),
- new PathPrimitive_1.PathPrimitiveLineToCommand(right - dx / 2, bottom),
- new PathPrimitive_1.PathPrimitiveArcToCommand(dx / 2, (bottom - top) / 2, 0, false, false, right - dx / 2, top)
- ], shape.style),
- ])
- .concat(this.createTextPrimitives(shape));
- };
- DisplayShapeDescription.arcWidthRatio = 0.2;
- return DisplayShapeDescription;
- }(RectangleShapeDescription_1.RectangleShapeDescription));
- exports.DisplayShapeDescription = DisplayShapeDescription;
- /***/ }),
- /* 147 */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- var __extends = (this && this.__extends) || (function () {
- var extendStatics = function (d, b) {
- extendStatics = Object.setPrototypeOf ||
- ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
- function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
- return extendStatics(d, b);
- };
- return function (d, b) {
- extendStatics(d, b);
- function __() { this.constructor = d; }
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
- };
- })();
- Object.defineProperty(exports, "__esModule", { value: true });
- var ShapeType_1 = __webpack_require__(1);
- var Utils_1 = __webpack_require__(0);
- var ShapeDescription_1 = __webpack_require__(11);
- var EllipseShapeDescription_1 = __webpack_require__(56);
- var PathPrimitive_1 = __webpack_require__(2);
- var OrShapeDescription = /** @class */ (function (_super) {
- __extends(OrShapeDescription, _super);
- function OrShapeDescription() {
- var _this = _super.call(this, "Or", "") || this;
- _this.defaultSize = new Utils_1.Size(ShapeDescription_1.ShapeDefaultDimension * 0.5, ShapeDescription_1.ShapeDefaultDimension * 0.5);
- return _this;
- }
- Object.defineProperty(OrShapeDescription.prototype, "key", {
- get: function () { return ShapeType_1.ShapeType.Or; },
- enumerable: true,
- configurable: true
- });
- Object.defineProperty(OrShapeDescription.prototype, "category", {
- get: function () { return ShapeType_1.ShapeCategory.Flowchart; },
- enumerable: true,
- configurable: true
- });
- Object.defineProperty(OrShapeDescription.prototype, "allowHasText", {
- get: function () { return false; },
- enumerable: true,
- configurable: true
- });
- OrShapeDescription.prototype.createPrimitives = function (shape) {
- var rect = shape.rectangle;
- var left = rect.left, top = rect.top, right = rect.right, bottom = rect.bottom;
- var _a = rect.center, cx = _a.x, cy = _a.y;
- var primitives = [];
- return primitives
- .concat(_super.prototype.createPrimitives.call(this, shape))
- .concat([
- new PathPrimitive_1.PathPrimitive([
- new PathPrimitive_1.PathPrimitiveMoveToCommand(cx, top),
- new PathPrimitive_1.PathPrimitiveLineToCommand(cx, bottom),
- new PathPrimitive_1.PathPrimitiveMoveToCommand(left, cy),
- new PathPrimitive_1.PathPrimitiveLineToCommand(right, cy)
- ], shape.style)
- ]);
- };
- return OrShapeDescription;
- }(EllipseShapeDescription_1.EllipseShapeDescription));
- exports.OrShapeDescription = OrShapeDescription;
- /***/ }),
- /* 148 */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- var __extends = (this && this.__extends) || (function () {
- var extendStatics = function (d, b) {
- extendStatics = Object.setPrototypeOf ||
- ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
- function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
- return extendStatics(d, b);
- };
- return function (d, b) {
- extendStatics(d, b);
- function __() { this.constructor = d; }
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
- };
- })();
- Object.defineProperty(exports, "__esModule", { value: true });
- var ShapeType_1 = __webpack_require__(1);
- var Utils_1 = __webpack_require__(0);
- var ShapeDescription_1 = __webpack_require__(11);
- var EllipseShapeDescription_1 = __webpack_require__(56);
- var PathPrimitive_1 = __webpack_require__(2);
- var SummingJunctionShapeDescription = /** @class */ (function (_super) {
- __extends(SummingJunctionShapeDescription, _super);
- function SummingJunctionShapeDescription() {
- var _this = _super.call(this, "Summing Junction", "") || this;
- _this.defaultSize = new Utils_1.Size(ShapeDescription_1.ShapeDefaultDimension * 0.5, ShapeDescription_1.ShapeDefaultDimension * 0.5);
- return _this;
- }
- Object.defineProperty(SummingJunctionShapeDescription.prototype, "key", {
- get: function () { return ShapeType_1.ShapeType.SummingJunction; },
- enumerable: true,
- configurable: true
- });
- Object.defineProperty(SummingJunctionShapeDescription.prototype, "category", {
- get: function () { return ShapeType_1.ShapeCategory.Flowchart; },
- enumerable: true,
- configurable: true
- });
- Object.defineProperty(SummingJunctionShapeDescription.prototype, "allowHasText", {
- get: function () { return false; },
- enumerable: true,
- configurable: true
- });
- SummingJunctionShapeDescription.prototype.createPrimitives = function (shape) {
- var rect = shape.rectangle;
- var left = rect.left, top = rect.top, right = rect.right, bottom = rect.bottom, width = rect.width, height = rect.height;
- var _a = rect.center, cx = _a.x, cy = _a.y;
- var rx = width / 2;
- var ry = height / 2;
- var angle = Math.atan(ry / rx);
- var ex = 1 / Math.sqrt(1 / Math.pow(rx, 2) + Math.pow(Math.tan(angle), 2) / Math.pow(ry, 2));
- var ey = ex * Math.tan(angle);
- var primitives = [];
- return primitives
- .concat(_super.prototype.createPrimitives.call(this, shape))
- .concat([
- new PathPrimitive_1.PathPrimitive([
- new PathPrimitive_1.PathPrimitiveMoveToCommand(cx - ex, cy - ey),
- new PathPrimitive_1.PathPrimitiveLineToCommand(cx + ex, cy + ey),
- new PathPrimitive_1.PathPrimitiveMoveToCommand(cx - ex, cy + ey),
- new PathPrimitive_1.PathPrimitiveLineToCommand(cx + ex, cy - ey)
- ], shape.style)
- ]);
- };
- return SummingJunctionShapeDescription;
- }(EllipseShapeDescription_1.EllipseShapeDescription));
- exports.SummingJunctionShapeDescription = SummingJunctionShapeDescription;
- /***/ }),
- /* 149 */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- var __extends = (this && this.__extends) || (function () {
- var extendStatics = function (d, b) {
- extendStatics = Object.setPrototypeOf ||
- ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
- function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
- return extendStatics(d, b);
- };
- return function (d, b) {
- extendStatics(d, b);
- function __() { this.constructor = d; }
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
- };
- })();
- Object.defineProperty(exports, "__esModule", { value: true });
- var ShapeType_1 = __webpack_require__(1);
- var ShapeDescription_1 = __webpack_require__(11);
- var ImagePrimitive_1 = __webpack_require__(150);
- var Utils_1 = __webpack_require__(0);
- var ConnectionPoint_1 = __webpack_require__(32);
- var DiagramItem_1 = __webpack_require__(3);
- var CustomShapeDescription = /** @class */ (function (_super) {
- __extends(CustomShapeDescription, _super);
- function CustomShapeDescription(shapeType, title, svgUrl, svgLeft, svgTop, svgWidth, svgHeight, defaultWidth, defaultHeight, defaultText, shapeAllowHasText, textLeft, textTop, textWidth, textHeight, shapeConnectionPoints, shapeCategory) {
- var _this = _super.call(this, title, defaultText, new Utils_1.Size(defaultWidth || 1440, defaultHeight || 1440)) || this;
- _this.shapeType = shapeType;
- _this.svgUrl = svgUrl;
- _this.svgLeft = svgLeft;
- _this.svgTop = svgTop;
- _this.svgWidth = svgWidth;
- _this.svgHeight = svgHeight;
- _this.shapeAllowHasText = shapeAllowHasText;
- _this.textLeft = textLeft;
- _this.textTop = textTop;
- _this.textWidth = textWidth;
- _this.textHeight = textHeight;
- _this.shapeConnectionPoints = shapeConnectionPoints;
- _this.shapeCategory = shapeCategory;
- _this.connectionPoints = _this.createConnectionPoints();
- return _this;
- }
- Object.defineProperty(CustomShapeDescription.prototype, "key", {
- get: function () { return this.shapeType; },
- enumerable: true,
- configurable: true
- });
- Object.defineProperty(CustomShapeDescription.prototype, "category", {
- get: function () { return this.shapeCategory || ShapeType_1.ShapeCategory.Custom; },
- enumerable: true,
- configurable: true
- });
- Object.defineProperty(CustomShapeDescription.prototype, "allowHasText", {
- get: function () { return !!this.shapeAllowHasText; },
- enumerable: true,
- configurable: true
- });
- CustomShapeDescription.prototype.createConnectionPoints = function () {
- if (this.shapeConnectionPoints && this.shapeConnectionPoints.length)
- return this.shapeConnectionPoints.map(function (ptObj) {
- if (ptObj && typeof ptObj["x"] === "number" && typeof ptObj["y"] === "number") {
- var side = typeof ptObj["side"] === "number" ? ptObj["side"] : DiagramItem_1.ConnectionPointSide.Undefined;
- return new ConnectionPoint_1.ConnectionPoint(ptObj["x"], ptObj["y"], side);
- }
- }).filter(function (pt) { return pt; });
- return _super.prototype.createConnectionPoints.call(this);
- };
- CustomShapeDescription.prototype.createPrimitives = function (shape, forToolbox) {
- var _a = shape.rectangle, left = _a.left, top = _a.top, width = _a.width, height = _a.height;
- var svgUrl = shape.description.svgUrl;
- var primitives = [];
- return primitives.concat([
- new ImagePrimitive_1.ImagePrimitive(left + (this.svgLeft && !forToolbox ? this.svgLeft * width : 0), top + (this.svgTop && !forToolbox ? this.svgTop * height : 0), this.svgWidth && !forToolbox ? this.svgWidth * width : width, this.svgHeight && !forToolbox ? this.svgHeight * height : height, svgUrl),
- ])
- .concat(this.createTextPrimitives(shape, forToolbox));
- };
- CustomShapeDescription.prototype.getTextRectangle = function (rect) {
- var left = rect.left, top = rect.top, width = rect.width, height = rect.height;
- return Utils_1.Rectangle.create(left + (this.textLeft ? this.textLeft * width : 0), top + (this.textTop ? this.textTop * height : 0), this.textWidth ? this.textWidth * width : width, this.textHeight ? this.textHeight * height : height);
- };
- return CustomShapeDescription;
- }(ShapeDescription_1.ShapeDescription));
- exports.CustomShapeDescription = CustomShapeDescription;
- /***/ }),
- /* 150 */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- var __extends = (this && this.__extends) || (function () {
- var extendStatics = function (d, b) {
- extendStatics = Object.setPrototypeOf ||
- ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
- function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
- return extendStatics(d, b);
- };
- return function (d, b) {
- extendStatics(d, b);
- function __() { this.constructor = d; }
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
- };
- })();
- Object.defineProperty(exports, "__esModule", { value: true });
- var RenderManager_1 = __webpack_require__(10);
- var Primitive_1 = __webpack_require__(15);
- var ImagePrimitive = /** @class */ (function (_super) {
- __extends(ImagePrimitive, _super);
- function ImagePrimitive(x, y, width, height, url, preserveAspectRatio, style, className) {
- if (preserveAspectRatio === void 0) { preserveAspectRatio = "none"; }
- var _this = _super.call(this, style, className) || this;
- _this.x = x;
- _this.y = y;
- _this.width = width;
- _this.height = height;
- _this.url = url;
- _this.preserveAspectRatio = preserveAspectRatio;
- return _this;
- }
- ImagePrimitive.prototype.createMainElement = function () {
- return document.createElementNS(RenderManager_1.svgNS, "image");
- };
- ImagePrimitive.prototype.applyElementProperties = function (element) {
- this.setUnitAttribute(element, "x", this.x);
- this.setUnitAttribute(element, "y", this.y);
- this.setUnitAttribute(element, "width", this.width);
- this.setUnitAttribute(element, "height", this.height);
- this.setUnitAttribute(element, "href", this.url);
- this.setUnitAttribute(element, "preserveAspectRatio", this.preserveAspectRatio);
- _super.prototype.applyElementProperties.call(this, element);
- };
- return ImagePrimitive;
- }(Primitive_1.SvgPrimitive));
- exports.ImagePrimitive = ImagePrimitive;
- /***/ }),
- /* 151 */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- Object.defineProperty(exports, "__esModule", { value: true });
- var Tree_1 = __webpack_require__(152);
- var Forest = /** @class */ (function () {
- function Forest(trees) {
- this.trees = trees;
- }
- Forest.create = function (graph) {
- var components = graph.getConnectedComponents();
- return new Forest(components.map(Tree_1.Tree.createSpanningTree));
- };
- return Forest;
- }());
- exports.Forest = Forest;
- /***/ }),
- /* 152 */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- Object.defineProperty(exports, "__esModule", { value: true });
- var Structures_1 = __webpack_require__(22);
- var Tree = /** @class */ (function () {
- function Tree(root, parentToChildren) {
- var _this = this;
- this.childToParent = {};
- this.root = root;
- this.parentToChildren = parentToChildren;
- var _loop_1 = function (key) {
- if (!parentToChildren.hasOwnProperty(key))
- return "continue";
- parentToChildren[key].forEach(function (c) { return _this.childToParent[c.key] = key; });
- };
- for (var key in parentToChildren) {
- _loop_1(key);
- }
- }
- Tree.prototype.getChildren = function (node) {
- return node && this.parentToChildren[node.key] ? this.parentToChildren[node.key] : [];
- };
- Tree.prototype.hasChildren = function (node) {
- return this.parentToChildren[node.key] && this.parentToChildren[node.key].length > 0;
- };
- Tree.prototype.iterate = function (callback) {
- this.iterateCore(this.root, 0, callback);
- };
- Tree.createSpanningTree = function (component) {
- var rootKey = Tree.findRoot(component);
- var iterator = component.createIterator(Structures_1.ConnectionMode.Outgoing);
- var parentToChildren = {};
- iterator.skipEdge = (function (e) { return e.to === undefined || iterator.isNodeVisited(e.to); });
- iterator.onNode = function (n) { return parentToChildren[n.key] = []; };
- iterator.onEdge = function (e) { return parentToChildren[e.from].push(component.getNode(e.to)); };
- iterator.iterate(rootKey);
- return new Tree(component.getNode(rootKey), parentToChildren);
- };
- Tree.prototype.iterateCore = function (node, level, callback) {
- var _this = this;
- callback(node, level);
- this.getChildren(node).forEach(function (n) { return _this.iterateCore(n, level + 1, callback); });
- };
- Tree.findRoot = function (component) {
- return component.nodes.reduce(function (aggregator, cur) {
- var edges = component.getAdjacentEdges(cur);
- var inc = edges.filter(function (l) { return l.to === cur; }).length;
- var out = edges.filter(function (l) { return l.from === cur; }).length;
- if (aggregator.candidate === undefined || (inc === 0 && (aggregator.inc > 0 || aggregator.out < out)) || (inc > 0 && aggregator.out - aggregator.inc < out - inc)) {
- aggregator.candidate = cur;
- aggregator.inc = inc;
- aggregator.out = out;
- }
- return aggregator;
- }, { inc: -1, out: -1, candidate: undefined }).candidate;
- };
- return Tree;
- }());
- exports.Tree = Tree;
- /***/ }),
- /* 153 */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- Object.defineProperty(exports, "__esModule", { value: true });
- var Graph_1 = __webpack_require__(34);
- var Structures_1 = __webpack_require__(22);
- var ListUtils_1 = __webpack_require__(60);
- var CycleRemover = /** @class */ (function () {
- function CycleRemover() {
- }
- CycleRemover.removeCycles = function (graph) {
- var feedbackSet = this.getFeedbackSet(graph);
- return this.reverseEdges(graph, feedbackSet);
- };
- CycleRemover.getFeedbackSet = function (graph) {
- var _this = this;
- var feedbackSet = {};
- var nonTrivialStronglyConnectedComponents = this.getNonTrivialStronglyConnectedComponents(graph);
- while (nonTrivialStronglyConnectedComponents.length) {
- nonTrivialStronglyConnectedComponents.forEach(function (g) {
- var maxCyclicEdges = _this.getMaxCyclicEdges(g);
- maxCyclicEdges.forEach(function (e) { return delete feedbackSet[e.reverse().getHashKey()]; });
- maxCyclicEdges.forEach(function (e) { return feedbackSet[e.getHashKey()] = true; });
- });
- nonTrivialStronglyConnectedComponents = this.getNonTrivialStronglyConnectedComponents(this.reverseEdges(graph, feedbackSet).graph);
- }
- return feedbackSet;
- };
- CycleRemover.getMaxCyclicEdges = function (graph) {
- var black = {};
- var gray = {};
- var edgeCycleCount = {};
- var visitedEdges = [];
- var cycles = [];
- var iterator = graph.createIterator(Structures_1.ConnectionMode.Outgoing);
- iterator.visitEachEdgeOnce = false;
- iterator.onNode = function (n) {
- gray[n.key] = true;
- };
- iterator.skipNode = function (n) {
- if (gray[n.key]) {
- var cycle = [];
- for (var i = 0; i < visitedEdges.length; i++) {
- var e = visitedEdges[i];
- if (edgeCycleCount[e.key] === undefined)
- edgeCycleCount[e.key] = 0;
- edgeCycleCount[e.key]++;
- cycle.push(e);
- if (e.from === n.key)
- break;
- }
- cycles.push(cycle);
- }
- return gray[n.key] || black[n.key];
- };
- iterator.skipEdge = function (e) { return false; };
- iterator.onEdge = function (e) {
- visitedEdges.splice(0, 0, e);
- };
- iterator.onAfterEdge = function (e) {
- visitedEdges.splice(0, 1);
- };
- iterator.onAllEdges = function (e) {
- black[e.key] = true;
- gray[e.key] = false;
- };
- iterator.iterate(graph.nodes[0]);
- var edgeSet = new ListUtils_1.HashSet([], function (e) { return e.key; });
- cycles.forEach(function (c) {
- edgeSet.tryPush(c.reduce(function (max, curr) { return edgeCycleCount[curr.key] > edgeCycleCount[max.key] ? curr : max; }, c[0]));
- });
- return edgeSet.list();
- };
- CycleRemover.reverseEdges = function (graph, feedbackSet) {
- var edges = new ListUtils_1.HashSet([], function (e) { return e.getHashKey(); });
- var reversedEdges = {};
- var removedEdges = {};
- graph.edges.forEach(function (e) {
- if (feedbackSet[e.getHashKey()]) {
- e = e.reverse();
- reversedEdges[e.key] = true;
- }
- if (!edges.tryPush(e)) {
- removedEdges[e.key] = true;
- delete reversedEdges[e.key];
- }
- });
- return {
- graph: new Graph_1.Graph(graph.nodes.map(function (n) { return graph.getNode(n); }), edges.list()),
- reversedEdges: reversedEdges,
- removedEdges: removedEdges
- };
- };
- CycleRemover.getNonTrivialStronglyConnectedComponents = function (graph) {
- return this.getStronglyConnectedComponents(graph).filter(function (g) { return g.edges.length; });
- };
- CycleRemover.getStronglyConnectedComponents = function (graph) {
- var _this = this;
- // Tarjan algorithm
- // https://en.wikipedia.org/wiki/Tarjan%27s_strongly_connected_components_algorithm
- var nodesStack = [];
- var index = 0;
- var lowIndex = {};
- var lowLink = {};
- var onStack = {};
- var components = [];
- var visitedNodes = {};
- for (var i = 0; i < graph.nodes.length; i++) {
- var nodeKey = graph.nodes[i];
- var iterator = graph.createIterator(Structures_1.ConnectionMode.Outgoing);
- iterator.visitEachEdgeOnce = false;
- iterator.visitEachNodeOnce = false;
- iterator.onNode = function (n) {
- visitedNodes[n.key] = true;
- nodesStack.push(n);
- onStack[n.key] = true;
- lowLink[n.key] = index;
- lowIndex[n.key] = index;
- index++;
- };
- iterator.skipNode = function (n) { return visitedNodes[n.key]; };
- iterator.skipEdge = function (e) {
- var isVisited = visitedNodes[e.to];
- if (isVisited && onStack[e.to])
- lowLink[e.from] = Math.min(lowLink[e.from], lowIndex[e.to]);
- return isVisited;
- };
- iterator.onAfterEdge = function (e) {
- lowLink[e.from] = Math.min(lowLink[e.from], lowLink[e.to]);
- };
- iterator.onAllEdges = function (n, outgoing) {
- if (outgoing && lowLink[n.key] === lowIndex[n.key])
- components.push(_this.getStronglyConnectedComponent(graph, n, nodesStack, onStack));
- };
- iterator.iterate(nodeKey);
- }
- return components;
- };
- CycleRemover.getStronglyConnectedComponent = function (graph, root, nodesStack, onStack) {
- var itemsMap = {};
- var nodes = [];
- var edges = [];
- var topStackNode;
- do {
- topStackNode = nodesStack.pop();
- if (!itemsMap[topStackNode.key])
- nodes.push(topStackNode);
- itemsMap[topStackNode.key] = true;
- onStack[topStackNode.key] = false;
- } while (topStackNode !== root);
- nodes.forEach(function (n) {
- var aEdges = graph.getAdjacentEdges(n.key, Structures_1.ConnectionMode.Outgoing);
- edges.push.apply(edges, aEdges.filter(function (e) { return !itemsMap[e.key] && itemsMap[e.to]; }));
- aEdges.forEach(function (e) { return itemsMap[e.key] = true; });
- });
- return new Graph_1.Graph(nodes, edges);
- };
- return CycleRemover;
- }());
- exports.CycleRemover = CycleRemover;
- /***/ }),
- /* 154 */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- var __extends = (this && this.__extends) || (function () {
- var extendStatics = function (d, b) {
- extendStatics = Object.setPrototypeOf ||
- ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
- function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
- return extendStatics(d, b);
- };
- return function (d, b) {
- extendStatics(d, b);
- function __() { this.constructor = d; }
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
- };
- })();
- Object.defineProperty(exports, "__esModule", { value: true });
- var CloneHistoryItem_1 = __webpack_require__(83);
- var CloneShapeHistoryItem = /** @class */ (function (_super) {
- __extends(CloneShapeHistoryItem, _super);
- function CloneShapeHistoryItem(shape) {
- return _super.call(this, shape) || this;
- }
- CloneShapeHistoryItem.prototype.clearConnections = function (item) {
- item.attachedConnectors = [];
- };
- CloneShapeHistoryItem.prototype.addItem = function (item, manipulator) {
- manipulator.addShape(item);
- };
- CloneShapeHistoryItem.prototype.deleteItem = function (item, manipulator) {
- manipulator.deleteShape(item);
- };
- return CloneShapeHistoryItem;
- }(CloneHistoryItem_1.CloneHistoryItem));
- exports.CloneShapeHistoryItem = CloneShapeHistoryItem;
- /***/ }),
- /* 155 */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- var __extends = (this && this.__extends) || (function () {
- var extendStatics = function (d, b) {
- extendStatics = Object.setPrototypeOf ||
- ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
- function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
- return extendStatics(d, b);
- };
- return function (d, b) {
- extendStatics(d, b);
- function __() { this.constructor = d; }
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
- };
- })();
- Object.defineProperty(exports, "__esModule", { value: true });
- var Connector_1 = __webpack_require__(5);
- var CloneHistoryItem_1 = __webpack_require__(83);
- var CloneConnectorHistoryItem = /** @class */ (function (_super) {
- __extends(CloneConnectorHistoryItem, _super);
- function CloneConnectorHistoryItem(connector, beginItem, endItem) {
- var _this = _super.call(this, connector) || this;
- _this.beginItem = beginItem;
- _this.endItem = endItem;
- return _this;
- }
- CloneConnectorHistoryItem.prototype.clearConnections = function (connector) {
- connector.beginItem = undefined;
- connector.endItem = undefined;
- };
- CloneConnectorHistoryItem.prototype.addItem = function (item, manipulator) {
- manipulator.addConnector(item);
- if (this.beginItem)
- manipulator.addConnection(item, this.beginItem, item.beginConnectionPointIndex, Connector_1.ConnectorPosition.Begin);
- if (this.endItem)
- manipulator.addConnection(item, this.endItem, item.endConnectionPointIndex, Connector_1.ConnectorPosition.End);
- };
- CloneConnectorHistoryItem.prototype.deleteItem = function (item, manipulator) {
- manipulator.deleteConnector(item);
- };
- return CloneConnectorHistoryItem;
- }(CloneHistoryItem_1.CloneHistoryItem));
- exports.CloneConnectorHistoryItem = CloneConnectorHistoryItem;
- /***/ }),
- /* 156 */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- var __extends = (this && this.__extends) || (function () {
- var extendStatics = function (d, b) {
- extendStatics = Object.setPrototypeOf ||
- ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
- function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
- return extendStatics(d, b);
- };
- return function (d, b) {
- extendStatics(d, b);
- function __() { this.constructor = d; }
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
- };
- })();
- Object.defineProperty(exports, "__esModule", { value: true });
- var CommandBase_1 = __webpack_require__(7);
- var CommandStates_1 = __webpack_require__(6);
- var UndoCommand = /** @class */ (function (_super) {
- __extends(UndoCommand, _super);
- function UndoCommand() {
- return _super !== null && _super.apply(this, arguments) || this;
- }
- UndoCommand.prototype.executeCore = function (state) {
- this.control.history.undo();
- return true;
- };
- UndoCommand.prototype.getState = function () {
- return new CommandStates_1.SimpleCommandState(this.isEnabled() && this.control.history.canUndo());
- };
- return UndoCommand;
- }(CommandBase_1.CommandBase));
- exports.UndoCommand = UndoCommand;
- /***/ }),
- /* 157 */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- var __extends = (this && this.__extends) || (function () {
- var extendStatics = function (d, b) {
- extendStatics = Object.setPrototypeOf ||
- ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
- function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
- return extendStatics(d, b);
- };
- return function (d, b) {
- extendStatics(d, b);
- function __() { this.constructor = d; }
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
- };
- })();
- Object.defineProperty(exports, "__esModule", { value: true });
- var CommandBase_1 = __webpack_require__(7);
- var CommandStates_1 = __webpack_require__(6);
- var RedoCommand = /** @class */ (function (_super) {
- __extends(RedoCommand, _super);
- function RedoCommand() {
- return _super !== null && _super.apply(this, arguments) || this;
- }
- RedoCommand.prototype.executeCore = function (state) {
- this.control.history.redo();
- return true;
- };
- RedoCommand.prototype.getState = function () {
- return new CommandStates_1.SimpleCommandState(this.isEnabled() && this.control.history.canRedo());
- };
- return RedoCommand;
- }(CommandBase_1.CommandBase));
- exports.RedoCommand = RedoCommand;
- /***/ }),
- /* 158 */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- var __extends = (this && this.__extends) || (function () {
- var extendStatics = function (d, b) {
- extendStatics = Object.setPrototypeOf ||
- ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
- function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
- return extendStatics(d, b);
- };
- return function (d, b) {
- extendStatics(d, b);
- function __() { this.constructor = d; }
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
- };
- })();
- Object.defineProperty(exports, "__esModule", { value: true });
- var CommandBase_1 = __webpack_require__(7);
- var CommandStates_1 = __webpack_require__(6);
- var Importer_1 = __webpack_require__(84);
- var ImportCommand = /** @class */ (function (_super) {
- __extends(ImportCommand, _super);
- function ImportCommand() {
- return _super !== null && _super.apply(this, arguments) || this;
- }
- ImportCommand.prototype.getState = function () {
- return new CommandStates_1.SimpleCommandState(true);
- };
- ImportCommand.prototype.executeCore = function (state, parameter) {
- var data = parameter["data"] ? parameter["data"] : parameter;
- if (parameter["keepExistingItems"] === true) {
- Importer_1.Importer.importItemsData(data, this.control.model);
- this.control.importItemsData();
- }
- else {
- var model = Importer_1.Importer.import(data);
- this.control.importModel(model);
- }
- return true;
- };
- return ImportCommand;
- }(CommandBase_1.CommandBase));
- exports.ImportCommand = ImportCommand;
- /***/ }),
- /* 159 */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- var __extends = (this && this.__extends) || (function () {
- var extendStatics = function (d, b) {
- extendStatics = Object.setPrototypeOf ||
- ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
- function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
- return extendStatics(d, b);
- };
- return function (d, b) {
- extendStatics(d, b);
- function __() { this.constructor = d; }
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
- };
- })();
- Object.defineProperty(exports, "__esModule", { value: true });
- var CommandBase_1 = __webpack_require__(7);
- var CommandStates_1 = __webpack_require__(6);
- var Exporter_1 = __webpack_require__(31);
- var ExportCommand = /** @class */ (function (_super) {
- __extends(ExportCommand, _super);
- function ExportCommand() {
- return _super !== null && _super.apply(this, arguments) || this;
- }
- ExportCommand.prototype.getState = function () {
- return new CommandStates_1.SimpleCommandState(true);
- };
- ExportCommand.prototype.executeCore = function (state, parameter) {
- var data = Exporter_1.Exporter.export(this.control.model);
- parameter(data);
- return true;
- };
- return ExportCommand;
- }(CommandBase_1.CommandBase));
- exports.ExportCommand = ExportCommand;
- /***/ }),
- /* 160 */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- var __extends = (this && this.__extends) || (function () {
- var extendStatics = function (d, b) {
- extendStatics = Object.setPrototypeOf ||
- ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
- function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
- return extendStatics(d, b);
- };
- return function (d, b) {
- extendStatics(d, b);
- function __() { this.constructor = d; }
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
- };
- })();
- Object.defineProperty(exports, "__esModule", { value: true });
- var ToggleStyleTextPropertyCommand_1 = __webpack_require__(41);
- var ToggleFontBoldCommand = /** @class */ (function (_super) {
- __extends(ToggleFontBoldCommand, _super);
- function ToggleFontBoldCommand() {
- return _super !== null && _super.apply(this, arguments) || this;
- }
- ToggleFontBoldCommand.prototype.getStyleProperty = function () {
- return "font-weight";
- };
- ToggleFontBoldCommand.prototype.getStylePropertyValue = function () {
- return "bold";
- };
- return ToggleFontBoldCommand;
- }(ToggleStyleTextPropertyCommand_1.ToggleStyleTextPropertyCommand));
- exports.ToggleFontBoldCommand = ToggleFontBoldCommand;
- /***/ }),
- /* 161 */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- var __extends = (this && this.__extends) || (function () {
- var extendStatics = function (d, b) {
- extendStatics = Object.setPrototypeOf ||
- ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
- function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
- return extendStatics(d, b);
- };
- return function (d, b) {
- extendStatics(d, b);
- function __() { this.constructor = d; }
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
- };
- })();
- Object.defineProperty(exports, "__esModule", { value: true });
- var ToggleStyleTextPropertyCommand_1 = __webpack_require__(41);
- var ToggleFontItalicCommand = /** @class */ (function (_super) {
- __extends(ToggleFontItalicCommand, _super);
- function ToggleFontItalicCommand() {
- return _super !== null && _super.apply(this, arguments) || this;
- }
- ToggleFontItalicCommand.prototype.getStyleProperty = function () {
- return "font-style";
- };
- ToggleFontItalicCommand.prototype.getStylePropertyValue = function () {
- return "italic";
- };
- return ToggleFontItalicCommand;
- }(ToggleStyleTextPropertyCommand_1.ToggleStyleTextPropertyCommand));
- exports.ToggleFontItalicCommand = ToggleFontItalicCommand;
- /***/ }),
- /* 162 */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- var __extends = (this && this.__extends) || (function () {
- var extendStatics = function (d, b) {
- extendStatics = Object.setPrototypeOf ||
- ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
- function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
- return extendStatics(d, b);
- };
- return function (d, b) {
- extendStatics(d, b);
- function __() { this.constructor = d; }
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
- };
- })();
- Object.defineProperty(exports, "__esModule", { value: true });
- var ToggleStyleTextPropertyCommand_1 = __webpack_require__(41);
- var ToggleFontUnderlineCommand = /** @class */ (function (_super) {
- __extends(ToggleFontUnderlineCommand, _super);
- function ToggleFontUnderlineCommand() {
- return _super !== null && _super.apply(this, arguments) || this;
- }
- ToggleFontUnderlineCommand.prototype.getStyleProperty = function () {
- return "text-decoration";
- };
- ToggleFontUnderlineCommand.prototype.getStylePropertyValue = function () {
- return "underline";
- };
- return ToggleFontUnderlineCommand;
- }(ToggleStyleTextPropertyCommand_1.ToggleStyleTextPropertyCommand));
- exports.ToggleFontUnderlineCommand = ToggleFontUnderlineCommand;
- /***/ }),
- /* 163 */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- var __extends = (this && this.__extends) || (function () {
- var extendStatics = function (d, b) {
- extendStatics = Object.setPrototypeOf ||
- ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
- function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
- return extendStatics(d, b);
- };
- return function (d, b) {
- extendStatics(d, b);
- function __() { this.constructor = d; }
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
- };
- })();
- Object.defineProperty(exports, "__esModule", { value: true });
- var ChangeStyleTextPropertyCommand_1 = __webpack_require__(62);
- var ChangeFontNameCommand = /** @class */ (function (_super) {
- __extends(ChangeFontNameCommand, _super);
- function ChangeFontNameCommand() {
- return _super !== null && _super.apply(this, arguments) || this;
- }
- ChangeFontNameCommand.prototype.getStyleProperty = function () {
- return "font-family";
- };
- return ChangeFontNameCommand;
- }(ChangeStyleTextPropertyCommand_1.ChangeStyleTextPropertyCommand));
- exports.ChangeFontNameCommand = ChangeFontNameCommand;
- /***/ }),
- /* 164 */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- var __extends = (this && this.__extends) || (function () {
- var extendStatics = function (d, b) {
- extendStatics = Object.setPrototypeOf ||
- ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
- function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
- return extendStatics(d, b);
- };
- return function (d, b) {
- extendStatics(d, b);
- function __() { this.constructor = d; }
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
- };
- })();
- Object.defineProperty(exports, "__esModule", { value: true });
- var ChangeStyleTextPropertyCommand_1 = __webpack_require__(62);
- var ChangeFontSizeCommand = /** @class */ (function (_super) {
- __extends(ChangeFontSizeCommand, _super);
- function ChangeFontSizeCommand() {
- return _super !== null && _super.apply(this, arguments) || this;
- }
- ChangeFontSizeCommand.prototype.getStyleProperty = function () {
- return "font-size";
- };
- return ChangeFontSizeCommand;
- }(ChangeStyleTextPropertyCommand_1.ChangeStyleTextPropertyCommand));
- exports.ChangeFontSizeCommand = ChangeFontSizeCommand;
- /***/ }),
- /* 165 */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- var __extends = (this && this.__extends) || (function () {
- var extendStatics = function (d, b) {
- extendStatics = Object.setPrototypeOf ||
- ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
- function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
- return extendStatics(d, b);
- };
- return function (d, b) {
- extendStatics(d, b);
- function __() { this.constructor = d; }
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
- };
- })();
- Object.defineProperty(exports, "__esModule", { value: true });
- var ChangeStyleTextPropertyCommand_1 = __webpack_require__(62);
- var ChangeFontColorCommand = /** @class */ (function (_super) {
- __extends(ChangeFontColorCommand, _super);
- function ChangeFontColorCommand() {
- return _super !== null && _super.apply(this, arguments) || this;
- }
- ChangeFontColorCommand.prototype.getStyleProperty = function () {
- return "fill";
- };
- return ChangeFontColorCommand;
- }(ChangeStyleTextPropertyCommand_1.ChangeStyleTextPropertyCommand));
- exports.ChangeFontColorCommand = ChangeFontColorCommand;
- /***/ }),
- /* 166 */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- var __extends = (this && this.__extends) || (function () {
- var extendStatics = function (d, b) {
- extendStatics = Object.setPrototypeOf ||
- ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
- function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
- return extendStatics(d, b);
- };
- return function (d, b) {
- extendStatics(d, b);
- function __() { this.constructor = d; }
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
- };
- })();
- Object.defineProperty(exports, "__esModule", { value: true });
- var ChangeStylePropertyCommand_1 = __webpack_require__(88);
- var ChangeFillColorCommand = /** @class */ (function (_super) {
- __extends(ChangeFillColorCommand, _super);
- function ChangeFillColorCommand() {
- return _super !== null && _super.apply(this, arguments) || this;
- }
- ChangeFillColorCommand.prototype.getStyleProperty = function () {
- return "fill";
- };
- return ChangeFillColorCommand;
- }(ChangeStylePropertyCommand_1.ChangeStylePropertyCommand));
- exports.ChangeFillColorCommand = ChangeFillColorCommand;
- /***/ }),
- /* 167 */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- var __extends = (this && this.__extends) || (function () {
- var extendStatics = function (d, b) {
- extendStatics = Object.setPrototypeOf ||
- ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
- function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
- return extendStatics(d, b);
- };
- return function (d, b) {
- extendStatics(d, b);
- function __() { this.constructor = d; }
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
- };
- })();
- Object.defineProperty(exports, "__esModule", { value: true });
- var ChangeStylePropertyCommand_1 = __webpack_require__(88);
- var ChangeStrokeColorCommand = /** @class */ (function (_super) {
- __extends(ChangeStrokeColorCommand, _super);
- function ChangeStrokeColorCommand() {
- return _super !== null && _super.apply(this, arguments) || this;
- }
- ChangeStrokeColorCommand.prototype.getStyleProperty = function () {
- return "stroke";
- };
- return ChangeStrokeColorCommand;
- }(ChangeStylePropertyCommand_1.ChangeStylePropertyCommand));
- exports.ChangeStrokeColorCommand = ChangeStrokeColorCommand;
- /***/ }),
- /* 168 */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- var __extends = (this && this.__extends) || (function () {
- var extendStatics = function (d, b) {
- extendStatics = Object.setPrototypeOf ||
- ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
- function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
- return extendStatics(d, b);
- };
- return function (d, b) {
- extendStatics(d, b);
- function __() { this.constructor = d; }
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
- };
- })();
- Object.defineProperty(exports, "__esModule", { value: true });
- var DataSource_1 = __webpack_require__(37);
- var ImportDataCommandBase_1 = __webpack_require__(89);
- var ImportDataSourceCommand = /** @class */ (function (_super) {
- __extends(ImportDataSourceCommand, _super);
- function ImportDataSourceCommand() {
- return _super !== null && _super.apply(this, arguments) || this;
- }
- ImportDataSourceCommand.prototype.performImportData = function (parameter) {
- var dataSource = new DataSource_1.DataSource(parameter.key || "0", parameter.name, parameter.nodeDataSource, parameter.edgeDataSource, parameter.nodeDataImporter, parameter.edgeDataImporter);
- this.control.registerDataSource(dataSource);
- if (parameter.layoutType !== undefined) {
- this.createItems(dataSource, parameter.layoutType);
- }
- };
- return ImportDataSourceCommand;
- }(ImportDataCommandBase_1.ImportDataCommandBase));
- exports.ImportDataSourceCommand = ImportDataSourceCommand;
- /***/ }),
- /* 169 */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- var __extends = (this && this.__extends) || (function () {
- var extendStatics = function (d, b) {
- extendStatics = Object.setPrototypeOf ||
- ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
- function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
- return extendStatics(d, b);
- };
- return function (d, b) {
- extendStatics(d, b);
- function __() { this.constructor = d; }
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
- };
- })();
- Object.defineProperty(exports, "__esModule", { value: true });
- var ToggleStyleTextPropertyCommand_1 = __webpack_require__(41);
- var ChangeTextAlignCommand = /** @class */ (function (_super) {
- __extends(ChangeTextAlignCommand, _super);
- function ChangeTextAlignCommand() {
- return _super !== null && _super.apply(this, arguments) || this;
- }
- ChangeTextAlignCommand.prototype.getStyleProperty = function () {
- return "text-anchor";
- };
- return ChangeTextAlignCommand;
- }(ToggleStyleTextPropertyCommand_1.ToggleStyleTextPropertyCommand));
- exports.ChangeTextAlignCommand = ChangeTextAlignCommand;
- var TextLeftAlignCommand = /** @class */ (function (_super) {
- __extends(TextLeftAlignCommand, _super);
- function TextLeftAlignCommand() {
- return _super !== null && _super.apply(this, arguments) || this;
- }
- TextLeftAlignCommand.prototype.getStylePropertyValue = function () {
- return "start";
- };
- return TextLeftAlignCommand;
- }(ChangeTextAlignCommand));
- exports.TextLeftAlignCommand = TextLeftAlignCommand;
- var TextCenterAlignCommand = /** @class */ (function (_super) {
- __extends(TextCenterAlignCommand, _super);
- function TextCenterAlignCommand() {
- return _super !== null && _super.apply(this, arguments) || this;
- }
- TextCenterAlignCommand.prototype.getStylePropertyValue = function () {
- return "middle";
- };
- return TextCenterAlignCommand;
- }(ChangeTextAlignCommand));
- exports.TextCenterAlignCommand = TextCenterAlignCommand;
- var TextRightAlignCommand = /** @class */ (function (_super) {
- __extends(TextRightAlignCommand, _super);
- function TextRightAlignCommand() {
- return _super !== null && _super.apply(this, arguments) || this;
- }
- TextRightAlignCommand.prototype.getStylePropertyValue = function () {
- return "end";
- };
- return TextRightAlignCommand;
- }(ChangeTextAlignCommand));
- exports.TextRightAlignCommand = TextRightAlignCommand;
- /***/ }),
- /* 170 */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- var __extends = (this && this.__extends) || (function () {
- var extendStatics = function (d, b) {
- extendStatics = Object.setPrototypeOf ||
- ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
- function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
- return extendStatics(d, b);
- };
- return function (d, b) {
- extendStatics(d, b);
- function __() { this.constructor = d; }
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
- };
- })();
- Object.defineProperty(exports, "__esModule", { value: true });
- var ChangeConnectorPropertyCommand_1 = __webpack_require__(90);
- var ConnectorProperties_1 = __webpack_require__(28);
- var ChangeConnectorStartLineEndingCommand = /** @class */ (function (_super) {
- __extends(ChangeConnectorStartLineEndingCommand, _super);
- function ChangeConnectorStartLineEndingCommand() {
- return _super !== null && _super.apply(this, arguments) || this;
- }
- ChangeConnectorStartLineEndingCommand.prototype.getPropertyName = function () {
- return "startLineEnding";
- };
- ChangeConnectorStartLineEndingCommand.prototype.getPropertyDefaultValue = function () {
- return ConnectorProperties_1.ConnectorLineEnding.None;
- };
- return ChangeConnectorStartLineEndingCommand;
- }(ChangeConnectorPropertyCommand_1.ChangeConnectorPropertyCommand));
- exports.ChangeConnectorStartLineEndingCommand = ChangeConnectorStartLineEndingCommand;
- var ChangeConnectorEndLineEndingCommand = /** @class */ (function (_super) {
- __extends(ChangeConnectorEndLineEndingCommand, _super);
- function ChangeConnectorEndLineEndingCommand() {
- return _super !== null && _super.apply(this, arguments) || this;
- }
- ChangeConnectorEndLineEndingCommand.prototype.getPropertyName = function () {
- return "endLineEnding";
- };
- ChangeConnectorEndLineEndingCommand.prototype.getPropertyDefaultValue = function () {
- return ConnectorProperties_1.ConnectorLineEnding.Arrow;
- };
- return ChangeConnectorEndLineEndingCommand;
- }(ChangeConnectorPropertyCommand_1.ChangeConnectorPropertyCommand));
- exports.ChangeConnectorEndLineEndingCommand = ChangeConnectorEndLineEndingCommand;
- /***/ }),
- /* 171 */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- var __extends = (this && this.__extends) || (function () {
- var extendStatics = function (d, b) {
- extendStatics = Object.setPrototypeOf ||
- ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
- function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
- return extendStatics(d, b);
- };
- return function (d, b) {
- extendStatics(d, b);
- function __() { this.constructor = d; }
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
- };
- })();
- Object.defineProperty(exports, "__esModule", { value: true });
- var ChangeConnectorPropertyCommand_1 = __webpack_require__(90);
- var ConnectorProperties_1 = __webpack_require__(28);
- var ChangeConnectorLineOptionCommand = /** @class */ (function (_super) {
- __extends(ChangeConnectorLineOptionCommand, _super);
- function ChangeConnectorLineOptionCommand() {
- return _super !== null && _super.apply(this, arguments) || this;
- }
- ChangeConnectorLineOptionCommand.prototype.getPropertyName = function () {
- return "lineOption";
- };
- ChangeConnectorLineOptionCommand.prototype.getPropertyDefaultValue = function () {
- return ConnectorProperties_1.ConnectorLineOption.Straight;
- };
- return ChangeConnectorLineOptionCommand;
- }(ChangeConnectorPropertyCommand_1.ChangeConnectorPropertyCommand));
- exports.ChangeConnectorLineOptionCommand = ChangeConnectorLineOptionCommand;
- /***/ }),
- /* 172 */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- var __extends = (this && this.__extends) || (function () {
- var extendStatics = function (d, b) {
- extendStatics = Object.setPrototypeOf ||
- ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
- function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
- return extendStatics(d, b);
- };
- return function (d, b) {
- extendStatics(d, b);
- function __() { this.constructor = d; }
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
- };
- })();
- Object.defineProperty(exports, "__esModule", { value: true });
- var CommandBase_1 = __webpack_require__(7);
- var CommandStates_1 = __webpack_require__(6);
- var SelectAllCommand = /** @class */ (function (_super) {
- __extends(SelectAllCommand, _super);
- function SelectAllCommand() {
- return _super !== null && _super.apply(this, arguments) || this;
- }
- SelectAllCommand.prototype.getState = function () {
- return new CommandStates_1.SimpleCommandState(true);
- };
- SelectAllCommand.prototype.executeCore = function (state, parameter) {
- var itemKeys = [];
- this.control.model.iterateItems(function (i) { return itemKeys.push(i.key); });
- this.control.selection.set(itemKeys);
- return true;
- };
- return SelectAllCommand;
- }(CommandBase_1.CommandBase));
- exports.SelectAllCommand = SelectAllCommand;
- /***/ }),
- /* 173 */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- var __extends = (this && this.__extends) || (function () {
- var extendStatics = function (d, b) {
- extendStatics = Object.setPrototypeOf ||
- ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
- function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
- return extendStatics(d, b);
- };
- return function (d, b) {
- extendStatics(d, b);
- function __() { this.constructor = d; }
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
- };
- })();
- Object.defineProperty(exports, "__esModule", { value: true });
- var AutoLayoutCommandBase_1 = __webpack_require__(43);
- var WideTree_1 = __webpack_require__(61);
- var LayoutSettings_1 = __webpack_require__(18);
- var AutoLayoutTreeVerticalCommand = /** @class */ (function (_super) {
- __extends(AutoLayoutTreeVerticalCommand, _super);
- function AutoLayoutTreeVerticalCommand() {
- return _super !== null && _super.apply(this, arguments) || this;
- }
- AutoLayoutTreeVerticalCommand.prototype.createLayout = function (graph) {
- var settings = this.createLayoutSettings();
- settings.orientation = LayoutSettings_1.OrientationKind.Vertical;
- return new WideTree_1.TreeLayoutBuilder(settings, graph).build();
- };
- return AutoLayoutTreeVerticalCommand;
- }(AutoLayoutCommandBase_1.AutoLayoutCommandBase));
- exports.AutoLayoutTreeVerticalCommand = AutoLayoutTreeVerticalCommand;
- /***/ }),
- /* 174 */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- var __extends = (this && this.__extends) || (function () {
- var extendStatics = function (d, b) {
- extendStatics = Object.setPrototypeOf ||
- ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
- function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
- return extendStatics(d, b);
- };
- return function (d, b) {
- extendStatics(d, b);
- function __() { this.constructor = d; }
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
- };
- })();
- Object.defineProperty(exports, "__esModule", { value: true });
- var ChangePagePropertyCommand_1 = __webpack_require__(23);
- var ChangeSnapToGridCommand = /** @class */ (function (_super) {
- __extends(ChangeSnapToGridCommand, _super);
- function ChangeSnapToGridCommand() {
- return _super !== null && _super.apply(this, arguments) || this;
- }
- ChangeSnapToGridCommand.prototype.getPropertyName = function () {
- return "snapToGrid";
- };
- return ChangeSnapToGridCommand;
- }(ChangePagePropertyCommand_1.ChangePagePropertyCommand));
- exports.ChangeSnapToGridCommand = ChangeSnapToGridCommand;
- /***/ }),
- /* 175 */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- var __extends = (this && this.__extends) || (function () {
- var extendStatics = function (d, b) {
- extendStatics = Object.setPrototypeOf ||
- ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
- function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
- return extendStatics(d, b);
- };
- return function (d, b) {
- extendStatics(d, b);
- function __() { this.constructor = d; }
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
- };
- })();
- Object.defineProperty(exports, "__esModule", { value: true });
- var HistoryItem_1 = __webpack_require__(4);
- var ChangePagePropertyHistoryItem = /** @class */ (function (_super) {
- __extends(ChangePagePropertyHistoryItem, _super);
- function ChangePagePropertyHistoryItem(propertyName, value) {
- var _this = _super.call(this) || this;
- _this.propertyName = propertyName;
- _this.value = value;
- return _this;
- }
- ChangePagePropertyHistoryItem.prototype.redo = function (manipulator) {
- this.oldValue = manipulator.model[this.propertyName];
- manipulator.changePageProperty(this.propertyName, this.value);
- };
- ChangePagePropertyHistoryItem.prototype.undo = function (manipulator) {
- manipulator.changePageProperty(this.propertyName, this.oldValue);
- };
- return ChangePagePropertyHistoryItem;
- }(HistoryItem_1.HistoryItem));
- exports.ChangePagePropertyHistoryItem = ChangePagePropertyHistoryItem;
- /***/ }),
- /* 176 */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- var __extends = (this && this.__extends) || (function () {
- var extendStatics = function (d, b) {
- extendStatics = Object.setPrototypeOf ||
- ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
- function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
- return extendStatics(d, b);
- };
- return function (d, b) {
- extendStatics(d, b);
- function __() { this.constructor = d; }
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
- };
- })();
- Object.defineProperty(exports, "__esModule", { value: true });
- var ChangePagePropertyCommand_1 = __webpack_require__(23);
- var ChangeGridSizeCommand = /** @class */ (function (_super) {
- __extends(ChangeGridSizeCommand, _super);
- function ChangeGridSizeCommand() {
- return _super !== null && _super.apply(this, arguments) || this;
- }
- ChangeGridSizeCommand.prototype.getPropertyName = function () {
- return "gridSize";
- };
- ChangeGridSizeCommand.prototype.getPropertyOptions = function () {
- return [
- { value: 90, text: this.control.model.getModelUnitText(90) },
- { value: 180, text: this.control.model.getModelUnitText(180) },
- { value: 360, text: this.control.model.getModelUnitText(360) },
- { value: 720, text: this.control.model.getModelUnitText(720) }
- ];
- };
- return ChangeGridSizeCommand;
- }(ChangePagePropertyCommand_1.ChangePagePropertyCommand));
- exports.ChangeGridSizeCommand = ChangeGridSizeCommand;
- /***/ }),
- /* 177 */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- var __extends = (this && this.__extends) || (function () {
- var extendStatics = function (d, b) {
- extendStatics = Object.setPrototypeOf ||
- ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
- function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
- return extendStatics(d, b);
- };
- return function (d, b) {
- extendStatics(d, b);
- function __() { this.constructor = d; }
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
- };
- })();
- Object.defineProperty(exports, "__esModule", { value: true });
- var ChangePagePropertyCommand_1 = __webpack_require__(23);
- var ChangePageLandscapeHistoryItem_1 = __webpack_require__(178);
- var ChangePageLandscapeCommand = /** @class */ (function (_super) {
- __extends(ChangePageLandscapeCommand, _super);
- function ChangePageLandscapeCommand() {
- return _super !== null && _super.apply(this, arguments) || this;
- }
- ChangePageLandscapeCommand.prototype.getPropertyName = function () {
- return "pageLandscape";
- };
- ChangePageLandscapeCommand.prototype.createHistoryItems = function (propertyName, parameter) {
- return [new ChangePageLandscapeHistoryItem_1.ChangePageLandscapeHistoryItem(parameter)];
- };
- return ChangePageLandscapeCommand;
- }(ChangePagePropertyCommand_1.ChangePagePropertyCommand));
- exports.ChangePageLandscapeCommand = ChangePageLandscapeCommand;
- /***/ }),
- /* 178 */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- var __extends = (this && this.__extends) || (function () {
- var extendStatics = function (d, b) {
- extendStatics = Object.setPrototypeOf ||
- ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
- function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
- return extendStatics(d, b);
- };
- return function (d, b) {
- extendStatics(d, b);
- function __() { this.constructor = d; }
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
- };
- })();
- Object.defineProperty(exports, "__esModule", { value: true });
- var HistoryItem_1 = __webpack_require__(4);
- var ChangePageLandscapeHistoryItem = /** @class */ (function (_super) {
- __extends(ChangePageLandscapeHistoryItem, _super);
- function ChangePageLandscapeHistoryItem(value) {
- var _this = _super.call(this) || this;
- _this.value = value;
- return _this;
- }
- ChangePageLandscapeHistoryItem.prototype.redo = function (manipulator) {
- this.oldValue = manipulator.model.pageLandscape;
- manipulator.changePageLandscape(this.value);
- };
- ChangePageLandscapeHistoryItem.prototype.undo = function (manipulator) {
- manipulator.changePageLandscape(this.oldValue);
- };
- return ChangePageLandscapeHistoryItem;
- }(HistoryItem_1.HistoryItem));
- exports.ChangePageLandscapeHistoryItem = ChangePageLandscapeHistoryItem;
- /***/ }),
- /* 179 */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- var __extends = (this && this.__extends) || (function () {
- var extendStatics = function (d, b) {
- extendStatics = Object.setPrototypeOf ||
- ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
- function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
- return extendStatics(d, b);
- };
- return function (d, b) {
- extendStatics(d, b);
- function __() { this.constructor = d; }
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
- };
- })();
- Object.defineProperty(exports, "__esModule", { value: true });
- var ChangePagePropertyCommand_1 = __webpack_require__(23);
- var Utils_1 = __webpack_require__(0);
- var ChangePageSizeHistoryItem_1 = __webpack_require__(180);
- var ChangePageSizeCommand = /** @class */ (function (_super) {
- __extends(ChangePageSizeCommand, _super);
- function ChangePageSizeCommand() {
- return _super !== null && _super.apply(this, arguments) || this;
- }
- ChangePageSizeCommand.prototype.getPropertyName = function () {
- return "pageSize";
- };
- ChangePageSizeCommand.prototype.createHistoryItems = function (propertyName, parameter) {
- return [new ChangePageSizeHistoryItem_1.ChangePageSizeHistoryItem(new Utils_1.Size(parameter.width, parameter.height))];
- };
- ChangePageSizeCommand.prototype.getPropertyOptions = function () {
- return [
- { value: new Utils_1.Size(12240, 15840), text: "US-Letter (" + this.control.model.getModelUnitText(12240) + " x " + this.control.model.getModelUnitText(15840) + ")" },
- { value: new Utils_1.Size(12240, 20160), text: "US-Legal (" + this.control.model.getModelUnitText(12240) + " x " + this.control.model.getModelUnitText(20160) + ")" },
- { value: new Utils_1.Size(15817, 24491), text: "US-Tabloid (" + this.control.model.getModelUnitText(15817) + " x " + this.control.model.getModelUnitText(24491) + ")" },
- { value: new Utils_1.Size(47679, 67408), text: "A0 (" + this.control.model.getModelUnitText(47679) + " x " + this.control.model.getModelUnitText(67408) + ")" },
- { value: new Utils_1.Size(33676, 47679), text: "A1 (" + this.control.model.getModelUnitText(33676) + " x " + this.control.model.getModelUnitText(47679) + ")" },
- { value: new Utils_1.Size(23811, 33676), text: "A2 (" + this.control.model.getModelUnitText(23811) + " x " + this.control.model.getModelUnitText(33676) + ")" },
- { value: new Utils_1.Size(16838, 23811), text: "A3 (" + this.control.model.getModelUnitText(16838) + " x " + this.control.model.getModelUnitText(23811) + ")" },
- { value: new Utils_1.Size(11906, 16838), text: "A4 (" + this.control.model.getModelUnitText(11906) + " x " + this.control.model.getModelUnitText(16838) + ")" },
- { value: new Utils_1.Size(8391, 11906), text: "A5 (" + this.control.model.getModelUnitText(8391) + " x " + this.control.model.getModelUnitText(11906) + ")" },
- { value: new Utils_1.Size(5953, 8391), text: "A6 (" + this.control.model.getModelUnitText(5953) + " x " + this.control.model.getModelUnitText(8391) + ")" },
- { value: new Utils_1.Size(4195, 5953), text: "A7 (" + this.control.model.getModelUnitText(4195) + " x " + this.control.model.getModelUnitText(5953) + ")" },
- ];
- };
- return ChangePageSizeCommand;
- }(ChangePagePropertyCommand_1.ChangePagePropertyCommand));
- exports.ChangePageSizeCommand = ChangePageSizeCommand;
- /***/ }),
- /* 180 */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- var __extends = (this && this.__extends) || (function () {
- var extendStatics = function (d, b) {
- extendStatics = Object.setPrototypeOf ||
- ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
- function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
- return extendStatics(d, b);
- };
- return function (d, b) {
- extendStatics(d, b);
- function __() { this.constructor = d; }
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
- };
- })();
- Object.defineProperty(exports, "__esModule", { value: true });
- var HistoryItem_1 = __webpack_require__(4);
- var ChangePageSizeHistoryItem = /** @class */ (function (_super) {
- __extends(ChangePageSizeHistoryItem, _super);
- function ChangePageSizeHistoryItem(size) {
- var _this = _super.call(this) || this;
- _this.size = size;
- return _this;
- }
- ChangePageSizeHistoryItem.prototype.redo = function (manipulator) {
- this.oldSize = manipulator.model.pageSize;
- manipulator.changePageSize(this.size);
- };
- ChangePageSizeHistoryItem.prototype.undo = function (manipulator) {
- manipulator.changePageSize(this.oldSize);
- };
- return ChangePageSizeHistoryItem;
- }(HistoryItem_1.HistoryItem));
- exports.ChangePageSizeHistoryItem = ChangePageSizeHistoryItem;
- /***/ }),
- /* 181 */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- var __extends = (this && this.__extends) || (function () {
- var extendStatics = function (d, b) {
- extendStatics = Object.setPrototypeOf ||
- ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
- function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
- return extendStatics(d, b);
- };
- return function (d, b) {
- extendStatics(d, b);
- function __() { this.constructor = d; }
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
- };
- })();
- Object.defineProperty(exports, "__esModule", { value: true });
- var Exporter_1 = __webpack_require__(31);
- var ExportImageCommand_1 = __webpack_require__(64);
- var ExportPngCommand = /** @class */ (function (_super) {
- __extends(ExportPngCommand, _super);
- function ExportPngCommand() {
- return _super !== null && _super.apply(this, arguments) || this;
- }
- ExportPngCommand.prototype.getExportFunc = function () {
- return Exporter_1.Exporter.exportPng;
- };
- return ExportPngCommand;
- }(ExportImageCommand_1.ExportImageCommand));
- exports.ExportPngCommand = ExportPngCommand;
- /***/ }),
- /* 182 */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- var __extends = (this && this.__extends) || (function () {
- var extendStatics = function (d, b) {
- extendStatics = Object.setPrototypeOf ||
- ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
- function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
- return extendStatics(d, b);
- };
- return function (d, b) {
- extendStatics(d, b);
- function __() { this.constructor = d; }
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
- };
- })();
- Object.defineProperty(exports, "__esModule", { value: true });
- var RenderManager_1 = __webpack_require__(10);
- var Primitive_1 = __webpack_require__(15);
- var PatternPrimitive = /** @class */ (function (_super) {
- __extends(PatternPrimitive, _super);
- function PatternPrimitive(id, children, x, y, width, height) {
- var _this = _super.call(this) || this;
- _this.id = id;
- _this.x = x;
- _this.y = y;
- _this.width = width;
- _this.height = height;
- _this.children = children;
- return _this;
- }
- PatternPrimitive.prototype.createMainElement = function () {
- return document.createElementNS(RenderManager_1.svgNS, "pattern");
- };
- PatternPrimitive.prototype.applyElementProperties = function (element) {
- if (this.id)
- element.setAttribute("id", this.id);
- this.setUnitAttribute(element, "x", this.x);
- this.setUnitAttribute(element, "y", this.y);
- this.setUnitAttribute(element, "width", this.width);
- this.setUnitAttribute(element, "height", this.height);
- _super.prototype.applyElementProperties.call(this, element);
- };
- return PatternPrimitive;
- }(Primitive_1.SvgPrimitive));
- exports.PatternPrimitive = PatternPrimitive;
- /***/ }),
- /* 183 */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- var __extends = (this && this.__extends) || (function () {
- var extendStatics = function (d, b) {
- extendStatics = Object.setPrototypeOf ||
- ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
- function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
- return extendStatics(d, b);
- };
- return function (d, b) {
- extendStatics(d, b);
- function __() { this.constructor = d; }
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
- };
- })();
- Object.defineProperty(exports, "__esModule", { value: true });
- var RenderManager_1 = __webpack_require__(10);
- var Primitive_1 = __webpack_require__(15);
- var GroupPrimitive = /** @class */ (function (_super) {
- __extends(GroupPrimitive, _super);
- function GroupPrimitive(children, className, zIndex) {
- var _this = _super.call(this, null, className) || this;
- _this.zIndex = zIndex;
- _this.children = children;
- return _this;
- }
- GroupPrimitive.prototype.createMainElement = function () {
- return document.createElementNS(RenderManager_1.svgNS, "g");
- };
- GroupPrimitive.prototype.applyElementProperties = function (element) {
- if (this.zIndex)
- element.style.setProperty("z-index", this.zIndex.toString());
- _super.prototype.applyElementProperties.call(this, element);
- };
- return GroupPrimitive;
- }(Primitive_1.SvgPrimitive));
- exports.GroupPrimitive = GroupPrimitive;
- /***/ }),
- /* 184 */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- var __extends = (this && this.__extends) || (function () {
- var extendStatics = function (d, b) {
- extendStatics = Object.setPrototypeOf ||
- ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
- function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
- return extendStatics(d, b);
- };
- return function (d, b) {
- extendStatics(d, b);
- function __() { this.constructor = d; }
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
- };
- })();
- Object.defineProperty(exports, "__esModule", { value: true });
- var RenderManager_1 = __webpack_require__(10);
- var Primitive_1 = __webpack_require__(15);
- var MaskPrimitive = /** @class */ (function (_super) {
- __extends(MaskPrimitive, _super);
- function MaskPrimitive(id, children, className, x, y, width, height) {
- var _this = _super.call(this, null, className) || this;
- _this.id = id;
- _this.x = x;
- _this.y = y;
- _this.width = width;
- _this.height = height;
- _this.children = children;
- return _this;
- }
- MaskPrimitive.prototype.createMainElement = function () {
- return document.createElementNS(RenderManager_1.svgNS, "mask");
- };
- MaskPrimitive.prototype.applyElementProperties = function (element) {
- if (this.id)
- element.setAttribute("id", this.id);
- this.setUnitAttribute(element, "x", this.x);
- this.setUnitAttribute(element, "y", this.y);
- this.setUnitAttribute(element, "width", this.width);
- this.setUnitAttribute(element, "height", this.height);
- _super.prototype.applyElementProperties.call(this, element);
- };
- return MaskPrimitive;
- }(Primitive_1.SvgPrimitive));
- exports.MaskPrimitive = MaskPrimitive;
- /***/ }),
- /* 185 */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- var __extends = (this && this.__extends) || (function () {
- var extendStatics = function (d, b) {
- extendStatics = Object.setPrototypeOf ||
- ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
- function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
- return extendStatics(d, b);
- };
- return function (d, b) {
- extendStatics(d, b);
- function __() { this.constructor = d; }
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
- };
- })();
- Object.defineProperty(exports, "__esModule", { value: true });
- var Exporter_1 = __webpack_require__(31);
- var ExportImageCommand_1 = __webpack_require__(64);
- var ExportSvgCommand = /** @class */ (function (_super) {
- __extends(ExportSvgCommand, _super);
- function ExportSvgCommand() {
- return _super !== null && _super.apply(this, arguments) || this;
- }
- ExportSvgCommand.prototype.getExportFunc = function () {
- return Exporter_1.Exporter.exportSvg;
- };
- return ExportSvgCommand;
- }(ExportImageCommand_1.ExportImageCommand));
- exports.ExportSvgCommand = ExportSvgCommand;
- /***/ }),
- /* 186 */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- var __extends = (this && this.__extends) || (function () {
- var extendStatics = function (d, b) {
- extendStatics = Object.setPrototypeOf ||
- ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
- function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
- return extendStatics(d, b);
- };
- return function (d, b) {
- extendStatics(d, b);
- function __() { this.constructor = d; }
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
- };
- })();
- Object.defineProperty(exports, "__esModule", { value: true });
- var Exporter_1 = __webpack_require__(31);
- var ExportImageCommand_1 = __webpack_require__(64);
- var ExportJpgCommand = /** @class */ (function (_super) {
- __extends(ExportJpgCommand, _super);
- function ExportJpgCommand() {
- return _super !== null && _super.apply(this, arguments) || this;
- }
- ExportJpgCommand.prototype.getExportFunc = function () {
- return Exporter_1.Exporter.exportJpg;
- };
- return ExportJpgCommand;
- }(ExportImageCommand_1.ExportImageCommand));
- exports.ExportJpgCommand = ExportJpgCommand;
- /***/ }),
- /* 187 */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- var __extends = (this && this.__extends) || (function () {
- var extendStatics = function (d, b) {
- extendStatics = Object.setPrototypeOf ||
- ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
- function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
- return extendStatics(d, b);
- };
- return function (d, b) {
- extendStatics(d, b);
- function __() { this.constructor = d; }
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
- };
- })();
- Object.defineProperty(exports, "__esModule", { value: true });
- var CommandStates_1 = __webpack_require__(6);
- var Exporter_1 = __webpack_require__(31);
- var ClipboardCommand_1 = __webpack_require__(65);
- var CopySelectionCommand = /** @class */ (function (_super) {
- __extends(CopySelectionCommand, _super);
- function CopySelectionCommand() {
- return _super !== null && _super.apply(this, arguments) || this;
- }
- CopySelectionCommand.prototype.getState = function () {
- return new CommandStates_1.SimpleCommandState(!this.control.selection.isEmpty(true));
- };
- CopySelectionCommand.prototype.executeCore = function (state) {
- var data = Exporter_1.Exporter.exportItems(this.control.selection.getSelectedItems());
- this.setClipboardData(data);
- return true;
- };
- return CopySelectionCommand;
- }(ClipboardCommand_1.ClipboardCommand));
- exports.CopySelectionCommand = CopySelectionCommand;
- /***/ }),
- /* 188 */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- var __extends = (this && this.__extends) || (function () {
- var extendStatics = function (d, b) {
- extendStatics = Object.setPrototypeOf ||
- ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
- function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
- return extendStatics(d, b);
- };
- return function (d, b) {
- extendStatics(d, b);
- function __() { this.constructor = d; }
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
- };
- })();
- Object.defineProperty(exports, "__esModule", { value: true });
- var CommandStates_1 = __webpack_require__(6);
- var Exporter_1 = __webpack_require__(31);
- var ModelUtils_1 = __webpack_require__(8);
- var ClipboardCommand_1 = __webpack_require__(65);
- var CutSelectionCommand = /** @class */ (function (_super) {
- __extends(CutSelectionCommand, _super);
- function CutSelectionCommand() {
- return _super !== null && _super.apply(this, arguments) || this;
- }
- CutSelectionCommand.prototype.getState = function () {
- return new CommandStates_1.SimpleCommandState(!this.control.selection.isEmpty());
- };
- CutSelectionCommand.prototype.executeCore = function (state) {
- var data = Exporter_1.Exporter.exportItems(this.control.selection.getSelectedItems());
- this.setClipboardData(data);
- ModelUtils_1.ModelUtils.deleteSelection(this.control.history, this.control.model, this.control.selection);
- return true;
- };
- return CutSelectionCommand;
- }(ClipboardCommand_1.ClipboardCommand));
- exports.CutSelectionCommand = CutSelectionCommand;
- /***/ }),
- /* 189 */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- var __extends = (this && this.__extends) || (function () {
- var extendStatics = function (d, b) {
- extendStatics = Object.setPrototypeOf ||
- ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
- function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
- return extendStatics(d, b);
- };
- return function (d, b) {
- extendStatics(d, b);
- function __() { this.constructor = d; }
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
- };
- })();
- Object.defineProperty(exports, "__esModule", { value: true });
- var CommandStates_1 = __webpack_require__(6);
- var Importer_1 = __webpack_require__(84);
- var Shape_1 = __webpack_require__(9);
- var ImportShapeHistoryItem_1 = __webpack_require__(190);
- var Connector_1 = __webpack_require__(5);
- var ImportConnectorHistoryItem_1 = __webpack_require__(191);
- var SetSelectionHistoryItem_1 = __webpack_require__(29);
- var ClipboardCommand_1 = __webpack_require__(65);
- var UnitConverter_1 = __webpack_require__(13);
- var ModelUtils_1 = __webpack_require__(8);
- var Browser_1 = __webpack_require__(20);
- var PasteSelectionCommand = /** @class */ (function (_super) {
- __extends(PasteSelectionCommand, _super);
- function PasteSelectionCommand() {
- return _super !== null && _super.apply(this, arguments) || this;
- }
- PasteSelectionCommand.prototype.getState = function () {
- return new CommandStates_1.SimpleCommandState(Browser_1.Browser.IE || (Browser_1.Browser.WebKitFamily && navigator && navigator["clipboard"] !== undefined));
- };
- PasteSelectionCommand.prototype.executeCore = function (state) {
- var _this = this;
- this.getClipboardData(function (data) {
- _this.performPaste(data);
- });
- return true;
- };
- PasteSelectionCommand.prototype.performPaste = function (data) {
- this.control.beginUpdate();
- this.control.history.beginTransaction();
- var ids = [];
- var items = Importer_1.Importer.importItems(data, this.control.model);
- for (var i = 0; i < items.length; i++) {
- var item = items[i];
- if (item instanceof Shape_1.Shape) {
- while (this.control.model.findShapeAtPosition(item.position)) {
- item.position.x += PasteSelectionCommand.positionOffset;
- item.position.y += PasteSelectionCommand.positionOffset;
- }
- this.control.history.addOrModifyAndRedo(new ImportShapeHistoryItem_1.ImportShapeHistoryItem(item));
- }
- else if (item instanceof Connector_1.Connector) {
- while (this.control.model.findConnectorAtPoints(item.points)) {
- item.points.forEach(function (pt) {
- pt.x += PasteSelectionCommand.positionOffset;
- pt.y += PasteSelectionCommand.positionOffset;
- });
- }
- this.control.history.addOrModifyAndRedo(new ImportConnectorHistoryItem_1.ImportConnectorHistoryItem(item));
- }
- ids.push(item.key);
- }
- ModelUtils_1.ModelUtils.tryUpdateModelSize(this.control.history, this.control.model);
- this.control.history.addOrModifyAndRedo(new SetSelectionHistoryItem_1.SetSelectionHistoryItem(this.control.selection, ids));
- this.control.history.endTransaction();
- this.control.endUpdate();
- };
- PasteSelectionCommand.positionOffset = UnitConverter_1.UnitConverter.pixelsToTwips(10);
- return PasteSelectionCommand;
- }(ClipboardCommand_1.ClipboardCommand));
- exports.PasteSelectionCommand = PasteSelectionCommand;
- /***/ }),
- /* 190 */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- var __extends = (this && this.__extends) || (function () {
- var extendStatics = function (d, b) {
- extendStatics = Object.setPrototypeOf ||
- ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
- function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
- return extendStatics(d, b);
- };
- return function (d, b) {
- extendStatics(d, b);
- function __() { this.constructor = d; }
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
- };
- })();
- Object.defineProperty(exports, "__esModule", { value: true });
- var HistoryItem_1 = __webpack_require__(4);
- var ImportShapeHistoryItem = /** @class */ (function (_super) {
- __extends(ImportShapeHistoryItem, _super);
- function ImportShapeHistoryItem(shape) {
- var _this = _super.call(this) || this;
- _this.shape = shape;
- return _this;
- }
- ImportShapeHistoryItem.prototype.redo = function (manipulator) {
- this.shapeKey = this.shape.key;
- manipulator.insertShape(this.shape);
- };
- ImportShapeHistoryItem.prototype.undo = function (manipulator) {
- manipulator.removeShape(manipulator.model.findShape(this.shapeKey));
- };
- return ImportShapeHistoryItem;
- }(HistoryItem_1.HistoryItem));
- exports.ImportShapeHistoryItem = ImportShapeHistoryItem;
- /***/ }),
- /* 191 */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- var __extends = (this && this.__extends) || (function () {
- var extendStatics = function (d, b) {
- extendStatics = Object.setPrototypeOf ||
- ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
- function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
- return extendStatics(d, b);
- };
- return function (d, b) {
- extendStatics(d, b);
- function __() { this.constructor = d; }
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
- };
- })();
- Object.defineProperty(exports, "__esModule", { value: true });
- var HistoryItem_1 = __webpack_require__(4);
- var ImportConnectorHistoryItem = /** @class */ (function (_super) {
- __extends(ImportConnectorHistoryItem, _super);
- function ImportConnectorHistoryItem(connector) {
- var _this = _super.call(this) || this;
- _this.connector = connector;
- return _this;
- }
- ImportConnectorHistoryItem.prototype.redo = function (manipulator) {
- this.connectorKey = this.connector.key;
- manipulator.insertConnector(this.connector);
- };
- ImportConnectorHistoryItem.prototype.undo = function (manipulator) {
- var connector = manipulator.model.findConnector(this.connectorKey);
- manipulator.removeConnector(connector);
- };
- return ImportConnectorHistoryItem;
- }(HistoryItem_1.HistoryItem));
- exports.ImportConnectorHistoryItem = ImportConnectorHistoryItem;
- /***/ }),
- /* 192 */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- var __extends = (this && this.__extends) || (function () {
- var extendStatics = function (d, b) {
- extendStatics = Object.setPrototypeOf ||
- ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
- function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
- return extendStatics(d, b);
- };
- return function (d, b) {
- extendStatics(d, b);
- function __() { this.constructor = d; }
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
- };
- })();
- Object.defineProperty(exports, "__esModule", { value: true });
- var CommandBase_1 = __webpack_require__(7);
- var CommandStates_1 = __webpack_require__(6);
- var BPMNImporter_1 = __webpack_require__(193);
- var LayoutUtils_1 = __webpack_require__(59);
- var ModelUtils_1 = __webpack_require__(8);
- var AddShapeHistoryItem_1 = __webpack_require__(51);
- var Utils_1 = __webpack_require__(0);
- var Connector_1 = __webpack_require__(5);
- var AddConnectorHistoryItem_1 = __webpack_require__(58);
- var AddConnectionHistoryItem_1 = __webpack_require__(35);
- var Structures_1 = __webpack_require__(22);
- var Sugiyama_1 = __webpack_require__(40);
- var LayoutSettings_1 = __webpack_require__(18);
- var ImportBPMNCommand = /** @class */ (function (_super) {
- __extends(ImportBPMNCommand, _super);
- function ImportBPMNCommand() {
- return _super !== null && _super.apply(this, arguments) || this;
- }
- ImportBPMNCommand.prototype.getState = function () {
- return new CommandStates_1.SimpleCommandState(true);
- };
- ImportBPMNCommand.prototype.executeCore = function (state, parameter) {
- var _this = this;
- var parser = new DOMParser();
- var doc = parser.parseFromString(parameter, "application/xml");
- var importer = new BPMNImporter_1.BPMNImporter(doc);
- var externalKeyToModelKey = {};
- var connectors = [];
- var graph = importer.import()
- .cast(function (node) {
- var insert = new AddShapeHistoryItem_1.AddShapeHistoryItem(node.type, new Utils_1.Point(0, 0), node.text, node.key);
- _this.control.history.addAndRedo(insert);
- externalKeyToModelKey[node.key] = insert.shapeKey;
- return LayoutUtils_1.LayoutUtils.shapeToLayout(_this.control.model.findShape(insert.shapeKey));
- }, function (edge) {
- var from = _this.control.model.findShape(externalKeyToModelKey[edge.from]);
- var to = _this.control.model.findShape(externalKeyToModelKey[edge.to]);
- var insert = new AddConnectorHistoryItem_1.AddConnectorHistoryItem([from.getConnectionPoint(0), to.getConnectionPoint(0)]);
- _this.control.history.addAndRedo(insert);
- var connector = _this.control.model.findConnector(insert.connectorKey);
- connectors.push(connector);
- _this.control.history.addAndRedo(new AddConnectionHistoryItem_1.AddConnectionHistoryItem(connector, from, 0, Connector_1.ConnectorPosition.Begin));
- _this.control.history.addAndRedo(new AddConnectionHistoryItem_1.AddConnectionHistoryItem(connector, to, 0, Connector_1.ConnectorPosition.End));
- return new Structures_1.Edge(connector.key, from.key, to.key);
- });
- var layout = new Sugiyama_1.SugiyamaLayoutBuilder(new LayoutSettings_1.LayoutSettings(), graph).build();
- var nonGraphItems = ModelUtils_1.ModelUtils.getSymmetricDifference(layout.nodeToLayout, this.control.model.items);
- layout = ModelUtils_1.ModelUtils.offsetLayoutToFreeSpace(layout, nonGraphItems.map(function (i) { return i.rectangle; }));
- ModelUtils_1.ModelUtils.applyLayoutToNodes(this.control.history, this.control.model, layout, connectors);
- ModelUtils_1.ModelUtils.applyLayoutToConnectors(this.control.history, layout, connectors);
- // set selection
- ModelUtils_1.ModelUtils.tryUpdateModelSize(this.control.history, this.control.model);
- return true;
- };
- return ImportBPMNCommand;
- }(CommandBase_1.CommandBase));
- exports.ImportBPMNCommand = ImportBPMNCommand;
- /***/ }),
- /* 193 */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- var __extends = (this && this.__extends) || (function () {
- var extendStatics = function (d, b) {
- extendStatics = Object.setPrototypeOf ||
- ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
- function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
- return extendStatics(d, b);
- };
- return function (d, b) {
- extendStatics(d, b);
- function __() { this.constructor = d; }
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
- };
- })();
- Object.defineProperty(exports, "__esModule", { value: true });
- var Graph_1 = __webpack_require__(34);
- var ShapeType_1 = __webpack_require__(1);
- var Structures_1 = __webpack_require__(22);
- var BPMNImporter = /** @class */ (function () {
- function BPMNImporter(doc) {
- this.doc = doc;
- this.graph = new Graph_1.Graph([], []);
- }
- BPMNImporter.prototype.import = function () {
- for (var child = void 0, i = 0; child = this.doc.children[i]; i++) {
- if (child.nodeName.toUpperCase() === "DEFINITIONS")
- this.onDefinitionsElement(child);
- }
- this.validate();
- return this.graph;
- };
- BPMNImporter.prototype.validate = function () {
- var nodesMap = {};
- this.graph.nodes.forEach(function (n) { return nodesMap[n] = true; });
- for (var i = 0, edge = void 0; edge = this.graph.edges[i]; i++) {
- if (!nodesMap[edge.from] || !nodesMap[edge.to]) {
- this.graph.edges.splice(i, 1);
- i--;
- }
- }
- };
- BPMNImporter.prototype.onDefinitionsElement = function (element) {
- this.dataSourceKey = element.getAttribute("id");
- for (var child = void 0, i = 0; child = element.children[i]; i++) {
- if (child.nodeName.toUpperCase() === "PROCESS")
- this.onProcessElement(child);
- }
- };
- BPMNImporter.prototype.onProcessElement = function (element) {
- for (var child = void 0, i = 0; child = element.children[i]; i++) {
- switch (child.nodeName.toUpperCase()) {
- case "STARTEVENT":
- this.onStartEventElement(child);
- break;
- case "SEQUENCEFLOW":
- this.onSequenceFlowElement(child);
- break;
- case "SCRIPTTASK":
- this.onScriptTaskElement(child);
- break;
- case "USERTASK":
- this.onUserTaskElement(child);
- break;
- case "SERVICETASK":
- this.onServiceTaskElement(child);
- break;
- case "SENDTASK":
- this.onSendTaskElement(child);
- break;
- case "EXCLUSIVEGATEWAY":
- this.onExclusiveGateway(child);
- break;
- case "ENDEVENT":
- this.onEndEventGateway(child);
- break;
- }
- }
- };
- BPMNImporter.prototype.onStartEventElement = function (element) {
- var node = this.createNode(element);
- node.type = ShapeType_1.ShapeType.Ellipsis;
- node.text = element.getAttribute("name");
- this.graph.addNode(node);
- };
- BPMNImporter.prototype.onSequenceFlowElement = function (element) {
- var fromKey = element.getAttribute("sourceRef");
- var toKey = element.getAttribute("targetRef");
- var edge = this.createEdge(element, fromKey, toKey);
- if (element.hasAttribute("name"))
- edge.text = element.getAttribute("name");
- this.graph.addEdge(edge);
- };
- BPMNImporter.prototype.onScriptTaskElement = function (element) {
- var node = this.createNode(element);
- node.text = element.getAttribute("name");
- this.graph.addNode(node);
- };
- BPMNImporter.prototype.onUserTaskElement = function (element) {
- var node = this.createNode(element);
- node.text = element.getAttribute("name");
- this.graph.addNode(node);
- };
- BPMNImporter.prototype.onServiceTaskElement = function (element) {
- var node = this.createNode(element);
- node.text = element.getAttribute("name");
- this.graph.addNode(node);
- };
- BPMNImporter.prototype.onSendTaskElement = function (element) {
- var node = this.createNode(element);
- node.text = element.getAttribute("name");
- this.graph.addNode(node);
- };
- BPMNImporter.prototype.onExclusiveGateway = function (element) {
- var node = this.createNode(element);
- node.text = element.getAttribute("name");
- node.type = ShapeType_1.ShapeType.Decision;
- this.graph.addNode(node);
- };
- BPMNImporter.prototype.onEndEventGateway = function (element) {
- var node = this.createNode(element);
- node.text = element.getAttribute("name");
- node.type = ShapeType_1.ShapeType.Ellipsis;
- this.graph.addNode(node);
- };
- BPMNImporter.prototype.createNode = function (element) {
- return new BPMNNode(this.dataSourceKey, element.getAttribute("id"));
- };
- BPMNImporter.prototype.createEdge = function (element, fromKey, toKey) {
- return new BPMNEdge(this.dataSourceKey, element.getAttribute("id"), fromKey, toKey);
- };
- return BPMNImporter;
- }());
- exports.BPMNImporter = BPMNImporter;
- var BPMNNode = /** @class */ (function () {
- function BPMNNode(sourceKey, key) {
- this.sourceKey = sourceKey;
- this.key = key;
- this.type = ShapeType_1.ShapeType.Rectangle;
- }
- return BPMNNode;
- }());
- var BPMNEdge = /** @class */ (function (_super) {
- __extends(BPMNEdge, _super);
- function BPMNEdge(sourceKey, key, fromKey, toKey) {
- var _this = _super.call(this, key, fromKey, toKey) || this;
- _this.sourceKey = sourceKey;
- return _this;
- }
- return BPMNEdge;
- }(Structures_1.Edge));
- /***/ }),
- /* 194 */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- var __extends = (this && this.__extends) || (function () {
- var extendStatics = function (d, b) {
- extendStatics = Object.setPrototypeOf ||
- ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
- function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
- return extendStatics(d, b);
- };
- return function (d, b) {
- extendStatics(d, b);
- function __() { this.constructor = d; }
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
- };
- })();
- Object.defineProperty(exports, "__esModule", { value: true });
- var CommandBase_1 = __webpack_require__(7);
- var CommandStates_1 = __webpack_require__(6);
- var ChangeZindexHistoryItem_1 = __webpack_require__(93);
- var SendToBackCommand = /** @class */ (function (_super) {
- __extends(SendToBackCommand, _super);
- function SendToBackCommand() {
- return _super !== null && _super.apply(this, arguments) || this;
- }
- SendToBackCommand.prototype.getState = function () {
- var items = this.control.selection.getSelectedItems();
- return new CommandStates_1.SimpleCommandState(items.length && this.needSendToBack(items));
- };
- SendToBackCommand.prototype.executeCore = function (state, parameter) {
- var _this = this;
- this.control.history.beginTransaction();
- var items = this.control.selection.getSelectedItems();
- items.forEach(function (item) {
- var newZIndex = _this.control.model.getIntersectItemsMinZIndex(item) - 1;
- _this.control.history.addAndRedo(new ChangeZindexHistoryItem_1.ChangeZindexHistoryItem(item, newZIndex));
- });
- this.control.history.endTransaction();
- return true;
- };
- SendToBackCommand.prototype.needSendToBack = function (items) {
- var _this = this;
- var _loop_1 = function (i) {
- var zIndex = this_1.control.model.getIntersectItemsMinZIndex(items[i]);
- if (zIndex < items[i].zIndex)
- return { value: true };
- if (zIndex === items[i].zIndex) {
- var result_1 = false;
- var sameZIndexItems = this_1.control.model.getIntersectItems(items[i]).filter(function (item) { return item.zIndex === items[i].zIndex; });
- sameZIndexItems.forEach(function (item) {
- if (_this.control.model.getItemIndex(item) < _this.control.model.getItemIndex(items[i])) {
- result_1 = true;
- return;
- }
- });
- return { value: result_1 };
- }
- };
- var this_1 = this;
- for (var i = 0; i < items.length; i++) {
- var state_1 = _loop_1(i);
- if (typeof state_1 === "object")
- return state_1.value;
- }
- return false;
- };
- return SendToBackCommand;
- }(CommandBase_1.CommandBase));
- exports.SendToBackCommand = SendToBackCommand;
- /***/ }),
- /* 195 */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- var __extends = (this && this.__extends) || (function () {
- var extendStatics = function (d, b) {
- extendStatics = Object.setPrototypeOf ||
- ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
- function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
- return extendStatics(d, b);
- };
- return function (d, b) {
- extendStatics(d, b);
- function __() { this.constructor = d; }
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
- };
- })();
- Object.defineProperty(exports, "__esModule", { value: true });
- var CommandBase_1 = __webpack_require__(7);
- var CommandStates_1 = __webpack_require__(6);
- var ChangeZindexHistoryItem_1 = __webpack_require__(93);
- var BringToFrontCommand = /** @class */ (function (_super) {
- __extends(BringToFrontCommand, _super);
- function BringToFrontCommand() {
- return _super !== null && _super.apply(this, arguments) || this;
- }
- BringToFrontCommand.prototype.getState = function () {
- var items = this.control.selection.getSelectedItems();
- return new CommandStates_1.SimpleCommandState(items.length && this.needBringToFront(items));
- };
- BringToFrontCommand.prototype.executeCore = function (state, parameter) {
- var _this = this;
- this.control.history.beginTransaction();
- var items = this.control.selection.getSelectedItems();
- items.forEach(function (item) {
- var newZIndex = _this.control.model.getIntersectItemsMaxZIndex(item) + 1;
- _this.control.history.addAndRedo(new ChangeZindexHistoryItem_1.ChangeZindexHistoryItem(item, newZIndex));
- });
- this.control.history.endTransaction();
- return true;
- };
- BringToFrontCommand.prototype.needBringToFront = function (items) {
- var _this = this;
- var _loop_1 = function (i) {
- var zIndex = this_1.control.model.getIntersectItemsMaxZIndex(items[i]);
- if (zIndex > items[i].zIndex)
- return { value: true };
- if (zIndex === items[i].zIndex) {
- var result_1 = false;
- var sameZIndexItems = this_1.control.model.getIntersectItems(items[i]).filter(function (item) { return item.zIndex === items[i].zIndex; });
- sameZIndexItems.forEach(function (item) {
- if (_this.control.model.getItemIndex(item) > _this.control.model.getItemIndex(items[i])) {
- result_1 = true;
- return;
- }
- });
- return { value: result_1 };
- }
- };
- var this_1 = this;
- for (var i = 0; i < items.length; i++) {
- var state_1 = _loop_1(i);
- if (typeof state_1 === "object")
- return state_1.value;
- }
- return false;
- };
- return BringToFrontCommand;
- }(CommandBase_1.CommandBase));
- exports.BringToFrontCommand = BringToFrontCommand;
- /***/ }),
- /* 196 */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- var __extends = (this && this.__extends) || (function () {
- var extendStatics = function (d, b) {
- extendStatics = Object.setPrototypeOf ||
- ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
- function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
- return extendStatics(d, b);
- };
- return function (d, b) {
- extendStatics(d, b);
- function __() { this.constructor = d; }
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
- };
- })();
- Object.defineProperty(exports, "__esModule", { value: true });
- var AutoLayoutCommandBase_1 = __webpack_require__(43);
- var Sugiyama_1 = __webpack_require__(40);
- var LayoutSettings_1 = __webpack_require__(18);
- var AutoLayoutLayeredHorizontalCommand = /** @class */ (function (_super) {
- __extends(AutoLayoutLayeredHorizontalCommand, _super);
- function AutoLayoutLayeredHorizontalCommand() {
- return _super !== null && _super.apply(this, arguments) || this;
- }
- AutoLayoutLayeredHorizontalCommand.prototype.createLayout = function (graph) {
- var settings = this.createLayoutSettings();
- settings.orientation = LayoutSettings_1.OrientationKind.Horizontal;
- return new Sugiyama_1.SugiyamaLayoutBuilder(settings, graph).build();
- };
- return AutoLayoutLayeredHorizontalCommand;
- }(AutoLayoutCommandBase_1.AutoLayoutCommandBase));
- exports.AutoLayoutLayeredHorizontalCommand = AutoLayoutLayeredHorizontalCommand;
- /***/ }),
- /* 197 */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- var __extends = (this && this.__extends) || (function () {
- var extendStatics = function (d, b) {
- extendStatics = Object.setPrototypeOf ||
- ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
- function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
- return extendStatics(d, b);
- };
- return function (d, b) {
- extendStatics(d, b);
- function __() { this.constructor = d; }
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
- };
- })();
- Object.defineProperty(exports, "__esModule", { value: true });
- var CommandBase_1 = __webpack_require__(7);
- var CommandStates_1 = __webpack_require__(6);
- var Utils_1 = __webpack_require__(0);
- var ModelUtils_1 = __webpack_require__(8);
- var UnitConverter_1 = __webpack_require__(13);
- var MoveCommand = /** @class */ (function (_super) {
- __extends(MoveCommand, _super);
- function MoveCommand() {
- return _super !== null && _super.apply(this, arguments) || this;
- }
- MoveCommand.prototype.getState = function () {
- return new CommandStates_1.SimpleCommandState(!this.control.selection.isEmpty());
- };
- MoveCommand.prototype.executeCore = function (state, parameter) {
- var _this = this;
- this.control.history.beginTransaction();
- var shapes = this.control.selection.getSelectedShapes();
- shapes.forEach(function (shape, index) {
- var pos = _this.getPosition(shape.position);
- ModelUtils_1.ModelUtils.setShapePosition(_this.control.history, _this.control.model, shape.key, pos, _this.control.history.addOrModifyAndRedo);
- shape.attachedConnectors.forEach(function (connector) {
- ModelUtils_1.ModelUtils.removeConnectorIntermediatePoints(_this.control.history, connector);
- ModelUtils_1.ModelUtils.updateConnectorAttachedPoints(_this.control.history, connector, _this.control.history.addOrModifyAndRedo);
- });
- });
- var connectors = this.control.selection.getSelectedConnectors();
- connectors.forEach(function (connector, index) {
- var startPtIndex = connector.beginItem ? 1 : 0;
- var endPtIndex = connector.endItem ? (connector.points.length - 2) : (connector.points.length - 1);
- for (var i = startPtIndex; i <= endPtIndex; i++) {
- var pos = _this.getPosition(connector.points[i]);
- ModelUtils_1.ModelUtils.setConnectorPoint(_this.control.history, _this.control.model, connector.key, i, pos, _this.control.history.addOrModifyAndRedo);
- }
- });
- ModelUtils_1.ModelUtils.tryUpdateModelSize(this.control.history, this.control.model);
- this.control.history.endTransaction();
- return true;
- };
- return MoveCommand;
- }(CommandBase_1.CommandBase));
- exports.MoveCommand = MoveCommand;
- var MoveLeftCommand = /** @class */ (function (_super) {
- __extends(MoveLeftCommand, _super);
- function MoveLeftCommand() {
- return _super !== null && _super.apply(this, arguments) || this;
- }
- MoveLeftCommand.prototype.getPosition = function (position) {
- return position.offset(-UnitConverter_1.UnitConverter.pixelsToTwips(1), 0);
- };
- return MoveLeftCommand;
- }(MoveCommand));
- exports.MoveLeftCommand = MoveLeftCommand;
- var MoveStepLeftCommand = /** @class */ (function (_super) {
- __extends(MoveStepLeftCommand, _super);
- function MoveStepLeftCommand() {
- return _super !== null && _super.apply(this, arguments) || this;
- }
- MoveStepLeftCommand.prototype.getPosition = function (position) {
- if (this.control.model.snapToGrid)
- return new Utils_1.Point(ModelUtils_1.ModelUtils.getSnappedPos(this.control.model, position.x - (this.control.model.gridSize / 2 + 2)), position.y);
- else
- return position.offset(-this.control.model.gridSize, 0);
- };
- return MoveStepLeftCommand;
- }(MoveCommand));
- exports.MoveStepLeftCommand = MoveStepLeftCommand;
- var MoveRightCommand = /** @class */ (function (_super) {
- __extends(MoveRightCommand, _super);
- function MoveRightCommand() {
- return _super !== null && _super.apply(this, arguments) || this;
- }
- MoveRightCommand.prototype.getPosition = function (position) {
- return position.offset(UnitConverter_1.UnitConverter.pixelsToTwips(1), 0);
- };
- return MoveRightCommand;
- }(MoveCommand));
- exports.MoveRightCommand = MoveRightCommand;
- var MoveStepRightCommand = /** @class */ (function (_super) {
- __extends(MoveStepRightCommand, _super);
- function MoveStepRightCommand() {
- return _super !== null && _super.apply(this, arguments) || this;
- }
- MoveStepRightCommand.prototype.getPosition = function (position) {
- if (this.control.model.snapToGrid)
- return new Utils_1.Point(ModelUtils_1.ModelUtils.getSnappedPos(this.control.model, position.x + (this.control.model.gridSize / 2 + 2)), position.y);
- else
- return position.offset(this.control.model.gridSize, 0);
- };
- return MoveStepRightCommand;
- }(MoveCommand));
- exports.MoveStepRightCommand = MoveStepRightCommand;
- var MoveUpCommand = /** @class */ (function (_super) {
- __extends(MoveUpCommand, _super);
- function MoveUpCommand() {
- return _super !== null && _super.apply(this, arguments) || this;
- }
- MoveUpCommand.prototype.getPosition = function (position) {
- return position.offset(0, -UnitConverter_1.UnitConverter.pixelsToTwips(1));
- };
- return MoveUpCommand;
- }(MoveCommand));
- exports.MoveUpCommand = MoveUpCommand;
- var MoveStepUpCommand = /** @class */ (function (_super) {
- __extends(MoveStepUpCommand, _super);
- function MoveStepUpCommand() {
- return _super !== null && _super.apply(this, arguments) || this;
- }
- MoveStepUpCommand.prototype.getPosition = function (position) {
- if (this.control.model.snapToGrid)
- return new Utils_1.Point(position.x, ModelUtils_1.ModelUtils.getSnappedPos(this.control.model, position.y - (this.control.model.gridSize / 2 + 2)));
- else
- return position.offset(0, -this.control.model.gridSize);
- };
- return MoveStepUpCommand;
- }(MoveCommand));
- exports.MoveStepUpCommand = MoveStepUpCommand;
- var MoveDownCommand = /** @class */ (function (_super) {
- __extends(MoveDownCommand, _super);
- function MoveDownCommand() {
- return _super !== null && _super.apply(this, arguments) || this;
- }
- MoveDownCommand.prototype.getPosition = function (position) {
- return position.offset(0, UnitConverter_1.UnitConverter.pixelsToTwips(1));
- };
- return MoveDownCommand;
- }(MoveCommand));
- exports.MoveDownCommand = MoveDownCommand;
- var MoveStepDownCommand = /** @class */ (function (_super) {
- __extends(MoveStepDownCommand, _super);
- function MoveStepDownCommand() {
- return _super !== null && _super.apply(this, arguments) || this;
- }
- MoveStepDownCommand.prototype.getPosition = function (position) {
- if (this.control.model.snapToGrid)
- return new Utils_1.Point(position.x, ModelUtils_1.ModelUtils.getSnappedPos(this.control.model, position.y + (this.control.model.gridSize / 2 + 2)));
- else
- return position.offset(0, this.control.model.gridSize);
- };
- return MoveStepDownCommand;
- }(MoveCommand));
- exports.MoveStepDownCommand = MoveStepDownCommand;
- /***/ }),
- /* 198 */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- var __extends = (this && this.__extends) || (function () {
- var extendStatics = function (d, b) {
- extendStatics = Object.setPrototypeOf ||
- ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
- function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
- return extendStatics(d, b);
- };
- return function (d, b) {
- extendStatics(d, b);
- function __() { this.constructor = d; }
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
- };
- })();
- Object.defineProperty(exports, "__esModule", { value: true });
- var ChangePagePropertyCommand_1 = __webpack_require__(23);
- var SetSelectionHistoryItem_1 = __webpack_require__(29);
- var ChangeZoomLevelCommand = /** @class */ (function (_super) {
- __extends(ChangeZoomLevelCommand, _super);
- function ChangeZoomLevelCommand() {
- return _super !== null && _super.apply(this, arguments) || this;
- }
- ChangeZoomLevelCommand.prototype.getPropertyName = function () {
- return "zoomLevel";
- };
- ChangeZoomLevelCommand.prototype.createHistoryItems = function (propertyName, parameter) {
- var result = _super.prototype.createHistoryItems.call(this, propertyName, parameter);
- return result.concat([new SetSelectionHistoryItem_1.SetSelectionHistoryItem(this.control.selection, [])]);
- };
- ChangeZoomLevelCommand.prototype.getPropertyOptions = function () {
- return [
- { value: 0.5, text: "50%" },
- { value: 0.75, text: "75%" },
- { value: 1, text: "100%" },
- { value: 1.25, text: "125%" },
- { value: 1.5, text: "150%" },
- { value: 2, text: "200%" },
- { value: 3, text: "300%" }
- ];
- };
- return ChangeZoomLevelCommand;
- }(ChangePagePropertyCommand_1.ChangePagePropertyCommand));
- exports.ChangeZoomLevelCommand = ChangeZoomLevelCommand;
- /***/ }),
- /* 199 */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- var __extends = (this && this.__extends) || (function () {
- var extendStatics = function (d, b) {
- extendStatics = Object.setPrototypeOf ||
- ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
- function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
- return extendStatics(d, b);
- };
- return function (d, b) {
- extendStatics(d, b);
- function __() { this.constructor = d; }
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
- };
- })();
- Object.defineProperty(exports, "__esModule", { value: true });
- var ModelUtils_1 = __webpack_require__(8);
- var ImportDataCommandBase_1 = __webpack_require__(89);
- var DocumentDataSource_1 = __webpack_require__(200);
- var BindDocumentCommand = /** @class */ (function (_super) {
- __extends(BindDocumentCommand, _super);
- function BindDocumentCommand() {
- return _super !== null && _super.apply(this, arguments) || this;
- }
- BindDocumentCommand.prototype.performImportData = function (parameter) {
- var dataSource = new DocumentDataSource_1.DocumentDataSource(parameter.nodeDataSource, parameter.edgeDataSource, parameter.nodeDataImporter, parameter.edgeDataImporter);
- this.control.registerDocumentDataSource(dataSource);
- if (parameter.layoutType !== undefined) {
- this.control.history.beginTransaction();
- ModelUtils_1.ModelUtils.deleteAllItems(this.control.history, this.control.model, this.control.selection);
- this.createItems(dataSource, parameter.layoutType);
- this.control.history.endTransaction();
- }
- this.control.history.clear();
- };
- return BindDocumentCommand;
- }(ImportDataCommandBase_1.ImportDataCommandBase));
- exports.BindDocumentCommand = BindDocumentCommand;
- /***/ }),
- /* 200 */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- var __extends = (this && this.__extends) || (function () {
- var extendStatics = function (d, b) {
- extendStatics = Object.setPrototypeOf ||
- ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
- function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
- return extendStatics(d, b);
- };
- return function (d, b) {
- extendStatics(d, b);
- function __() { this.constructor = d; }
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
- };
- })();
- Object.defineProperty(exports, "__esModule", { value: true });
- var ShapeType_1 = __webpack_require__(1);
- var Shape_1 = __webpack_require__(9);
- var Connector_1 = __webpack_require__(5);
- var ModelUtils_1 = __webpack_require__(8);
- var DataSource_1 = __webpack_require__(37);
- var DocumentDataSource = /** @class */ (function (_super) {
- __extends(DocumentDataSource, _super);
- function DocumentDataSource(nodeDataSource, edgeDataSource, nodeDataImporter, edgeDataImporter) {
- return _super.call(this, "Document", "Document Data Source", nodeDataSource, edgeDataSource, nodeDataImporter, edgeDataImporter) || this;
- }
- DocumentDataSource.prototype.createModelItems = function (history, model, selection, layoutType) {
- ModelUtils_1.ModelUtils.createItemsByDataSource(history, model, selection, this, layoutType, true);
- };
- DocumentDataSource.prototype.updateItems = function (model, changesListener) {
- var _this = this;
- this.deleteNodes(model, changesListener);
- this.deleteEdges(model, changesListener);
- model.items.forEach(function (item) {
- if (item instanceof Shape_1.Shape)
- _this.updateNode(item, changesListener);
- if (item instanceof Connector_1.Connector)
- _this.updateEdge(item, changesListener);
- });
- };
- DocumentDataSource.prototype.updateNode = function (shape, changesListener) {
- var _this = this;
- var nodeObj = this.findNode(shape.dataKey);
- if (!nodeObj) {
- var dataObj = {};
- nodeObj = this.addNodeInternal(dataObj, shape.text, shape.description.key);
- this.nodeDataSource.push(nodeObj.dataObj);
- this.nodeDataImporter.setKey(dataObj, nodeObj.key);
- this.updateNodeObject(nodeObj, shape);
- this.updateNodeObjectKey(nodeObj, nodeObj.dataObj, shape);
- changesListener.NotifyNodeInserted.call(changesListener, nodeObj.dataObj, function (data) {
- _this.updateNodeObjectKey(nodeObj, data, shape);
- });
- }
- else {
- if (this.isNodeObjectModified(nodeObj, shape)) {
- this.updateNodeObject(nodeObj, shape);
- changesListener.NotifyNodeUpdated.call(changesListener, this.nodeDataImporter.getKey(nodeObj.dataObj || nodeObj.key), nodeObj.dataObj, function (key, data) { });
- }
- }
- if (this.useNodeParentId) {
- var parentKey = this.getParentShapeKey(shape);
- var parentItem = this.findNode(parentKey);
- this.updateNodeObjectParentKey(nodeObj, parentItem, changesListener);
- }
- if (this.useNodeItems) {
- var parentKey = this.getParentShapeKey(shape);
- var parentItem = this.findNode(parentKey);
- this.updateNodeObjectItems(nodeObj, parentItem, changesListener);
- }
- };
- DocumentDataSource.prototype.isNodeObjectModified = function (nodeObj, shape) {
- return nodeObj.text !== shape.text || (nodeObj.type !== shape.description.key &&
- !(nodeObj.type === undefined && shape.description.key === ShapeType_1.ShapeType.Rectangle));
- };
- DocumentDataSource.prototype.updateNodeObject = function (nodeObj, shape) {
- nodeObj.text = shape.text;
- this.nodeDataImporter.setText(nodeObj.dataObj, shape.text);
- nodeObj.type = shape.description.key;
- this.nodeDataImporter.setType(nodeObj.dataObj, shape.description.key);
- };
- DocumentDataSource.prototype.updateNodeObjectParentKey = function (nodeObj, parentNodeObj, changesListener) {
- var parentKey = this.nodeDataImporter.getParentKey(nodeObj.dataObj);
- var newParentKey = parentNodeObj ? this.nodeDataImporter.getKey(parentNodeObj.dataObj) : undefined;
- if (parentKey !== newParentKey) {
- this.nodeDataImporter.setParentKey(nodeObj.dataObj, newParentKey);
- changesListener.NotifyNodeUpdated.call(changesListener, this.nodeDataImporter.getKey(nodeObj.dataObj) || nodeObj.key, nodeObj.dataObj, function (key, data) { });
- }
- };
- DocumentDataSource.prototype.updateNodeObjectItems = function (nodeObj, parentNodeObj, changesListener) {
- if (parentNodeObj && nodeObj.parentDataObj !== parentNodeObj.dataObj ||
- !parentNodeObj && nodeObj.parentDataObj) {
- if (!parentNodeObj || !this.checkNodeCyrcleItems(nodeObj.dataObj, parentNodeObj.dataObj)) {
- var oldItemsArray = nodeObj.parentDataObj ? this.nodeDataImporter.getItems(nodeObj.parentDataObj) : this.nodeDataSource;
- var index = oldItemsArray.indexOf(nodeObj.dataObj);
- oldItemsArray.splice(index, 1);
- var itemsArray = parentNodeObj ? this.nodeDataImporter.getItems(parentNodeObj.dataObj) : this.nodeDataSource;
- if (!itemsArray)
- this.nodeDataImporter.setItems(parentNodeObj.dataObj, [nodeObj.dataObj]);
- else
- itemsArray.push(nodeObj.dataObj);
- nodeObj.parentDataObj = parentNodeObj && parentNodeObj.dataObj;
- changesListener.NotifyNodeUpdated.call(changesListener, this.nodeDataImporter.getKey(nodeObj.dataObj) || nodeObj.key, nodeObj.dataObj, function (key, data) { });
- }
- }
- };
- DocumentDataSource.prototype.checkNodeCyrcleItems = function (nodeDataObj, parentDataObjCandidate) {
- var _this = this;
- var result = false;
- var items = this.nodeDataImporter.getItems(nodeDataObj);
- if (items) {
- items.forEach(function (childDataObj) {
- result = result || childDataObj === parentDataObjCandidate ||
- _this.checkNodeCyrcleItems(childDataObj, parentDataObjCandidate);
- });
- }
- return result;
- };
- DocumentDataSource.prototype.updateNodeObjectKey = function (nodeObj, dataObj, shape) {
- var key = this.nodeDataImporter.getKey(dataObj);
- if (key !== undefined && key !== null && key !== nodeObj.key) {
- nodeObj.key = key.toString();
- delete this.nodeKeyMap[nodeObj.key];
- this.nodeKeyMap[key] = nodeObj.key;
- }
- shape.dataKey = nodeObj.key;
- nodeObj.dataObj = dataObj;
- };
- DocumentDataSource.prototype.updateEdge = function (connector, changesListener) {
- var _this = this;
- var beginDataKey = connector.beginItem ? connector.beginItem.dataKey : undefined;
- var endDataKey = connector.endItem ? connector.endItem.dataKey : undefined;
- var edgeObj = this.findEdge(connector.dataKey);
- if (!edgeObj) {
- var dataObj = this.useEdgesArray() ? {} : undefined;
- edgeObj = this.addEdgeInternal(dataObj, beginDataKey, endDataKey);
- if (dataObj) {
- this.edgeDataImporter.setKey(dataObj, edgeObj.key);
- this.edgeDataSource.push(edgeObj.dataObj);
- }
- this.updateEdgeObject(edgeObj, connector);
- this.updateEdgeObjectKey(edgeObj, edgeObj.dataObj, connector);
- if (dataObj) {
- changesListener.NotifyEdgeInserted.call(changesListener, edgeObj.dataObj, function (data) {
- _this.updateEdgeObjectKey(edgeObj, data, connector);
- });
- }
- }
- else {
- if (this.isEdgeObjectModified(edgeObj, connector)) {
- this.updateEdgeObject(edgeObj, connector);
- if (edgeObj.dataObj) {
- changesListener.NotifyEdgeUpdated.call(changesListener, this.edgeDataImporter.getKey(edgeObj.dataObj) || edgeObj.key, edgeObj.dataObj, function (key, data) { });
- }
- }
- }
- };
- DocumentDataSource.prototype.isEdgeObjectModified = function (edgeObj, connector) {
- return edgeObj.from !== (connector.beginItem ? connector.beginItem.dataKey : undefined) ||
- edgeObj.to !== (connector.endItem ? connector.endItem.dataKey : undefined);
- };
- DocumentDataSource.prototype.updateEdgeObject = function (edgeObj, connector) {
- var fromObj = this.findNode(connector.beginItem && connector.beginItem.dataKey);
- edgeObj.from = fromObj && fromObj.key;
- if (edgeObj.dataObj)
- this.edgeDataImporter.setFrom(edgeObj.dataObj, fromObj && fromObj.dataObj && this.nodeDataImporter.getKey(fromObj.dataObj));
- var toObj = this.findNode(connector.endItem && connector.endItem.dataKey);
- edgeObj.to = toObj && toObj.key;
- if (edgeObj.dataObj)
- this.edgeDataImporter.setTo(edgeObj.dataObj, toObj && toObj.dataObj && this.nodeDataImporter.getKey(toObj.dataObj));
- };
- DocumentDataSource.prototype.updateEdgeObjectKey = function (edgeObj, dataObj, connector) {
- var key = dataObj && this.edgeDataImporter.getKey(dataObj);
- if (key !== undefined && key !== null && key !== edgeObj.key) {
- edgeObj.key = key.toString();
- delete this.edgeKeyMap[edgeObj.key];
- this.edgeKeyMap[key] = edgeObj.key;
- }
- connector.dataKey = edgeObj.key;
- edgeObj.dataObj = dataObj;
- };
- DocumentDataSource.prototype.deleteNodes = function (model, changesListener) {
- var _this = this;
- this.deleteItems(this.nodes, function (key) { return model.findShapeByDataKey(key); }, function (item) { return _this.getNodeParentArray(item); }, function (item, dataModified) {
- var key = (item.dataObj && _this.nodeDataImporter.getKey(item.dataObj)) || item.key;
- var dataKey = _this.nodeKeyMap[key];
- if (dataKey)
- delete _this.nodeKeyMap[key];
- var nodeObj = _this.findNode(dataKey);
- if (nodeObj)
- _this.nodes.splice(_this.nodes.indexOf(nodeObj), 1);
- if (dataModified)
- changesListener.NotifyNodeRemoved.call(changesListener, key, function (key) { });
- });
- };
- DocumentDataSource.prototype.deleteEdges = function (model, changesListener) {
- var _this = this;
- this.deleteItems(this.edges, function (key) { return model.findConnectorByDataKey(key); }, function (item) { return _this.edgeDataSource; }, function (item, dataModified) {
- var key = (item.dataObj && _this.edgeDataImporter.getKey(item.dataObj)) || item.key;
- var dataKey = _this.edgeKeyMap[key];
- if (dataKey)
- delete _this.edgeKeyMap[key];
- var edgeObj = _this.findEdge(dataKey);
- if (edgeObj)
- _this.edges.splice(_this.edges.indexOf(edgeObj), 1);
- if (dataModified)
- changesListener.NotifyEdgeRemoved.call(changesListener, key, function (key) { });
- });
- };
- DocumentDataSource.prototype.deleteItems = function (dataSourceItems, findItem, getParentArray, callback) {
- var items = dataSourceItems.slice();
- items.forEach(function (item) {
- if (item.key && !findItem(item.key)) {
- var parentArray = getParentArray(item);
- var index = parentArray.indexOf(item.dataObj);
- parentArray.splice(index, 1);
- callback(item, index > -1);
- }
- });
- };
- DocumentDataSource.prototype.getParentShapeKey = function (shape) {
- var parentKey;
- for (var i = 0; i < shape.attachedConnectors.length; i++) {
- if (shape.attachedConnectors[i].endItem === shape) {
- var parentShape = shape.attachedConnectors[i].beginItem;
- parentKey = parentShape && parentShape.dataKey;
- break;
- }
- }
- return parentKey;
- };
- DocumentDataSource.prototype.getNodeParentArray = function (item) {
- var items;
- if (this.useNodeItems && item.parentDataObj)
- items = this.nodeDataImporter.getItems(item.parentDataObj);
- return items || this.nodeDataSource;
- };
- return DocumentDataSource;
- }(DataSource_1.DataSource));
- exports.DocumentDataSource = DocumentDataSource;
- /***/ }),
- /* 201 */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- var __extends = (this && this.__extends) || (function () {
- var extendStatics = function (d, b) {
- extendStatics = Object.setPrototypeOf ||
- ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
- function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
- return extendStatics(d, b);
- };
- return function (d, b) {
- extendStatics(d, b);
- function __() { this.constructor = d; }
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
- };
- })();
- Object.defineProperty(exports, "__esModule", { value: true });
- var CommandStates_1 = __webpack_require__(6);
- var ModelUtils_1 = __webpack_require__(8);
- var CommandBase_1 = __webpack_require__(7);
- var UnbindDocumentCommand = /** @class */ (function (_super) {
- __extends(UnbindDocumentCommand, _super);
- function UnbindDocumentCommand() {
- return _super !== null && _super.apply(this, arguments) || this;
- }
- UnbindDocumentCommand.prototype.getState = function () {
- return new CommandStates_1.SimpleCommandState(true);
- };
- UnbindDocumentCommand.prototype.executeCore = function (state) {
- this.control.unregisterDocumentDataSource();
- ModelUtils_1.ModelUtils.deleteAllItems(this.control.history, this.control.model, this.control.selection);
- this.control.history.clear();
- if (this.control.renderManager)
- this.control.renderManager.onWindowResize(null);
- return true;
- };
- return UnbindDocumentCommand;
- }(CommandBase_1.CommandBase));
- exports.UnbindDocumentCommand = UnbindDocumentCommand;
- /***/ }),
- /* 202 */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- var __extends = (this && this.__extends) || (function () {
- var extendStatics = function (d, b) {
- extendStatics = Object.setPrototypeOf ||
- ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
- function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
- return extendStatics(d, b);
- };
- return function (d, b) {
- extendStatics(d, b);
- function __() { this.constructor = d; }
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
- };
- })();
- Object.defineProperty(exports, "__esModule", { value: true });
- var AutoLayoutCommandBase_1 = __webpack_require__(43);
- var WideTree_1 = __webpack_require__(61);
- var LayoutSettings_1 = __webpack_require__(18);
- var AutoLayoutTreeHorizontalCommand = /** @class */ (function (_super) {
- __extends(AutoLayoutTreeHorizontalCommand, _super);
- function AutoLayoutTreeHorizontalCommand() {
- return _super !== null && _super.apply(this, arguments) || this;
- }
- AutoLayoutTreeHorizontalCommand.prototype.createLayout = function (graph) {
- var settings = this.createLayoutSettings();
- settings.orientation = LayoutSettings_1.OrientationKind.Horizontal;
- return new WideTree_1.TreeLayoutBuilder(settings, graph).build();
- };
- return AutoLayoutTreeHorizontalCommand;
- }(AutoLayoutCommandBase_1.AutoLayoutCommandBase));
- exports.AutoLayoutTreeHorizontalCommand = AutoLayoutTreeHorizontalCommand;
- /***/ }),
- /* 203 */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- var __extends = (this && this.__extends) || (function () {
- var extendStatics = function (d, b) {
- extendStatics = Object.setPrototypeOf ||
- ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
- function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
- return extendStatics(d, b);
- };
- return function (d, b) {
- extendStatics(d, b);
- function __() { this.constructor = d; }
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
- };
- })();
- Object.defineProperty(exports, "__esModule", { value: true });
- var AutoLayoutCommandBase_1 = __webpack_require__(43);
- var Sugiyama_1 = __webpack_require__(40);
- var LayoutSettings_1 = __webpack_require__(18);
- var AutoLayoutLayeredVerticalCommand = /** @class */ (function (_super) {
- __extends(AutoLayoutLayeredVerticalCommand, _super);
- function AutoLayoutLayeredVerticalCommand() {
- return _super !== null && _super.apply(this, arguments) || this;
- }
- AutoLayoutLayeredVerticalCommand.prototype.createLayout = function (graph) {
- var settings = this.createLayoutSettings();
- settings.orientation = LayoutSettings_1.OrientationKind.Vertical;
- return new Sugiyama_1.SugiyamaLayoutBuilder(settings, graph).build();
- };
- return AutoLayoutLayeredVerticalCommand;
- }(AutoLayoutCommandBase_1.AutoLayoutCommandBase));
- exports.AutoLayoutLayeredVerticalCommand = AutoLayoutLayeredVerticalCommand;
- /***/ }),
- /* 204 */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- var __extends = (this && this.__extends) || (function () {
- var extendStatics = function (d, b) {
- extendStatics = Object.setPrototypeOf ||
- ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
- function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
- return extendStatics(d, b);
- };
- return function (d, b) {
- extendStatics(d, b);
- function __() { this.constructor = d; }
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
- };
- })();
- Object.defineProperty(exports, "__esModule", { value: true });
- var CommandStates_1 = __webpack_require__(6);
- var CommandBase_1 = __webpack_require__(7);
- var CloseDataSourceCommand = /** @class */ (function (_super) {
- __extends(CloseDataSourceCommand, _super);
- function CloseDataSourceCommand() {
- return _super !== null && _super.apply(this, arguments) || this;
- }
- CloseDataSourceCommand.prototype.getState = function () {
- return new CommandStates_1.SimpleCommandState(true);
- };
- CloseDataSourceCommand.prototype.executeCore = function (state, parameter) {
- this.control.unregisterDataSource(parameter);
- return true;
- };
- return CloseDataSourceCommand;
- }(CommandBase_1.CommandBase));
- exports.CloseDataSourceCommand = CloseDataSourceCommand;
- /***/ }),
- /* 205 */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- var __extends = (this && this.__extends) || (function () {
- var extendStatics = function (d, b) {
- extendStatics = Object.setPrototypeOf ||
- ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
- function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
- return extendStatics(d, b);
- };
- return function (d, b) {
- extendStatics(d, b);
- function __() { this.constructor = d; }
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
- };
- })();
- Object.defineProperty(exports, "__esModule", { value: true });
- var ChangeLockedCommand_1 = __webpack_require__(94);
- var LockCommand = /** @class */ (function (_super) {
- __extends(LockCommand, _super);
- function LockCommand() {
- return _super !== null && _super.apply(this, arguments) || this;
- }
- LockCommand.prototype.getLockState = function () {
- return true;
- };
- return LockCommand;
- }(ChangeLockedCommand_1.ChangeLockedCommand));
- exports.LockCommand = LockCommand;
- /***/ }),
- /* 206 */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- var __extends = (this && this.__extends) || (function () {
- var extendStatics = function (d, b) {
- extendStatics = Object.setPrototypeOf ||
- ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
- function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
- return extendStatics(d, b);
- };
- return function (d, b) {
- extendStatics(d, b);
- function __() { this.constructor = d; }
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
- };
- })();
- Object.defineProperty(exports, "__esModule", { value: true });
- var HistoryItem_1 = __webpack_require__(4);
- var ChangeLockedHistoryItem = /** @class */ (function (_super) {
- __extends(ChangeLockedHistoryItem, _super);
- function ChangeLockedHistoryItem(item, locked) {
- var _this = _super.call(this) || this;
- _this.itemKey = item.key;
- _this.locked = locked;
- return _this;
- }
- ChangeLockedHistoryItem.prototype.redo = function (manipulator) {
- var item = manipulator.model.findItem(this.itemKey);
- this.oldLocked = item.locked;
- manipulator.changeLocked(item, this.locked);
- };
- ChangeLockedHistoryItem.prototype.undo = function (manipulator) {
- var item = manipulator.model.findItem(this.itemKey);
- manipulator.changeLocked(item, this.oldLocked);
- };
- return ChangeLockedHistoryItem;
- }(HistoryItem_1.HistoryItem));
- exports.ChangeLockedHistoryItem = ChangeLockedHistoryItem;
- /***/ }),
- /* 207 */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- var __extends = (this && this.__extends) || (function () {
- var extendStatics = function (d, b) {
- extendStatics = Object.setPrototypeOf ||
- ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
- function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
- return extendStatics(d, b);
- };
- return function (d, b) {
- extendStatics(d, b);
- function __() { this.constructor = d; }
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
- };
- })();
- Object.defineProperty(exports, "__esModule", { value: true });
- var ChangeLockedCommand_1 = __webpack_require__(94);
- var UnLockCommand = /** @class */ (function (_super) {
- __extends(UnLockCommand, _super);
- function UnLockCommand() {
- return _super !== null && _super.apply(this, arguments) || this;
- }
- UnLockCommand.prototype.getLockState = function () {
- return false;
- };
- return UnLockCommand;
- }(ChangeLockedCommand_1.ChangeLockedCommand));
- exports.UnLockCommand = UnLockCommand;
- /***/ }),
- /* 208 */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- var __extends = (this && this.__extends) || (function () {
- var extendStatics = function (d, b) {
- extendStatics = Object.setPrototypeOf ||
- ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
- function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
- return extendStatics(d, b);
- };
- return function (d, b) {
- extendStatics(d, b);
- function __() { this.constructor = d; }
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
- };
- })();
- Object.defineProperty(exports, "__esModule", { value: true });
- var CommandBase_1 = __webpack_require__(7);
- var CommandStates_1 = __webpack_require__(6);
- var Model_1 = __webpack_require__(21);
- var ModelUtils_1 = __webpack_require__(8);
- var CloneCommand = /** @class */ (function (_super) {
- __extends(CloneCommand, _super);
- function CloneCommand() {
- return _super !== null && _super.apply(this, arguments) || this;
- }
- CloneCommand.prototype.getState = function () {
- return new CommandStates_1.SimpleCommandState(!this.control.selection.isEmpty());
- };
- CloneCommand.prototype.executeCore = function (state, parameter) {
- var selectionRect = Model_1.DiagramModel.getRectangle(this.control.selection.getSelectedItems());
- ModelUtils_1.ModelUtils.cloneSelectionToOffset(this.control.history, this.control.model, this.control.selection, this.getOffsetX(selectionRect), this.getOffsetY(selectionRect));
- return true;
- };
- CloneCommand.prototype.getOffsetX = function (selectionRect) {
- return 0;
- };
- ;
- CloneCommand.prototype.getOffsetY = function (selectionRect) {
- return 0;
- };
- ;
- return CloneCommand;
- }(CommandBase_1.CommandBase));
- exports.CloneCommand = CloneCommand;
- var CloneLeftCommand = /** @class */ (function (_super) {
- __extends(CloneLeftCommand, _super);
- function CloneLeftCommand() {
- return _super !== null && _super.apply(this, arguments) || this;
- }
- CloneLeftCommand.prototype.getOffsetX = function (selectionRect) {
- return -selectionRect.width;
- };
- ;
- return CloneLeftCommand;
- }(CloneCommand));
- exports.CloneLeftCommand = CloneLeftCommand;
- var CloneRightCommand = /** @class */ (function (_super) {
- __extends(CloneRightCommand, _super);
- function CloneRightCommand() {
- return _super !== null && _super.apply(this, arguments) || this;
- }
- CloneRightCommand.prototype.getOffsetX = function (selectionRect) {
- return selectionRect.width;
- };
- ;
- return CloneRightCommand;
- }(CloneCommand));
- exports.CloneRightCommand = CloneRightCommand;
- var CloneUpCommand = /** @class */ (function (_super) {
- __extends(CloneUpCommand, _super);
- function CloneUpCommand() {
- return _super !== null && _super.apply(this, arguments) || this;
- }
- CloneUpCommand.prototype.getOffsetY = function (selectionRect) {
- return -selectionRect.height;
- };
- ;
- return CloneUpCommand;
- }(CloneCommand));
- exports.CloneUpCommand = CloneUpCommand;
- var CloneDownCommand = /** @class */ (function (_super) {
- __extends(CloneDownCommand, _super);
- function CloneDownCommand() {
- return _super !== null && _super.apply(this, arguments) || this;
- }
- CloneDownCommand.prototype.getOffsetY = function (selectionRect) {
- return selectionRect.height;
- };
- ;
- return CloneDownCommand;
- }(CloneCommand));
- exports.CloneDownCommand = CloneDownCommand;
- /***/ }),
- /* 209 */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- var __extends = (this && this.__extends) || (function () {
- var extendStatics = function (d, b) {
- extendStatics = Object.setPrototypeOf ||
- ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
- function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
- return extendStatics(d, b);
- };
- return function (d, b) {
- extendStatics(d, b);
- function __() { this.constructor = d; }
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
- };
- })();
- Object.defineProperty(exports, "__esModule", { value: true });
- var ChangePagePropertyCommand_1 = __webpack_require__(23);
- var Model_1 = __webpack_require__(21);
- var ChangeUnitsCommand = /** @class */ (function (_super) {
- __extends(ChangeUnitsCommand, _super);
- function ChangeUnitsCommand() {
- return _super !== null && _super.apply(this, arguments) || this;
- }
- ChangeUnitsCommand.prototype.getPropertyName = function () {
- return "units";
- };
- ChangeUnitsCommand.prototype.getPropertyOptions = function () {
- return [
- { value: Model_1.DiagramUnit.In, text: "in" },
- { value: Model_1.DiagramUnit.Cm, text: "cm" },
- { value: Model_1.DiagramUnit.Px, text: "px" }
- ];
- };
- return ChangeUnitsCommand;
- }(ChangePagePropertyCommand_1.ChangePagePropertyCommand));
- exports.ChangeUnitsCommand = ChangeUnitsCommand;
- /***/ }),
- /* 210 */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- var __extends = (this && this.__extends) || (function () {
- var extendStatics = function (d, b) {
- extendStatics = Object.setPrototypeOf ||
- ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
- function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
- return extendStatics(d, b);
- };
- return function (d, b) {
- extendStatics(d, b);
- function __() { this.constructor = d; }
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
- };
- })();
- Object.defineProperty(exports, "__esModule", { value: true });
- var ChangePagePropertyCommand_1 = __webpack_require__(23);
- var ChangePageColorCommand = /** @class */ (function (_super) {
- __extends(ChangePageColorCommand, _super);
- function ChangePageColorCommand() {
- return _super !== null && _super.apply(this, arguments) || this;
- }
- ChangePageColorCommand.prototype.getPropertyName = function () {
- return "pageColor";
- };
- return ChangePageColorCommand;
- }(ChangePagePropertyCommand_1.ChangePagePropertyCommand));
- exports.ChangePageColorCommand = ChangePageColorCommand;
- /***/ }),
- /* 211 */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- var __extends = (this && this.__extends) || (function () {
- var extendStatics = function (d, b) {
- extendStatics = Object.setPrototypeOf ||
- ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
- function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
- return extendStatics(d, b);
- };
- return function (d, b) {
- extendStatics(d, b);
- function __() { this.constructor = d; }
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
- };
- })();
- Object.defineProperty(exports, "__esModule", { value: true });
- var ChangePagePropertyCommand_1 = __webpack_require__(23);
- var ChangeShowGridCommand = /** @class */ (function (_super) {
- __extends(ChangeShowGridCommand, _super);
- function ChangeShowGridCommand() {
- return _super !== null && _super.apply(this, arguments) || this;
- }
- ChangeShowGridCommand.prototype.getPropertyName = function () {
- return "showGrid";
- };
- return ChangeShowGridCommand;
- }(ChangePagePropertyCommand_1.ChangePagePropertyCommand));
- exports.ChangeShowGridCommand = ChangeShowGridCommand;
- /***/ }),
- /* 212 */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- var __extends = (this && this.__extends) || (function () {
- var extendStatics = function (d, b) {
- extendStatics = Object.setPrototypeOf ||
- ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
- function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
- return extendStatics(d, b);
- };
- return function (d, b) {
- extendStatics(d, b);
- function __() { this.constructor = d; }
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
- };
- })();
- Object.defineProperty(exports, "__esModule", { value: true });
- var CommandBase_1 = __webpack_require__(7);
- var CommandStates_1 = __webpack_require__(6);
- var ToggleFullscreenCommand = /** @class */ (function (_super) {
- __extends(ToggleFullscreenCommand, _super);
- function ToggleFullscreenCommand() {
- return _super !== null && _super.apply(this, arguments) || this;
- }
- ToggleFullscreenCommand.prototype.getState = function () {
- return new CommandStates_1.SimpleCommandState(true, this.control.settings.fullscreen);
- };
- ToggleFullscreenCommand.prototype.executeCore = function (state, parameter) {
- this.control.settings.fullscreen = !this.control.settings.fullscreen;
- this.control.NotifyToggleFullscreen(this.control.settings.fullscreen);
- return true;
- };
- return ToggleFullscreenCommand;
- }(CommandBase_1.CommandBase));
- exports.ToggleFullscreenCommand = ToggleFullscreenCommand;
- /***/ }),
- /* 213 */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- Object.defineProperty(exports, "__esModule", { value: true });
- var ModelManipulator_1 = __webpack_require__(214);
- var CanvasManager_1 = __webpack_require__(44);
- var CommandManager_1 = __webpack_require__(68);
- var EventManager_1 = __webpack_require__(215);
- var SelectionController_1 = __webpack_require__(238);
- var Model_1 = __webpack_require__(21);
- var Selection_1 = __webpack_require__(239);
- var History_1 = __webpack_require__(241);
- var BarManager_1 = __webpack_require__(242);
- var RenderManager_1 = __webpack_require__(10);
- var ShapeToolbox_1 = __webpack_require__(244);
- var DataToolbox_1 = __webpack_require__(245);
- var ShapeDescriptionManager_1 = __webpack_require__(30);
- var DiagramSettings_1 = __webpack_require__(246);
- var DiagramControl = /** @class */ (function () {
- function DiagramControl() {
- this.dataSources = [];
- this.settings = new DiagramSettings_1.DiagramSettings();
- this.model = new Model_1.DiagramModel();
- this.selection = new Selection_1.Selection(this.model);
- this.modelManipulator = new ModelManipulator_1.ModelManipulator(this.model);
- this.modelManipulator.initialize(this.model);
- this.history = new History_1.History(this.modelManipulator);
- this.commandManager = new CommandManager_1.CommandManager(this);
- this.eventManager = new EventManager_1.EventManager(this);
- this.barManager = new BarManager_1.BarManager(this);
- this.selection.onChanged.add(this.barManager);
- this.modelManipulator.onLoad();
- this.history.onChanged.add(this);
- }
- DiagramControl.prototype.createDocument = function (parent) {
- if (this.renderManager) {
- if (this.renderManager.mainElement.parentNode !== parent)
- parent.appendChild(this.renderManager.mainElement);
- }
- else {
- this.renderManager = new RenderManager_1.RenderManager(parent, this.eventManager);
- this.canvasManager = new CanvasManager_1.CanvasManager(this.renderManager.svgElement);
- this.eventManager.onTextInputOperation.add(this.renderManager);
- this.eventManager.onTextInputOperation.add(this.canvasManager);
- this.eventManager.onMouseOperation.add(this.canvasManager);
- this.eventManager.onVisualizersUpdate.add(this.canvasManager);
- this.modelManipulator.onModelChanged.add(this.renderManager);
- this.modelManipulator.onModelChanged.add(this.canvasManager);
- var selectionController = new SelectionController_1.SelectionController(this.selection);
- this.modelManipulator.onModelChanged.add(selectionController);
- selectionController.onSelectionChanged.add(this.canvasManager);
- this.modelManipulator.onLoad();
- }
- };
- DiagramControl.prototype.createToolbox = function (parent, shapeIconSize, shapeIconSpacing, shapeIconAttributes, shapes) {
- var toolbox = new ShapeToolbox_1.ShapeToolboxManager();
- toolbox.initialize(parent, {
- shapeIconSize: shapeIconSize,
- shapeIconSpacing: shapeIconSpacing,
- shapeIconAttributes: shapeIconAttributes,
- shapes: shapes
- });
- toolbox.onDragOperation.add(this);
- this.eventManager.registerToolbox(toolbox);
- };
- DiagramControl.prototype.createDataSourceToolbox = function (key, parent) {
- if (key === undefined || key === null)
- throw new Error("Data source toolbox key must be specified");
- var dataSource = this.getDataSource(key);
- if (!dataSource)
- throw Error("Data source with the specified key cannot be found");
- var toolbox = new DataToolbox_1.DataToolboxManager(key);
- toolbox.initialize(parent, dataSource);
- toolbox.onDragOperation.add(this);
- this.eventManager.registerToolbox(toolbox);
- };
- DiagramControl.prototype.updateLayout = function () {
- if (this.renderManager)
- this.renderManager.updateLayout();
- };
- DiagramControl.prototype.captureFocus = function () {
- if (this.renderManager)
- this.renderManager.captureFocus();
- };
- DiagramControl.prototype.isFocused = function () {
- if (this.renderManager)
- return this.renderManager.isFocused();
- return true;
- };
- DiagramControl.prototype.addCustomShapes = function (shapes) {
- var _this = this;
- shapes.forEach(function (shape) {
- if (shape.defaultWidth)
- shape.defaultWidth = _this.model.getTwipsUnit(shape.defaultWidth);
- if (shape.defaultHeight)
- shape.defaultHeight = _this.model.getTwipsUnit(shape.defaultHeight);
- ShapeDescriptionManager_1.ShapeDescriptionManager.registerCustomShape(shape);
- });
- };
- DiagramControl.prototype.removeCustomShapes = function (shapeIds) {
- shapeIds.forEach(function (id) {
- ShapeDescriptionManager_1.ShapeDescriptionManager.unregisterCustomShape(id);
- });
- };
- DiagramControl.prototype.getUnitText = function (twipsValue, fractionDigits) {
- if (fractionDigits === void 0) { fractionDigits = 2; }
- return this.model.getModelUnitText(twipsValue, fractionDigits);
- };
- DiagramControl.prototype.importModel = function (model) {
- this.model = model;
- this.importData();
- };
- DiagramControl.prototype.importItemsData = function () {
- this.model.invalidateItems();
- this.importData();
- };
- DiagramControl.prototype.importData = function () {
- if (this.canvasManager !== undefined)
- this.canvasManager.clear();
- this.selection.initialize(this.model);
- this.modelManipulator.initialize(this.model);
- this.history.clear();
- this.eventManager.initialize();
- this.modelManipulator.onLoad();
- };
- DiagramControl.prototype.registerDataSource = function (ds) {
- var dataSource = this.getDataSource(ds.key);
- if (dataSource)
- throw Error("Data Source key is duplicated");
- this.dataSources.push(ds);
- };
- DiagramControl.prototype.unregisterDataSource = function (key) {
- var dataSource = this.getDataSource(key);
- if (dataSource) {
- this.dataSources.splice(this.dataSources.indexOf(dataSource), 1);
- }
- };
- DiagramControl.prototype.getDataSource = function (key) {
- return this.dataSources.filter(function (ds) { return ds.key === key; })[0];
- };
- DiagramControl.prototype.registerDocumentDataSource = function (ds) {
- this.documentDataSource = ds;
- };
- DiagramControl.prototype.unregisterDocumentDataSource = function () {
- delete this.documentDataSource;
- };
- DiagramControl.prototype.beginUpdate = function () {
- this.barManager.beginUpdate();
- };
- DiagramControl.prototype.endUpdate = function () {
- this.barManager.endUpdate();
- };
- DiagramControl.prototype.NotifyEdgeInserted = function (data, callback) {
- if (this.onEdgeInserted)
- this.onEdgeInserted(data, callback);
- };
- DiagramControl.prototype.NotifyEdgeUpdated = function (key, data, callback) {
- if (this.onEdgeUpdated)
- this.onEdgeUpdated(key, data, callback);
- };
- DiagramControl.prototype.NotifyEdgeRemoved = function (key, callback) {
- if (this.onEdgeUpdated)
- this.onEdgeRemoved(key, callback);
- };
- DiagramControl.prototype.NotifyNodeInserted = function (data, callback) {
- if (this.onNodeInserted)
- this.onNodeInserted(data, callback);
- };
- DiagramControl.prototype.NotifyNodeUpdated = function (key, data, callback) {
- if (this.onNodeUpdated)
- this.onNodeUpdated(key, data, callback);
- };
- DiagramControl.prototype.NotifyNodeRemoved = function (key, callback) {
- if (this.onNodeRemoved)
- this.onNodeRemoved(key, callback);
- };
- DiagramControl.prototype.NotifyHistoryChanged = function () {
- if (this.documentDataSource)
- this.documentDataSource.updateItems(this.model, this);
- if (this.onChanged)
- this.onChanged();
- };
- DiagramControl.prototype.NotifyToolboxDragStart = function () {
- if (this.onToolboxDragStart)
- this.onToolboxDragStart();
- };
- DiagramControl.prototype.NotifyToolboxDragEnd = function () {
- if (this.onToolboxDragEnd)
- this.onToolboxDragEnd();
- };
- DiagramControl.prototype.NotifyToggleFullscreen = function (value) {
- if (this.onToggleFullscreen)
- this.onToggleFullscreen(value);
- };
- return DiagramControl;
- }());
- exports.DiagramControl = DiagramControl;
- /***/ }),
- /* 214 */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- Object.defineProperty(exports, "__esModule", { value: true });
- var Shape_1 = __webpack_require__(9);
- var ModelChange_1 = __webpack_require__(48);
- var Utils_1 = __webpack_require__(0);
- var Connector_1 = __webpack_require__(5);
- var ModelManipulator = /** @class */ (function () {
- function ModelManipulator(model) {
- this.onModelChanged = new Utils_1.EventDispatcher();
- this.model = model;
- }
- ModelManipulator.prototype.initialize = function (model) {
- this.model = model;
- };
- ModelManipulator.prototype.onLoad = function () {
- var _this = this;
- var changes = [];
- this.model.iterateItems(function (item) {
- changes.push(_this.createItemChange(item, ModelChange_1.ItemChangeType.Create));
- });
- this.raiseModelChanged([new ModelChange_1.PageChange(this.model, ModelChange_1.PageChangeType.Create)]);
- this.raiseModelChanged(changes);
- };
- // Items
- ModelManipulator.prototype.changeStyle = function (item, styleProperty, styleValue) {
- this.changeStyleCore(item, item.style, styleProperty, styleValue);
- };
- ModelManipulator.prototype.changeStyleText = function (item, styleProperty, styleValue) {
- this.changeStyleCore(item, item.styleText, styleProperty, styleValue);
- };
- ModelManipulator.prototype.changeStyleCore = function (item, styleObj, styleProperty, styleValue) {
- if (styleValue !== undefined)
- styleObj[styleProperty] = styleValue;
- else
- delete styleObj[styleProperty];
- item.invalidatePrimitives();
- this.raiseModelChanged([this.createItemChange(item, ModelChange_1.ItemChangeType.Update)]);
- };
- ModelManipulator.prototype.changeZIndex = function (item, zIndex) {
- item.zIndex = zIndex;
- this.raiseModelChanged([this.createItemChange(item, ModelChange_1.ItemChangeType.UpdateZIndex)]);
- };
- ModelManipulator.prototype.changeLocked = function (item, locked) {
- item.locked = locked;
- this.raiseModelChanged([this.createItemChange(item, ModelChange_1.ItemChangeType.Update)]);
- };
- // Shapes
- ModelManipulator.prototype.addShape = function (shape, key) {
- if (shape.attachedConnectors.length)
- throw Error("A creating shape should not contain existing connectors.");
- shape.key = key !== undefined ? key : this.model.getNextKey();
- return this.insertShape(shape);
- };
- ModelManipulator.prototype.insertShape = function (shape) {
- this.model.pushItem(shape);
- this.raiseModelChanged([new ModelChange_1.ShapeChange(shape, ModelChange_1.ItemChangeType.Create)]);
- return shape;
- };
- ModelManipulator.prototype.resizeShape = function (shape, position, size) {
- shape.position = position;
- shape.size = size;
- shape.invalidatePrimitives();
- this.raiseModelChanged([new ModelChange_1.ShapeChange(shape, ModelChange_1.ItemChangeType.Update)]);
- };
- ModelManipulator.prototype.moveShape = function (shape, position) {
- shape.position = position;
- shape.invalidatePrimitives();
- this.raiseModelChanged([new ModelChange_1.ShapeChange(shape, ModelChange_1.ItemChangeType.Update)]);
- };
- ModelManipulator.prototype.changeShapeParameters = function (shape, parameters) {
- shape.parameters.forEach(function (p) {
- var parameter = parameters.get(p.key);
- if (parameter)
- p.value = parameter.value;
- });
- shape.invalidatePrimitives();
- this.raiseModelChanged([new ModelChange_1.ShapeChange(shape, ModelChange_1.ItemChangeType.Update)]);
- };
- ModelManipulator.prototype.changeShapeText = function (shape, text) {
- shape.text = text;
- shape.invalidatePrimitives();
- this.raiseModelChanged([new ModelChange_1.ShapeChange(shape, ModelChange_1.ItemChangeType.UpdateStructure)]);
- };
- ModelManipulator.prototype.deleteShape = function (shape) {
- if (shape.attachedConnectors.length)
- throw Error("A removing shape should not contain existing connectors.");
- this.removeShape(shape);
- };
- ModelManipulator.prototype.removeShape = function (shape) {
- this.model.removeItem(shape);
- this.raiseModelChanged([new ModelChange_1.ShapeChange(shape, ModelChange_1.ItemChangeType.Remove)]);
- };
- // Connectors
- ModelManipulator.prototype.addConnector = function (connector, key) {
- if (connector.beginItem || connector.endItem)
- throw Error("Creating connector should not contain begin/end items");
- connector.key = key !== undefined ? key : this.model.getNextKey();
- ;
- return this.insertConnector(connector);
- };
- ModelManipulator.prototype.insertConnector = function (connector) {
- this.model.pushItem(connector);
- this.raiseModelChanged([new ModelChange_1.ConnectorChange(connector, ModelChange_1.ItemChangeType.Create)]);
- return connector;
- };
- ModelManipulator.prototype.deleteConnector = function (connector) {
- if (connector.beginItem || connector.endItem)
- throw Error("Creating connector should not contain begin/end items");
- this.removeConnector(connector);
- };
- ModelManipulator.prototype.removeConnector = function (connector) {
- this.model.removeItem(connector);
- this.raiseModelChanged([new ModelChange_1.ConnectorChange(connector, ModelChange_1.ItemChangeType.Remove)]);
- };
- ModelManipulator.prototype.moveConnectorPoint = function (connector, pointIndex, point) {
- connector.points[pointIndex] = point;
- connector.invalidateRenderPoints();
- connector.invalidatePrimitives();
- this.raiseModelChanged([new ModelChange_1.ConnectorChange(connector, ModelChange_1.ItemChangeType.UpdateStructure)]);
- };
- ModelManipulator.prototype.addConnectorPoint = function (connector, pointIndex, point) {
- connector.points.splice(pointIndex, 0, point);
- connector.invalidateRenderPoints();
- connector.invalidatePrimitives();
- this.raiseModelChanged([new ModelChange_1.ConnectorChange(connector, ModelChange_1.ItemChangeType.UpdateStructure)]);
- };
- ModelManipulator.prototype.deleteConnectorPoint = function (connector, pointIndex) {
- connector.points.splice(pointIndex, 1);
- connector.invalidateRenderPoints();
- connector.invalidatePrimitives();
- this.raiseModelChanged([new ModelChange_1.ConnectorChange(connector, ModelChange_1.ItemChangeType.UpdateStructure)]);
- };
- ModelManipulator.prototype.addConnection = function (connector, item, connectionPointIndex, position) {
- var existingItem = connector.getExtremeItem(position);
- if (existingItem === item)
- return;
- else if (existingItem)
- throw Error("Connector is already connected");
- item.attachedConnectors.push(connector);
- if (position === Connector_1.ConnectorPosition.Begin) {
- connector.beginItem = item;
- connector.beginConnectionPointIndex = connectionPointIndex;
- }
- else {
- connector.endItem = item;
- connector.endConnectionPointIndex = connectionPointIndex;
- }
- this.raiseModelChanged([new ModelChange_1.ConnectorChange(connector, ModelChange_1.ItemChangeType.Update)]);
- };
- ModelManipulator.prototype.setConnectionPointIndex = function (connector, connectionPointIndex, position) {
- if (!connector.getExtremeItem(position))
- throw Error("Connection should be connected");
- if (position === Connector_1.ConnectorPosition.Begin)
- connector.beginConnectionPointIndex = connectionPointIndex;
- else
- connector.endConnectionPointIndex = connectionPointIndex;
- this.raiseModelChanged([new ModelChange_1.ConnectorChange(connector, ModelChange_1.ItemChangeType.Update)]);
- };
- ModelManipulator.prototype.deleteConnection = function (connector, position) {
- var item = connector.getExtremeItem(position);
- if (!item)
- return;
- item.attachedConnectors.splice(item.attachedConnectors.indexOf(connector), 1);
- if (position === Connector_1.ConnectorPosition.Begin) {
- connector.beginItem = null;
- connector.beginConnectionPointIndex = -1;
- }
- else {
- connector.endItem = null;
- connector.endConnectionPointIndex = -1;
- }
- this.raiseModelChanged([new ModelChange_1.ConnectorChange(connector, ModelChange_1.ItemChangeType.Update)]);
- };
- ModelManipulator.prototype.changeConnectorProperty = function (connector, propertyName, value) {
- connector.properties[propertyName] = value;
- connector.invalidateRenderPoints();
- connector.invalidatePrimitives();
- this.raiseModelChanged([new ModelChange_1.ConnectorChange(connector, ModelChange_1.ItemChangeType.UpdateStructure)]);
- };
- ModelManipulator.prototype.changeConnectorText = function (connector, position, text) {
- connector.setText(position, text);
- connector.invalidatePrimitives();
- this.raiseModelChanged([new ModelChange_1.ConnectorChange(connector, ModelChange_1.ItemChangeType.UpdateStructure)]);
- };
- ModelManipulator.prototype.changeConnectorTextPosition = function (connector, position, newPosition) {
- var text = connector.getText(position);
- connector.setText(position, null);
- connector.setText(newPosition, text);
- connector.invalidatePrimitives();
- this.raiseModelChanged([new ModelChange_1.ConnectorChange(connector, ModelChange_1.ItemChangeType.UpdateStructure)]);
- };
- // Model
- ModelManipulator.prototype.changeModelSize = function (size, offset) {
- this.model.size.width = size.width;
- this.model.size.height = size.height;
- this.raiseModelChanged([new ModelChange_1.PageChange(this.model, ModelChange_1.PageChangeType.Update, offset)]);
- };
- ModelManipulator.prototype.changePageSize = function (value) {
- this.model.pageSize = value;
- this.model.size = new Utils_1.Size(this.model.pageWidth, this.model.pageHeight);
- this.raiseModelChanged([new ModelChange_1.PageChange(this.model, ModelChange_1.PageChangeType.Update)]);
- };
- ModelManipulator.prototype.changePageLandscape = function (value) {
- this.model.pageLandscape = value;
- this.model.size = new Utils_1.Size(this.model.pageWidth, this.model.pageHeight);
- this.raiseModelChanged([new ModelChange_1.PageChange(this.model, ModelChange_1.PageChangeType.Update)]);
- };
- ModelManipulator.prototype.changePageProperty = function (propertyName, value) {
- this.model[propertyName] = value;
- this.raiseModelChanged([new ModelChange_1.PageChange(this.model, ModelChange_1.PageChangeType.Update)]);
- };
- ModelManipulator.prototype.createItemChange = function (item, changeType) {
- if (item instanceof Shape_1.Shape)
- return new ModelChange_1.ShapeChange(item, changeType);
- if (item instanceof Connector_1.Connector)
- return new ModelChange_1.ConnectorChange(item, changeType);
- };
- ModelManipulator.prototype.raiseModelChanged = function (changes) {
- this.onModelChanged.raise("NotifyModelChanged", changes);
- };
- return ModelManipulator;
- }());
- exports.ModelManipulator = ModelManipulator;
- /***/ }),
- /* 215 */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- Object.defineProperty(exports, "__esModule", { value: true });
- var MouseHandler_1 = __webpack_require__(216);
- var Utils_1 = __webpack_require__(0);
- var TextInputHandler_1 = __webpack_require__(236);
- var EventManager = /** @class */ (function () {
- function EventManager(control) {
- this.onMouseOperation = new Utils_1.EventDispatcher();
- this.onTextInputOperation = new Utils_1.EventDispatcher();
- this.toolboxes = [];
- this.control = control;
- this.mouseHandler = new MouseHandler_1.MouseHandler(control.history, control.selection, control.model, this);
- this.textInputHandler = new TextInputHandler_1.TextInputHandler(control);
- }
- Object.defineProperty(EventManager.prototype, "onVisualizersUpdate", {
- get: function () {
- return this.mouseHandler.onVisualizersUpdate;
- },
- enumerable: true,
- configurable: true
- });
- EventManager.prototype.registerToolbox = function (toolbox) {
- this.toolboxes.push(toolbox);
- };
- EventManager.prototype.initialize = function () {
- this.mouseHandler.initialize(this.control.model);
- };
- EventManager.prototype.onMouseDown = function (evt) {
- this.mouseHandler.onMouseDown(evt);
- };
- EventManager.prototype.onMouseMove = function (evt) {
- var draggingEvt = this.getDraggingEvent();
- if (draggingEvt && !this.draggingEvent) {
- this.draggingEvent = draggingEvt;
- this.mouseHandler.onDragStart(this.draggingEvent);
- this.control.captureFocus();
- }
- else if (!draggingEvt && this.draggingEvent) {
- delete this.draggingEvent;
- this.mouseHandler.onDragEnd(evt);
- }
- this.mouseHandler.onMouseMove(evt);
- };
- EventManager.prototype.onMouseUp = function (evt) {
- this.mouseHandler.onMouseUp(evt);
- };
- EventManager.prototype.onMouseEnter = function (evt) {
- this.mouseHandler.onMouseEnter(evt);
- };
- EventManager.prototype.onMouseLeave = function (evt) {
- this.mouseHandler.onMouseLeave(evt);
- };
- EventManager.prototype.onDblClick = function (evt) {
- this.mouseHandler.onMouseDoubleClick(evt);
- this.textInputHandler.onMouseDoubleClick(evt);
- };
- EventManager.prototype.onKeyDown = function (evt) {
- if (this.textInputHandler.isTextInputActive())
- this.textInputHandler.onKeyDown(evt);
- else {
- var scCode = evt.getShortcutCode();
- if (this.onShortcut(scCode)) {
- this.mouseHandler.updateConnectionPoints();
- this.mouseHandler.updateConnectionMarks();
- evt.preventDefault = true;
- }
- }
- };
- EventManager.prototype.onInputBlur = function (evt) {
- this.textInputHandler.onInputBlur(evt);
- };
- EventManager.prototype.onInputFocus = function (evt) {
- this.textInputHandler.onInputFocus(evt);
- };
- EventManager.prototype.onShortcut = function (code) {
- if (this.control.commandManager.processShortcut(code))
- return true;
- if (this.mouseHandler.onShortcut(code))
- return true;
- };
- EventManager.prototype.onPaste = function (evt) {
- if (!this.textInputHandler.isTextInputActive() && this.control.commandManager.processPaste(evt.clipboardData)) {
- this.mouseHandler.updateConnectionPoints();
- this.mouseHandler.updateConnectionMarks();
- evt.preventDefault = true;
- }
- };
- EventManager.prototype.isFocused = function () {
- return this.control.isFocused();
- };
- EventManager.prototype.getDraggingEvent = function () {
- return this.toolboxes
- .filter(function (t) { return t.draggingObject; })
- .map(function (t) { return t.draggingObject.evt; })[0];
- };
- EventManager.prototype.onDocumentDragEnd = function (itemKeys) {
- this.onMouseOperation.raise("NotifyDragEnd", itemKeys);
- this.control.endUpdate();
- };
- EventManager.prototype.onDocumentDragStart = function (itemKeys) {
- this.control.beginUpdate();
- this.control.captureFocus();
- this.onMouseOperation.raise("NotifyDragStart", itemKeys);
- };
- EventManager.prototype.raiseTextInputStart = function (item, text, position, size) {
- this.onTextInputOperation.raise("NotifyTextInputStart", item, text, position, size);
- };
- EventManager.prototype.raiseTextInputEnd = function (item) {
- this.onTextInputOperation.raise("NotifyTextInputEnd", item);
- };
- return EventManager;
- }());
- exports.EventManager = EventManager;
- /***/ }),
- /* 216 */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- Object.defineProperty(exports, "__esModule", { value: true });
- var MouseHandlerDefaultState_1 = __webpack_require__(217);
- var Event_1 = __webpack_require__(14);
- var Utils_1 = __webpack_require__(0);
- var ConnectionPointsVisualizer_1 = __webpack_require__(233);
- var KeyCode_1 = __webpack_require__(16);
- var ModelUtils_1 = __webpack_require__(8);
- var Model_1 = __webpack_require__(21);
- var ExtensionLinesVisualizer_1 = __webpack_require__(92);
- var Shape_1 = __webpack_require__(9);
- var CanvasManager_1 = __webpack_require__(44);
- var ConnectionMarksVisualizer_1 = __webpack_require__(234);
- var ConnectionTargetVisualizer_1 = __webpack_require__(235);
- var ConnectionPointsVisualizerBase_1 = __webpack_require__(67);
- var MouseHandlerMoveClonedShapeState_1 = __webpack_require__(66);
- var MouseHandler = /** @class */ (function () {
- function MouseHandler(history, selection, model, eventManager) {
- this.history = history;
- this.selection = selection;
- this.model = model;
- this.eventManager = eventManager;
- this.onVisualizersUpdate = new Utils_1.EventDispatcher();
- this.initialize(model);
- this.connectionPointsVisualizer = new ConnectionPointsVisualizer_1.ConnectionPointsVisualizer(this.onVisualizersUpdate);
- this.connectionMarksVisualizer = new ConnectionMarksVisualizer_1.ConnectionMarksVisualizer(this.onVisualizersUpdate);
- this.connectionPointsVisualizer = new ConnectionPointsVisualizer_1.ConnectionPointsVisualizer(this.onVisualizersUpdate);
- this.connectionTargetVisualizer = new ConnectionTargetVisualizer_1.ConnectionTargetVisualizer(this.onVisualizersUpdate);
- this.extensionLinesVisualizer = new ExtensionLinesVisualizer_1.ExtensionLinesVisualizer(this.onVisualizersUpdate);
- }
- ;
- MouseHandler.prototype.initialize = function (model) {
- this.model = model;
- this.defaultState = new MouseHandlerDefaultState_1.MouseHandlerDefaultState(this, this.history, this.selection, this.model);
- this.switchToDefaultState();
- };
- MouseHandler.prototype.onMouseDown = function (evt) {
- this.state.onMouseDown(evt);
- };
- MouseHandler.prototype.onMouseMove = function (evt) {
- this.state.onMouseMove(evt);
- };
- MouseHandler.prototype.onMouseUp = function (evt) {
- this.state.onMouseUp(evt);
- };
- MouseHandler.prototype.onMouseDoubleClick = function (evt) {
- this.state.onMouseDoubleClick(evt);
- this.switchToDefaultState();
- };
- MouseHandler.prototype.onMouseEnter = function (evt) {
- };
- MouseHandler.prototype.onMouseLeave = function (evt) {
- this.resetConnectionPoints();
- this.resetConnectionMarks();
- this.resetConnectionTarget();
- this.resetExtensionLines();
- };
- MouseHandler.prototype.onShortcut = function (code) {
- return this.state.onShortcut(code);
- };
- MouseHandler.prototype.onDragStart = function (evt) {
- this.state.onDragStart(evt);
- };
- MouseHandler.prototype.onDragEnd = function (evt) {
- this.state.onDragEnd(evt);
- };
- // utils
- MouseHandler.prototype.getSnappedPos = function (evt, pos) {
- if (!this.model.snapToGrid || (evt.modifiers & KeyCode_1.ModifierKey.Ctrl))
- return pos;
- return ModelUtils_1.ModelUtils.getSnappedPos(this.model, pos);
- };
- MouseHandler.prototype.getSnappedPoint = function (evt, point, additionalSnappedPoint) {
- var x = this.getSnappedPos(evt, point.x);
- var y = this.getSnappedPos(evt, point.y);
- if (additionalSnappedPoint === undefined)
- return new Utils_1.Point(x, y);
- else {
- if (Math.pow(point.x - x, 2) + Math.pow(point.y - y, 2) < Math.pow(point.x - additionalSnappedPoint.x, 2) + Math.pow(point.y - additionalSnappedPoint.y, 2))
- return new Utils_1.Point(x, y);
- else
- return additionalSnappedPoint;
- }
- };
- MouseHandler.prototype.tryUpdateModelSize = function (processPoints) {
- ModelUtils_1.ModelUtils.tryUpdateModelSize(this.history, this.model, processPoints);
- };
- MouseHandler.prototype.setConnectionPoints = function (item, type, pointIndex) {
- if (!this.eventManager.isFocused())
- return;
- if (item && !item.locked && (type === Event_1.MouseEventElementType.Shape ||
- type === Event_1.MouseEventElementType.ShapeConnectionPoint ||
- type === Event_1.MouseEventElementType.ShapeConnection) && item !== undefined) {
- var key = item.key;
- if (!this.selection.hasKey(key)) {
- var points = item.getConnectionPoints();
- this.connectionPointsVisualizer.setPoints(key, points.map(function (pt, index) { return new ConnectionPointsVisualizerBase_1.ConnectionPointInfo(pt, item.getConnectionPointSide(index)); }), pointIndex);
- }
- }
- else
- this.connectionPointsVisualizer.reset();
- };
- MouseHandler.prototype.setConnectionPointIndex = function (index) {
- this.connectionPointsVisualizer.setPointIndex(index);
- };
- MouseHandler.prototype.updateConnectionPoints = function () {
- var item = this.model.findItem(this.connectionPointsVisualizer.getKey());
- if (item !== undefined)
- this.connectionPointsVisualizer.update();
- else
- this.connectionPointsVisualizer.reset();
- };
- MouseHandler.prototype.resetConnectionPoints = function () {
- this.connectionPointsVisualizer.reset();
- };
- MouseHandler.prototype.setConnectionMarks = function (item, type, pointIndex) {
- if (!this.eventManager.isFocused())
- return;
- if (item && !item.locked && (type === Event_1.MouseEventElementType.Shape ||
- type === Event_1.MouseEventElementType.ShapeConnectionPoint ||
- type === Event_1.MouseEventElementType.ShapeConnection) && item !== undefined) {
- var key = item.key;
- var points = item.getConnectionPointsForSelection();
- this.connectionMarksVisualizer.setPoints(key, points.map(function (pt, index) { return new ConnectionPointsVisualizerBase_1.ConnectionPointInfo(pt, item.getConnectionPointForSelectionSide(index)); }), pointIndex);
- }
- else
- this.connectionMarksVisualizer.reset();
- };
- MouseHandler.prototype.updateConnectionMarks = function () {
- var item = this.model.findItem(this.connectionMarksVisualizer.getKey());
- if (item !== undefined)
- this.connectionMarksVisualizer.update();
- else
- this.connectionMarksVisualizer.reset();
- };
- MouseHandler.prototype.resetConnectionMarks = function () {
- this.connectionMarksVisualizer.reset();
- };
- MouseHandler.prototype.setConnectionTarget = function (item, type) {
- if (item && !item.locked && (type === Event_1.MouseEventElementType.Shape ||
- type === Event_1.MouseEventElementType.ShapeConnectionPoint ||
- type === Event_1.MouseEventElementType.ShapeConnection)) {
- this.connectionTargetVisualizer.setTargetRect(item.key, item.rectangle);
- }
- else
- this.connectionTargetVisualizer.reset();
- };
- MouseHandler.prototype.resetConnectionTarget = function () {
- this.connectionTargetVisualizer.reset();
- };
- MouseHandler.prototype.setExtensionLines = function (items) {
- var _this = this;
- if (!this.eventManager.isFocused())
- return;
- this.extensionLinesVisualizer.reset();
- var rect = Model_1.DiagramModel.getRectangle(items.filter(function (item) { return item && !item.locked; }));
- this.addPageExtensionLines(rect);
- this.model.items.forEach(function (item) {
- if (item.locked || items.indexOf(item) > -1)
- return;
- if (item instanceof Shape_1.Shape)
- _this.addShapeExtensionLines(item, rect);
- });
- };
- MouseHandler.prototype.addPageExtensionLines = function (rect) {
- var horPages = Math.round(this.model.size.width / this.model.pageWidth);
- var verPages = Math.round(this.model.size.height / this.model.pageHeight);
- for (var i = 0; i < horPages; i++) {
- for (var j = 0; j < verPages; j++) {
- var center = new Utils_1.Point(i * this.model.pageWidth + this.model.pageWidth / 2, j * this.model.pageHeight + this.model.pageHeight / 2);
- if (Math.abs(rect.center.x - center.x) < this.model.gridSize / 2) {
- var segment = new Utils_1.Segment(new Utils_1.Point(rect.center.x, 0), new Utils_1.Point(rect.center.x, this.model.size.height));
- this.extensionLinesVisualizer.addSegment(ExtensionLinesVisualizer_1.ExtensionLineType.HorizontalCenterToPageCenter, segment, "");
- }
- if (Math.abs(rect.center.y - center.y) < this.model.gridSize / 2) {
- var segment = new Utils_1.Segment(new Utils_1.Point(0, rect.center.y), new Utils_1.Point(this.model.size.width, rect.center.y));
- this.extensionLinesVisualizer.addSegment(ExtensionLinesVisualizer_1.ExtensionLineType.VerticalCenterToPageCenter, segment, "");
- }
- if (Math.abs(rect.left - center.x) < this.model.gridSize / 2) {
- var segment = new Utils_1.Segment(new Utils_1.Point(rect.left, 0), new Utils_1.Point(rect.left, this.model.size.height));
- this.extensionLinesVisualizer.addSegment(ExtensionLinesVisualizer_1.ExtensionLineType.LeftToPageCenter, segment, "");
- }
- if (Math.abs(rect.top - center.y) < this.model.gridSize / 2) {
- var segment = new Utils_1.Segment(new Utils_1.Point(0, rect.top), new Utils_1.Point(this.model.size.width, rect.top));
- this.extensionLinesVisualizer.addSegment(ExtensionLinesVisualizer_1.ExtensionLineType.TopToPageCenter, segment, "");
- }
- if (Math.abs(rect.right - center.x) < this.model.gridSize / 2) {
- var segment = new Utils_1.Segment(new Utils_1.Point(rect.right, 0), new Utils_1.Point(rect.right, this.model.size.height));
- this.extensionLinesVisualizer.addSegment(ExtensionLinesVisualizer_1.ExtensionLineType.RightToPageCenter, segment, "");
- }
- if (Math.abs(rect.bottom - center.y) < this.model.gridSize / 2) {
- var segment = new Utils_1.Segment(new Utils_1.Point(0, rect.bottom), new Utils_1.Point(this.model.size.width, rect.bottom));
- this.extensionLinesVisualizer.addSegment(ExtensionLinesVisualizer_1.ExtensionLineType.BottomToPageCenter, segment, "");
- }
- }
- }
- };
- MouseHandler.prototype.addShapeExtensionLines = function (shape, rect) {
- var sRect = shape.rectangle;
- var lwCor = Shape_1.Shape.lineWidth - CanvasManager_1.CanvasManager.extensionLineWidth;
- var showDistance = true;
- var x1, y1, x2, y2;
- if (rect.right < sRect.left) {
- x1 = rect.right + lwCor + CanvasManager_1.CanvasManager.extensionLineOffset;
- x2 = sRect.left - CanvasManager_1.CanvasManager.extensionLineOffset;
- }
- else if (rect.left > sRect.right) {
- x1 = rect.left - CanvasManager_1.CanvasManager.extensionLineOffset;
- x2 = sRect.right + lwCor + CanvasManager_1.CanvasManager.extensionLineOffset;
- }
- if (rect.bottom < sRect.top) {
- y1 = rect.bottom + lwCor + CanvasManager_1.CanvasManager.extensionLineOffset;
- y2 = sRect.top - CanvasManager_1.CanvasManager.extensionLineOffset;
- }
- else if (rect.top > sRect.bottom) {
- y1 = rect.top - CanvasManager_1.CanvasManager.extensionLineOffset;
- y2 = sRect.bottom + lwCor + CanvasManager_1.CanvasManager.extensionLineOffset;
- }
- if (x1 != undefined && x2 !== undefined) {
- if (rect.center.y === sRect.center.y) {
- var segment = new Utils_1.Segment(new Utils_1.Point(x1, rect.center.y), new Utils_1.Point(x2, sRect.center.y));
- this.extensionLinesVisualizer.addSegment(x1 > x2 ? ExtensionLinesVisualizer_1.ExtensionLineType.VerticalCenterAfter : ExtensionLinesVisualizer_1.ExtensionLineType.VerticalCenterBefore, segment, showDistance ? this.model.getModelUnitText(segment.distance) : "");
- showDistance = false;
- }
- if (rect.top === sRect.top) {
- var segment = new Utils_1.Segment(new Utils_1.Point(x1, rect.top), new Utils_1.Point(x2, sRect.top));
- this.extensionLinesVisualizer.addSegment(x1 > x2 ? ExtensionLinesVisualizer_1.ExtensionLineType.TopToTopAfter : ExtensionLinesVisualizer_1.ExtensionLineType.TopToTopBefore, segment, showDistance ? this.model.getModelUnitText(segment.distance) : "");
- }
- if (rect.bottom === sRect.bottom) {
- var segment = new Utils_1.Segment(new Utils_1.Point(x1, rect.bottom + lwCor), new Utils_1.Point(x2, sRect.bottom + lwCor));
- this.extensionLinesVisualizer.addSegment(x1 > x2 ? ExtensionLinesVisualizer_1.ExtensionLineType.BottomToBottomAfter : ExtensionLinesVisualizer_1.ExtensionLineType.BottomToBottomBefore, segment, showDistance ? this.model.getModelUnitText(segment.distance) : "");
- }
- if (rect.top === sRect.bottom) {
- var segment = new Utils_1.Segment(new Utils_1.Point(x1, rect.top), new Utils_1.Point(x2, sRect.bottom + lwCor));
- this.extensionLinesVisualizer.addSegment(x1 > x2 ? ExtensionLinesVisualizer_1.ExtensionLineType.TopToBottomAfter : ExtensionLinesVisualizer_1.ExtensionLineType.TopToBottomBefore, segment, showDistance ? this.model.getModelUnitText(segment.distance) : "");
- }
- if (rect.bottom === sRect.top) {
- var segment = new Utils_1.Segment(new Utils_1.Point(x1, rect.bottom + lwCor), new Utils_1.Point(x2, sRect.top));
- this.extensionLinesVisualizer.addSegment(x1 > x2 ? ExtensionLinesVisualizer_1.ExtensionLineType.BottomToTopAfter : ExtensionLinesVisualizer_1.ExtensionLineType.BottomToTopBefore, segment, showDistance ? this.model.getModelUnitText(segment.distance) : "");
- }
- }
- if (y1 != undefined && y2 !== undefined) {
- if (rect.center.x === sRect.center.x) {
- var segment = new Utils_1.Segment(new Utils_1.Point(rect.center.x, y1), new Utils_1.Point(sRect.center.x, y2));
- this.extensionLinesVisualizer.addSegment(y1 > y2 ? ExtensionLinesVisualizer_1.ExtensionLineType.HorizontalCenterBelow : ExtensionLinesVisualizer_1.ExtensionLineType.HorizontalCenterAbove, segment, showDistance ? this.model.getModelUnitText(segment.distance) : "");
- showDistance = false;
- }
- if (rect.left === sRect.left) {
- var segment = new Utils_1.Segment(new Utils_1.Point(rect.left, y1), new Utils_1.Point(sRect.left, y2));
- this.extensionLinesVisualizer.addSegment(y1 > y2 ? ExtensionLinesVisualizer_1.ExtensionLineType.LeftToLeftBelow : ExtensionLinesVisualizer_1.ExtensionLineType.LeftToLeftAbove, segment, showDistance ? this.model.getModelUnitText(segment.distance) : "");
- }
- if (rect.right === sRect.right) {
- var segment = new Utils_1.Segment(new Utils_1.Point(rect.right + lwCor, y1), new Utils_1.Point(sRect.right + lwCor, y2));
- this.extensionLinesVisualizer.addSegment(y1 > y2 ? ExtensionLinesVisualizer_1.ExtensionLineType.RightToRightBelow : ExtensionLinesVisualizer_1.ExtensionLineType.RightToRightAbove, segment, showDistance ? this.model.getModelUnitText(segment.distance) : "");
- }
- if (rect.left === sRect.right) {
- var segment = new Utils_1.Segment(new Utils_1.Point(rect.left, y1), new Utils_1.Point(sRect.right + lwCor, y2));
- this.extensionLinesVisualizer.addSegment(y1 > y2 ? ExtensionLinesVisualizer_1.ExtensionLineType.LeftToRightBelow : ExtensionLinesVisualizer_1.ExtensionLineType.LeftToRightAbove, segment, showDistance ? this.model.getModelUnitText(segment.distance) : "");
- }
- if (rect.right === sRect.left) {
- var segment = new Utils_1.Segment(new Utils_1.Point(rect.right + lwCor, y1), new Utils_1.Point(sRect.left, y2));
- this.extensionLinesVisualizer.addSegment(y1 > y2 ? ExtensionLinesVisualizer_1.ExtensionLineType.RightToLeftBelow : ExtensionLinesVisualizer_1.ExtensionLineType.RightToLeftAbove, segment, showDistance ? this.model.getModelUnitText(segment.distance) : "");
- }
- }
- };
- MouseHandler.prototype.resetExtensionLines = function () {
- this.extensionLinesVisualizer.reset();
- };
- MouseHandler.prototype.raiseDragStart = function (keys) {
- this.eventManager.onDocumentDragStart(keys);
- };
- MouseHandler.prototype.raiseDragEnd = function (keys) {
- this.eventManager.onDocumentDragEnd(keys);
- };
- // switch state
- MouseHandler.prototype.switchToDefaultState = function () {
- this.switchState(this.defaultState);
- };
- MouseHandler.prototype.switchToMoveClonedShapeState = function (startPoint) {
- this.switchState(new MouseHandlerMoveClonedShapeState_1.MouseHandlerMoveClonedShapeState(this, this.history, this.model, this.selection, startPoint));
- };
- MouseHandler.prototype.switchState = function (state) {
- if (this.state)
- this.state.finish();
- this.state = state;
- this.state.start();
- };
- return MouseHandler;
- }());
- exports.MouseHandler = MouseHandler;
- /***/ }),
- /* 217 */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- var __extends = (this && this.__extends) || (function () {
- var extendStatics = function (d, b) {
- extendStatics = Object.setPrototypeOf ||
- ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
- function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
- return extendStatics(d, b);
- };
- return function (d, b) {
- extendStatics(d, b);
- function __() { this.constructor = d; }
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
- };
- })();
- Object.defineProperty(exports, "__esModule", { value: true });
- var MouseHandlerStateBase_1 = __webpack_require__(45);
- var Event_1 = __webpack_require__(14);
- var MouseHandlerMoveShapeState_1 = __webpack_require__(218);
- var MouseHandlerMoveConnectorPointState_1 = __webpack_require__(220);
- var MouseHandlerResizeShapeState_1 = __webpack_require__(221);
- var MouseHandlerMoveConnectorSideState_1 = __webpack_require__(223);
- var MouseHandlerDragParameterPointState_1 = __webpack_require__(224);
- var KeyCode_1 = __webpack_require__(16);
- var MouseHandlerSelectionState_1 = __webpack_require__(226);
- var MouseHandlerCreateConnectorState_1 = __webpack_require__(228);
- var UnitConverter_1 = __webpack_require__(13);
- var MouseHandlerMoveConnectorOrthogonalSideState_1 = __webpack_require__(229);
- var MouseHandlerToolboxDraggingState_1 = __webpack_require__(230);
- var MouseHandlerMoveConnectorTextState_1 = __webpack_require__(231);
- var MouseHandlerMoveClonedShapeState_1 = __webpack_require__(66);
- var MouseHandlerDefaultState = /** @class */ (function (_super) {
- __extends(MouseHandlerDefaultState, _super);
- function MouseHandlerDefaultState(handler, history, selection, model) {
- var _this = _super.call(this, handler) || this;
- _this.history = history;
- _this.selection = selection;
- _this.model = model;
- return _this;
- }
- MouseHandlerDefaultState.prototype.finish = function () {
- this.handler.resetConnectionPoints();
- this.handler.resetConnectionMarks();
- _super.prototype.finish.call(this);
- };
- MouseHandlerDefaultState.prototype.onMouseDown = function (evt) {
- if (evt.source.type === Event_1.MouseEventElementType.Shape) {
- var shapeKey = evt.source.key;
- if (MouseHandlerMoveClonedShapeState_1.MouseHandlerMoveClonedShapeState.isMoveClonedShapeEvent(evt)) {
- this.selection.add(shapeKey);
- this.handler.switchToMoveClonedShapeState();
- }
- else {
- this.modifySelection(evt, shapeKey);
- this.handler.switchState(new MouseHandlerMoveShapeState_1.MouseHandlerMoveShapeState(this.handler, this.history, this.model, this.selection));
- }
- this.handler.state.onMouseDown(evt);
- }
- else if (evt.source.type === Event_1.MouseEventElementType.Connector) {
- var connectorKey = evt.source.key;
- this.modifySelection(evt, connectorKey);
- }
- else if (evt.source.type === Event_1.MouseEventElementType.ConnectorText) {
- var connectorKey = evt.source.key;
- this.modifySelection(evt, connectorKey);
- this.handler.switchState(new MouseHandlerMoveConnectorTextState_1.MouseHandlerMoveConnectorTextState(this.handler, this.history, this.model));
- this.handler.state.onMouseDown(evt);
- }
- else if (evt.source.type === Event_1.MouseEventElementType.ShapeResizeBox) {
- this.handler.switchState(new MouseHandlerResizeShapeState_1.MouseHandlerResizeShapeState(this.handler, this.history, this.model, this.selection));
- this.handler.state.onMouseDown(evt);
- }
- else if (evt.source.type === Event_1.MouseEventElementType.ShapeParameterBox) {
- this.handler.switchState(new MouseHandlerDragParameterPointState_1.MouseHandlerDragParameterPointState(this.handler, this.history, this.model));
- this.handler.state.onMouseDown(evt);
- }
- else if (evt.source.type === Event_1.MouseEventElementType.ConnectorPoint) {
- this.handler.switchState(new MouseHandlerMoveConnectorPointState_1.MouseHandlerMoveConnectorPointState(this.handler, this.history, this.model));
- this.handler.state.onMouseDown(evt);
- }
- else if (evt.source.type === Event_1.MouseEventElementType.ConnectorSide) {
- this.handler.switchState(new MouseHandlerMoveConnectorSideState_1.MouseHandlerMoveConnectorSideState(this.handler, this.history, this.model));
- this.handler.state.onMouseDown(evt);
- }
- else if (evt.source.type === Event_1.MouseEventElementType.ConnectorOrthogonalSide) {
- this.handler.switchState(new MouseHandlerMoveConnectorOrthogonalSideState_1.MouseHandlerMoveConnectorOrthogonalSideState(this.handler, this.history, this.model));
- this.handler.state.onMouseDown(evt);
- }
- else if (evt.source.type === Event_1.MouseEventElementType.ShapeConnectionPoint) {
- this.handler.switchState(new MouseHandlerCreateConnectorState_1.MouseHandlerCreateConnectorState(this.handler, this.history, this.model, this.selection));
- this.handler.state.onMouseDown(evt);
- }
- else if (evt.source.type === Event_1.MouseEventElementType.ShapeConnection) {
- this.handler.switchState(new MouseHandlerCreateConnectorState_1.MouseHandlerCreateConnectorState(this.handler, this.history, this.model, this.selection, -1));
- this.handler.state.onMouseDown(evt);
- }
- else {
- this.handler.switchState(new MouseHandlerSelectionState_1.MouseHandlerSelectionState(this.handler, this.selection));
- this.handler.state.onMouseDown(evt);
- }
- };
- MouseHandlerDefaultState.prototype.onDragStart = function (evt) {
- this.handler.switchState(new MouseHandlerToolboxDraggingState_1.MouseHandlerBeforeToolboxDraggingState(this.handler, this.history, this.model, this.selection));
- this.handler.state.onDragStart(evt);
- };
- MouseHandlerDefaultState.prototype.onMouseMove = function (evt) {
- var item = this.model.findItem(evt.source.key);
- var pointIndex = -1;
- if (evt.source.value && evt.source.type === Event_1.MouseEventElementType.ShapeConnectionPoint)
- pointIndex = parseInt(evt.source.value);
- this.handler.setConnectionPoints(item, evt.source.type, pointIndex);
- var connectionIndex = -1;
- if (evt.source.value && evt.source.type === Event_1.MouseEventElementType.ShapeConnection)
- connectionIndex = parseInt(evt.source.value);
- this.handler.setConnectionMarks(item, evt.source.type, connectionIndex);
- };
- MouseHandlerDefaultState.prototype.modifySelection = function (evt, key) {
- if (evt.modifiers & KeyCode_1.ModifierKey.Ctrl || evt.modifiers & KeyCode_1.ModifierKey.Shift) {
- if (this.selection.hasKey(key))
- this.selection.remove(key);
- else
- this.selection.add(key);
- }
- else if (!this.selection.hasKey(key))
- this.selection.set([key]);
- };
- MouseHandlerDefaultState.itemEdge = UnitConverter_1.UnitConverter.pixelsToTwips(10);
- return MouseHandlerDefaultState;
- }(MouseHandlerStateBase_1.MouseHandlerStateBase));
- exports.MouseHandlerDefaultState = MouseHandlerDefaultState;
- /***/ }),
- /* 218 */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- var __extends = (this && this.__extends) || (function () {
- var extendStatics = function (d, b) {
- extendStatics = Object.setPrototypeOf ||
- ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
- function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
- return extendStatics(d, b);
- };
- return function (d, b) {
- extendStatics(d, b);
- function __() { this.constructor = d; }
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
- };
- })();
- Object.defineProperty(exports, "__esModule", { value: true });
- var MouseHandlerMoveClonedShapeState_1 = __webpack_require__(66);
- var MouseHandlerMoveShapeOrthogonallyState_1 = __webpack_require__(219);
- var MouseHandlerMoveShapeState = /** @class */ (function (_super) {
- __extends(MouseHandlerMoveShapeState, _super);
- function MouseHandlerMoveShapeState() {
- return _super !== null && _super.apply(this, arguments) || this;
- }
- MouseHandlerMoveShapeState.prototype.onMouseMove = function (evt) {
- _super.prototype.onMouseMove.call(this, evt);
- this.switchToMoveClonedShapeState(evt);
- };
- MouseHandlerMoveShapeState.prototype.switchToMoveClonedShapeState = function (evt) {
- if (MouseHandlerMoveClonedShapeState_1.MouseHandlerMoveClonedShapeState.isMoveClonedShapeEvent(evt)) {
- this.cancelChanges();
- this.handler.switchToMoveClonedShapeState(this.startPoint);
- this.handler.onMouseDown(evt);
- }
- };
- return MouseHandlerMoveShapeState;
- }(MouseHandlerMoveShapeOrthogonallyState_1.MouseHandlerMoveShapeOrthogonallyState));
- exports.MouseHandlerMoveShapeState = MouseHandlerMoveShapeState;
- /***/ }),
- /* 219 */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- var __extends = (this && this.__extends) || (function () {
- var extendStatics = function (d, b) {
- extendStatics = Object.setPrototypeOf ||
- ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
- function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
- return extendStatics(d, b);
- };
- return function (d, b) {
- extendStatics(d, b);
- function __() { this.constructor = d; }
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
- };
- })();
- Object.defineProperty(exports, "__esModule", { value: true });
- var KeyCode_1 = __webpack_require__(16);
- var MouseHandlerMoveShapeStateBase_1 = __webpack_require__(95);
- var MouseHandlerMoveShapeOrthogonallyState = /** @class */ (function (_super) {
- __extends(MouseHandlerMoveShapeOrthogonallyState, _super);
- function MouseHandlerMoveShapeOrthogonallyState() {
- return _super !== null && _super.apply(this, arguments) || this;
- }
- MouseHandlerMoveShapeOrthogonallyState.prototype.onApplyChanges = function (evt) {
- this.calculateFixedPosition(evt);
- _super.prototype.onApplyChanges.call(this, evt);
- };
- MouseHandlerMoveShapeOrthogonallyState.prototype.getXPosition = function (evt, baseX) {
- return this.fixedX ? baseX : _super.prototype.getXPosition.call(this, evt, baseX);
- };
- MouseHandlerMoveShapeOrthogonallyState.prototype.getYPosition = function (evt, baseY) {
- return this.fixedY ? baseY : _super.prototype.getYPosition.call(this, evt, baseY);
- };
- MouseHandlerMoveShapeOrthogonallyState.prototype.calculateFixedPosition = function (evt) {
- this.fixedX = false;
- this.fixedY = false;
- if (evt.modifiers & KeyCode_1.ModifierKey.Shift) {
- var dx = Math.abs(this.startPoint.x - evt.layoutPoint.x);
- var dy = Math.abs(this.startPoint.y - evt.layoutPoint.y);
- if (dx < dy)
- this.fixedX = true;
- else
- this.fixedY = true;
- }
- };
- return MouseHandlerMoveShapeOrthogonallyState;
- }(MouseHandlerMoveShapeStateBase_1.MouseHandlerMoveShapeStateBase));
- exports.MouseHandlerMoveShapeOrthogonallyState = MouseHandlerMoveShapeOrthogonallyState;
- /***/ }),
- /* 220 */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- var __extends = (this && this.__extends) || (function () {
- var extendStatics = function (d, b) {
- extendStatics = Object.setPrototypeOf ||
- ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
- function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
- return extendStatics(d, b);
- };
- return function (d, b) {
- extendStatics(d, b);
- function __() { this.constructor = d; }
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
- };
- })();
- Object.defineProperty(exports, "__esModule", { value: true });
- var MouseHandlerMoveConnectorPointStateBase_1 = __webpack_require__(96);
- var Connector_1 = __webpack_require__(5);
- var ModelUtils_1 = __webpack_require__(8);
- var Utils_1 = __webpack_require__(0);
- var ConnectorProperties_1 = __webpack_require__(28);
- var MouseHandlerMoveConnectorPointState = /** @class */ (function (_super) {
- __extends(MouseHandlerMoveConnectorPointState, _super);
- function MouseHandlerMoveConnectorPointState() {
- return _super !== null && _super.apply(this, arguments) || this;
- }
- MouseHandlerMoveConnectorPointState.prototype.onMouseDown = function (evt) {
- this.connector = this.model.findConnector(evt.source.key);
- this.pointIndex = parseInt(evt.source.value);
- if (this.pointIndex === 0) {
- this.pointPosition = Connector_1.ConnectorPosition.Begin;
- }
- else if (this.pointIndex === this.connector.points.length - 1) {
- this.pointPosition = Connector_1.ConnectorPosition.End;
- }
- _super.prototype.onMouseDown.call(this, evt);
- };
- MouseHandlerMoveConnectorPointState.prototype.onApplyChanges = function (evt) {
- if (this.connector.properties.lineOption !== ConnectorProperties_1.ConnectorLineOption.Orthogonal ||
- this.pointIndex === 0 || this.pointIndex === this.connector.points.length - 1)
- _super.prototype.onApplyChanges.call(this, evt);
- };
- MouseHandlerMoveConnectorPointState.prototype.onFinishWithChanges = function () {
- ModelUtils_1.ModelUtils.removeUnnecessaryConnectorPoints(this.history, this.connector);
- };
- MouseHandlerMoveConnectorPointState.prototype.getSnappedPoint = function (evt, point) {
- var points = this.connector.points;
- var index = this.pointIndex;
- if (0 < index && index < points.length - 1) {
- var tg = (points[index + 1].y - points[index - 1].y) / (points[index + 1].x - points[index - 1].x);
- var x = point.x;
- var y = points[index + 1].y - (points[index + 1].x - x) * tg;
- return this.handler.getSnappedPoint(evt, point, new Utils_1.Point(x, y));
- }
- return this.handler.getSnappedPoint(evt, point);
- };
- return MouseHandlerMoveConnectorPointState;
- }(MouseHandlerMoveConnectorPointStateBase_1.MouseHandlerMoveConnectorPointStateBase));
- exports.MouseHandlerMoveConnectorPointState = MouseHandlerMoveConnectorPointState;
- /***/ }),
- /* 221 */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- var __extends = (this && this.__extends) || (function () {
- var extendStatics = function (d, b) {
- extendStatics = Object.setPrototypeOf ||
- ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
- function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
- return extendStatics(d, b);
- };
- return function (d, b) {
- extendStatics(d, b);
- function __() { this.constructor = d; }
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
- };
- })();
- Object.defineProperty(exports, "__esModule", { value: true });
- var Utils_1 = __webpack_require__(0);
- var Event_1 = __webpack_require__(14);
- var KeyCode_1 = __webpack_require__(16);
- var MouseHandlerDraggingState_1 = __webpack_require__(24);
- var Model_1 = __webpack_require__(21);
- var ModelUtils_1 = __webpack_require__(8);
- var ResizeInfoVisualizer_1 = __webpack_require__(222);
- var CanvasManager_1 = __webpack_require__(44);
- var MouseHandlerResizeShapeState = /** @class */ (function (_super) {
- __extends(MouseHandlerResizeShapeState, _super);
- function MouseHandlerResizeShapeState(handler, history, model, selection) {
- var _this = _super.call(this, handler, history) || this;
- _this.model = model;
- _this.selection = selection;
- _this.startScrollLeft = 0;
- _this.startScrollTop = 0;
- _this.rotation = 0;
- return _this;
- }
- MouseHandlerResizeShapeState.prototype.start = function () {
- this.resizeInfoVisualizer = new ResizeInfoVisualizer_1.ResizeInfoVisualizer(this.handler.onVisualizersUpdate);
- _super.prototype.start.call(this);
- };
- MouseHandlerResizeShapeState.prototype.finish = function () {
- this.resetResizeInfo();
- this.handler.resetExtensionLines();
- _super.prototype.finish.call(this);
- };
- MouseHandlerResizeShapeState.prototype.onMouseDown = function (evt) {
- var source = parseInt(evt.source.value);
- this.resizeEventSource = source;
- this.startPoint = evt.layoutPoint;
- this.lockH = source == Event_1.ResizeEventSource.ResizeBox_S || source == Event_1.ResizeEventSource.ResizeBox_N;
- this.lockV = source == Event_1.ResizeEventSource.ResizeBox_E || source == Event_1.ResizeEventSource.ResizeBox_W;
- this.sideH = source == Event_1.ResizeEventSource.ResizeBox_E || source == Event_1.ResizeEventSource.ResizeBox_NE || source == Event_1.ResizeEventSource.ResizeBox_SE;
- this.sideV = source == Event_1.ResizeEventSource.ResizeBox_SE || source == Event_1.ResizeEventSource.ResizeBox_S || source == Event_1.ResizeEventSource.ResizeBox_SW;
- this.shapes = this.selection.getSelectedShapes();
- if (this.shapes.length === 0) {
- this.handler.switchToDefaultState();
- return;
- }
- this.connectors = this.selection.getSelectedConnectors();
- this.startRectangle = Model_1.DiagramModel.getRectangle(this.shapes);
- this.startShapeSizes = this.shapes.map(function (shape) { return shape.size.clone(); });
- this.startShapePositions = this.shapes.map(function (shape) { return shape.position.clone(); });
- this.startConnectorPoints = this.connectors.map(function (c) { return c.points.map(function (p) { return p.clone(); }); });
- this.lockAspectRatio = !!(evt.modifiers & KeyCode_1.ModifierKey.Shift);
- _super.prototype.onMouseDown.call(this, evt);
- };
- MouseHandlerResizeShapeState.prototype.onMouseMove = function (evt) {
- _super.prototype.onMouseMove.call(this, evt);
- var items = this.selection.getSelectedItems();
- this.handler.setExtensionLines(this.selection.getSelectedShapes());
- };
- MouseHandlerResizeShapeState.prototype.onApplyChanges = function (evt) {
- var _this = this;
- var rectangle = Model_1.DiagramModel.getRectangle(this.shapes);
- var size = this.getSize(evt, rectangle.position, this.startRectangle.size);
- var pos = this.getPosition(evt, size, this.startRectangle.size, this.startRectangle.position);
- var ratioX = size.width / this.startRectangle.width;
- var ratioY = size.height / this.startRectangle.height;
- this.shapes.forEach(function (shape, index) {
- var shapeSize = new Utils_1.Size(_this.startShapeSizes[index].width * ratioX, _this.startShapeSizes[index].height * ratioY);
- var shapePos = new Utils_1.Point(pos.x + (_this.startShapePositions[index].x - _this.startRectangle.left) * ratioX, pos.y + (_this.startShapePositions[index].y - _this.startRectangle.top) * ratioY);
- ModelUtils_1.ModelUtils.setShapeSize(_this.history, _this.model, shape.key, shapePos, shapeSize, _this.history.addOrModifyAndRedo);
- shape.attachedConnectors.forEach(function (connector) {
- ModelUtils_1.ModelUtils.updateConnectorAttachedPoints(_this.history, connector, _this.history.addOrModifyAndRedo);
- });
- });
- this.connectors.forEach(function (connector, index) {
- var startPtIndex = connector.beginItem ? 1 : 0;
- var endPtIndex = connector.endItem ? (connector.points.length - 2) : (connector.points.length - 1);
- for (var i = startPtIndex; i <= endPtIndex; i++) {
- var connectorPtPos = new Utils_1.Point(pos.x + (_this.startConnectorPoints[index][i].x - _this.startRectangle.left) * ratioX, pos.y + (_this.startConnectorPoints[index][i].y - _this.startRectangle.top) * ratioY);
- ModelUtils_1.ModelUtils.setConnectorPoint(_this.history, _this.model, connector.key, i, connectorPtPos, _this.history.addOrModifyAndRedo);
- }
- });
- this.tryUpdateModelSize();
- this.setResizeInfo();
- };
- MouseHandlerResizeShapeState.prototype.tryUpdateModelSize = function () {
- var _this = this;
- this.handler.tryUpdateModelSize(function (offsetLeft, offsetTop) {
- _this.startShapePositions.forEach(function (pt) {
- pt.x += offsetLeft;
- pt.y += offsetTop;
- });
- _this.startConnectorPoints.forEach(function (connector) {
- connector.forEach(function (pt) {
- pt.x += offsetLeft;
- pt.y += offsetTop;
- });
- });
- _this.startRectangle.position.x += offsetLeft;
- _this.startRectangle.position.y += offsetTop;
- _this.startPoint.x += offsetLeft;
- _this.startPoint.y += offsetTop;
- });
- };
- MouseHandlerResizeShapeState.prototype.setResizeInfo = function () {
- var rect = Model_1.DiagramModel.getRectangle(this.shapes);
- var point = new Utils_1.Point(rect.center.x, rect.bottom + CanvasManager_1.CanvasManager.resizeInfoOffset);
- var text = this.model.getModelUnitText(rect.width) + " x " + this.model.getModelUnitText(rect.height);
- this.resizeInfoVisualizer.set(point, text);
- };
- MouseHandlerResizeShapeState.prototype.resetResizeInfo = function () {
- this.resizeInfoVisualizer.reset();
- };
- MouseHandlerResizeShapeState.prototype.getDraggingElementKeys = function () {
- return this.shapes.map(function (shape) { return shape.key; });
- };
- MouseHandlerResizeShapeState.prototype.getSize = function (evt, position, startSize) {
- var absDeltaX = evt.layoutPoint.x - (this.startScrollLeft - evt.scrollX) - this.startPoint.x;
- var absDeltaY = evt.layoutPoint.y - (this.startScrollTop - evt.scrollY) - this.startPoint.y;
- var deltaX = absDeltaX * Math.cos(this.rotation) - (-absDeltaY) * Math.sin(this.rotation);
- var deltaY = -(absDeltaX * Math.sin(this.rotation) + (-absDeltaY) * Math.cos(this.rotation));
- var newWidth, newHeight;
- deltaY = !this.sideV && deltaY > 0 ? Math.min(startSize.height + 1, deltaY) : deltaY;
- deltaX = !this.sideH && deltaX > 0 ? Math.min(startSize.width + 1, deltaX) : deltaX;
- if (!this.lockH && !this.lockV && this.lockAspectRatio) {
- if (Math.abs(deltaX) > Math.abs(deltaY)) {
- newWidth = this.sideH ? Math.max(MouseHandlerResizeShapeState.minSize, startSize.width + deltaX) : (startSize.width - deltaX);
- newHeight = startSize.height * (newWidth / startSize.width);
- }
- else {
- newHeight = this.sideV ? Math.max(MouseHandlerResizeShapeState.minSize, startSize.height + deltaY) : (startSize.height - deltaY);
- newWidth = startSize.width * (newHeight / startSize.height);
- }
- }
- else {
- deltaX = this.lockH ? 0 : deltaX;
- deltaY = this.lockV ? 0 : deltaY;
- newWidth = Math.max(MouseHandlerResizeShapeState.minSize, this.sideH ? (startSize.width + deltaX) : (startSize.width - deltaX));
- newHeight = Math.max(MouseHandlerResizeShapeState.minSize, this.sideV ? (startSize.height + deltaY) : (startSize.height - deltaY));
- }
- if (!this.lockH)
- newWidth = this.handler.getSnappedPos(evt, position.x + newWidth) - position.x;
- if (!this.lockV)
- newHeight = this.handler.getSnappedPos(evt, position.y + newHeight) - position.y;
- return new Utils_1.Size(newWidth, newHeight);
- };
- MouseHandlerResizeShapeState.prototype.getPosition = function (evt, size, startSize, startPosition) {
- var x = startPosition.x;
- var y = startPosition.y;
- if (this.resizeEventSource === Event_1.ResizeEventSource.ResizeBox_N ||
- this.resizeEventSource === Event_1.ResizeEventSource.ResizeBox_NE ||
- this.resizeEventSource === Event_1.ResizeEventSource.ResizeBox_NW) {
- y += startSize.height - size.height;
- var snappedY = this.handler.getSnappedPos(evt, y);
- size.height += y - snappedY;
- y = snappedY;
- }
- if (this.resizeEventSource === Event_1.ResizeEventSource.ResizeBox_W ||
- this.resizeEventSource === Event_1.ResizeEventSource.ResizeBox_NW ||
- this.resizeEventSource === Event_1.ResizeEventSource.ResizeBox_SW) {
- x += startSize.width - size.width;
- var snappedX = this.handler.getSnappedPos(evt, x);
- size.width += x - snappedX;
- x = snappedX;
- }
- return new Utils_1.Point(x, y);
- };
- MouseHandlerResizeShapeState.minSize = 360;
- return MouseHandlerResizeShapeState;
- }(MouseHandlerDraggingState_1.MouseHandlerDraggingState));
- exports.MouseHandlerResizeShapeState = MouseHandlerResizeShapeState;
- /***/ }),
- /* 222 */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- Object.defineProperty(exports, "__esModule", { value: true });
- var ResizeInfoVisualizer = /** @class */ (function () {
- function ResizeInfoVisualizer(dispatcher) {
- this.dispatcher = dispatcher;
- }
- ResizeInfoVisualizer.prototype.set = function (point, text) {
- this.point = point;
- this.text = text;
- this.raiseShow();
- };
- ResizeInfoVisualizer.prototype.reset = function () {
- if (this.point !== undefined) {
- this.point = undefined;
- this.text = undefined;
- this.raiseHide();
- }
- };
- ResizeInfoVisualizer.prototype.raiseShow = function () {
- var _this = this;
- this.dispatcher.raise1(function (l) { return l.NotifyResizeInfoShow(_this.point, _this.text); });
- };
- ResizeInfoVisualizer.prototype.raiseHide = function () {
- this.dispatcher.raise1(function (l) { return l.NotifyResizeInfoHide(); });
- };
- return ResizeInfoVisualizer;
- }());
- exports.ResizeInfoVisualizer = ResizeInfoVisualizer;
- /***/ }),
- /* 223 */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- var __extends = (this && this.__extends) || (function () {
- var extendStatics = function (d, b) {
- extendStatics = Object.setPrototypeOf ||
- ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
- function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
- return extendStatics(d, b);
- };
- return function (d, b) {
- extendStatics(d, b);
- function __() { this.constructor = d; }
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
- };
- })();
- Object.defineProperty(exports, "__esModule", { value: true });
- var MouseHandlerDraggingState_1 = __webpack_require__(24);
- var AddConnectorPointHistoryItem_1 = __webpack_require__(97);
- var MoveConnectorPointHistoryItem_1 = __webpack_require__(36);
- var ModelUtils_1 = __webpack_require__(8);
- var MouseHandlerMoveConnectorSideState = /** @class */ (function (_super) {
- __extends(MouseHandlerMoveConnectorSideState, _super);
- function MouseHandlerMoveConnectorSideState(handler, history, model) {
- var _this = _super.call(this, handler, history) || this;
- _this.model = model;
- return _this;
- }
- MouseHandlerMoveConnectorSideState.prototype.onMouseDown = function (evt) {
- this.startPoint = evt.layoutPoint;
- this.connectorKey = evt.source.key;
- this.pointIndex = parseInt(evt.source.value);
- _super.prototype.onMouseDown.call(this, evt);
- };
- MouseHandlerMoveConnectorSideState.prototype.onApplyChanges = function (evt) {
- var point = this.getSnappedPoint(evt, evt.layoutPoint);
- if (!this.pointCreated) {
- this.history.addOrModifyAndRedo(new AddConnectorPointHistoryItem_1.AddConnectorPointHistoryItem(this.connectorKey, this.pointIndex, point));
- this.pointCreated = true;
- }
- else {
- this.history.addOrModifyAndRedo(new MoveConnectorPointHistoryItem_1.MoveConnectorPointHistoryItem(this.connectorKey, this.pointIndex, point));
- }
- this.handler.tryUpdateModelSize();
- };
- MouseHandlerMoveConnectorSideState.prototype.onFinishWithChanges = function () {
- ModelUtils_1.ModelUtils.removeUnnecessaryConnectorPoints(this.history, this.model.findConnector(this.connectorKey));
- };
- MouseHandlerMoveConnectorSideState.prototype.getDraggingElementKeys = function () {
- return [this.connectorKey];
- };
- return MouseHandlerMoveConnectorSideState;
- }(MouseHandlerDraggingState_1.MouseHandlerDraggingState));
- exports.MouseHandlerMoveConnectorSideState = MouseHandlerMoveConnectorSideState;
- /***/ }),
- /* 224 */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- var __extends = (this && this.__extends) || (function () {
- var extendStatics = function (d, b) {
- extendStatics = Object.setPrototypeOf ||
- ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
- function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
- return extendStatics(d, b);
- };
- return function (d, b) {
- extendStatics(d, b);
- function __() { this.constructor = d; }
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
- };
- })();
- Object.defineProperty(exports, "__esModule", { value: true });
- var MouseHandlerDraggingState_1 = __webpack_require__(24);
- var ChangeShapeParametersHistoryItem_1 = __webpack_require__(225);
- var MouseHandlerDragParameterPointState = /** @class */ (function (_super) {
- __extends(MouseHandlerDragParameterPointState, _super);
- function MouseHandlerDragParameterPointState(handler, history, model) {
- var _this = _super.call(this, handler, history) || this;
- _this.model = model;
- _this.startScrollLeft = 0;
- _this.startScrollTop = 0;
- return _this;
- }
- MouseHandlerDragParameterPointState.prototype.onMouseDown = function (evt) {
- this.startPoint = evt.layoutPoint;
- this.shape = this.model.findShape(evt.source.key);
- this.parameterPointKey = evt.source.value;
- this.startParameters = this.shape.parameters.clone();
- _super.prototype.onMouseDown.call(this, evt);
- };
- MouseHandlerDragParameterPointState.prototype.onApplyChanges = function (evt) {
- var offsetX = this.handler.getSnappedPos(evt, evt.layoutPoint.x - this.startPoint.x);
- var offsetY = this.handler.getSnappedPos(evt, evt.layoutPoint.y - this.startPoint.y);
- var parameters = this.startParameters.clone();
- this.shape.description.modifyParameters(this.shape, parameters, offsetX, offsetY);
- this.history.addOrModifyAndRedo(new ChangeShapeParametersHistoryItem_1.ChangeShapeParametersHistoryItem(this.shape.key, parameters));
- };
- MouseHandlerDragParameterPointState.prototype.getDraggingElementKeys = function () {
- return [this.shape.key];
- };
- return MouseHandlerDragParameterPointState;
- }(MouseHandlerDraggingState_1.MouseHandlerDraggingState));
- exports.MouseHandlerDragParameterPointState = MouseHandlerDragParameterPointState;
- /***/ }),
- /* 225 */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- var __extends = (this && this.__extends) || (function () {
- var extendStatics = function (d, b) {
- extendStatics = Object.setPrototypeOf ||
- ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
- function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
- return extendStatics(d, b);
- };
- return function (d, b) {
- extendStatics(d, b);
- function __() { this.constructor = d; }
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
- };
- })();
- Object.defineProperty(exports, "__esModule", { value: true });
- var HistoryItem_1 = __webpack_require__(4);
- var ChangeShapeParametersHistoryItem = /** @class */ (function (_super) {
- __extends(ChangeShapeParametersHistoryItem, _super);
- function ChangeShapeParametersHistoryItem(shapeKey, parameters) {
- var _this = _super.call(this) || this;
- _this.shapeKey = shapeKey;
- _this.parameters = parameters;
- return _this;
- }
- ChangeShapeParametersHistoryItem.prototype.redo = function (manipulator) {
- var shape = manipulator.model.findShape(this.shapeKey);
- this.oldParameters = shape.parameters.clone();
- manipulator.changeShapeParameters(shape, this.parameters);
- };
- ChangeShapeParametersHistoryItem.prototype.undo = function (manipulator) {
- var shape = manipulator.model.findShape(this.shapeKey);
- manipulator.changeShapeParameters(shape, this.oldParameters);
- };
- return ChangeShapeParametersHistoryItem;
- }(HistoryItem_1.HistoryItem));
- exports.ChangeShapeParametersHistoryItem = ChangeShapeParametersHistoryItem;
- /***/ }),
- /* 226 */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- var __extends = (this && this.__extends) || (function () {
- var extendStatics = function (d, b) {
- extendStatics = Object.setPrototypeOf ||
- ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
- function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
- return extendStatics(d, b);
- };
- return function (d, b) {
- extendStatics(d, b);
- function __() { this.constructor = d; }
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
- };
- })();
- Object.defineProperty(exports, "__esModule", { value: true });
- var Event_1 = __webpack_require__(14);
- var Utils_1 = __webpack_require__(0);
- var SelectionRectVisualizer_1 = __webpack_require__(227);
- var MouseHandlerStateBase_1 = __webpack_require__(45);
- var MouseHandlerSelectionState = /** @class */ (function (_super) {
- __extends(MouseHandlerSelectionState, _super);
- function MouseHandlerSelectionState(handler, selection) {
- var _this = _super.call(this, handler) || this;
- _this.selection = selection;
- return _this;
- }
- MouseHandlerSelectionState.prototype.cancelChanges = function () { };
- MouseHandlerSelectionState.prototype.start = function () {
- this.selectionRectangleVisualizer = new SelectionRectVisualizer_1.SelectionRectVisualizer(this.handler.onVisualizersUpdate);
- _super.prototype.start.call(this);
- };
- MouseHandlerSelectionState.prototype.finish = function () {
- this.selectionRectangleVisualizer.reset();
- _super.prototype.finish.call(this);
- };
- MouseHandlerSelectionState.prototype.onMouseDown = function (evt) {
- this.startPoint = evt.layoutPoint;
- };
- MouseHandlerSelectionState.prototype.onMouseMove = function (evt) {
- if (evt.button !== Event_1.MouseButton.Left) {
- this.handler.switchToDefaultState();
- return;
- }
- var rect = Utils_1.Rectangle.createByPoints(this.startPoint, evt.layoutPoint);
- this.selectionRectangleVisualizer.setRectangle(rect);
- };
- MouseHandlerSelectionState.prototype.onMouseUp = function (evt) {
- var selectionRect = this.selectionRectangleVisualizer.getRectangle();
- if (selectionRect !== undefined)
- this.selection.selectRect(selectionRect);
- else
- this.selection.set([]);
- this.handler.switchToDefaultState();
- };
- return MouseHandlerSelectionState;
- }(MouseHandlerStateBase_1.MouseHandlerCancellableState));
- exports.MouseHandlerSelectionState = MouseHandlerSelectionState;
- /***/ }),
- /* 227 */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- Object.defineProperty(exports, "__esModule", { value: true });
- var SelectionRectVisualizer = /** @class */ (function () {
- function SelectionRectVisualizer(dispatcher) {
- this.dispatcher = dispatcher;
- }
- SelectionRectVisualizer.prototype.getRectangle = function () {
- return this.rect;
- };
- SelectionRectVisualizer.prototype.setRectangle = function (rect) {
- this.rect = rect;
- this.raiseShow();
- };
- SelectionRectVisualizer.prototype.reset = function () {
- this.rect = undefined;
- this.raiseHide();
- };
- SelectionRectVisualizer.prototype.raiseShow = function () {
- var _this = this;
- this.dispatcher.raise1(function (l) { return l.NotifySelectionRectShow(_this.rect); });
- };
- SelectionRectVisualizer.prototype.raiseHide = function () {
- this.dispatcher.raise1(function (l) { return l.NotifySelectionRectHide(); });
- };
- return SelectionRectVisualizer;
- }());
- exports.SelectionRectVisualizer = SelectionRectVisualizer;
- /***/ }),
- /* 228 */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- var __extends = (this && this.__extends) || (function () {
- var extendStatics = function (d, b) {
- extendStatics = Object.setPrototypeOf ||
- ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
- function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
- return extendStatics(d, b);
- };
- return function (d, b) {
- extendStatics(d, b);
- function __() { this.constructor = d; }
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
- };
- })();
- Object.defineProperty(exports, "__esModule", { value: true });
- var Connector_1 = __webpack_require__(5);
- var AddConnectionHistoryItem_1 = __webpack_require__(35);
- var AddConnectorHistoryItem_1 = __webpack_require__(58);
- var MouseHandlerMoveConnectorPointStateBase_1 = __webpack_require__(96);
- var SetSelectionHistoryItem_1 = __webpack_require__(29);
- var ChangeConnectorPropertyHistoryItem_1 = __webpack_require__(91);
- var ChangeStyleHistoryItem_1 = __webpack_require__(63);
- var ChangeStyleTextHistoryItem_1 = __webpack_require__(42);
- var MouseHandlerCreateConnectorState = /** @class */ (function (_super) {
- __extends(MouseHandlerCreateConnectorState, _super);
- function MouseHandlerCreateConnectorState(handler, history, model, selection, connectionPointIndex) {
- var _this = _super.call(this, handler, history, model) || this;
- _this.selection = selection;
- _this.connectionPointIndex = connectionPointIndex;
- return _this;
- }
- MouseHandlerCreateConnectorState.prototype.onMouseDown = function (evt) {
- if (this.connectionPointIndex === undefined)
- this.connectionPointIndex = parseInt(evt.source.value);
- this.connectedItem = this.model.findItem(evt.source.key);
- this.pointIndex = 1;
- this.pointPosition = Connector_1.ConnectorPosition.End;
- _super.prototype.onMouseDown.call(this, evt);
- };
- MouseHandlerCreateConnectorState.prototype.onApplyChanges = function (evt) {
- var _this = this;
- var point = this.getSnappedPoint(evt, evt.layoutPoint);
- if (!this.connector) {
- var historyItem = new AddConnectorHistoryItem_1.AddConnectorHistoryItem([this.connectedItem.getConnectionPoint(this.connectionPointIndex, point), point]);
- this.history.addOrModifyAndRedo(historyItem);
- this.connector = this.model.findConnector(historyItem.connectorKey);
- this.connector.properties.forEach(function (propertyName) {
- _this.history.addOrModifyAndRedo(new ChangeConnectorPropertyHistoryItem_1.ChangeConnectorPropertyHistoryItem(_this.connector.key, propertyName, _this.selection.inputPosition.getConnectorPropertyDefaultValue(propertyName)));
- });
- this.connector.style.forEach(function (propertyName) {
- _this.history.addOrModifyAndRedo(new ChangeStyleHistoryItem_1.ChangeStyleHistoryItem(_this.connector.key, propertyName, _this.selection.inputPosition.getStylePropertyDefaultValue(propertyName)));
- });
- this.connector.styleText.forEach(function (propertyName) {
- _this.history.addOrModifyAndRedo(new ChangeStyleTextHistoryItem_1.ChangeStyleTextHistoryItem(_this.connector.key, propertyName, _this.selection.inputPosition.getStyleTextPropertyDefaultValue(propertyName)));
- });
- this.history.addOrModifyAndRedo(new AddConnectionHistoryItem_1.AddConnectionHistoryItem(this.connector, this.connectedItem, this.connectionPointIndex, Connector_1.ConnectorPosition.Begin));
- }
- else
- _super.prototype.onApplyChanges.call(this, evt);
- };
- MouseHandlerCreateConnectorState.prototype.onFinishWithChanges = function () {
- this.history.addAndRedo(new SetSelectionHistoryItem_1.SetSelectionHistoryItem(this.selection, [this.connector.key]));
- };
- return MouseHandlerCreateConnectorState;
- }(MouseHandlerMoveConnectorPointStateBase_1.MouseHandlerMoveConnectorPointStateBase));
- exports.MouseHandlerCreateConnectorState = MouseHandlerCreateConnectorState;
- /***/ }),
- /* 229 */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- var __extends = (this && this.__extends) || (function () {
- var extendStatics = function (d, b) {
- extendStatics = Object.setPrototypeOf ||
- ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
- function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
- return extendStatics(d, b);
- };
- return function (d, b) {
- extendStatics(d, b);
- function __() { this.constructor = d; }
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
- };
- })();
- Object.defineProperty(exports, "__esModule", { value: true });
- var Utils_1 = __webpack_require__(0);
- var Connector_1 = __webpack_require__(5);
- var MouseHandlerDraggingState_1 = __webpack_require__(24);
- var AddConnectorPointHistoryItem_1 = __webpack_require__(97);
- var MoveConnectorPointHistoryItem_1 = __webpack_require__(36);
- var ModelUtils_1 = __webpack_require__(8);
- var DiagramItem_1 = __webpack_require__(3);
- var MouseHandlerMoveConnectorOrthogonalSideState = /** @class */ (function (_super) {
- __extends(MouseHandlerMoveConnectorOrthogonalSideState, _super);
- function MouseHandlerMoveConnectorOrthogonalSideState(handler, history, model) {
- var _this = _super.call(this, handler, history) || this;
- _this.model = model;
- return _this;
- }
- MouseHandlerMoveConnectorOrthogonalSideState.prototype.onMouseDown = function (evt) {
- this.startPoint = evt.layoutPoint;
- this.connector = this.model.findConnector(evt.source.key);
- var renderPointIndexes = evt.source.value.split("_");
- var renderPointIndex1 = parseInt(renderPointIndexes[0]);
- var renderPointIndex2 = parseInt(renderPointIndexes[1]);
- var points = this.connector.getRenderPoints(true);
- this.renderPoint1 = points[renderPointIndex1].clone();
- this.renderPoint2 = points[renderPointIndex2].clone();
- this.isVerticalOrientation = this.renderPoint1.x === this.renderPoint2.x;
- if (this.renderPoint1.pointIndex !== -1) {
- this.pointIndex1 = this.renderPoint1.pointIndex;
- if (this.pointIndex1 === 0) {
- this.pointIndex1++;
- this.correctEdgePoint(this.renderPoint1, this.renderPoint2, this.connector.beginItem, this.connector.beginConnectionPointIndex);
- }
- else
- this.point1 = this.connector.points[this.pointIndex1];
- }
- else
- this.pointIndex1 = this.findPointIndex(points, renderPointIndex1, false) + 1;
- if (this.renderPoint2.pointIndex !== -1) {
- this.pointIndex2 = this.renderPoint2.pointIndex;
- if (this.pointIndex2 === this.connector.points.length - 1) {
- this.correctEdgePoint(this.renderPoint2, this.renderPoint1, this.connector.endItem, this.connector.endConnectionPointIndex);
- }
- else
- this.point2 = this.connector.points[this.pointIndex2];
- }
- else
- this.pointIndex2 = this.findPointIndex(points, renderPointIndex2, true);
- _super.prototype.onMouseDown.call(this, evt);
- };
- MouseHandlerMoveConnectorOrthogonalSideState.prototype.onApplyChanges = function (evt) {
- var _this = this;
- if (!this.pointCreated) {
- var createdPoint1 = void 0, createdPoint2 = void 0;
- if (this.point1 === undefined) {
- this.point1 = new Utils_1.Point(this.renderPoint1.x, this.renderPoint1.y);
- this.history.addOrModifyAndRedo(new AddConnectorPointHistoryItem_1.AddConnectorPointHistoryItem(this.connector.key, this.pointIndex1, this.point1));
- createdPoint1 = this.point1;
- this.pointIndex2++;
- }
- if (this.point2 === undefined) {
- this.point2 = new Utils_1.Point(this.renderPoint2.x, this.renderPoint2.y);
- this.history.addOrModifyAndRedo(new AddConnectorPointHistoryItem_1.AddConnectorPointHistoryItem(this.connector.key, this.pointIndex2, this.point2));
- createdPoint2 = this.point2;
- }
- ModelUtils_1.ModelUtils.removeUnnecessaryConnectorPoints(this.history, this.connector, [createdPoint1, createdPoint2], function (index) {
- if (index < _this.pointIndex1)
- _this.pointIndex1--;
- if (index < _this.pointIndex2)
- _this.pointIndex2--;
- });
- this.pointCreated = true;
- }
- var point = this.getSnappedPoint(evt, evt.layoutPoint);
- if (this.isVerticalOrientation) {
- this.point1.x = point.x;
- this.point2.x = point.x;
- }
- else {
- this.point1.y = point.y;
- this.point2.y = point.y;
- }
- this.history.addOrModifyAndRedo(new MoveConnectorPointHistoryItem_1.MoveConnectorPointHistoryItem(this.connector.key, this.pointIndex1, this.point1));
- this.history.addOrModifyAndRedo(new MoveConnectorPointHistoryItem_1.MoveConnectorPointHistoryItem(this.connector.key, this.pointIndex2, this.point2));
- this.handler.tryUpdateModelSize();
- };
- MouseHandlerMoveConnectorOrthogonalSideState.prototype.onFinishWithChanges = function () {
- ModelUtils_1.ModelUtils.removeUnnecessaryConnectorPoints(this.history, this.connector);
- };
- MouseHandlerMoveConnectorOrthogonalSideState.prototype.findPointIndex = function (points, index, direction) {
- var point;
- while (point = points[index]) {
- if (point.pointIndex !== -1)
- return point.pointIndex;
- index += direction ? 1 : -1;
- }
- };
- MouseHandlerMoveConnectorOrthogonalSideState.prototype.correctEdgePoint = function (point, directionPoint, item, connectionPointIndex) {
- var offset = 0;
- if (item !== undefined) {
- var side = item.getConnectionPointSide(connectionPointIndex);
- var rect = item.rectangle;
- offset = Connector_1.Connector.minOffset;
- switch (side) {
- case DiagramItem_1.ConnectionPointSide.South:
- offset += rect.bottom - point.y;
- break;
- case DiagramItem_1.ConnectionPointSide.North:
- offset += point.y - rect.top;
- break;
- case DiagramItem_1.ConnectionPointSide.East:
- offset += rect.right - point.x;
- break;
- case DiagramItem_1.ConnectionPointSide.West:
- offset += point.x - rect.left;
- break;
- }
- }
- if (this.isVerticalOrientation) {
- if (point.y > directionPoint.y)
- point.y -= Math.min(offset, point.y - directionPoint.y);
- else
- point.y += Math.min(offset, directionPoint.y - point.y);
- }
- else {
- if (point.x > directionPoint.x)
- point.x -= Math.min(offset, point.x - directionPoint.x);
- else
- point.x += Math.min(offset, directionPoint.x - point.x);
- }
- };
- MouseHandlerMoveConnectorOrthogonalSideState.prototype.getDraggingElementKeys = function () {
- return [this.connector.key];
- };
- return MouseHandlerMoveConnectorOrthogonalSideState;
- }(MouseHandlerDraggingState_1.MouseHandlerDraggingState));
- exports.MouseHandlerMoveConnectorOrthogonalSideState = MouseHandlerMoveConnectorOrthogonalSideState;
- /***/ }),
- /* 230 */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- var __extends = (this && this.__extends) || (function () {
- var extendStatics = function (d, b) {
- extendStatics = Object.setPrototypeOf ||
- ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
- function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
- return extendStatics(d, b);
- };
- return function (d, b) {
- extendStatics(d, b);
- function __() { this.constructor = d; }
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
- };
- })();
- Object.defineProperty(exports, "__esModule", { value: true });
- var ShapeDescriptionManager_1 = __webpack_require__(30);
- var Utils_1 = __webpack_require__(0);
- var AddShapeHistoryItem_1 = __webpack_require__(51);
- var SetSelectionHistoryItem_1 = __webpack_require__(29);
- var ChangeStyleHistoryItem_1 = __webpack_require__(63);
- var ChangeStyleTextHistoryItem_1 = __webpack_require__(42);
- var MouseHandlerDraggingState_1 = __webpack_require__(24);
- var DeleteShapeHistoryItem_1 = __webpack_require__(74);
- var ModelUtils_1 = __webpack_require__(8);
- var MouseHandlerStateBase_1 = __webpack_require__(45);
- var NON_DOCUMENT_TIMER = 500;
- var LOCK_UPDATEPAGESIZE_TIMER = 300;
- var MouseHandlerBeforeToolboxDraggingState = /** @class */ (function (_super) {
- __extends(MouseHandlerBeforeToolboxDraggingState, _super);
- function MouseHandlerBeforeToolboxDraggingState(handler, history, model, selection) {
- var _this = _super.call(this, handler) || this;
- _this.history = history;
- _this.model = model;
- _this.selection = selection;
- return _this;
- }
- MouseHandlerBeforeToolboxDraggingState.prototype.cancelChanges = function () {
- this.tryRemoveTimer();
- };
- MouseHandlerBeforeToolboxDraggingState.prototype.onDragStart = function (evt) {
- this.dragging = evt;
- };
- MouseHandlerBeforeToolboxDraggingState.prototype.onDragEnd = function (evt) {
- this.cancelChanges();
- this.handler.switchToDefaultState();
- };
- MouseHandlerBeforeToolboxDraggingState.prototype.onMouseMove = function (evt) {
- var _this = this;
- if (this.canSwitchToDraggingState(evt)) {
- this.tryRemoveTimer();
- this.switchToDraggingState(evt, false);
- }
- else if (evt.source.type !== undefined) {
- this.savedEvt = evt;
- if (this.nonPageAreaTimer === undefined)
- this.nonPageAreaTimer = setTimeout(function () { return _this.switchToDraggingState(_this.savedEvt, true); }, NON_DOCUMENT_TIMER);
- }
- else if (this.nonPageAreaTimer !== undefined)
- this.tryRemoveTimer();
- };
- MouseHandlerBeforeToolboxDraggingState.prototype.switchToDraggingState = function (evt, skipLockUpdatePageSize) {
- this.handler.switchState(new MouseHandlerToolboxDraggingState(this.handler, this.history, this.model, this.selection, skipLockUpdatePageSize));
- this.handler.state.onDragStart(this.dragging);
- this.handler.state.onMouseMove(evt);
- };
- MouseHandlerBeforeToolboxDraggingState.prototype.canSwitchToDraggingState = function (evt) {
- return evt.source.type !== undefined &&
- evt.layoutPoint.x >= 0 && evt.layoutPoint.x <= this.model.size.width &&
- evt.layoutPoint.y >= 0 && evt.layoutPoint.y <= this.model.size.height;
- };
- MouseHandlerBeforeToolboxDraggingState.prototype.tryRemoveTimer = function () {
- if (this.nonPageAreaTimer !== undefined) {
- clearTimeout(this.nonPageAreaTimer);
- delete this.nonPageAreaTimer;
- }
- };
- MouseHandlerBeforeToolboxDraggingState.prototype.finish = function () {
- this.tryRemoveTimer();
- };
- return MouseHandlerBeforeToolboxDraggingState;
- }(MouseHandlerStateBase_1.MouseHandlerCancellableState));
- exports.MouseHandlerBeforeToolboxDraggingState = MouseHandlerBeforeToolboxDraggingState;
- var MouseHandlerToolboxDraggingState = /** @class */ (function (_super) {
- __extends(MouseHandlerToolboxDraggingState, _super);
- function MouseHandlerToolboxDraggingState(handler, history, model, selection, skipLockUpdatePageSize) {
- var _this = _super.call(this, handler, history) || this;
- _this.model = model;
- _this.selection = selection;
- if (!skipLockUpdatePageSize) {
- _this.updatePageSizeTimer = setTimeout(function () {
- _this.handler.tryUpdateModelSize();
- delete _this.updatePageSizeTimer;
- }, LOCK_UPDATEPAGESIZE_TIMER);
- }
- return _this;
- }
- MouseHandlerToolboxDraggingState.prototype.onMouseMove = function (evt) {
- _super.prototype.onMouseMove.call(this, evt);
- var shape = this.model.findShape(this.shapeKey);
- if (shape)
- this.handler.setExtensionLines([shape]);
- };
- MouseHandlerToolboxDraggingState.prototype.getDraggingElementKeys = function () {
- return this.shapeKey === undefined ? [] : [this.shapeKey];
- };
- MouseHandlerToolboxDraggingState.prototype.onApplyChanges = function (evt) {
- if (evt.source.type === undefined) {
- this.dragging.onCaptured(false);
- if (this.shapeKey !== undefined && !this.deleteHistoryItem) {
- this.deleteHistoryItem = new DeleteShapeHistoryItem_1.DeleteShapeHistoryItem(this.shapeKey);
- this.history.addOrModifyAndRedo(this.deleteHistoryItem);
- }
- return;
- }
- this.dragging.onCaptured(true);
- if (this.shapeKey === undefined) {
- this.startPoint = evt.layoutPoint;
- this.shapeKey = this.insertToolboxItem(evt);
- }
- if (this.deleteHistoryItem) {
- this.history.undoTransactionTo(this.deleteHistoryItem);
- delete this.deleteHistoryItem;
- }
- var pos = this.getPosition(evt, this.startShapePosition);
- ModelUtils_1.ModelUtils.setShapePosition(this.history, this.model, this.shapeKey, pos, this.history.addOrModifyAndRedo);
- if (this.updatePageSizeTimer === undefined)
- this.handler.tryUpdateModelSize();
- };
- MouseHandlerToolboxDraggingState.prototype.onFinishWithChanges = function () {
- this.history.addOrModifyAndRedo(new SetSelectionHistoryItem_1.SetSelectionHistoryItem(this.selection, [this.shapeKey]));
- };
- MouseHandlerToolboxDraggingState.prototype.onDragStart = function (evt) {
- this.dragging = evt;
- };
- MouseHandlerToolboxDraggingState.prototype.onDragEnd = function (evt) {
- if (this.shapeKey !== undefined && evt.source.type === undefined)
- this.cancelChanges();
- this.handler.switchToDefaultState();
- };
- MouseHandlerToolboxDraggingState.prototype.finish = function () {
- this.handler.resetExtensionLines();
- this.dragging.onFinishDragging();
- _super.prototype.finish.call(this);
- };
- MouseHandlerToolboxDraggingState.prototype.updateShapeProperties = function (itemKey) {
- var _this = this;
- this.selection.inputPosition.stylePropertiesDefault.forEach(function (propertyName) {
- _this.history.addOrModifyAndRedo(new ChangeStyleHistoryItem_1.ChangeStyleHistoryItem(itemKey, propertyName, _this.selection.inputPosition.getStylePropertyDefaultValue(propertyName)));
- });
- this.selection.inputPosition.styleTextPropertiesDefault.forEach(function (propertyName) {
- _this.history.addOrModifyAndRedo(new ChangeStyleTextHistoryItem_1.ChangeStyleTextHistoryItem(itemKey, propertyName, _this.selection.inputPosition.getStyleTextPropertyValue(propertyName)));
- });
- };
- MouseHandlerToolboxDraggingState.prototype.insertToolboxItem = function (evt) {
- var description = ShapeDescriptionManager_1.ShapeDescriptionManager.get(this.dragging.shapeType);
- this.startShapePosition = this.getSnappedPoint(evt, new Utils_1.Point(evt.layoutPoint.x - description.defaultSize.width / 2, evt.layoutPoint.y - description.defaultSize.height / 2));
- var historyItem = new AddShapeHistoryItem_1.AddShapeHistoryItem(this.dragging.shapeType, this.startShapePosition, this.dragging.item && this.dragging.item.text);
- this.history.addOrModifyAndRedo(historyItem);
- this.updateShapeProperties(historyItem.shapeKey);
- return historyItem.shapeKey;
- };
- MouseHandlerToolboxDraggingState.prototype.getPosition = function (evt, basePoint) {
- return this.getSnappedPoint(evt, new Utils_1.Point(basePoint.x + evt.layoutPoint.x - this.startPoint.x, basePoint.y + evt.layoutPoint.y - this.startPoint.y));
- };
- return MouseHandlerToolboxDraggingState;
- }(MouseHandlerDraggingState_1.MouseHandlerDraggingState));
- exports.MouseHandlerToolboxDraggingState = MouseHandlerToolboxDraggingState;
- /***/ }),
- /* 231 */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- var __extends = (this && this.__extends) || (function () {
- var extendStatics = function (d, b) {
- extendStatics = Object.setPrototypeOf ||
- ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
- function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
- return extendStatics(d, b);
- };
- return function (d, b) {
- extendStatics(d, b);
- function __() { this.constructor = d; }
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
- };
- })();
- Object.defineProperty(exports, "__esModule", { value: true });
- var MouseHandlerDraggingState_1 = __webpack_require__(24);
- var ChangeConnectorTextPositionHistoryItem_1 = __webpack_require__(232);
- var ChangeConnectorTextHistoryItem_1 = __webpack_require__(98);
- var MouseHandlerMoveConnectorTextState = /** @class */ (function (_super) {
- __extends(MouseHandlerMoveConnectorTextState, _super);
- function MouseHandlerMoveConnectorTextState(handler, history, model) {
- var _this = _super.call(this, handler, history) || this;
- _this.model = model;
- return _this;
- }
- MouseHandlerMoveConnectorTextState.prototype.onMouseDown = function (evt) {
- this.connector = this.model.findConnector(evt.source.key);
- this.position = parseFloat(evt.source.value);
- this.text = this.connector.getText(this.position);
- this.savedText = "";
- _super.prototype.onMouseDown.call(this, evt);
- };
- MouseHandlerMoveConnectorTextState.prototype.onApplyChanges = function (evt) {
- var newPosition = this.connector.getTextPositionByPoint(evt.layoutPoint);
- if (newPosition != this.position) {
- var text = this.connector.getText(newPosition);
- if (text !== "" && text !== this.text) {
- this.history.addAndRedo(new ChangeConnectorTextHistoryItem_1.ChangeConnectorTextHistoryItem(this.connector, newPosition, ""));
- this.savedText = text;
- }
- this.history.addOrModifyAndRedo(new ChangeConnectorTextPositionHistoryItem_1.ChangeConnectorTextPositionHistoryItem(this.connector, this.position, newPosition));
- if (this.savedText !== "" && this.savedText !== text) {
- this.history.addAndRedo(new ChangeConnectorTextHistoryItem_1.ChangeConnectorTextHistoryItem(this.connector, this.position, this.savedText));
- this.savedText = "";
- }
- this.position = newPosition;
- }
- };
- MouseHandlerMoveConnectorTextState.prototype.getDraggingElementKeys = function () {
- return [this.connector.key];
- };
- return MouseHandlerMoveConnectorTextState;
- }(MouseHandlerDraggingState_1.MouseHandlerDraggingState));
- exports.MouseHandlerMoveConnectorTextState = MouseHandlerMoveConnectorTextState;
- /***/ }),
- /* 232 */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- var __extends = (this && this.__extends) || (function () {
- var extendStatics = function (d, b) {
- extendStatics = Object.setPrototypeOf ||
- ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
- function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
- return extendStatics(d, b);
- };
- return function (d, b) {
- extendStatics(d, b);
- function __() { this.constructor = d; }
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
- };
- })();
- Object.defineProperty(exports, "__esModule", { value: true });
- var HistoryItem_1 = __webpack_require__(4);
- var ChangeConnectorTextPositionHistoryItem = /** @class */ (function (_super) {
- __extends(ChangeConnectorTextPositionHistoryItem, _super);
- function ChangeConnectorTextPositionHistoryItem(connector, position, newPosition) {
- var _this = _super.call(this) || this;
- _this.connectorKey = connector.key;
- _this.position = position;
- _this.newPosition = newPosition;
- return _this;
- }
- ChangeConnectorTextPositionHistoryItem.prototype.redo = function (manipulator) {
- var connector = manipulator.model.findConnector(this.connectorKey);
- manipulator.changeConnectorTextPosition(connector, this.position, this.newPosition);
- };
- ChangeConnectorTextPositionHistoryItem.prototype.undo = function (manipulator) {
- var connector = manipulator.model.findConnector(this.connectorKey);
- manipulator.changeConnectorTextPosition(connector, this.newPosition, this.position);
- };
- return ChangeConnectorTextPositionHistoryItem;
- }(HistoryItem_1.HistoryItem));
- exports.ChangeConnectorTextPositionHistoryItem = ChangeConnectorTextPositionHistoryItem;
- /***/ }),
- /* 233 */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- var __extends = (this && this.__extends) || (function () {
- var extendStatics = function (d, b) {
- extendStatics = Object.setPrototypeOf ||
- ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
- function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
- return extendStatics(d, b);
- };
- return function (d, b) {
- extendStatics(d, b);
- function __() { this.constructor = d; }
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
- };
- })();
- Object.defineProperty(exports, "__esModule", { value: true });
- var ConnectionPointsVisualizerBase_1 = __webpack_require__(67);
- var ConnectionPointsVisualizer = /** @class */ (function (_super) {
- __extends(ConnectionPointsVisualizer, _super);
- function ConnectionPointsVisualizer(dispatcher) {
- return _super.call(this, dispatcher) || this;
- }
- ConnectionPointsVisualizer.prototype.raiseShow = function () {
- var _this = this;
- this.dispatcher.raise1(function (l) { return l.NotifyConnectionPointsShow(_this.key, _this.points, _this.pointIndex); });
- };
- ConnectionPointsVisualizer.prototype.raiseHide = function () {
- this.dispatcher.raise1(function (l) { return l.NotifyConnectionPointsHide(); });
- };
- return ConnectionPointsVisualizer;
- }(ConnectionPointsVisualizerBase_1.ConnectionPointsVisualizerBase));
- exports.ConnectionPointsVisualizer = ConnectionPointsVisualizer;
- /***/ }),
- /* 234 */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- var __extends = (this && this.__extends) || (function () {
- var extendStatics = function (d, b) {
- extendStatics = Object.setPrototypeOf ||
- ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
- function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
- return extendStatics(d, b);
- };
- return function (d, b) {
- extendStatics(d, b);
- function __() { this.constructor = d; }
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
- };
- })();
- Object.defineProperty(exports, "__esModule", { value: true });
- var ConnectionPointsVisualizerBase_1 = __webpack_require__(67);
- var ConnectionMarksVisualizer = /** @class */ (function (_super) {
- __extends(ConnectionMarksVisualizer, _super);
- function ConnectionMarksVisualizer(dispatcher) {
- return _super.call(this, dispatcher) || this;
- }
- ConnectionMarksVisualizer.prototype.raiseShow = function () {
- var _this = this;
- this.dispatcher.raise1(function (l) { return l.NotifyConnectionMarksShow(_this.key, _this.points, _this.pointIndex); });
- };
- ConnectionMarksVisualizer.prototype.raiseHide = function () {
- this.dispatcher.raise1(function (l) { return l.NotifyConnectionMarksHide(); });
- };
- return ConnectionMarksVisualizer;
- }(ConnectionPointsVisualizerBase_1.ConnectionPointsVisualizerBase));
- exports.ConnectionMarksVisualizer = ConnectionMarksVisualizer;
- /***/ }),
- /* 235 */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- Object.defineProperty(exports, "__esModule", { value: true });
- var ConnectionTargetVisualizer = /** @class */ (function () {
- function ConnectionTargetVisualizer(dispatcher) {
- this.dispatcher = dispatcher;
- }
- ConnectionTargetVisualizer.prototype.getKey = function () {
- return this.key;
- };
- ConnectionTargetVisualizer.prototype.setTargetRect = function (key, targetRect) {
- if (this.key !== key) {
- this.key = key;
- this.targetRect = targetRect;
- this.raiseShow();
- }
- };
- ConnectionTargetVisualizer.prototype.reset = function () {
- if (this.key !== "-1") {
- this.key = "-1";
- this.targetRect = undefined;
- this.raiseHide();
- }
- };
- ConnectionTargetVisualizer.prototype.raiseShow = function () {
- var _this = this;
- this.dispatcher.raise1(function (l) { return l.NotifyConnectionTargetShow(_this.key, _this.targetRect); });
- };
- ConnectionTargetVisualizer.prototype.raiseHide = function () {
- this.dispatcher.raise1(function (l) { return l.NotifyConnectionTargetHide(); });
- };
- return ConnectionTargetVisualizer;
- }());
- exports.ConnectionTargetVisualizer = ConnectionTargetVisualizer;
- /***/ }),
- /* 236 */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- Object.defineProperty(exports, "__esModule", { value: true });
- var ChangeShapeTextHistoryItem_1 = __webpack_require__(237);
- var Event_1 = __webpack_require__(14);
- var KeyCode_1 = __webpack_require__(16);
- var Shape_1 = __webpack_require__(9);
- var Connector_1 = __webpack_require__(5);
- var ChangeConnectorTextHistoryItem_1 = __webpack_require__(98);
- var TextInputHandler = /** @class */ (function () {
- function TextInputHandler(control) {
- this.control = control;
- }
- TextInputHandler.prototype.startTextInput = function (item, position) {
- if (item.locked || !item.allowHasText)
- return;
- this.control.beginUpdate();
- this.textInputItem = item;
- if (this.textInputItem instanceof Shape_1.Shape) {
- var textRect = this.textInputItem.textRectangle;
- this.control.eventManager.raiseTextInputStart(this.textInputItem, this.textInputItem.text, textRect.position, textRect.size);
- }
- if (this.textInputItem instanceof Connector_1.Connector) {
- this.textInputPosition = position;
- this.control.eventManager.raiseTextInputStart(this.textInputItem, this.textInputItem.getText(this.textInputPosition), this.textInputItem.getTextPoint(this.textInputPosition));
- }
- };
- TextInputHandler.prototype.endTextInput = function () {
- this.control.eventManager.raiseTextInputEnd(this.textInputItem);
- delete this.textInputItem;
- this.control.endUpdate();
- };
- TextInputHandler.prototype.applyTextInput = function (text) {
- var textInputItem = this.textInputItem;
- var textInputPosition = this.textInputPosition;
- // call this first to be able measure text on changes
- this.endTextInput();
- if (textInputItem instanceof Shape_1.Shape) {
- if (textInputItem.text !== text)
- this.control.history.addOrModifyAndRedo(new ChangeShapeTextHistoryItem_1.ChangeShapeTextHistoryItem(textInputItem, text));
- }
- else if (textInputItem instanceof Connector_1.Connector) {
- if (textInputItem.getText(textInputPosition) !== text)
- this.control.history.addOrModifyAndRedo(new ChangeConnectorTextHistoryItem_1.ChangeConnectorTextHistoryItem(textInputItem, textInputPosition, text));
- }
- };
- TextInputHandler.prototype.cancelTextInput = function () {
- this.endTextInput();
- };
- TextInputHandler.prototype.isTextInputActive = function () {
- return this.textInputItem !== undefined;
- };
- TextInputHandler.prototype.onMouseDoubleClick = function (evt) {
- if (evt.source.type === Event_1.MouseEventElementType.Shape) {
- var shape = this.control.model.findShape(evt.source.key);
- this.startTextInput(shape);
- }
- else if (evt.source.type === Event_1.MouseEventElementType.Connector) {
- var connector = this.control.model.findConnector(evt.source.key);
- var position = connector.getTextPositionByPoint(evt.layoutPoint);
- this.startTextInput(connector, position);
- }
- else if (evt.source.type === Event_1.MouseEventElementType.ConnectorText) {
- var connector = this.control.model.findConnector(evt.source.key);
- var position = parseFloat(evt.source.value);
- this.startTextInput(connector, position);
- }
- };
- TextInputHandler.prototype.onKeyDown = function (evt) {
- if (!this.isTextInputActive())
- return;
- if (evt.keyCode === 13 && (evt.modifiers & KeyCode_1.ModifierKey.Ctrl)) {
- evt.preventDefault = true;
- this.applyTextInput(evt.inputText);
- }
- if (evt.keyCode === 27)
- this.cancelTextInput();
- };
- TextInputHandler.prototype.onInputBlur = function (evt) {
- if (this.isTextInputActive())
- this.applyTextInput(evt.inputText);
- };
- TextInputHandler.prototype.onInputFocus = function (evt) {
- };
- return TextInputHandler;
- }());
- exports.TextInputHandler = TextInputHandler;
- /***/ }),
- /* 237 */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- var __extends = (this && this.__extends) || (function () {
- var extendStatics = function (d, b) {
- extendStatics = Object.setPrototypeOf ||
- ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
- function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
- return extendStatics(d, b);
- };
- return function (d, b) {
- extendStatics(d, b);
- function __() { this.constructor = d; }
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
- };
- })();
- Object.defineProperty(exports, "__esModule", { value: true });
- var HistoryItem_1 = __webpack_require__(4);
- var ChangeShapeTextHistoryItem = /** @class */ (function (_super) {
- __extends(ChangeShapeTextHistoryItem, _super);
- function ChangeShapeTextHistoryItem(item, text) {
- var _this = _super.call(this) || this;
- _this.shapeKey = item.key;
- _this.text = text;
- return _this;
- }
- ChangeShapeTextHistoryItem.prototype.redo = function (manipulator) {
- var item = manipulator.model.findShape(this.shapeKey);
- this.oldText = item.text;
- manipulator.changeShapeText(item, this.text);
- };
- ChangeShapeTextHistoryItem.prototype.undo = function (manipulator) {
- var item = manipulator.model.findShape(this.shapeKey);
- manipulator.changeShapeText(item, this.oldText);
- };
- return ChangeShapeTextHistoryItem;
- }(HistoryItem_1.HistoryItem));
- exports.ChangeShapeTextHistoryItem = ChangeShapeTextHistoryItem;
- /***/ }),
- /* 238 */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- Object.defineProperty(exports, "__esModule", { value: true });
- var Utils_1 = __webpack_require__(0);
- var SelectionController = /** @class */ (function () {
- function SelectionController(selection) {
- this.onSelectionChanged = new Utils_1.EventDispatcher();
- this.selection = selection;
- this.selection.onChanged.add(this);
- }
- SelectionController.prototype.NotifyModelChanged = function (changes) {
- for (var i = 0, change; change = changes[i]; i++) {
- if (this.selection.hasKey(change.key)) {
- this.raiseUpdateSelection();
- return;
- }
- }
- };
- SelectionController.prototype.NotifySelectionChanged = function (selection) {
- this.raiseUpdateSelection();
- };
- SelectionController.prototype.raiseUpdateSelection = function () {
- this.onSelectionChanged.raise("NotifyRedrawSelection", this.selection);
- };
- return SelectionController;
- }());
- exports.SelectionController = SelectionController;
- /***/ }),
- /* 239 */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- Object.defineProperty(exports, "__esModule", { value: true });
- var Utils_1 = __webpack_require__(0);
- var InputPosition_1 = __webpack_require__(240);
- var Selection = /** @class */ (function () {
- function Selection(model) {
- this.onChanged = new Utils_1.EventDispatcher();
- this.inputPosition = new InputPosition_1.InputPosition(this);
- this.onChanged.add(this.inputPosition);
- this.initialize(model);
- }
- Selection.prototype.initialize = function (model) {
- this.model = model;
- this.keys = [];
- this.inputPosition.initialize();
- };
- Selection.prototype.add = function (key) {
- if (this.keys.indexOf(key) < 0) { // binarySearch
- this.keys.push(key);
- this.raiseSelectionChanged();
- }
- };
- Selection.prototype.remove = function (key) {
- if (this.keys.indexOf(key) >= 0) { // binarySearch
- this.keys.splice(this.keys.indexOf(key), 1);
- this.raiseSelectionChanged();
- }
- };
- Selection.prototype.clear = function () {
- this.keys = [];
- this.raiseSelectionChanged();
- };
- Selection.prototype.set = function (keys) {
- this.keys = keys;
- this.raiseSelectionChanged();
- };
- Selection.prototype.getKeys = function () {
- return this.keys;
- };
- Selection.prototype.getKey = function (index) {
- return this.keys[index];
- };
- Selection.prototype.getSelectedItems = function (includeLocked) {
- var _this = this;
- return this.keys.map(function (key) { return _this.model.findItem(key); }).filter(function (item) { return item && (includeLocked || !item.locked); });
- };
- Selection.prototype.getSelectedShapes = function (includeLocked) {
- var _this = this;
- return this.keys.map(function (key) { return _this.model.findShape(key); }).filter(function (shape) { return shape && (includeLocked || !shape.locked); });
- };
- Selection.prototype.getSelectedConnectors = function (includeLocked) {
- var _this = this;
- return this.keys.map(function (key) { return _this.model.findConnector(key); }).filter(function (conn) { return conn && (includeLocked || !conn.locked); });
- };
- Selection.prototype.hasKey = function (key) {
- return this.keys.indexOf(key) >= 0;
- };
- Selection.prototype.isEmpty = function (includeLocked) {
- return !this.getSelectedItems(includeLocked).length;
- };
- Selection.prototype.selectRect = function (rect) {
- var keys = [];
- this.model.iterateItems(function (item) {
- if (item.intersectedByRect(rect))
- keys.push(item.key);
- });
- this.set(keys);
- this.raiseSelectionChanged();
- };
- Selection.prototype.raiseSelectionChanged = function () {
- this.onChanged.raise("NotifySelectionChanged", this);
- };
- return Selection;
- }());
- exports.Selection = Selection;
- /***/ }),
- /* 240 */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- Object.defineProperty(exports, "__esModule", { value: true });
- var ConnectorProperties_1 = __webpack_require__(28);
- var Style_1 = __webpack_require__(47);
- var InputPosition = /** @class */ (function () {
- function InputPosition(selection) {
- this.selection = selection;
- this.initialize();
- }
- InputPosition.prototype.initialize = function () {
- this.reset();
- this.connectorPropertiesDefault = new ConnectorProperties_1.ConnectorProperties();
- this.stylePropertiesDefault = new Style_1.Style();
- this.styleTextPropertiesDefault = new Style_1.StyleText();
- };
- InputPosition.prototype.reset = function () {
- this.connectorPropertiesCurrent = null;
- this.stylePropertiesCurrent = null;
- this.styleTextPropertiesCurrent = null;
- };
- // Connectors
- InputPosition.prototype.getConnectorProperties = function () {
- if (!this.connectorPropertiesCurrent) {
- this.connectorPropertiesCurrent = this.connectorPropertiesDefault.clone();
- this.updateConnectorProperties(this.connectorPropertiesCurrent);
- }
- return this.connectorPropertiesCurrent;
- };
- InputPosition.prototype.getConnectorPropertyValue = function (propertyName) {
- return this.getConnectorProperties()[propertyName];
- };
- InputPosition.prototype.getConnectorPropertyDefaultValue = function (propertyName) {
- return this.connectorPropertiesDefault[propertyName];
- };
- InputPosition.prototype.setConnectorPropertyValue = function (propertyName, value) {
- this.getConnectorProperties()[propertyName] = value;
- this.connectorPropertiesDefault[propertyName] = value;
- };
- InputPosition.prototype.updateConnectorProperties = function (properties) {
- var _this = this;
- var connectors = this.selection.getSelectedConnectors();
- properties.forEach(function (propertyName) {
- _this.updatePropertyValue(properties, connectors, function (item) { return item["properties"]; }, propertyName);
- });
- };
- // Style
- InputPosition.prototype.getStyleProperties = function () {
- if (!this.stylePropertiesCurrent) {
- this.stylePropertiesCurrent = this.stylePropertiesDefault.clone();
- this.updateStyleProperties(this.stylePropertiesCurrent, "style");
- }
- return this.stylePropertiesCurrent;
- };
- InputPosition.prototype.getStyleTextProperties = function () {
- if (!this.styleTextPropertiesCurrent) {
- this.styleTextPropertiesCurrent = this.styleTextPropertiesDefault.clone();
- this.updateStyleProperties(this.styleTextPropertiesCurrent, "styleText");
- }
- return this.styleTextPropertiesCurrent;
- };
- InputPosition.prototype.getStylePropertyValue = function (propertyName) {
- return this.getStyleProperties()[propertyName];
- };
- InputPosition.prototype.getStylePropertyDefaultValue = function (propertyName) {
- return this.stylePropertiesDefault[propertyName];
- };
- InputPosition.prototype.getStyleTextPropertyValue = function (propertyName) {
- return this.getStyleTextProperties()[propertyName];
- };
- InputPosition.prototype.getStyleTextPropertyDefaultValue = function (propertyName) {
- return this.styleTextPropertiesDefault[propertyName];
- };
- InputPosition.prototype.setStylePropertyValue = function (propertyName, value) {
- this.getStyleProperties()[propertyName] = value;
- this.stylePropertiesDefault[propertyName] = value;
- };
- InputPosition.prototype.setStyleTextPropertyValue = function (propertyName, value) {
- this.getStyleTextProperties()[propertyName] = value;
- this.styleTextPropertiesDefault[propertyName] = value;
- };
- InputPosition.prototype.updateStyleProperties = function (style, stylePropertyName) {
- var _this = this;
- var items = this.selection.getSelectedItems();
- style.forEach(function (propertyName) {
- _this.updatePropertyValue(style, items, function (item) { return item[stylePropertyName]; }, propertyName);
- });
- };
- InputPosition.prototype.updatePropertyValue = function (destObj, items, getSrcObj, propertyName) {
- var value = undefined;
- var valueAssigned = false;
- items.forEach(function (item) {
- var obj = getSrcObj(item);
- var propertyValue = obj[propertyName];
- if (value === undefined && propertyValue != undefined) {
- value = propertyValue;
- valueAssigned = true;
- }
- else if (valueAssigned && value !== propertyValue) {
- value = undefined;
- return;
- }
- });
- if (valueAssigned)
- destObj[propertyName] = value;
- };
- InputPosition.prototype.NotifySelectionChanged = function (selection) {
- this.reset();
- };
- return InputPosition;
- }());
- exports.InputPosition = InputPosition;
- /***/ }),
- /* 241 */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- Object.defineProperty(exports, "__esModule", { value: true });
- var HistoryItem_1 = __webpack_require__(4);
- var __1 = __webpack_require__(46);
- var History = /** @class */ (function () {
- function History(modelManipulator) {
- this.historyItems = [];
- this.currentIndex = -1;
- this.incrementalId = -1;
- this.transactionLevel = -1;
- this.unmodifiedIndex = -1;
- // need for async actions
- this.currTransactionId = 0;
- this.onChanged = new __1.EventDispatcher();
- this.modelManipulator = modelManipulator;
- }
- History.prototype.isModified = function () {
- if (this.unmodifiedIndex == this.currentIndex)
- return false;
- var startIndex = Math.min(this.unmodifiedIndex, this.currentIndex);
- var endIndex = Math.max(this.unmodifiedIndex, this.currentIndex);
- for (var i = startIndex + 1; i <= endIndex; i++) {
- if (this.historyItems[i].changeModified())
- return true;
- }
- return false;
- };
- History.prototype.undo = function () {
- if (!this.canUndo())
- return;
- this.historyItems[this.currentIndex].undo(this.modelManipulator);
- this.currentIndex--;
- this.raiseChanged();
- };
- History.prototype.redo = function () {
- if (!this.canRedo())
- return;
- this.currentIndex++;
- this.historyItems[this.currentIndex].redo(this.modelManipulator);
- this.raiseChanged();
- };
- History.prototype.canUndo = function () {
- return this.currentIndex >= 0;
- };
- History.prototype.canRedo = function () {
- return this.currentIndex < this.historyItems.length - 1;
- };
- History.prototype.beginTransaction = function () {
- this.transactionLevel++;
- if (this.transactionLevel == 0)
- this.transaction = new HistoryItem_1.CompositionHistoryItem();
- var id = this.currTransactionId++;
- return id;
- };
- History.prototype.endTransaction = function () {
- if (--this.transactionLevel >= 0)
- return;
- var transactionLength = this.transaction.historyItems.length;
- if (transactionLength > 1)
- this.addInternal(this.transaction);
- else if (transactionLength == 1)
- this.addInternal(this.transaction.historyItems.pop());
- if (this.transaction.historyItems.length > 0)
- this.raiseChanged();
- delete this.transaction;
- };
- History.prototype.addAndRedo = function (historyItem) {
- this.add(historyItem);
- historyItem.redo(this.modelManipulator);
- this.raiseChanged();
- };
- History.prototype.add = function (historyItem) {
- if (this.transactionLevel >= 0)
- this.transaction.add(historyItem);
- else
- this.addInternal(historyItem);
- };
- History.prototype.addInternal = function (historyItem) {
- if (this.currentIndex < this.historyItems.length - 1) {
- this.historyItems.splice(this.currentIndex + 1);
- this.unmodifiedIndex = Math.min(this.unmodifiedIndex, this.currentIndex);
- }
- this.historyItems.push(historyItem);
- this.currentIndex++;
- this.deleteOldItems();
- };
- History.prototype.deleteOldItems = function () {
- var exceedItemsCount = this.historyItems.length - History.MAX_HISTORY_ITEM_COUNT;
- if (exceedItemsCount > 0 && this.currentIndex > exceedItemsCount) {
- this.historyItems.splice(0, exceedItemsCount);
- this.currentIndex -= exceedItemsCount;
- }
- };
- History.prototype.getNextId = function () {
- this.incrementalId++;
- return this.incrementalId;
- };
- History.prototype.clear = function () {
- this.currentIndex = -1;
- this.unmodifiedIndex = -1;
- this.incrementalId = -1;
- this.historyItems = [];
- delete this.transaction;
- this.transactionLevel = -1;
- };
- History.prototype.resetModified = function () {
- this.unmodifiedIndex = this.currentIndex;
- };
- History.prototype.getCurrentItemId = function () {
- if (this.currentIndex == -1)
- return -1;
- var currentItem = this.historyItems[this.currentIndex];
- if (currentItem.uniqueId == -1)
- currentItem.uniqueId = this.getNextId();
- return currentItem.uniqueId;
- };
- History.prototype.addOrModifyAndRedo = function (item) {
- // if(!this.transaction)
- // throw Error("History item modification available only in the transaction mode");
- // let name = item.getName();
- // let items = this.transaction.historyItems;
- // for(let i = items.length - 1, foundItem: HistoryItem; foundItem = items[i]; i--) {
- // if(foundItem.getName() === name) {
- // items.splice(i, 1, item)[0].undo();
- // item.redo();
- // return;
- // }
- // }
- this.addAndRedo(item);
- };
- History.prototype.undoTransaction = function () {
- var items = this.transaction.historyItems;
- while (items.length)
- items.pop().undo(this.modelManipulator);
- this.raiseChanged();
- };
- History.prototype.undoTransactionTo = function (item) {
- var items = this.transaction.historyItems;
- while (items.length) {
- var ti = items.pop();
- ti.undo(this.modelManipulator);
- if (ti === item)
- return;
- }
- this.raiseChanged();
- };
- History.prototype.raiseChanged = function () {
- if (this.transactionLevel === -1)
- this.onChanged.raise("NotifyHistoryChanged");
- };
- History.MAX_HISTORY_ITEM_COUNT = 100;
- return History;
- }());
- exports.History = History;
- /***/ }),
- /* 242 */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- var __extends = (this && this.__extends) || (function () {
- var extendStatics = function (d, b) {
- extendStatics = Object.setPrototypeOf ||
- ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
- function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
- return extendStatics(d, b);
- };
- return function (d, b) {
- extendStatics(d, b);
- function __() { this.constructor = d; }
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
- };
- })();
- Object.defineProperty(exports, "__esModule", { value: true });
- var BatchUpdatableObject_1 = __webpack_require__(243);
- var BarManager = /** @class */ (function (_super) {
- __extends(BarManager, _super);
- function BarManager(control) {
- var _this = _super.call(this) || this;
- _this.bars = [];
- _this.control = control;
- return _this;
- }
- BarManager.prototype.registerBar = function (bar) {
- this.bars.push(bar);
- bar.onChanged.add(this);
- this.updateBarItemsState(bar);
- };
- BarManager.prototype.updateItemsState = function (queryCommands) {
- if (this.isUpdateLocked())
- return;
- for (var i = 0, bar; bar = this.bars[i]; i++)
- this.updateBarItemsState(bar, queryCommands);
- };
- BarManager.prototype.updateBarItemsState = function (bar, queryCommands) {
- if (this.isUpdateLocked())
- return;
- if (bar.isVisible()) {
- var commandKeys = queryCommands || bar.getCommandKeys();
- var length_1 = commandKeys.length;
- for (var j = 0; j < length_1; j++)
- this.updateBarItem(bar, commandKeys[j]);
- }
- };
- BarManager.prototype.updateBarItem = function (bar, commandKey) {
- var command = this.control.commandManager.getCommand(commandKey);
- if (command) {
- var commandState = command.getState();
- bar.setItemVisible(commandKey, commandState.visible);
- if (commandState.visible) {
- bar.setItemEnabled(commandKey, commandState.enabled);
- if (!commandState.denyUpdateValue) {
- var itemValue = this.getItemValue(commandState.value);
- if (commandState.items)
- bar.setItemSubItems(commandKey, commandState.items);
- bar.setItemValue(commandKey, itemValue);
- }
- }
- }
- };
- BarManager.prototype.setEnabled = function (enabled) {
- for (var i = 0, bar; bar = this.bars[i]; i++)
- bar.setEnabled(enabled);
- };
- BarManager.prototype.NotifyBarCommandExecuted = function (commandID, parameter) {
- var executeResult = this.control.commandManager.getCommand(commandID).execute(parameter);
- if (!executeResult)
- this.updateItemsState([commandID]);
- this.control.captureFocus();
- };
- BarManager.prototype.NotifyBarUpdateRequested = function () {
- this.updateItemsState();
- };
- // ISelectionChangesListener
- BarManager.prototype.NotifySelectionChanged = function (_selection) {
- this.updateItemsState();
- };
- BarManager.prototype.onUpdateUnlocked = function (occurredEvents) {
- this.updateItemsState(); // TODO
- };
- BarManager.prototype.getItemValue = function (value) {
- return value;
- };
- return BarManager;
- }(BatchUpdatableObject_1.BatchUpdatableObject));
- exports.BarManager = BarManager;
- /***/ }),
- /* 243 */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- Object.defineProperty(exports, "__esModule", { value: true });
- var BatchUpdatableObject = /** @class */ (function () {
- function BatchUpdatableObject() {
- this.suspendUpdateCount = 0;
- this.occurredEvents = 0;
- }
- BatchUpdatableObject.prototype.beginUpdate = function () {
- if (this.suspendUpdateCount === 0)
- this.onUpdateLocked();
- if (this.suspendUpdateCount < 0)
- this.suspendUpdateCount--;
- else
- this.suspendUpdateCount++;
- };
- BatchUpdatableObject.prototype.endUpdate = function () {
- if (this.suspendUpdateCount < 0)
- this.suspendUpdateCount++;
- else if (this.suspendUpdateCount > 0)
- this.suspendUpdateCount--;
- if (!this.isUpdateLocked()) {
- var occurredEvents = this.occurredEvents;
- this.occurredEvents = 0;
- this.onUpdateUnlocked(occurredEvents);
- }
- };
- BatchUpdatableObject.prototype.suspendUpdate = function () {
- if (this.suspendUpdateCount > 0) {
- this.suspendUpdateCount *= -1;
- var occurredEvents = this.occurredEvents;
- this.occurredEvents = 0;
- this.onUpdateUnlocked(occurredEvents);
- }
- };
- BatchUpdatableObject.prototype.continueUpdate = function () {
- if (this.suspendUpdateCount < 0)
- this.suspendUpdateCount *= -1;
- };
- BatchUpdatableObject.prototype.isUpdateLocked = function () {
- return this.suspendUpdateCount > 0;
- };
- BatchUpdatableObject.prototype.onUpdateLocked = function () { };
- BatchUpdatableObject.prototype.registerOccurredEvent = function (eventMask) {
- this.occurredEvents |= eventMask;
- };
- BatchUpdatableObject.prototype.isLocked = function () {
- return this.suspendUpdateCount != 0;
- };
- return BatchUpdatableObject;
- }());
- exports.BatchUpdatableObject = BatchUpdatableObject;
- /***/ }),
- /* 244 */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- var __extends = (this && this.__extends) || (function () {
- var extendStatics = function (d, b) {
- extendStatics = Object.setPrototypeOf ||
- ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
- function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
- return extendStatics(d, b);
- };
- return function (d, b) {
- extendStatics(d, b);
- function __() { this.constructor = d; }
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
- };
- })();
- Object.defineProperty(exports, "__esModule", { value: true });
- var Toolbox_1 = __webpack_require__(99);
- var ShapeDescriptionManager_1 = __webpack_require__(30);
- var RenderManager_1 = __webpack_require__(10);
- var Shape_1 = __webpack_require__(9);
- var UnitConverter_1 = __webpack_require__(13);
- var Utils_1 = __webpack_require__(0);
- var TextShapeDescription_1 = __webpack_require__(76);
- var ShapeToolboxManager = /** @class */ (function (_super) {
- __extends(ShapeToolboxManager, _super);
- function ShapeToolboxManager() {
- return _super !== null && _super.apply(this, arguments) || this;
- }
- ShapeToolboxManager.prototype.initialize = function (element, options) {
- if (!element)
- return;
- var el = document.createElement("div");
- el.setAttribute("class", "dxdi-toolbox");
- element.appendChild(el);
- this.shapeIconSize = options.shapeIconSize;
- this.shapeIconSpacing = options.shapeIconSpacing;
- this.shapeIconAttributes = options.shapeIconAttributes;
- this.createElements(el, this.getDefaultDescriptions(options.shapes));
- _super.prototype.initialize.call(this, el, options);
- };
- ShapeToolboxManager.prototype.getDefaultDescriptions = function (shapes) {
- if (Array.isArray(shapes))
- return shapes;
- return ShapeDescriptionManager_1.ShapeDescriptionManager.getTypesByCategory(shapes);
- };
- ShapeToolboxManager.prototype.createElements = function (element, shapeTypes) {
- var svgElement = document.createElementNS(RenderManager_1.svgNS, "svg");
- svgElement.className.baseVal = "dxdi-canvas";
- element.appendChild(svgElement);
- this.drawShapeIcons(svgElement, shapeTypes, svgElement.getBoundingClientRect().width);
- };
- ShapeToolboxManager.prototype.drawShapeIcons = function (parent, shapeTypes, svgWidth) {
- var _this = this;
- var lineWidth = UnitConverter_1.UnitConverter.twipsToPixels(Shape_1.Shape.lineWidth);
- svgWidth -= 2 * lineWidth;
- var iconCount = 1;
- var width = this.shapeIconSize;
- while (width < svgWidth) {
- width += this.shapeIconSpacing + this.shapeIconSize;
- if (width < svgWidth)
- iconCount++;
- }
- var shapeIconSpacing = (svgWidth - this.shapeIconSize * iconCount) / (iconCount - 1);
- var xPos = lineWidth, yPos = lineWidth;
- shapeTypes.forEach(function (shapeType, index) {
- if (index > 0 && index % iconCount === 0) {
- xPos = lineWidth;
- yPos += _this.shapeIconSize + shapeIconSpacing;
- }
- var shapeDescription = ShapeDescriptionManager_1.ShapeDescriptionManager.get(shapeType);
- var shape = _this.createShape(shapeDescription, xPos, yPos);
- _this.updateShapeIconBounds(shape);
- _this.drawShape(parent, shape);
- xPos += _this.shapeIconSize + shapeIconSpacing;
- });
- parent.style.height = yPos + this.shapeIconSize + lineWidth + "px";
- };
- ShapeToolboxManager.prototype.drawShape = function (parent, shape) {
- var primitives = shape.description.createPrimitives(shape, true);
- var gEl = document.createElementNS(RenderManager_1.svgNS, "g");
- gEl.setAttribute("data-tb-type", shape.description.key.toString());
- gEl.setAttribute("class", "toolbox-item");
- gEl.setAttribute("title", shape.description.title);
- for (var key in this.shapeIconAttributes) {
- if (this.shapeIconAttributes.hasOwnProperty(key))
- gEl.setAttribute(key, this.shapeIconAttributes[key]);
- }
- parent.appendChild(gEl);
- primitives.forEach(function (pr) {
- var el = pr.createElement();
- gEl.appendChild(el);
- pr.applyElementProperties(el);
- });
- };
- ShapeToolboxManager.prototype.createShape = function (shapeDescription, xPos, yPos) {
- var xPosT = UnitConverter_1.UnitConverter.pixelsToTwips(xPos);
- var yPosT = UnitConverter_1.UnitConverter.pixelsToTwips(yPos);
- var shape = new Shape_1.Shape(shapeDescription, new Utils_1.Point(xPosT, yPosT));
- if (!(shapeDescription instanceof TextShapeDescription_1.TextShapeDescription))
- shape.text = "";
- return shape;
- };
- ShapeToolboxManager.prototype.updateShapeIconBounds = function (shape) {
- var shapeSizeT = UnitConverter_1.UnitConverter.pixelsToTwips(this.shapeIconSize);
- if (shape.size.width > shape.size.height) {
- var ratio = shape.size.height / shape.size.width;
- shape.size.width = shapeSizeT;
- shape.size.height = shapeSizeT * ratio;
- shape.position.y = shape.position.y + (shapeSizeT - shape.size.height) / 2;
- shape.parameters.forEach(function (p) { p.value = p.value * shapeSizeT / shape.description.defaultSize.width; });
- }
- else if (shape.size.width < shape.size.height) {
- var ratio = shape.size.width / shape.size.height;
- shape.size.height = shapeSizeT;
- shape.size.width = shapeSizeT * ratio;
- shape.position.x = shape.position.x + (shapeSizeT - shape.size.width) / 2;
- shape.parameters.forEach(function (p) { p.value = p.value * shapeSizeT / shape.description.defaultSize.height; });
- }
- else {
- shape.size.width = shapeSizeT;
- shape.size.height = shapeSizeT;
- shape.parameters.forEach(function (p) { p.value = p.value * shapeSizeT / shape.description.defaultSize.width; });
- }
- };
- ShapeToolboxManager.prototype.createDraggingObject = function (srcElement) {
- var shapeType = this.getDragShapeType(srcElement);
- if (shapeType !== undefined) {
- var evt = new Toolbox_1.DiagramDraggingEvent();
- evt.shapeType = shapeType;
- return new Toolbox_1.ToolboxDraggingObject(evt);
- }
- return undefined;
- };
- ShapeToolboxManager.prototype.createDraggingElement = function (draggingObject) {
- var element = document.createElement("DIV");
- element.setAttribute("class", "dxdi-toolbox-drag-item");
- document.body.appendChild(element);
- var svgElement = document.createElementNS(RenderManager_1.svgNS, "svg");
- svgElement.className.baseVal = "dxdi-canvas";
- element.appendChild(svgElement);
- var shapeDescription = ShapeDescriptionManager_1.ShapeDescriptionManager.get(draggingObject.evt.shapeType);
- var shape = this.createShape(shapeDescription, UnitConverter_1.UnitConverter.twipsToPixels(Shape_1.Shape.lineWidth), UnitConverter_1.UnitConverter.twipsToPixels(Shape_1.Shape.lineWidth));
- this.drawShape(svgElement, shape);
- element.style.width = UnitConverter_1.UnitConverter.twipsToPixels(shape.size.width + 2 * Shape_1.Shape.lineWidth) + "px";
- element.style.height = UnitConverter_1.UnitConverter.twipsToPixels(shape.size.height + 2 * Shape_1.Shape.lineWidth) + "px";
- return element;
- };
- ShapeToolboxManager.prototype.getDragShapeType = function (element) {
- while (element && element instanceof SVGElement) {
- if (element.getAttribute("data-tb-type"))
- return parseInt(element.getAttribute("data-tb-type"));
- element = element.parentNode instanceof SVGElement ? element.parentNode : undefined;
- }
- return undefined;
- };
- return ShapeToolboxManager;
- }(Toolbox_1.Toolbox));
- exports.ShapeToolboxManager = ShapeToolboxManager;
- /***/ }),
- /* 245 */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- var __extends = (this && this.__extends) || (function () {
- var extendStatics = function (d, b) {
- extendStatics = Object.setPrototypeOf ||
- ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
- function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
- return extendStatics(d, b);
- };
- return function (d, b) {
- extendStatics(d, b);
- function __() { this.constructor = d; }
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
- };
- })();
- Object.defineProperty(exports, "__esModule", { value: true });
- var Toolbox_1 = __webpack_require__(99);
- var ShapeType_1 = __webpack_require__(1);
- var DataToolboxManager = /** @class */ (function (_super) {
- __extends(DataToolboxManager, _super);
- function DataToolboxManager(key) {
- var _this = _super.call(this) || this;
- _this.key = key;
- return _this;
- }
- DataToolboxManager.prototype.initialize = function (element, dataSource) {
- _super.prototype.initialize.call(this, element, dataSource);
- this.dataSource = dataSource;
- this.createDataSourceElement(element);
- };
- DataToolboxManager.prototype.createDataSourceElement = function (parent) {
- var _this = this;
- var element = document.createElement("div");
- element.setAttribute("class", "dxdi-datasource");
- parent.appendChild(element);
- if (this.dataSource.name && this.dataSource.name !== "") {
- var header = document.createElement("div");
- header.setAttribute("class", "dxdi-datasource-title");
- header.innerHTML = this.dataSource.name;
- element.appendChild(header);
- }
- this.dataSource.nodes.forEach(function (node, index) {
- var itemEl = document.createElement("div");
- itemEl.setAttribute("class", "dxdi-datasource-item");
- itemEl.setAttribute("data-ds-key", _this.dataSource.key);
- itemEl.setAttribute("data-ds-index", index.toString());
- itemEl.innerHTML = node.text || node.key;
- element.appendChild(itemEl);
- });
- };
- DataToolboxManager.prototype.createDraggingElement = function (dragginObject) {
- var element = document.createElement("DIV");
- element.setAttribute("class", "dxdi-datasource-drag-item");
- element.innerHTML = dragginObject.evt.item.text;
- document.body.appendChild(element);
- return element;
- };
- DataToolboxManager.prototype.createDraggingObject = function (srcElement) {
- if (srcElement.hasAttribute("data-ds-key")) {
- if (this.dataSource) {
- var nodeIndex = srcElement.getAttribute("data-ds-index");
- var node = this.dataSource.nodes[nodeIndex];
- if (node) {
- var evt = new Toolbox_1.DiagramDraggingEvent();
- evt.item = node;
- evt.shapeType = node.type || ShapeType_1.ShapeType.Rectangle;
- evt.dataSource = this.dataSource;
- return new Toolbox_1.ToolboxDraggingObject(evt);
- }
- }
- }
- };
- return DataToolboxManager;
- }(Toolbox_1.Toolbox));
- exports.DataToolboxManager = DataToolboxManager;
- /***/ }),
- /* 246 */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- Object.defineProperty(exports, "__esModule", { value: true });
- var DiagramSettings = /** @class */ (function () {
- function DiagramSettings() {
- this._fullscreen = false;
- }
- Object.defineProperty(DiagramSettings.prototype, "fullscreen", {
- get: function () { return this._fullscreen; },
- set: function (value) { this._fullscreen = value; },
- enumerable: true,
- configurable: true
- });
- return DiagramSettings;
- }());
- exports.DiagramSettings = DiagramSettings;
- /***/ }),
- /* 247 */
- /***/ (function(module, exports, __webpack_require__) {
- // extracted by mini-css-extract-plugin
- /***/ })
- /******/ ]);
- });
|