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ACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,KAEAC,GAAY,CACZ,EACA,GACA,GACA,GACA,GACA,GACA,GACA,GACA,GACA,GACA,GACA,GACA,GACA,GACA,GACA,GACA,GACA,GACA,GACA,GACA,GACA,GACA,GACA,GACA,GACA,GACA,GACA,GACA,GACA,GACA,GACA,GACA,GACA,GACA,GACA,GACA,GACA,GACA,GACA,GACA,GACA,GACA,GACA,GACA,GACA,GACA,GACA,GACA,GACA,GACA,GACA,GACA,GACA,GACA,GACA,GACA,GACA,GACA,GACA,GACA,GACA,GACA,GACA,GACA,GACA,GACA,GACA,GACA,GACA,GACA,GACA,GACA,GACA,GACA,GACA,GACA,GACA,GACA,GACA,GACA,GACA,GACA,GACA,GACA,GACA,GACA,GACA,GACA,GACA,GACA,GACA,GACA,GACA,GACA,GACA,GACA,GACA,GACA,GACA,GACA,GACA,GACA,GACA,GACA,GACA,GACA,GACA,GACA,GACA,GACA,GACA,GACA,GACA,GACA,GACA,GACA,GACA,GACA,GACA,GACA,GACA,GACA,GACA,GACA,GACA,GACA,GACA,GACA,GACA,GACA,GACA,GACA,GACA,GACA,GACA,GACA,GACA,GACA,GACA,GACA,GACA,GACA,GACA,GACA,GACA,GACA,GACA,GACA,GACA,GACA,GACA,GACA,GACA,GACA,GACA,GACA,GACA,GACA,GACA,GACA,GACA,GACA,GACA,GACA,GACA,GACA,GACA,GACA,GACA,GACA,GACA,GACA,GACA,GACA,GACA,GACA,GACA,GACA,GACA,GACA,GACA,GACA,GACA,GACA,GACA,GACA,GACA,GACA,GACA,GACA,GACA,GACA,GACA,GACA,GACA,GACA,GACA,GACA,GACA,GACA,GACA,GACA,GACA,GACA,GACA,GACA,GACA,GACA,GACA,GACA,GACA,GACA,GACA,GACA,GACA,GACA,GACA,GACA,GACA,GACA,GACA,GACA,GACA,GACA,GACA,GACA,GACA,GACA,GACA,GACA,GACA,GACA,GACA,GACA,GACA,GACA,GACA,GACA,GACA,GACA,GACA,GACA,GACA,GACA,GACA,GACA,GACA,GACA,GACA,GACA,GACA,GACA,GACA,GACA,IAyLJxmC,EAAQC,gBAAgBia,EAAM,aAAc,EAAGxO,IAAsB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A,MAC45E,YAD55EA,CAC45E,cAD55EA,MACs/E,IADt/EA,eAC5F,MAD4FA,MACs6D,GADt6DA,MACs6D,yCADt6DA,MACigE,GADjgEA,MACigE,mCADjgEA,MACmmE,GADnmEA,MACmmE,wCADnmEA,MACkrE,GADlrEA,MACkrE,+BADlrEA,MACgxE,GADhxEA,MACgxE,wCADhxEA,MACs/E,GADt/EA,MACs/E0oG,kBAAllFG,YAAq7UC,MAAr7UzD,ozPAnoBMhF,OAytBN,YAAsBr+F,IAClB,OAAQsL,MAAMtL,KAAUmlD,SAASnlD,IAGrC,YAAsBoC,IAIlB,MAAyB,MAAlBA,GAAMqH,KAAK,EAAO,CAG7B,WAAkCrH,GAAOvC,IACrC,IAAIm5C,EACJ,OAKQA,EALJqnD,GAAaj+F,IAIK,iBAAPvC,GACCyhG,GAAkBl/F,GAAMgpC,QAASvrC,KAAOyhG,GAAkBl/F,GAAMkpC,eAAgBzrC,IAIhFuC,GAAMgpC,QAAQ,IAAMhpC,GAAMkpC,eAAe,GAI7ClpC,GAEL42C,EAAQ,CAAEr4C,EAAGq4C,EAAMvoC,QAAS0D,EAAG6kC,EAAMroC,cAAYlL,EAG5D,YAA2B2lC,GAASvrC,IAChC,QAAS0T,EAAI,EAAGA,EAAI63B,GAAQ9tC,OAAQiW,IAChC,GAAI63B,GAAQ73B,GAAGw4B,aAAelsC,GAC1B,OAAOurC,GAAQ73B,OAuBrB4rB,SAAN,UAEAA,UAAgBb,UAAhB,0BAA4Ga,KAC5GA,GAAgBZ,UAnJ4EvgC,MAmJ5F,MAA6GmhC,KAC7GA,GAAgBV,UApJ4EzgC,MAoJ5F,UAAwI,CAAChB,KAAc+pG,OAAkBA,SAJnK5nE","names":["SwiperCore","Navigation","Pagination","Scrollbar","A11y","Autoplay","SwiperConfig","slidesPerView","spaceBetween","navigation","autoplay","loop","pagination","clickable","scrollbar","draggable","breakpoints","centerInsufficientSlides","simulateTouch","SortByModule","CommonModule","SortByPipe","transform","items","key","sortBy","length","array","sort","catA","catB","orderbyAsc","String","toUpperCase","orderbyDesc","pure","i0","ctx_r7","oxw","ctx_r10","ctx_r13","TicketHoldersComponent","constructor","bsModalRef","myProfileService","fb","orderService","alertService","authService","formHelper","this","CustomerDataRequirementTypeEnum","Subject","ngOnInit","customers","group","customer","loadOrder","ngOnDestroy","unsubscribe$","next","complete","onSwiper","swiper","clearForm","id","document","getElementById","value","enableForm","disabled","c","get","at","idx","_a","enable","u","_b","x","_c","findUser","loadingFindUser","checkCustomerRegisterWithCpf","subscribe","re","order","tickets","useFacialRecognition","toast","icon","title","customerDataRequirementType","hasImage","doc","phone","phones","replace","setValue","name","email","catchError","of","preventTab","event","preventDefault","enterEvent","KeyboardEvent","target","dispatchEvent","back","activeIndex","onComplete","hide","slidePrev","continue","currentCustomer","allowedDuplicateCount","n","limitByCPF","testPhones","_d","D","_e","validaCPF","R","_f","hasAnyValue","W","_g","$","_h","Ee","_j","ot","_k","hasAllValues","Ke","_l","Nt","_m","xt","_o","St","_p","duplicateCount","filter","ticket","index","ke","kt","foundIndex","findIndex","showSesiTerms","sesiTermsAccepted","Et","_q","undefined","saveHolder","slice","some","slideNext","sesiTermsOfUseChange","eve","srcElement","checked","currentOrder","pipe","takeUntil","sesiEvents","indexOf","forEach","res","element","Validators","push","getCustomer","firstFormCustomer","selectors","ctx","JsonLDService","_document","schema","startDate","endDate","eventAttendanceMode","eventStatus","location","address","streetAddress","addressLocality","addressRegion","addressCountry","image","images","description","offers","url","eventUrl","availability","performer","organizer","companyName","companyUrl","minPrice","price","priceCurrency","removeStructuredData","els","Array","from","head","getElementsByClassName","el","removeChild","insertSchema","className","script","shouldAppend","createElement","setAttribute","type","scriptType","text","JSON","stringify","appendChild","sameAs","contactPoint","telephone","contactType","DOCUMENT","factory","CountdownComponent","Date","EventEmitter","time","transformInDate","eventTimeStartSell","eventDateStartSell","getTime","totalMinutes","sendOpenEvent","emit","changeTime","startCountdown","interval","clearInterval","setInterval","Number","isNaN","seconds","date","now","timeSplit","split","setHours","setDate","setMonth","setFullYear","add0","toString","hours","Math","floor","minutes","ctx_r2","MapV2TicketsComponent","service","ticketId","ngOnChanges","place","selectedTicket","selectTicket","find","t","reserve","then","setView","MapView","unselectTicket","cancelReserve","amount","quantity","MapV2CartComponent","cart","getCart","selectedPlaces","places","deletePlace","MapV2LoaderComponent","PlacesBySectorPipe","sectorId","p","ctx_r5","ctx_r9","MapV2PlacesComponent","zoom","initializeLoading","initializeView","initializeMap","initializeSector","isTicketsShowing","view","isCartShowing","closePlaces","closeDrawer","openTickets","isDisabledPlace","selectedPlace","openCart","getPlaceStyle","left","top","coords","borderRadius","shape","backgroundColor","row","number","available","height","width","isSelected","zoomIn","zoomElement","querySelector","style","zoomOut","loadImageEvents","addEventListener","e","startX","clientX","startY","clientY","scrollStartX","scrollLeft","scrollStartY","scrollTop","drag","diffY","pointerEvents","stopDrag","removeEventListener","speed","deltaY","getMap","map","isReserved","reduce","sum","fee","getSelectedSector","sector","isLoading","loading","getView","$event","MapV2SectorsComponent","elementRef","sectors","initializeCanvas","initializeSectors","onResize","parentElement","nativeElement","parentWidth","offsetWidth","imgElement","openPlaces","setSelectedSector","hasPlaces","show","fillPolygon","getAttribute","context","beginPath","moveTo","i","lineTo","fillStyle","color","globalAlpha","drawOn","mapElement","innerHTML","mapSectors","mapSector","area","cursor","y","join","onmouseover","onmouseout","clearRect","canvas","onclick","getContext","src","imageSectors","onload","getMapWithSectors","MapV2Component","dialog","change","loadSectors","eventId","loadMap","isShowing","open","disableClose","autoFocus","panelClass","maxWidth","closeAll","listenReserves","setSelectedSectorById","SeatsioComponent","loadScript","renderChart","catch","error","message","Promise","resolve","reject","async","onerror","Error","body","useSeats","category","ticketTypes","a","b","position","ticketType","label","prices","chart","seatsio","SeatingChart","divId","region","workspaceKey","environment","seatsioEventKey","language","session","showSeatLabels","pricing","priceFormatter","toLocaleString","minimumFractionDigits","onHoldSucceeded","object","ticketName","selectedTicketType","blockFullTickets","deselect","onReleaseHoldFailed","onChartRenderingFailed","destroy","sendLoading","onRenderStarted","onHoldTokenExpired","onChartRendered","onObjectSelected","selectedSeats","limitCPF","getSelectedObjects","onObjectDeselected","getDeselectedObjects","render","selectedSeat","sendLoadingSeatsIo","deselectedSeat","deselectedSeats","ctx_r24","ctx_r27","ctx_r29","ctx_r31","ctx_r33","ctx_r35","MapPlaceComponent","cdr","platform","eventService","generalHelper","modalService","initialLoadComplete","loadMapPlace","canvas_dom","window","getWidthMap","stage","setWidth","batchDraw","changes","currentValue","firstChange","div","clientWidth","getHeightMap","clientHeight","getHeightZoomBar","Konva","loadingMap","orderMapReserveCode","uniqueIdGenerate","iniX","endX","iniY","endY","getNumber","data","isMobile","screen","cloneCircle","cloneRect","attrs","stageRegistered","parse","container","idDB","scale","scaleX","Hammer","domEvents","set","l","layers","layerRegistered","layerRegisteredCanvas","layer","configs","transformsEnabled","bi","children","Image","imageType","getFileTypeFromBase64","imageBase64","bg","add","draw","posItemXIni","posItemXEnd","posItemYIni","posItemYEnd","placeRegistered","placeRegisteredCanvas","qtdPerson","qtdDisponible","gt","onClickPlace","listening","item","fill","getAllTickets","v","placeId","radius","clone","cache","placebox","hitStrokeWidth","perfectDrawEnabled","zIndex","zIndexLayerCount","initZoom","initPosition","setTimeout","divWidth","divHeight","marginH","innerWidth","getRelativePosition","zoomMouseWheel","evt","oldScale","mousePointTo","getPointerPosition","newScale","newPos","zoomPinchMobile","gesture","on","blockClickPlace","positionMoveStart","startPosition","initDrag","endDrag","move","calc","idPlace","actionPlace","loadModal","modalShowSelectTickets","ticketDateId","selectedTicketName","onEditPlace","loadingModal","modalRef","selectTicketModal","ticketSelectFormShowError","ticketSelectForm","permittedTicketsFromPlace","iT","fees","lotId","blockedTickets","blockedEvents","finished","placeName","ticketTags","ticketCupom","isMapPlace","unitPriceWithFee","unitPrice","firstTicketSelected","dateTicketId","selectedTickets","getTicketChange","submitSelectedTickets","valid","isEspecialEvent","code","loadingConfirmPlace","console","log","newMapReserve","clearCache","amountSelectedTickets","selected","placeAlreadyInCart","ticketOrder","qty","sendSelectedSeat","addTicket","newTicket","disponible","removeTicket","removeAt","cancelPlace","removeTicketByPlaceId","fillDefined","changeZoomSlider","marginW","instructionsStatus","localStorage","getItem","okUnderstand","setItem","guid","priceTotalPlace","total","controls","search","QtyComponent","allowAdd","max","action","remove","allowRemove","min","ArraysHelper","emptyItemRemove","noRemove","removeEmpty","removeNull","newData","Object","assign","isArray","valueItem","emptyItemReplace","replaceFrom","replaceTo","serializeDate","dates","dt","dateStartEvent","year","month","day","hour","minute","serializeDate2","dateTimeBR","toCurrency","Intl","NumberFormat","currency","format","ctx_r36","ctx_r38","ctx_r39","FormPorscheEventComponent","formBuilder","arrayHelper","formPorscheOwner","owner","quantityTickets","cpf","additionalInformation","model","version","yearModel","plate","sizeShirt","question","validators","testCpf","testFullName","getOwner","status","sendPorscheOwner","defineAdditionalCustomer","submitted","checkCustomerRegister","cpfCustomer","toArray","FilterPipe","field","normalize","includes","o","toLowerCase","pattern","RegExp","IsOnlyOneTicketByCustomer","ctx_r26","ctx_r100","ctx_r104","ctx_r109","ctx_r127","ctx_r129","ctx_r130","ctx_r146","ctx_r151","ctx_r154","ctx_r156","ctx_r177","ctx_r181","ctx_r210","ctx_r222","ctx_r227","ctx_r252","ctx_r256","ctx_r264","ctx_r276","ctx_r278","ctx_r279","ctx_r292","ctx_r295","ctx_r303","ctx_r317","ctx_r319","ctx_r326","ctx_r328","ctx_r330","ctx_r332","ctx_r338","ctx_r340","ctx_r341","ctx_r350","ctx_r353","ctx_r355","ctx_r360","ctx_r362","ctx_r364","ctx_r366","ctx_r369","ctx_r371","EventComponent","scriptService","renderer","activatedRoute","router","mapV2Service","titleService","metaService","store","host","NotRequired","select","PdvSelectors","company","pt","ut","Oe","logosite","checkFeng","loadEvent","voucherlink","site","modeComissioner","comissionerMode","formHolder","showCupom","checkNewIntegration","removeAccents","s","r","removePub","defineDefaultMeta","removeAnalytics","removeTagManager","removeTagManageriFrame","getElementsByTagName","getCustomerTickets","loadingBuyedTickets","getCustomerBuyedTickets","customerTicketsBuyed","checkComissioner","rfr","snapshot","queryParams","comissaryId","isLoggednIn","navigateByUrl","paramMap","loadEventOrder","user","saveCustomer","skipLocationChange","selectSector","selectedSector","indexSector","totalPriceSeats","mapV2Change","getBoundingClientRect","pageYOffset","scroll","mapv2Id","mapId","mapv2Row","mapv2Number","qtyEventType","qtyChanged","openPaymentConfirmationModal","paymentConfirmationModal","openPaymentConfirmationModalRef","backdrop","getHolder","sessionId","checkToken","errors","msg","token","termsOfUseAccepted","halfTickets","fullTickets","selectedPaymentMethodName","countTickets","changeQty","allowMapV2","ticketIdForOnlyOneCustomer","isCupom","ticketTagsQuantity","fengIntegration","fengPlansPartner","quantityPctValuePartner","fengPlansExtra","quantityPctValueExtra","fengPlansInvited","quantityPctValueInvited","batch","ownerPorscheTicket","priceks","blacklist","canNewFengDiscount","changeCountFengDiscount","showTicketHolders","class","initialState","content","isCompleted","ticketHoldersSubmitted","hideTicketHolders","buy","termsOfUseChanged","ev","setTermsOfUse","numberTickets","limit","qttToBuy","existsBlacklist","ticketNameBlacklist","reload","openHalfEntryModalInformation","halfEntryModalInformation","halfEntryModalInformationRef","openFormPorsche","formPorscheModal","ownerPorscheTicketQuantity","openFormPorscheModalRef","getPorscheOwner","eventName","self","ticket2","ticketsWithSeats","allTickets","concat","sell","titularModal","titularModalRef","createSellOrder","ticketOrderSubmit","lotName","placeHoldToken","parseFloat","toFixed","unitPriceWithoutFee","trim","customerRequired","comissionerId","params","getOrderEvent","paymentInChange","paymentMethods","selectedPaymentMethod","installments","paymentMethodId","sendPayment","removeAllTickets","payments","paymentCompleted","orderId","numberOrder","autoincrement","success","openCloseMap","mapModal","showMap","selectedSeatSector","mapModalRef","copySellLink","execCommand","holdersSubmitted","cardSubmitted","slideTo","getSelectedSeats","pdvs","isSeatsIo","objectType","holdToken","batchName","calculateTotalPricesSeats","removeTicketsFromOrderService","seats","closeMapModal","scrollIntoView","behavior","removeSelectedSeats","seat","splice","removeTicketByPlaceName","getLoadingSeatsIo","loadingSeatsIo","getOpenEvent","showEventInfo","isCountDown0","parseInt","slug","eventSlug","fengEndedSells","categories","categorySports","sendBanner","banner","setTitle","updateTag","property","getProducer","producerOwnerId","hideAdvertising","showPub","loadAnalytics","googleAnalyticsKey","googleTagManagerKey","loadTagManager","loadScript2","hideFullTickets","hideFullTicket","hasSeatsChart","an","fbPixel","pe","loadScript3","integrations","_r","fengPlanId","eventClosed","customerName","quantityPctValuePartnerFixed","quantityPctValueInvitedFixed","quantityPctValueExtraFixed","Me","_s","seatsIOSectors","setEvent","queryParamMap","wt","_t","useGoogleEvents","loadStructureData","cupom","sendCupomTicket","checkCustomerDataRequirementType","skipCustomerDataOnPdv","requireCustomerDataOnPdv","Obrigatory","Optional","ticketCupomError","getCupomTicket","ticketQuantity","hasAnalitycs","company$","gtag","dataLayer","arguments","userData","user_data","email_address","phone_number","first_name","last_name","street","addressStreet","addressNumber","city","addressDistrict","addressState","postal_code","addressPostalCode","country","page_event","page_name","f","frameElement","parent","parentNode","insertBefore","eventData","state","imageWeb","origin","pathname","eventSchema","fbq","callMethod","apply","queue","_fbq","loaded","disablePushState","getSelectedMapPlace","amountSelectedSeatSector","mapTicketDescription","savedTicket","buyInOtherSector","count","SeatsioAngularModule","ɵfac","ɵmod","ɵngcc0","ɵinj","imports","SeatsioModule","MapPlaceModule","provide","HAMMER_GESTURE_CONFIG","useClass","HammerGestureConfig","FormsModule","ReactiveFormsModule","MatSliderModule","NgSelectModule","SpinnerModule","QtyModule","routes","path","component","EventRoutingModule","RouterModule","FilterModule","TicketHoldersModule","SwiperModule","NgxMaskModule","FormPorscheEventModule","CountdownModule","NgxSkeletonLoaderModule","maskConfig","validation","EventModule","ModalModule","MapV2Module","exportName","VENDOR_PREFIXES","TEST_ELEMENT","round","abs","fn","timeout","bindFn","arg","each","obj","iterator","call","hasOwnProperty","method","deprecationMessage","stack","warn","TypeError","output","source","nextKey","extend","deprecate","dest","merge","keys","child","base","properties","childP","baseP","prototype","create","_super","val","args","val1","val2","types","handler","splitStr","str","findByKey","results","values","inArray","prefix","prop","camelProp","_uniqueId","ownerDocument","defaultView","parentWindow","INPUT_TYPE_TOUCH","INPUT_TYPE_MOUSE","PROPS_XY","PROPS_CLIENT_XY","manager","callback","options","inputTarget","domHandler","boolOrFn","init","eventType","input","pointersLen","pointers","changedPointersLen","changedPointers","isFirst","isFinal","INPUT_END","pointersLength","firstInput","simpleCloneInputData","E","firstMultiple","offsetCenter","center","getCenter","timeStamp","deltaTime","angle","getAngle","distance","getDistance","offset","offsetDelta","prevDelta","prevInput","deltaX","computeDeltaXY","offsetDirection","getDirection","overallVelocity","getVelocity","overallVelocityX","overallVelocityY","start","end","getScale","rotation","getRotation","maxPointers","S","velocity","velocityX","velocityY","direction","last","lastInterval","computeIntervalInputData","node","hasParent","srcEvent","computeInputData","recognize","DIRECTION_DOWN","p1","p2","props","sqrt","atan2","PI","Input","evEl","addEventListeners","evTarget","evWin","getWindowForElement","removeEventListeners","MOUSE_INPUT_MAP","mousedown","mousemove","mouseup","MOUSE_ELEMENT_EVENTS","MOUSE_WINDOW_EVENTS","pressed","inherit","MouseInput","button","which","pointerType","POINTER_INPUT_MAP","pointerdown","pointermove","pointerup","pointercancel","pointerout","IE10_POINTER_TYPE_ENUM","POINTER_ELEMENT_EVENTS","POINTER_WINDOW_EVENTS","MSPointerEvent","PointerEvent","PointerEventInput","removePointer","eventTypeNormalized","isTouch","storeIndex","pointerId","V","SINGLE_TOUCH_INPUT_MAP","touchstart","touchmove","touchend","touchcancel","SINGLE_TOUCH_TARGET_EVENTS","SINGLE_TOUCH_WINDOW_EVENTS","started","all","touches","changed","changedTouches","uniqueArray","SingleTouchInput","normalizeSingleTouches","TOUCH_INPUT_MAP","TOUCH_TARGET_EVENTS","targetIds","allTouches","INPUT_START","identifier","targetTouches","changedTargetTouches","touch","TouchInput","mouse","primaryTouch","lastTouches","setLastTouch","lastTouch","lts","DEDUP_TIMEOUT","dx","dy","DEDUP_DISTANCE","getTouches","TouchMouseInput","inputEvent","inputData","isMouse","sourceCapabilities","firesTouchEvents","recordTouches","isSyntheticEvent","PREFIXED_TOUCH_ACTION","prefixed","NATIVE_TOUCH_ACTION","TOUCH_ACTION_COMPUTE","TOUCH_ACTION_MANIPULATION","TOUCH_ACTION_NONE","TOUCH_ACTION_PAN_X","TOUCH_ACTION_PAN_Y","TOUCH_ACTION_MAP","touchMap","cssSupports","CSS","supports","getTouchActionProps","defaults","uniqueId","ifUndefined","simultaneous","requireFail","otherRecognizer","recognizer","Recognizer","AttrRecognizer","pX","pY","_timer","_input","pTime","pCenter","recognizers","preset","Manager","handlers","oldCssProps","inputClass","inputHandler","createInputInstance","touchAction","TouchAction","toggleCssProps","recognizeWith","requireFailure","cssProps","compute","actions","update","getTouchAction","inStr","hasPanX","hasPanY","TOUCH_ACTION_AUTO","cleanTouchActions","preventDefaults","prevented","hasNone","DIRECTION_LEFT","DIRECTION_UP","preventSrc","invokeArrayArg","getRecognizerByNameIfManager","dropRecognizeWith","dropRequireFailure","hasRequireFailures","canRecognizeWith","stateStr","additionalEvent","tryEmit","canEmit","STATE_FAILED","inputDataClone","reset","STATE_RECOGNIZED","process","STATE_BEGAN","attrTest","optionPointers","isRecognized","isValid","PanRecognizer","threshold","DIRECTION_HORIZONTAL","directionTest","hasMoved","directionStr","PinchRecognizer","PressRecognizer","validPointers","validMovement","validTime","setTimeoutContext","clearTimeout","RotateRecognizer","SwipeRecognizer","TapRecognizer","taps","posThreshold","validTouchTime","failTimeout","validInterval","validMultiTap","tapCount","VERSION","userSelect","touchSelect","touchCallout","contentZooming","userDrag","tapHighlightColor","stop","force","stopped","STOP","curRecognizer","existing","events","off","gestureEvent","createEvent","initEvent","triggerDomEvent","INPUT_MOVE","INPUT_CANCEL","STATE_POSSIBLE","STATE_CHANGED","STATE_ENDED","STATE_CANCELLED","DIRECTION_NONE","DIRECTION_RIGHT","DIRECTION_VERTICAL","DIRECTION_ALL","Tap","Pan","Swipe","Pinch","Rotate","Press","define","module","exports","PI_OVER_180","glob","global","WorkerGlobalScope","Konva$2","_global","isBrowser","detectBrowser","isUnminified","test","param","dblClickWindow","angleDeg","enableTrace","pointerEventsEnabled","autoDrawEnabled","hitOnDragEnabled","capturePointerEventsEnabled","_mouseListenClick","_touchListenClick","_pointerListenClick","_mouseInDblClickWindow","_touchInDblClickWindow","_pointerInDblClickWindow","_mouseDblClickPointerId","_touchDblClickPointerId","_pointerDblClickPointerId","pixelRatio","devicePixelRatio","dragDistance","showWarnings","dragButtons","isDragging","DD","isDragReady","releaseCanvasOnDestroy","_injectGlobal","_registerNode","NodeClass","getClassName","m","dirty","copy","Transform","copyInto","tr","point","translate","sx","sy","rotate","rad","cos","sin","m12","m21","m22","getTranslation","skew","multiply","matrix","invert","d","m1","m2","m3","m4","m5","getMatrix","decompose","delta","result","scaleY","skewX","skewY","acos","Util","_getRotation","PI_OVER_DEG180","DEG180_OVER_PI","KONVA_ERROR","COLORS","aliceblue","antiquewhite","aqua","aquamarine","azure","beige","bisque","black","blanchedalmond","blue","blueviolet","brown","burlywood","cadetblue","chartreuse","chocolate","coral","cornflowerblue","cornsilk","crimson","cyan","darkblue","darkcyan","darkgoldenrod","darkgray","darkgreen","darkgrey","darkkhaki","darkmagenta","darkolivegreen","darkorange","darkorchid","darkred","darksalmon","darkseagreen","darkslateblue","darkslategray","darkslategrey","darkturquoise","darkviolet","deeppink","deepskyblue","dimgray","dimgrey","dodgerblue","firebrick","floralwhite","forestgreen","fuchsia","gainsboro","ghostwhite","gold","goldenrod","gray","green","greenyellow","grey","honeydew","hotpink","indianred","indigo","ivory","khaki","lavender","lavenderblush","lawngreen","lemonchiffon","lightblue","lightcoral","lightcyan","lightgoldenrodyellow","lightgray","lightgreen","lightgrey","lightpink","lightsalmon","lightseagreen","lightskyblue","lightslategray","lightslategrey","lightsteelblue","lightyellow","lime","limegreen","linen","magenta","maroon","mediumaquamarine","mediumblue","mediumorchid","mediumpurple","mediumseagreen","mediumslateblue","mediumspringgreen","mediumturquoise","mediumvioletred","midnightblue","mintcream","mistyrose","moccasin","navajowhite","navy","oldlace","olive","olivedrab","orange","orangered","orchid","palegoldenrod","palegreen","paleturquoise","palevioletred","papayawhip","peachpuff","peru","pink","plum","powderblue","purple","rebeccapurple","red","rosybrown","royalblue","saddlebrown","salmon","sandybrown","seagreen","seashell","sienna","silver","skyblue","slateblue","slategray","slategrey","snow","springgreen","steelblue","tan","teal","thistle","transparent","tomato","turquoise","violet","wheat","white","whitesmoke","yellow","yellowgreen","RGB_REGEX","animQueue","req","requestAnimationFrame","_isElement","nodeType","_isFunction","_isPlainObject","_isArray","_isNumber","isFinite","_isString","_isBoolean","isObject","isValidSelector","selector","firstChar","_sign","requestAnimFrame","cb","createCanvasElement","createImageElement","_isInDocument","_urlToImage","imageObj","_rgbToHex","g","_hexToRgb","hex","bigint","getRandomColor","randColor","random","getRGB","rgb","substring","substr","exec","colorToRGBA","_namedColorToRBA","_hex3ColorToRGBA","_hex6ColorToRGBA","_rgbColorToRGBA","_rgbaColorToRGBA","_hslColorToRGBA","parts","match","_","hsl","h","t2","t3","t1","haveIntersection","r1","r2","cloneObject","retObj","cloneArray","arr","degToRad","deg","radToDeg","_degToRad","_radToDeg","radians","_capitalize","charAt","throw","func","_inRange","right","_getProjectionToSegment","x1","y1","x2","y2","x3","y3","dist","pd2","_getProjectionToLine","line","isClosed","pc","MAX_VALUE","proj","py","pdist","_prepareArrayForTween","startArray","endArray","temp","newStart","pr","_prepareToStringify","desc","visitedByCircularReferenceRemoval","getOwnPropertyDescriptor","configurable","_assign","_getFirstPointerId","releaseCanvas","canvases","attr","_formatValue","noOfElements","isNumber","isValidArray","isString","isGradient","addColorStop","GET","SET$1","Factory","addGetterSetter","def","validator","after","addGetter","addSetter","addOverloadedGetterSetter","overWriteSetter","_setAttr","addComponentsGetterSetter","components","len","capitalize","getter","setter","ret","getAttr","basicValidator","getComponentValidator","oldVal","_fireChangeEvent","capitalizedAttr","addDeprecatedGetterSetter","backCompat","methods","oldMethodName","newMethodName","oldGetter","oldSetter","deprecated","afterSetFilter","_filterUpToDate","retArr","util","CONTEXT_METHODS","traceArr","_enableTrace","fillShape","fillEnabled","_fill","strokeShape","hasStroke","_stroke","fillStrokeShape","fillAfterStrokeEnabled","getTrace","relaxed","rounded","trace","k","clearTrace","_trace","shift","getCanvas","getPixelRatio","setTransform","clear","bounds","getWidth","getHeight","_applyLineCap","lineCap","getLineCap","setAttr","_applyOpacity","absOpacity","getAbsoluteOpacity","_applyLineJoin","lineJoin","_context","arc","a0","a1","a2","a3","a4","a5","arcTo","bezierCurveTo","clip","closePath","createImageData","createLinearGradient","createPattern","createRadialGradient","drawImage","a6","a7","a8","ellipse","isPointInPath","path2d","fillRect","strokeRect","fillText","measureText","getImageData","rect","putImageData","quadraticCurveTo","restore","save","setLineDash","mozDash","webkitLineDash","getLineDash","stroke","strokeText","that","origSetter","methodName","origMethod","simplifyArray","_applyGlobalCompositeOperation","op","globalCompositeOperation","defineProperty","Context","super","_canvas","_fillColor","_fillFunc","_fillPattern","_getFillPattern","_fillLinearGradient","grd","_getLinearGradient","_fillRadialGradient","_getRadialGradient","hasColor","fillPriority","getFillPriority","hasPattern","getFillPatternImage","hasLinearGradient","getFillLinearGradientColorStops","hasRadialGradient","getFillRadialGradientColorStops","_strokeLinearGradient","getStrokeLinearGradientStartPoint","getStrokeLinearGradientEndPoint","colorStops","getStrokeLinearGradientColorStops","dash","strokeScaleEnabled","getStrokeScaleEnabled","dashEnabled","dashOffset","strokeWidth","getShadowForStrokeEnabled","_strokeFunc","_applyShadow","getShadowRGBA","blur","getShadowBlur","getShadowOffset","getAbsoluteScale","ratio","willReadFrequently","colorKey","_fillFuncHit","hasHitStroke","_strokeFuncHit","_pixelRatio","config","isCache","webkitBackingStorePixelRatio","mozBackingStorePixelRatio","msBackingStorePixelRatio","oBackingStorePixelRatio","backingStorePixelRatio","getDevicePixelRatio","padding","margin","border","background","setPixelRatio","previousRatio","setSize","setHeight","toDataURL","mimeType","quality","err","Canvas","getNumberValidator","SceneContext","hitCanvas","HitContext","flag","_dragElements","elem","dragStatus","justDragged","Map","_drag","nodesToFireEvents","getStage","setPointersPositions","pos","_changedPointerPositions","startPointerPos","startDrag","_setDragPosition","fire","_endDragBefore","drawNodes","drawNode","getLayer","Stage","_endDragAfter","delete","ABSOLUTE_OPACITY","ALL_LISTENERS","ABSOLUTE_TRANSFORM","ABSOLUTE_SCALE","CANVAS","LISTENING","MOUSEENTER$1","MOUSELEAVE$1","TRANSFORM","VISIBLE","TRANSFORM_CHANGE_STR$1","idCounter$1","_id","eventListeners","_allEventListeners","_cache","_attachedDepsListeners","_lastPos","_batchingTransformChange","_needClearTransformCache","_isUnderCache","_dragEventId","_shouldFireChangeEvents","setAttrs","hasChildren","_clearCache","_getCache","privateGetter","_calculate","deps","depsString","dep","_getCanvasCache","_clearSelfAndDescendantCache","has","scene","hit","_requestDraw","conf","getClientRect","skipTransform","relativeTo","getParent","ceil","drawBorder","hitCanvasPixelRatio","cachedSceneCanvas","SceneCanvas","cachedFilterCanvas","cachedHitCanvas","HitCanvas","sceneContext","hitContext","imageSmoothingEnabled","drawScene","drawHit","isCached","_transformedRect","minX","minY","maxX","maxY","points","trans","getAbsoluteTransform","transformed","_drawCachedSceneCanvas","canvasCache","cacheCanvas","_getCachedSceneCanvas","_drawCachedHitCanvas","imageData","filters","cachedCanvas","sceneCanvas","filterCanvas","filterContext","evtStr","_delegate","baseEvent","_off","stopNode","targets","findAncestors","currentTarget","_remove","_clearCaches","_setChildrenIndices","getAncestors","ancestors","getAttrs","_batchTransformChanges","isListening","_isListening","isVisible","_isVisible","visible","shouldDrawHit","skipDragCheck","layerUnderDrag","dragSkip","getZIndex","getAbsoluteZIndex","nodes","depth","getDepth","getChildren","addChildren","setPosition","getPosition","getRelativePointerPosition","getAbsolutePosition","haveCachedParent","absoluteMatrix","absoluteTransform","setAbsolutePosition","origTrans","_clearTransform","it","_getAbsoluteTransform","_setTransform","offsetX","offsetY","changeX","changeY","_eachAncestorReverse","family","unshift","theta","moveToTop","moveUp","moveDown","moveToBottom","setZIndex","_getAbsoluteOpacity","opacity","newContainer","toObject","defaultValue","toJSON","includeSelf","_isMatch","ancestor","isAncestorOf","findAncestor","sel","selectorArr","hasName","_getStage","bubble","_fireAndBubble","_fire","getTransform","getAbsoluteRotation","_getTransform","allListeners","listener","_toKonvaCanvas","box","toCanvas","toImage","img","toBlob","blob","size","getSize","getType","getDragDistance","evtName","evtListeners","newVal","addName","oldName","newName","fullName","removeName","names","_setComponentAttr","compareShape","stopBubble","cancelBubble","_getProtoListeners","listeners","getPrototypeOf","topListeners","selfListeners","_createDragElement","ap","_getPointerById","bubbleEvent","newNodePos","dbf","dragBoundFunc","bounded","setDraggable","_dragChange","_listenDrag","_dragCleanup","hasDraggingChild","dragElement","isReady","isClientRectOnScreen","screenRect","_createNode","no","Node","Class","_attrsAffectingSize","getStringValidator","getBooleanValidator","rotateDeg","setRotationDeg","getRotationDeg","filterFunc","removeChildren","destroyChildren","_validateAdd","_generalFind","findOne","_descendants","shouldStop","getAllIntersections","intersects","can","caching","_drawChildren","drawMethod","clipWidth","clipHeight","clipFunc","hasClip","selfCache","clipX","clipY","hasComposition","selfRect","skipShadow","skipStroke","shapes","hasVisible","T","Container","Captures","SUPPORT_POINTER_EVENTS","releaseCapture","MOUSELEAVE","MOUSEOVER","MOUSEENTER","MOUSEMOVE","MOUSEDOWN","MOUSEUP","POINTERMOVE","POINTERDOWN","POINTERUP","POINTERCANCEL","POINTEROUT","POINTERLEAVE","POINTEROVER","POINTERENTER","CONTEXTMENU","TOUCHSTART","TOUCHEND","TOUCHMOVE","TOUCHCANCEL","WHEEL","EVENTS","EVENTS_MAP","MOUSEOUT","pointerclick","pointerdblclick","pointer","getEventType","getEventsMap","stages","checkNoClip","_pointerPositions","_buildDOM","_bindContentEvents","_resizeDOM","_checkVisibility","isLayer","isFastLayer","display","setContainer","bufferCanvas","bufferHitCanvas","getPointersPositions","getContent","layerCanvas","getIntersection","rest","hasPointerCapture","setPointerCapture","getLayers","passive","_pointerenter","pointerenter","_pointerover","pointerover","_getTargetShape","evenType","_pointerleave","targetShape","eventsEnabled","pointerleave","pointerPos","_pointerdown","triggeredOnShape","cancelable","_pointermove","processedShapesIds","getCapturedShape","differentTarget","_pointerup","clickStartShape","clickEndShape","fireDblClick","_contextmenu","_wheel","_pointercancel","_lostpointercapture","contentPosition","_getContentPosition","_setPointerPosition","HAS_SHADOW","SHADOW_RGBA","patternImage","linearGradient","radialGradient","dummyContext$1","getSceneFunc","sceneFunc","_sceneFunc","getHitFunc","hitFunc","_hitFunc","hasShadow","_hasShadow","shadowEnabled","shadowOpacity","shadowColor","shadowBlur","shadowOffsetX","shadowOffsetY","__getFillPattern","fillPatternImage","getDummyContext$1","fillPatternRepeat","fillPatternX","fillPatternY","fillPatternRotation","fillPatternScaleX","fillPatternScaleY","fillPatternOffsetX","fillPatternOffsetY","DOMMatrix","__getLinearGradient","fillLinearGradientColorStops","fillLinearGradientStartPoint","fillLinearGradientEndPoint","__getRadialGradient","fillRadialGradientColorStops","fillRadialGradientStartPoint","fillRadialGradientEndPoint","fillRadialGradientStartRadius","fillRadialGradientEndRadius","_getShadowRGBA","rgba","hasFill","strokeEnabled","strokeLinearGradientColorStops","_useBufferCanvas","forceFill","isTransparent","strokeForShadow","shadowForStrokeEnabled","setStrokeHitEnabled","getStrokeHitEnabled","getSelfRect","_centroid","fillAndStrokeWidth","fillAndStrokeHeight","applyShadow","preWidth","preHeight","blurRadius","bufferContext","drawFunc","skipBuffer","cachingSelf","drawHitFromCache","alphaThreshold","hitImageData","hitData","rgbColorKey","hitWidth","hitHeight","Shape","getStringOrGradientValidator","getNumberOrAutoValidator","dashArray","getDashArray","setDashArray","getDrawFunc","setDrawFunc","drawHitFunc","getDrawHitFunc","setDrawHitFunc","INTERSECTION_OFFSETS","INTERSECTION_OFFSETS_LEN","_waitingForDraw","_setSmoothEnabled","createPNGStream","getNativeCanvasElement","getHitCanvas","spiralSearchDistance","continueSearch","intersectionOffset","_getIntersection","antialiased","p3","clearBeforeDraw","enableHitGraph","hitGraphEnabled","disableHitGraph","setHitGraphEnabled","getHitGraphEnabled","toggleHitCanvas","Layer","FastLayer","Group","performance","Animation","animIdCounter","frame","timeDiff","lastTime","frameRate","setLayers","addLayer","isRunning","animations","_addAnimation","_removeAnimation","_updateFrameObject","anim","_handleAnimation","layersLen","layerHash","Anim","_runFrames","_animationLoop","animRunning","duration","easing","onFinish","yoyo","idCounter","colorAttrs","propFunc","begin","finish","_pos","_change","prevPos","_time","_position","_startTime","_finish","pause","setTime","reverse","play","getTimer","onEnterFrame","seek","Tween","nodeId","Easings","Linear","tween","TweenEngine","_tweenFunc","_addListeners","tweens","_addAttr","onReset","onUpdate","diff","tweenId","trueEnd","trueStart","endRGBA","closed","startRGBA","onPlay","onReverse","onPause","thisId","to","BackEaseIn","BackEaseOut","BackEaseInOut","ElasticEaseIn","asin","pow","ElasticEaseOut","ElasticEaseInOut","BounceEaseOut","BounceEaseIn","BounceEaseInOut","EaseIn","EaseOut","EaseInOut","StrongEaseIn","StrongEaseOut","StrongEaseInOut","Konva$1","clockwise","outerRadius","innerRadius","boundLeftRatio","boundTopRatio","boundBottomRatio","boundLeft","boundTop","boundBottom","x0","y0","d01","d12","fa","p2y","tension","cp","allPoints","getControlPoints","Arc","tp","bezier","getTensionPoints","_getTensionPoints","_getTensionPointsClosed","expandPoints","firstControlPoints","lastControlPoints","middle","Line","TypedArray","Int8Array","getNumberArrayValidator","dataArray","pathLength","Path","parsePathData","ca","command","cx","cy","rx","ry","dTheta","psi","fs","inc","getPointOnEllipticalArc","getPointOnCubicBezier","getLength","getPointAtLength","ii","getPointOnLine","getPointOnQuadraticBezier","P1x","P1y","P2x","P2y","fromX","fromY","run","rise","ix","iy","getLineLength","pRise","pRun","pct","P3x","P3y","P4x","P4y","CB1","CB2","CB3","CB4","QB1","QB2","QB3","cosPsi","sinPsi","cs","cc","cpx","cpy","j","jlen","parsed","prevCmd","ctlPtx","ctlPty","cmd","convertEndpointToCenterParameterization","calcLength","psiDeg","xp","yp","lambda","cxp","cyp","vMag","vRatio","vAngle","PI2","fromTension","pointerLength","lp","lastLength","previous","pointerWidth","pointerAtEnding","__fillStroke","pointerAtBeginning","isDashEnabled","lineRect","Arrow","Circle","radiusX","radiusY","Ellipse","_setImageLoad","readyState","cropWidth","cropHeight","cropX","cropY","onError","crossOrigin","ATTR_CHANGE_LIST$2","RIGHT$1","DOWN","LEFT$1","attrChangeListLen$1","_sync","getText","getTag","pointerDirection","pointerHeight","tag","Label","cornerRadius","topLeft","topRight","bottomLeft","bottomRight","Tag","getNumberOrArrayOfNumbersValidator","Rect","_getPoints","sides","RegularPolygon","PIx2","Ring","_updated","updated","frameIndex","_setInterval","animation","ix4","offsets","frameOffsets","ix2","_updateIndex","Sprite","getIndex","setIndex","numPoints","string","Star","dummyContext","AUTO","JUSTIFY","ATTR_CHANGE_LIST$1","attrChangeListLen","checkDefaultFill","_partialTextX","_partialTextY","_setTextData","textArr","textArrLen","fontSize","lineHeightPx","lineHeight","verticalAlign","alignY","align","totalWidth","letterSpacing","textDecoration","shouldUnderline","shouldLineThrough","translateY","lineTranslateX","lineTranslateY","_getContextFont","spacesNumber","oneWord","lineWidth","lastLine","lastInParagraph","strokeStyle","stringToArray","li","letter","_partialText","measureSize","setText","getTextWidth","textWidth","getTextHeight","textHeight","metrics","getDummyContext","font","fontStyle","fontVariant","fontFamily","hasSpace","hasQuotes","normalizeFontFamily","_addTextLine","_getTextWidth","lines","fixedWidth","fixedHeight","maxHeightPx","currentHeightPx","wrap","wrapAtWord","shouldAddEllipsis","ellipsis","additionalWidth","low","high","matchWidth","mid","substrWidth","wrapIndex","nextChar","lastIndexOf","trimRight","_shouldHandleEllipsis","_tryToAddEllipsisToLastLine","trimLeft","ELLIPSIS","Text","partialText","dummyCanvas","textBaseline","glyphInfo","p0","_getTextSize","kerningFunc","textFullWidth","fullPathWidth","pathCmd","charArr","pIndex","currentT","getNextPathSegment","pathData","findSegmentToFitCharacter","glyphWidth","currLen","attempts","cumulativePathLength","needNewSegment","ae","lettersInOffset","kern","midpoint","transposeX","transposeY","info","TextPath","EVENTS_NAME","ATTR_CHANGE_LIST","NODES_RECT","TRANSFORM_CHANGE_STR","ANGLES","TOUCH_DEVICE","ANCHORS_NAMES","MAX_SAFE_INTEGER","angleRad","deltaRad","rotateAroundPoint","_transforming","_createElements","_handleMouseMove","bind","_handleMouseUp","getNode","attachTo","setNode","setNodes","_nodes","_getEventNamespace","detach","useSingleNodeRotation","onChange","_resetTransformCache","additionalEvents","_proxyDrag","lastPos","otherNode","otherAbs","getNodes","getActiveAnchor","_movingAnchorName","_getNodeRect","__getNodeRect","__getNodeShape","rot","relative","ignoreStroke","absScale","absPos","totalPoints","getX","getY","_createBack","_createAnchor","anchor","_handleMouseDown","anchorName","getCursor","_cursorChange","rotateEnabled","rotateAnchorOffset","shouldOverdrawWholeArea","hypotenuse","_anchorDragOffset","newHypotenuse","anchorNode","pp","oldAbs","anchorDragBoundFunc","newAbs","newRotation","tol","rotationSnapTolerance","rotateAroundCenter","snaps","newRotationRad","snapped","absDiff","dif","snappedRot","rotationSnaps","_fitNodesInto","keepProportion","keepRatio","shiftKey","centeredScaling","altKey","comparePoint","reverseX","reverseY","topOffsetX","topOffsetY","bottomOffsetX","bottomOffsetY","_removeEvents","newAttrs","oldAttrs","allowNegativeScale","flipEnabled","boundBoxFunc","baseSize","oldTr","newTr","parentTransform","localTransform","newLocalTransform","forceUpdate","_batchChangeChild","enabledAnchors","resizeEnabled","anchorSize","anchorStroke","anchorStrokeWidth","anchorFill","anchorCornerRadius","borderEnabled","borderStroke","borderStrokeWidth","borderDash","isTransforming","stopTransform","Transformer","lineEnabled","rotateHandlerOffset","enabledHandlers","Wedge","getAngleDeg","setAngleDeg","mul_table","shg_table","fromValue","fromMin","fromMax","toMin","toMax","fromRange","toRange","toValue","idata","RGBComponent","Filters","Blur","yi","yw","r_sum","g_sum","b_sum","a_sum","r_out_sum","g_out_sum","b_out_sum","a_out_sum","r_in_sum","g_in_sum","b_in_sum","a_in_sum","pg","pb","pa","rbs","pixels","widthMinus1","heightMinus1","radiusPlus1","sumFactor","stackStart","BlurStack","stackEnd","stackIn","stackOut","mul_sum","shg_sum","te","filterGaussBlurRGBA","Brighten","brightness","Contrast","adjust","contrast","nPixels","Emboss","strength","embossStrength","greyLevel","embossWhiteLevel","embossDirection","blend","embossBlend","dirY","dirX","w","w4","otherY","offsetYOther","otherX","offsetOther","dG","dB","absDif","Enhance","nSubPixels","rMin","rMax","gMin","gMax","bMin","bMax","enhanceAmount","enhance","rMid","rGoalMax","rGoalMin","gMid","gGoalMax","gGoalMin","bMid","bGoalMax","bGoalMin","remap","Grayscale","HSL","saturation","hue","luminance","vsu","vsw","rr","rg","rb","gr","gg","gb","br","bb","HSV","Invert","Kaleidoscope","xoff","srcPos","dstPos","xSize","ySize","power","kaleidoscopePower","kaleidoscopeAngle","tempCanvas","scratchData","dst","opt","srcPixels","dstPixels","xMid","polarCenterX","yMid","polarCenterY","rSize","tSize","conversion","ToPolar","minSectionSize","sectionSize","xStart","xEnd","xDelta","phaseShift","polarRotation","FromPolar","Mask","mask","rgbv_no","pixelAt","rgbv_ne","rgbv_so","rgbv_se","thres","rgbDistance","mean","pTab","rgbMean","backgroundMask","applyMask","sw","sh","weights","side","halfSide","maskResult","so","scy","scx","smoothEdgeMask","dilateMask","erodeMask","Noise","noise","half","Pixelate","alpha","xBinStart","xBinEnd","yBinStart","yBinEnd","xBin","yBin","pixelsInBin","pixelSize","nBinsX","nBinsY","Posterize","levels","RGB","RGBA","ia","Sepia","Solarize","Threshold","level","activeEventOptions","normalizePassiveListenerOptions","MAT_SLIDER_VALUE_ACCESSOR","NG_VALUE_ACCESSOR","useExisting","forwardRef","MatSlider","multi","_MatSliderBase","mixinTabIndex","mixinColor","mixinDisabled","_elementRef","_focusMonitor","_changeDetectorRef","_dir","tabIndex","_ngZone","_animationMode","_invert","_max","_min","_step","_thumbLabel","_tickInterval","_value","_vertical","valueChange","onTouched","_percent","_isSliding","_isActive","_tickIntervalPercent","_sliderDimensions","_controlValueAccessorChangeFn","_dirChangeSubscription","Subscription","_pointerDown","isTouchEvent","_touchId","sliderHost","contains","getTouchIdForSlider","pointerPosition","getPointerPositionOnPage","oldValue","_lastPointerEvent","_focusHostElement","_onMouseenter","_bindGlobalEvents","_updateValueFromPosition","_valueOnSlideStart","_emitInputEvent","_pointerMove","_pointerUp","findMatchingTouch","_removeGlobalEvents","_emitChangeEvent","_windowBlur","runOutsideAngular","coerceBooleanProperty","coerceNumberProperty","_calculatePercentage","markForCheck","step","_roundToDecimal","pop","thumbLabel","tickInterval","vertical","displayValue","displayWith","focus","_blurHostElement","percent","_clamp","_shouldInvertAxis","_isMinValue","_getThumbGap","_getTrackBackgroundStyles","_shouldInvertMouseCoords","_getTrackFillStyles","_getTicksContainerStyles","_getDirection","_getTicksStyles","tickSize","styles","backgroundSize","shouldInvertAxis","_getThumbContainerStyles","ngAfterViewInit","monitor","detectChanges","stopMonitoring","unsubscribe","_getSliderDimensions","_updateTickIntervalPercent","_onFocus","_onBlur","_onKeydown","hasModifierKey","keyCode","PAGE_UP","_increment","PAGE_DOWN","END","HOME","LEFT_ARROW","UP_ARROW","RIGHT_ARROW","DOWN_ARROW","_onKeyup","_getWindow","triggerEvent","endEventName","numSteps","clampedValue","exactValue","_calculateValue","closestValue","_createChangeEvent","tickIntervalPercent","trackSize","pixelsPerTick","isSafeNumber","MatSliderChange","percentage","_sliderWrapper","writeValue","registerOnChange","registerOnTouched","setDisabledState","isDisabled","i1","i2","ANIMATION_MODULE_TYPE","ɵcmp","Dt","de","U","fe","decls","directives","i3","MatCommonModule"],"sourceRoot":"webpack:///","sources":["./src/app/config/swiper.config.ts","./src/app/pipes/sort-by/sort-by.module.ts","./src/app/pipes/sort-by/sort-by.pipe.ts","./src/app/views/dialogs/ticket-holders/ticket-holders.component.html","./src/app/views/dialogs/ticket-holders/ticket-holders.component.ts","./src/app/services/structure-data.ts","./src/app/views/components/countdown/countdown.component.ts","./src/app/views/components/countdown/countdown.component.html","./src/app/views/components/mapv2/mapv2-tickets/mapv2-tickets.component.html","./src/app/views/components/mapv2/mapv2-tickets/mapv2-tickets.component.ts","./src/app/views/components/mapv2/mapv2-cart/mapv2-cart.component.html","./src/app/views/components/mapv2/mapv2-cart/mapv2-cart.component.ts","./src/app/views/components/mapv2/mapv2-loader/mapv2-loader.component.html","./src/app/views/components/mapv2/mapv2-loader/mapv2-loader.component.ts","./src/app/views/components/mapv2/pipes/places-by-sector.pipe.ts","./src/app/views/components/mapv2/mapv2-places/mapv2-places.component.html","./src/app/views/components/mapv2/mapv2-places/mapv2-places.component.ts","./src/app/views/components/mapv2/mapv2-sectors/mapv2-sectors.component.ts","./src/app/views/components/mapv2/mapv2-sectors/mapv2-sectors.component.html","./src/app/views/components/mapv2/mapv2.component.html","./src/app/views/components/mapv2/mapv2.component.ts","./src/app/views/components/seatsio/seatsio.component.ts","./src/app/views/components/seatsio/seatsio.component.html","./src/app/views/components/map-place/map-place.component.html","./src/app/views/components/map-place/map-place.component.ts","./src/app/views/components/qty/qty.component.ts","./src/app/views/components/qty/qty.component.html","./src/app/helpers/arrays.ts","./src/app/views/components/form-porsche-event/form-porsche-event.component.html","./src/app/views/components/form-porsche-event/form-porsche-event.component.ts","./src/app/pipes/filter/filter.pipe.ts","./src/app/views/pages/event/pipes/IsOnlyOneTicketByCustomer.pipe.ts","./src/app/views/pages/event/event.component.html","./src/app/views/pages/event/event.component.ts","./node_modules/@seatsio/seatsio-angular/__ivy_ngcc__/fesm2015/seatsio-seatsio-angular.js","./src/app/views/components/seatsio/seatsio.module.ts","./src/app/views/components/map-place/map-place.module.ts","./src/app/views/components/qty/qty.module.ts","./src/app/views/pages/event/event-routing.module.ts","./src/app/pipes/filter/filter.module.ts","./src/app/views/dialogs/ticket-holders/ticket-holders.module.ts","./src/app/views/components/form-porsche-event/form-porsche-event.module.ts","./src/app/views/components/countdown/countdown.module.ts","./src/app/views/pages/event/event.module.ts","./src/assets/hammer.konva.js","./src/assets/konva.js","./node_modules/@angular/material/fesm2015/slider.mjs"],"sourcesContent":["import SwiperCore, { Navigation, Pagination, Scrollbar, A11y, SwiperOptions, Autoplay } from 'swiper';\n\n// install Swiper modules\nSwiperCore.use([Navigation, Pagination, Scrollbar, A11y, Autoplay]);\n\nexport class SwiperConfig {\n\n public static banners: SwiperOptions = {\n slidesPerView: 1,\n spaceBetween: 0,\n navigation: true,\n autoplay: true,\n loop: true,\n pagination: { clickable: true },\n scrollbar: { draggable: true },\n };\n\n public static categories: SwiperOptions = {\n loop: true,\n slidesPerView: 1,\n spaceBetween: 10,\n breakpoints: {\n 320: {\n slidesPerView: 2,\n spaceBetween: 10\n },\n 576: {\n slidesPerView: 3,\n spaceBetween: 20\n },\n 768: {\n slidesPerView: 4,\n spaceBetween: 20\n },\n 992: {\n slidesPerView: 5,\n spaceBetween: 20\n }\n }\n };\n\n public static events: SwiperOptions = {\n loop: true,\n slidesPerView: 1,\n navigation: true,\n scrollbar: { draggable: true },\n breakpoints: {\n 576: {\n slidesPerView: 2\n },\n 768: {\n slidesPerView: 3\n },\n 1400: {\n slidesPerView: 4\n }\n }\n };\n\n public static cities: SwiperOptions = {\n loop: true,\n slidesPerView: 2,\n navigation: true,\n scrollbar: { draggable: true },\n breakpoints: {\n 576: {\n slidesPerView: 3\n },\n 768: {\n slidesPerView: 4\n },\n 992: {\n slidesPerView: 5\n }\n }\n };\n\n public static states: SwiperOptions = {\n loop: true,\n slidesPerView: 2,\n navigation: true,\n scrollbar: { draggable: true },\n breakpoints: {\n 576: {\n slidesPerView: 3\n },\n 768: {\n slidesPerView: 3\n },\n 992: {\n slidesPerView: 3\n }\n }\n };\n\n public static sectors: SwiperOptions = {\n slidesPerView: 1,\n spaceBetween: 15,\n centerInsufficientSlides: true,\n navigation: true,\n scrollbar: { draggable: true },\n breakpoints: {\n 360: {\n slidesPerView: 2,\n spaceBetween: 15\n },\n 576: {\n slidesPerView: 3,\n spaceBetween: 15\n },\n 1200: {\n slidesPerView: 4,\n spaceBetween: 15\n }\n }\n };\n\n public static ticketHolders: SwiperOptions = {\n slidesPerView: 1,\n spaceBetween: 0,\n simulateTouch: false,\n pagination: { clickable: false },\n scrollbar: { draggable: true },\n };\n\n}\n","import { NgModule } from '@angular/core';\nimport { CommonModule } from '@angular/common';\nimport { SortByPipe } from './sort-by.pipe';\n\n\n\n@NgModule({\n declarations: [SortByPipe],\n imports: [\n CommonModule\n ],\n exports: [SortByPipe]\n})\nexport class SortByModule { }\n","import { Pipe, PipeTransform } from '@angular/core';\n\n@Pipe({\n name: 'sortBy'\n})\nexport class SortByPipe implements PipeTransform {\n transform(items: any[] | undefined, key: string, sortBy: 'asc' | 'desc' = 'asc'): any[] {\n if (!items || items.length == 0) {\n return [];\n }\n\n if (sortBy == 'asc') {\n return orderbyAsc(items, key);\n }\n return orderbyDesc(items, key);\n }\n}\n\nfunction orderbyAsc(array: any[], key: string) {\n return array.sort((catA: any, catB: any) => {\n if (catA[key] > catB[key]) {\n return 1;\n } else if (catA[key] < catB[key]) {\n return -1;\n } else {\n return 0;\n }\n });\n}\n\nfunction orderbyDesc(array: any[], key: string) {\n return array.sort((catA: any, catB: any) => {\n catA = String(catA[key]).toUpperCase();\n catB = String(catB[key]).toUpperCase();\n if (catA < catB) {\n return 1;\n } else if (catA > catB) {\n return -1;\n } else {\n return 0;\n }\n });\n}\n","
\n \n \n \n
Titulares dos ingressos
\n
\n
\n \n \n
\n
\n

\n {{ ticket.name }}\n
\n Loading...\n
\n

\n
{{id+ 1 }}º Ingresso
\n
\n
\n
\n \n {{sesiTerms}}\n
\n
\n
\n Ao avançar declaro que as informações acima são verdadeiras.\n
\n
\n
\n \n \n
\n
\n
\n
\n \n \n
\n
\n
\n
\n \n \n
\n
\n
\n
\n \n \n
\n
\n
\n
\n
\n
\n","import { Component, Input, OnDestroy, OnInit } from '@angular/core';\nimport { BsModalRef } from 'ngx-bootstrap/modal';\nimport { catchError, of, Subject, takeUntil } from 'rxjs';\nimport { SwiperConfig } from 'src/app/config/swiper.config';\nimport { OrderModel } from 'src/app/models/order.model';\nimport { AlertService } from 'src/app/services/alert.service';\nimport { OrderService } from 'src/app/services/order.service';\nimport { MyProfileService } from 'src/app/services/my-profile.service';\nimport { FormArray, FormBuilder, FormGroup } from '@angular/forms';\nimport { Validators } from '@angular/forms';\nimport Swiper from 'swiper';\nimport { CustomerDataRequirementTypeEnum } from '../../pages/event/event.component';\nimport { AuthService } from 'src/app/services/auth.service';\nimport { FormHelper } from '../../../helpers/form.helper';\nimport { testPhones, validaCPF } from 'src/app/helpers/utils.helper';\n\n@Component({\n selector: 'app-ticket-holders',\n templateUrl: './ticket-holders.component.html',\n styleUrls: ['./ticket-holders.component.scss']\n})\nexport class TicketHoldersComponent implements OnInit, OnDestroy {\n\n @Input()\n public customerDataRequirementType: CustomerDataRequirementTypeEnum = CustomerDataRequirementTypeEnum.NotRequired;\n\n public loadingFindUser: boolean = false;\n\n public order!: OrderModel;\n public sesiTerms: string = \"O comprador concorda que o evento poderá ser, por parte da IngressoSA ou do Sistema Indústria (CNI, SESI, SENAI e IEL), filmado, gravado e/ou fotografado para posterior publicação, transmissão, retransmissão, reprodução e/ou divulgação em televisão, cinema, rádio, internet, redes sociais, publicidade em geral e qualquer outro veículo de comunicação, produção de CD e DVD. O Comprador concorda que, ao comparecer ao evento/espetáculo, autoriza a utilização gratuita de sua imagem, nome e voz, nos termos ora mencionados, no Brasil e no exterior, sem limite de vezes e tempo, sem que isso caracterize uso indevido da imagem ou qualquer outro direito e sem que dessa utilização ocorra qualquer ônus e/ou indenização.\"\n public showSesiTerms: boolean = false\n public sesiEvents = [\n \"b2c13214-217e-4ae4-91f1-97fdf73b9cd2\",\n \"bfb2fe3a-e0f9-4fab-bc1e-d1520ee6e9c8\",\n \"93da81ab-8069-49cc-b5ce-821a9c8cb019\",\n \"92fe33ac-f50a-463b-be4a-62bdd78ea055\",\n \"327742cf-2f73-488d-908a-bcbd7c440286\",\n \"0763f8e9-73fc-4ef1-98fc-54ea72e8c26b\",\n \"c0011a5d-8730-43f1-a5c8-e655260ed681\",\n \"de4d9eb5-da49-4ef9-a9fa-934fed924e40\",\n \"b55c3a53-96be-4e48-9592-d4d2d8f2b9be\",\n \"5a335743-3767-43e9-a038-1da639ec3e91\",\n \"d070af08-6c11-4ed0-8f83-d8977b84bf02\",\n \"45df1529-74d8-46a6-9957-312950e18beb\",\n \"cbe3128e-203d-44d2-a318-543c57bc8016\",\n \"921c8643-3161-4d26-b6eb-4187083ff279\",\n \"07df87d1-63fc-4888-80ee-2506a329caa6\",\n \"cfe1d9c8-1c0c-4111-94ce-f2062dca874b\",\n \"470464a1-6314-4f82-a535-b00215904566\",\n \"d0cb1828-e2a2-43f6-87f1-55436de5906a\",\n \"b1bd3ea2-45fc-416e-b7a3-7759a323bdbd\",\n \"a1e1cd02-f972-4469-98aa-89c6381e9a8d\",\n \"6ddb97be-0c87-4b97-8609-3880541a3d5b\",\n \"3797fe20-f53a-4fde-88d1-a3b6abb12dba\",\n \"fb55a102-84ad-421d-ab5e-e747b5d15d95\",\n \"ac74fc0f-dbd6-4cd2-9891-1147a185cef6\",\n \"635138ce-385a-4150-af9c-a965c08ecb04\",\n \"7f042ac9-d77c-484f-b61f-c5d66832477d\",\n \"952fddb0-5c87-4140-bdf3-3643fb7ab67e\"\n ]\n public swiper!: Swiper;\n public config = SwiperConfig.ticketHolders;\n public onComplete = new Subject();\n private unsubscribe$ = new Subject();\n public customers!: FormGroup\n public idx = 0\n public sesiTermsOfUseAccepted: boolean = false\n\n constructor(\n private bsModalRef: BsModalRef,\n private myProfileService: MyProfileService,\n public fb: FormBuilder,\n private orderService: OrderService,\n private alertService: AlertService,\n private authService: AuthService,\n private formHelper: FormHelper\n ) { }\n\n ngOnInit(): void {\n this.customers = this.fb.group({\n 'customer': this.fb.array([])\n })\n this.loadOrder();\n }\n\n ngOnDestroy(): void {\n this.unsubscribe$.next(null);\n this.unsubscribe$.complete();\n }\n\n public onSwiper(swiper: Swiper): void {\n this.swiper = swiper;\n }\n\n public clearForm(id) {\n (document!.getElementById(\"name\" + id)! as HTMLInputElement).value = \"\";\n (document!.getElementById(\"email\" + id)! as HTMLInputElement).value = \"\";\n (document!.getElementById(\"phone\" + id)! as HTMLInputElement).value = \"\";\n }\n\n public enableForm(id) {\n (document!.getElementById(\"name\" + id)! as HTMLInputElement).disabled = false;\n (document!.getElementById(\"email\" + id)! as HTMLInputElement).disabled = false;\n (document!.getElementById(\"phone\" + id)! as HTMLInputElement).disabled = false;\n (this.customers.get('customer') as FormArray).at(this.idx).get(\"name\")?.enable();\n (this.customers.get('customer') as FormArray).at(this.idx).get(\"email\")?.enable();\n (this.customers.get('customer') as FormArray).at(this.idx).get(\"phone\")?.enable();\n }\n\n public findUser(id) {\n if ((this.customers.get('customer') as FormArray).at(this.idx).get(\"doc\")!.value.length == 14) {\n this.loadingFindUser = true;\n this.myProfileService.checkCustomerRegisterWithCpf((this.customers.get('customer') as FormArray).at(this.idx).get(\"doc\")!.value).subscribe((re) => {\n this.loadingFindUser = false;\n\n if (!re || re.length == 0) {\n if (this.order.tickets[this.idx].useFacialRecognition) {\n this.alertService.toast({\n icon: 'error',\n title: 'Não foi possível encontrar um usuário com este CPF. Por favor, informe um CPF cadastrado.'\n });\n return;\n }\n\n if (this.customerDataRequirementType == CustomerDataRequirementTypeEnum.Obrigatory) {\n this.alertService.toast({\n icon: 'error',\n title: 'Não foi possível encontrar um usuário com este CPF. Por favor, informe os dados do titular do ingresso.'\n });\n this.clearForm(id);\n this.enableForm(id);\n return;\n }\n\n if (this.customerDataRequirementType == CustomerDataRequirementTypeEnum.Optional) {\n this.alertService.toast({\n icon: 'warning',\n title: 'Não foi possível encontrar um usuário com este CPF. Preencha as informações do titular do ingresso.'\n });\n this.clearForm(id);\n this.enableForm(id);\n return;\n }\n }\n\n if (this.order.tickets[this.idx].useFacialRecognition) {\n if (!re[0].hasImage) {\n this.alertService.toast({\n icon: 'error',\n title: `É necessário informar um usuário com imagem de reconhecimento facial. Por favor, solicite o titular do CPF ${re[0]?.doc || ''} o cadastro da imagem antes de continuar.`\n });\n this.clearForm(id);\n return;\n }\n }\n\n const phone = re[0].phones?.length > 0 ? re[0].phones[0].replace(/\\s+/g, \"\") : null;\n\n (document!.getElementById(\"name\" + id)! as HTMLInputElement).disabled = true;\n (document!.getElementById(\"email\" + id)! as HTMLInputElement).disabled = true;\n (document!.getElementById(\"phone\" + id)! as HTMLInputElement).disabled = phone == null ? false : true;\n\n (this.customers.get('customer') as FormArray).at(this.idx).get(\"name\")!.setValue(re[0].name);\n (this.customers.get('customer') as FormArray).at(this.idx).get(\"email\")!.setValue(re[0].email);\n (this.customers.get('customer') as FormArray).at(this.idx).get(\"phone\")!.setValue(phone);\n\n },\n catchError(() => {\n this.loadingFindUser = false;\n return of(null);\n })\n )\n }\n }\n\n public preventTab(event: KeyboardEvent): void {\n if (event.key === 'Tab') {\n event.preventDefault();\n const enterEvent = new KeyboardEvent('keydown', { key: 'Enter' });\n event.target?.dispatchEvent(enterEvent);\n }\n }\n\n public back() {\n if (this.swiper.activeIndex == 0) {\n this.onComplete.next(false);\n this.bsModalRef.hide();\n } else {\n this.swiper.slidePrev();\n this.idx = this.swiper.activeIndex\n }\n }\n\n public continue() {\n this.idx = this.swiper.activeIndex;\n const customers = (this.customers.get('customer') as FormArray);\n const currentCustomer = customers.at(this.idx);\n \n\n let allowedDuplicateCount = this.order.event?.limitByCPF ? this.order.event?.limitByCPF : 0;\n if (this.order.tickets[this.idx].useFacialRecognition) {\n allowedDuplicateCount = 1;\n }\n\n if (currentCustomer.get(\"phone\")?.value && !testPhones([currentCustomer.get(\"phone\")?.value])) {\n this.alertService.toast({\n icon: 'error',\n title: 'Verfique se o telefone informado no ingresso é válido'\n });\n return;\n }\n\n if (currentCustomer.get(\"doc\")?.value && !validaCPF(currentCustomer.get(\"doc\")?.value)) {\n this.alertService.toast({\n icon: 'error',\n title: 'Verfique se o CPF informado no ingresso é válido'\n });\n return;\n }\n\n const hasAnyValue = currentCustomer.get(\"name\")?.value ||\n currentCustomer.get(\"doc\")?.value ||\n currentCustomer.get(\"email\")?.value ||\n currentCustomer.get(\"phone\")?.value;\n\n const hasAllValues = currentCustomer.get(\"name\")?.value &&\n currentCustomer.get(\"doc\")?.value &&\n currentCustomer.get(\"email\")?.value &&\n currentCustomer.get(\"phone\")?.value;\n\n if (hasAnyValue && !hasAllValues) {\n this.alertService.toast({\n icon: 'error',\n title: 'Se algum campo for preenchido, todos os campos devem ser preenchidos!'\n });\n return;\n }\n\n if (\n this.customerDataRequirementType == CustomerDataRequirementTypeEnum.Obrigatory && !hasAllValues\n ) {\n this.alertService.toast({\n icon: 'error',\n title: 'Todos os campos são obrigatórios para esse ingresso!'\n });\n return;\n }\n\n const duplicateCount = this.order.tickets.filter((ticket, index) => ticket.customer?.doc != null && ticket.customer?.doc == currentCustomer.get(\"doc\")!.value && index != this.idx).length;\n if (allowedDuplicateCount != 0 && duplicateCount >= allowedDuplicateCount) {\n const foundIndex = this.order.tickets.findIndex((ticket, index) => ticket.customer?.doc == currentCustomer.get(\"doc\")!.value && index != this.idx);\n this.alertService.toast({\n icon: 'error',\n title: `O CPF ${currentCustomer.get(\"doc\")!.value} já está informado no ingresso ${foundIndex + 1}.`\n });\n this.clearForm(this.idx);\n return;\n }\n\n if (this.showSesiTerms == true && this.order.tickets[this.idx].sesiTermsAccepted == false) {\n this.alertService.toast({\n icon: 'error',\n title: 'Você precisa aceitar os termos do ingresso'\n });\n return\n }\n\n\n this.order.tickets[this.idx].customer = {\n doc: currentCustomer.get(\"doc\")!.value,\n name: currentCustomer.get(\"name\")!.value,\n email: currentCustomer.get(\"email\")!.value,\n phones: currentCustomer.get(\"phone\")?.value ? [currentCustomer.get(\"phone\")!.value] : undefined\n };\n\n this.orderService.saveHolder(this.order.tickets[this.idx].customer, this.idx);\n\n const remainingTickets = this.order.tickets.slice(this.idx + 1);\n const hasUnfilledTickets = remainingTickets.some(ticket => !ticket.customer);\n\n if (hasUnfilledTickets) {\n this.swiper.slideNext();\n this.idx = this.swiper.activeIndex;\n } else {\n this.onComplete.next(true);\n this.bsModalRef.hide();\n }\n }\n\n sesiTermsOfUseChange(eve: any) {\n (this.order.tickets[this.swiper.activeIndex] as any).sesiTermsAccepted = eve.srcElement.checked \n }\n\n private loadOrder() {\n this.orderService.currentOrder\n .pipe(takeUntil(this.unsubscribe$))\n .subscribe(order => {\n this.order = order;\n\n \n\n if (this.sesiEvents.indexOf(this?.order?.event?.id as string) > -1) {\n let tickets: any = []\n this.order.tickets.forEach((res) => {\n (res as any).sesiTermsAccepted = false\n tickets[tickets.length] = res\n })\n this.showSesiTerms = true\n }\n\n \n\n this.order.tickets.forEach(element => {\n let customer = this.fb.group({\n doc: { value: element.customer?.doc, disabled: false },\n name: { value: element.customer?.name, disabled: true },\n email: [{ value: element.customer?.email, disabled: true }, [Validators.email]],\n phone: [{ value: element.customer?.phones?.length ? element.customer.phones[0] : '', disabled: false }],\n });\n\n (this.customers.get('customer') as FormArray).push(customer);\n });\n\n if (!this.order.tickets[0].customer?.doc) {\n const customer = this.authService.getCustomer();\n if (!customer) {\n return;\n }\n\n let phone = '';\n if (customer.phones?.length) {\n phone = customer.phones[0];\n }\n\n this.order.tickets[0].customer = {\n doc: customer.doc,\n name: customer.name,\n email: customer.email,\n phones: [phone]\n };\n\n const firstFormCustomer = (this.customers.get('customer') as FormArray).at(0);\n\n firstFormCustomer.get(\"doc\")!.setValue(customer.doc)\n firstFormCustomer.get(\"name\")!.setValue(customer.name)\n firstFormCustomer.get(\"email\")!.setValue(customer.email)\n\n firstFormCustomer.get(\"phone\")!.setValue(phone)\n firstFormCustomer.get(\"phone\")!.enable();\n\n }\n\n });\n }\n}\n","import { DOCUMENT } from \"@angular/common\";\nimport { Inject, Injectable } from \"@angular/core\";\n\nexport interface EventData{\n name: string,\n description?: string,\n startDate: string,\n endDate?: string,\n location: EventLocationData,\n images: Array,\n companyName: string,\n companyUrl: string,\n\tminPrice?: string,\n\teventUrl: string\n}\n\nexport interface EventLocationData{\n name: string,\n streetAddress: string,\n addressLocality: string,\n postalCode?: string,\n addressRegion: string,\n addressCountry?: string,\n}\n\n@Injectable({\n\tprovidedIn: 'root'\n})\n\nexport class JsonLDService {\n\tstatic scriptType = 'application/ld+json';\n \n eventSchema = (event: EventData ) => {\n\t\tvar schema:any = {\n \"@context\": \"https://schema.org\",\n \"@type\": \"Event\",\n \"name\": event.name,\n \"startDate\": event.startDate,\n \"endDate\": event.endDate,\n \"eventAttendanceMode\": \"https://schema.org/OfflineEventAttendanceMode\",\n \"eventStatus\": \"https://schema.org/EventScheduled\",\n \"location\": {\n \"@type\": \"Place\",\n \"name\": event.location.name,\n \"address\": {\n \"@type\": \"PostalAddress\",\n \"streetAddress\": event.location.streetAddress,\n \"addressLocality\": event.location.addressLocality,\n //\"postalCode\": event.location.postalCode,\n \"addressRegion\": event.location.addressRegion,\n \"addressCountry\": event.location.addressCountry || 'BR'\n }\n },\n \"image\": event.images,\n \"description\": event.description || event.name,\n \"offers\": {\n \"@type\": \"Offer\",\n \"url\": event.eventUrl,\n \"availability\": \"https://schema.org/InStock\",\n },\n \"performer\": {\n \"@type\": \"PerformingGroup\",\n \"name\": event.name\n },\n \"organizer\": {\n \"@type\": \"Organization\",\n \"name\": event.companyName,\n \"url\": event.companyUrl\n }\n };\n\n\t\tif(event.minPrice){\n\t\t\tschema.offers.price = event.minPrice;\n\t\t\tschema.offers.priceCurrency = 'BRL';\n\t\t}\n\n\t\treturn schema;\n\t};\n\n\tstatic websiteSchema = (url?: string, name?: string) => {\n\t\treturn {\n\t\t\t'@context': 'http://schema.org',\n\t\t\t'@type' : 'WebSite',\n\t\t\turl : url || 'https:\\/\\/google.com',\n\t\t\tname : name || 'Google',\n\t\t\t\"sameAs\": [\"https://facebook.com/google\",\n\t\t\t\t \"https://instagram.com/google\",\n\t\t\t\t \"https://twitter.com/google\"]\n\t\t\t};\n\t};\n\n\tstatic orgSchema = () => ({\n\t\t\t'@context' :\n\t\t\t\t'https://schema.org',\n\t\t\t'@type' :\n\t\t\t\t'Organization',\n\t\t\turl :\n\t\t\t\t'https://google.com',\n\t\t\tname :\n\t\t\t\t'Google',\n\t\t\tcontactPoint: {\n\t\t\t\t'@type' :\n\t\t\t\t\t'ContactPoint',\n\t\t\t\ttelephone :\n\t\t\t\t\t'01293019413',\n\t\t\t\tcontactType:\n\t\t\t\t\t'Customer service'\n\t\t\t}\n\t\t});\n\n\tconstructor(@Inject(DOCUMENT) private _document: Document) {}\n\n\tremoveStructuredData(): void {\n\t\tconst els = Array();\n\t\t[ 'structured-data', 'structured-data-org' ].forEach((c:any) => {\n\t\t\tels.push(...Array.from(this._document.head.getElementsByClassName(c)));\n\t\t});\n\t\tels.forEach(el => this._document.head.removeChild(el));\n\t}\n\n\tinsertSchema(schema: Record, className = 'structured-data'): void {\n\t\tlet script;\n\t\tlet shouldAppend = false;\n\t\tif (this._document.head.getElementsByClassName(className).length) {\n\t\t\tscript = this._document.head.getElementsByClassName(className)[0];\n\t\t} else {\n\t\t\tscript = this._document.createElement('script');\n\t\t\tshouldAppend = true;\n\t\t}\n\t\tscript.setAttribute('class', className);\n\t\tscript.type = JsonLDService.scriptType;\n\t\tscript.text = JSON.stringify(schema);\n\t\tif (shouldAppend) {\n\t\t\tthis._document.head.appendChild(script);\n\t\t}\n\t}\n}","import { Component, OnInit, Input, Output, EventEmitter } from '@angular/core';\n\n@Component({\n selector: 'app-countdown',\n templateUrl: './countdown.component.html',\n styleUrls: ['./countdown.component.scss']\n})\nexport class CountdownComponent implements OnInit {\n\n\n public totalMinutes: number = 0; \n public thisTime = new Date()\n public endTime: Date = new Date()\n public hours: number = 0;\n public minutes: number = 0;\n public seconds: number = 0;\n private interval: any; \n\n @Input() eventTimeStartSell: any = \"0\"\n @Input() eventDateStartSell: any = \"0\"\n @Output() sendOpenEvent: EventEmitter = new EventEmitter()\n\n constructor() { }\n \n ngOnInit(): void {\n \n let time = (this.transformInDate(this.eventTimeStartSell, this.eventDateStartSell).getTime() - new Date().getTime())\n this.totalMinutes = time / 1000 / 60;\n if (this.totalMinutes <= 0) {\n this.sendOpenEvent.emit(\"open\")\n }\n\n this.changeTime(); \n this.startCountdown();\n \n }\n \n ngOnDestroy(): void {\n if (this.interval) {\n clearInterval(this.interval);\n }\n }\n\n startCountdown() {\n this.interval = setInterval(() => {\n if (this.totalMinutes > 0 && Number.isNaN(this.seconds) == false) {\n this.totalMinutes --;\n this.changeTime();\n } \n\n if (this.totalMinutes <= 0) {\n this.sendOpenEvent.emit(\"open\")\n clearInterval(this.interval);\n }\n }, 1000);\n }\n \n transformInDate(time: string, date: string){\n let now = new Date(date)\n let timeSplit = time.split(\":\"); \n now.setHours(Number(timeSplit[0]), Number( timeSplit[1]), 0, 0); \n now.setDate(date.split(\"-\")[2] as unknown as number)\n now.setMonth(date.split(\"-\")[1] as unknown as number - 1)\n now.setFullYear(date.split(\"-\")[0] as unknown as number) \n return now\n }\n \n add0(time) {\n if (time < 10) {\n return '0' + time\n }\n return time.toString();\n }\n \n changeTime() {\n let time = (this.transformInDate(this.eventTimeStartSell, this.eventDateStartSell).getTime() - new Date().getTime())\n this.totalMinutes = time / 1000 / 60;\n \n\n this.hours = this.add0(Math.floor(this.totalMinutes / 60)); \n this.minutes = this.add0(Math.floor(this.totalMinutes % 60));\n this.seconds = this.add0(Math.floor((this.totalMinutes * 60) % 60)); \n }\n}\n","
\n

Faltam

\n
\n

Horas: {{hours}}

\n
\n
\n

Minutos: {{minutes}}

\n
\n
\n

Segundos: {{seconds}}

\n
\n

Para abrir as vendas

\n
\n\n","
\n \n \n \n
\n ","import { Component, Input, OnChanges, OnDestroy } from '@angular/core';\nimport { MapPlace } from '../models/MapPlace';\nimport { MapV2Service } from '../mapv2.service';\nimport { Subject } from 'rxjs';\nimport { MapView } from '../models/Map';\nimport { PlaceTicket } from '../models/PlaceTicket';\n\n@Component({\n selector: 'mapv2-tickets',\n templateUrl: './mapv2-tickets.component.html',\n styleUrls: ['./mapv2-tickets.component.scss']\n})\nexport class MapV2TicketsComponent implements OnDestroy, OnChanges {\n public ticketId: string;\n private unsubscribe$: Subject;\n\n @Input()\n public place!: MapPlace;\n\n constructor(\n private service: MapV2Service\n ) {\n this.unsubscribe$ = new Subject();\n this.ticketId = '';\n }\n\n public ngOnDestroy(): void {\n this.unsubscribe$.next();\n this.unsubscribe$.complete();\n }\n\n public ngOnChanges(): void {\n if (this.place && this.place.selectedTicket) {\n this.ticketId = this.place.selectedTicket.id;\n }\n }\n\n public selectTicket(): void {\n const ticket = this.place.tickets.find(t => t.id === this.ticketId) as PlaceTicket;\n this.service.reserve(this.place, ticket)\n .then(() => {\n this.service.setView(MapView.PLACES);\n });\n }\n\n public unselectTicket(): void {\n this.service.cancelReserve(this.place)\n .then(() => {\n this.ticketId = '';\n this.service.setView(MapView.PLACES);\n });\n }\n\n public amount(value: number): number {\n return value * this.place.quantity;\n }\n}\n","
\n
\n
\n \n
\n
\n
{{ place.selectedTicket!.name }}
\n

{{ place.row }} {{ place.number }}

\n
\n
\n
R$ {{ (place.selectedTicket!.price * place.quantity) | number:'1.2-2' }}
\n

R$ {{ (place.selectedTicket!.fee * place.quantity) | number:'1.2-2' }} (Taxa)

\n
\n
\n
\n ","import { Component, OnInit, ViewEncapsulation, OnDestroy } from '@angular/core';\nimport { MapPlace } from '../models/MapPlace';\nimport { MapV2Service } from '../mapv2.service';\nimport { Subject } from 'rxjs';\nimport { MapView } from '../models/Map';\n\n@Component({\n selector: 'mapv2-cart',\n templateUrl: './mapv2-cart.component.html',\n styleUrls: ['./mapv2-cart.component.scss'],\n encapsulation: ViewEncapsulation.None,\n})\nexport class MapV2CartComponent implements OnInit, OnDestroy {\n public selectedPlaces!: MapPlace[];\n private unsubscribe$: Subject;\n\n constructor(\n private service: MapV2Service\n ) {\n this.unsubscribe$ = new Subject();\n }\n\n public ngOnInit(): void {\n const cart = this.service.getCart();\n this.selectedPlaces = cart.places;\n }\n\n public ngOnDestroy(): void {\n this.unsubscribe$.next();\n this.unsubscribe$.complete();\n }\n \n public deletePlace(place: MapPlace): void {\n this.service.cancelReserve(place)\n .then(() => {\n this.service.setView(MapView.PLACES);\n });\n }\n}\n","
\n
\n
","import { Component, Input } from '@angular/core';\n\n@Component({\n selector: 'mapv2-loader',\n templateUrl: './mapv2-loader.component.html',\n styleUrls: ['./mapv2-loader.component.scss']\n})\nexport class MapV2LoaderComponent {\n @Input()\n public show: boolean = true;\n \n @Input() \n public size: number = 32;\n\n @Input() \n public fill: string = '#FFFFFF';\n\n @Input() \n public weight: number = 3;\n\n constructor() { }\n}","import { Pipe, PipeTransform } from '@angular/core';\nimport { MapPlace } from '../models/MapPlace';\n\n@Pipe({\n name: 'placesBySector'\n})\nexport class PlacesBySectorPipe implements PipeTransform {\n transform(places: MapPlace[] = [], sectorId: string): MapPlace[] {\n if (!sectorId) return places;\n return places.filter(p => {\n return !!p.tickets.find(t => t.sectorId == sectorId);\n });\n }\n}\n","\n \n\n
{{ sector.name }}
\n\n \n\n \n
\n\n \n \n
\n
\n \n
\n
\n
\n
\n
\n \n \n
\n
\n
\n \n Disponível\n
\n
\n \n Indisponível\n
\n
\n \n Selecionado\n
\n
\n
\n \n
\n \n
\n\n \n \n \n \n
\n\n","import { Component, OnInit } from '@angular/core';\nimport { MapPlace } from '../models/MapPlace';\nimport { Subject } from 'rxjs';\nimport { takeUntil } from 'rxjs/operators';\nimport { MapV2Service } from '../mapv2.service';\nimport { Map, MapView } from '../models/Map';\nimport { Sector } from '../models/Sector';\n\n@Component({\n selector: 'mapv2-places',\n templateUrl: './mapv2-places.component.html',\n styleUrls: ['./mapv2-places.component.scss']\n})\nexport class MapV2PlacesComponent implements OnInit {\n public loading!: boolean;\n public sector!: Sector;\n public view!: MapView;\n public map!: Map;\n public selectedPlace?: MapPlace;\n public selectedPlaces!: MapPlace[];\n public amount: number;\n private zoom: number;\n private startX!: number;\n private startY!: number;\n private scrollStartX!: number;\n private scrollStartY!: number;\n private unsubscribe$: Subject;\n\n constructor(\n private service: MapV2Service\n ) {\n this.unsubscribe$ = new Subject();\n this.zoom = 1;\n this.amount = 0;\n }\n\n public ngOnInit(): void {\n this.initializeLoading();\n this.initializeView();\n this.initializeMap();\n this.initializeSector();\n }\n\n public ngOnDestroy(): void {\n this.unsubscribe$.complete();\n this.unsubscribe$.next();\n }\n\n public get isTicketsShowing(): boolean {\n return this.view === MapView.TICKETS;\n }\n\n public get isCartShowing(): boolean {\n return this.view === MapView.CART;\n }\n\n public closePlaces(): void {\n this.service.hide();\n }\n\n public closeDrawer(): void {\n this.service.setView(MapView.PLACES);\n }\n\n public openTickets(place: MapPlace): void {\n if (!this.isDisabledPlace(place)) {\n this.selectedPlace = place;\n this.service.setView(MapView.TICKETS);\n }\n }\n\n public openCart(): void {\n this.service.setView(MapView.CART);\n }\n\n public getPlaceStyle(place: MapPlace): object {\n const [left, top] = place.coords.split(',');\n const borderRadius = place.shape == 'circle' ? '100%' : '1px';\n let backgroundColor: string;\n const isSelected = this.selectedPlaces.find((p) => (\n p.row == place.row && p.number == place.number\n ));\n if (isSelected) {\n backgroundColor = 'rgba(0, 0, 255, .8)';\n }\n else if (place.available) {\n backgroundColor = 'rgba(0, 255, 0, .8)';\n }\n else {\n backgroundColor = 'rgba(160, 160, 160, .8)';\n }\n return {\n top: `${top}px`,\n left: `${left}px`,\n height: `${place.height}px`,\n width: `${place.width}px`,\n borderRadius,\n backgroundColor\n }\n }\n\n public isDisabledPlace(place: MapPlace) {\n const isSelected = this.selectedPlaces.find((p) => (\n p.row == place.row && p.number == place.number\n ));\n return !place.available && !isSelected;\n }\n\n public zoomIn(): void {\n const zoomElement = document.querySelector('#image-zoom') as HTMLElement;\n this.zoom += 0.1;\n zoomElement.style['zoom'] = this.zoom.toString();\n }\n\n public zoomOut(): void {\n const zoomElement = document.querySelector('#image-zoom') as HTMLElement;\n if (this.zoom - 0.1 >= 1) {\n this.zoom -= 0.1;\n }\n zoomElement.style['zoom'] = this.zoom.toString();\n }\n\n public loadImageEvents() {\n const element = document.getElementById('image-zoom') as HTMLElement;\n\n element.addEventListener('mousedown', (e) => {\n this.startX = e.clientX;\n this.startY = e.clientY;\n this.scrollStartX = element.scrollLeft;\n this.scrollStartY = element.scrollTop;\n\n const drag = (event: MouseEvent) => {\n const currentX = event.clientX;\n const currentY = event.clientY;\n const diffX = currentX - this.startX;\n const diffY = currentY - this.startY;\n \n element.scrollLeft = this.scrollStartX - diffX;\n element.scrollTop = this.scrollStartY - diffY;\n\n element.style.pointerEvents = 'none';\n }\n \n const stopDrag = () => {\n document.removeEventListener('mousemove', drag);\n document.removeEventListener('mouseup', stopDrag);\n\n element.style.pointerEvents = 'auto';\n }\n \n document.addEventListener('mousemove', drag);\n document.addEventListener('mouseup', stopDrag);\n });\n\n element.addEventListener('wheel', (event) => {\n event.preventDefault();\n const speed = 0.05;\n if (event.deltaY < 0) {\n this.zoom += speed;\n }\n else if (this.zoom - speed >= 1) {\n this.zoom -= speed;\n }\n element.style['zoom'] = this.zoom.toString();\n });\n }\n\n private initializeMap(): void {\n this.service.getMap()\n .pipe(takeUntil(this.unsubscribe$))\n .subscribe({\n next: (map) => {\n if (map) {\n this.map = map;\n this.selectedPlaces = map.places.filter(p => p.isReserved);\n this.amount = this.selectedPlaces.reduce((sum, place) => (\n sum + ((place.selectedTicket!.price + place.selectedTicket!.fee) * place.quantity)\n ), 0);\n }\n }\n });\n }\n\n private initializeSector(): void {\n this.service.getSelectedSector()\n .pipe(takeUntil(this.unsubscribe$))\n .subscribe({\n next: (sector) => {\n if (sector) {\n this.sector = sector;\n }\n }\n });\n }\n\n private initializeLoading(): void {\n this.service.isLoading()\n .pipe(takeUntil(this.unsubscribe$))\n .subscribe({\n next: (isLoading) => {\n this.loading = isLoading;\n }\n });\n }\n\n private initializeView(): void {\n this.service.getView()\n .pipe(takeUntil(this.unsubscribe$))\n .subscribe({\n next: (view) => {\n this.view = view;\n }\n });\n }\n}\n","import {\n\tComponent,\n\tElementRef,\n\tHostListener,\n\tOnDestroy,\n\tOnInit,\n} from \"@angular/core\";\nimport { Sector } from \"../models/Sector\";\nimport { takeUntil } from \"rxjs/operators\";\nimport { Subject } from \"rxjs\";\nimport { Map } from \"../models/Map\";\nimport { MapV2Service } from \"../mapv2.service\";\n\n@Component({\n\tselector: \"mapv2-sectors\",\n\ttemplateUrl: \"./mapv2-sectors.component.html\",\n\tstyleUrls: [\"./mapv2-sectors.component.scss\"],\n})\nexport class MapV2SectorsComponent implements OnInit, OnDestroy {\n\tpublic map: Map | null;\n\tpublic sectors: Sector[];\n\tpublic zoom: number;\n\tprivate canvas!: HTMLCanvasElement;\n\tprivate context!: CanvasRenderingContext2D;\n\tprivate imgElement!: HTMLImageElement;\n\tprivate unsubscribe$: Subject;\n\n\tconstructor(\n\t\tprivate elementRef: ElementRef,\n\t\tprivate service: MapV2Service\n\t) {\n\t\tthis.unsubscribe$ = new Subject();\n\t\tthis.zoom = 1.5;\n\t\tthis.sectors = [];\n\t\tthis.map = null;\n\t}\n\n\tpublic ngOnInit(): void {\n\t\tthis.initializeCanvas();\n\t\tthis.initializeMap();\n\t\tthis.initializeSectors();\n\t}\n\n\tpublic ngOnDestroy(): void {\n\t\tthis.unsubscribe$.next(null);\n\t\tthis.unsubscribe$.complete();\n\t}\n\n\t@HostListener(\"window:resize\")\n\tpublic onResize() {\n\t\tconst parentElement = this.elementRef.nativeElement.parentElement;\n\t\tif (parentElement) {\n\t\t\tconst parentWidth = parentElement.offsetWidth;\n\t\t\tif (parentWidth > 0) {\n\t\t\t\tthis.zoom = parentWidth / (this.imgElement.width - 150);\n\t\t\t}\n\t\t}\n\t}\n\n\tprivate openPlaces(sector: Sector) {\n\t\tthis.service.setSelectedSector(sector);\n\t\tif (this.service.hasPlaces(sector.id)) {\n\t\t\tthis.service.show();\n\t\t}\n\t}\n\n\tprivate fillPolygon(element: HTMLAreaElement) {\n\t\tconst coords = String(element.getAttribute(\"coords\"))\n\t\t\t.split(\",\")\n\t\t\t.map((c) => Number(c));\n\n\t\tthis.context.beginPath();\n\t\tthis.context.moveTo(coords[0], coords[1]);\n\t\tfor (let i = 2; i < coords.length; i += 2) {\n\t\t\tthis.context.lineTo(coords[i], coords[i + 1]);\n\t\t}\n\t\tthis.context.lineTo(coords[0], coords[1]);\n\t\tthis.context.fillStyle = this.map!.color;\n\t\tthis.context.globalAlpha = 0.5;\n\t\t//this.context.fill();\n\t}\n\n\tprivate drawOn() {\n\t\tconst mapElement = document.querySelector(\"#mapv2__map\") as HTMLAreaElement;\n\t\tmapElement.innerHTML = \"\";\n\t\tif (this.sectors != null) {\n\t\t\tthis.sectors\n\t\t\t\t.filter((sector) => sector.mapSectors.length > 0)\n\t\t\t\t.forEach((sector) => {\n\t\t\t\t\tsector.mapSectors.forEach((mapSector) => {\n\t\t\t\t\t\tconst area = document.createElement(\"area\");\n\t\t\t\t\t\tarea.shape = \"poly\";\n\t\t\t\t\t\tarea.style.cursor = \"pointer\";\n\t\t\t\t\t\tarea.coords = mapSector.coords\n\t\t\t\t\t\t\t.map(({ x, y }) => (x) + \",\" + (y))\n\t\t\t\t\t\t\t.join(\",\");\n\t\t\t\t\t\tarea.onmouseover = () => {\n\t\t\t\t\t\t\tthis.fillPolygon(area);\n\t\t\t\t\t\t};\n\t\t\t\t\t\tarea.onmouseout = () => {\n\t\t\t\t\t\t\tthis.context.clearRect(\n\t\t\t\t\t\t\t\t0,\n\t\t\t\t\t\t\t\t0,\n\t\t\t\t\t\t\t\tthis.canvas.width,\n\t\t\t\t\t\t\t\tthis.canvas.height\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t};\n\t\t\t\t\t\tarea.onclick = () => {\n\t\t\t\t\t\t\tthis.openPlaces(sector);\n\t\t\t\t\t\t};\n\t\t\t\t\t\tmapElement.appendChild(area);\n\t\t\t\t\t});\n\t\t\t\t});\n\t\t}\n\t}\n\n\tprivate initializeCanvas(): void {\n\t\tthis.canvas = document.querySelector(\n\t\t\t\"#mapv2__sectors__canvas\"\n\t\t) as HTMLCanvasElement;\n\t\tthis.imgElement = document.querySelector(\n\t\t\t\"#mapv2__sectors__img\"\n\t\t) as HTMLImageElement;\n\t\tthis.context = this.canvas.getContext(\"2d\") as CanvasRenderingContext2D;\n\t}\n\n\tprivate initializeMap(): void {\n\t\tthis.service\n\t\t\t.getMap()\n\t\t\t.pipe(takeUntil(this.unsubscribe$))\n\t\t\t.subscribe({\n\t\t\t\tnext: (map) => {\n\t\t\t\t\tif (map) {\n\t\t\t\t\t\tthis.map = map;\n\t\t\t\t\t\tthis.imgElement.src = this.map.imageSectors;\n\t\t\t\t\t\tthis.imgElement.onload = () => {\n\t\t\t\t\t\t\tthis.onResize();\n\t\t\t\t\t\t\tthis.canvas.width = this.imgElement.width;\n\t\t\t\t\t\t\tthis.canvas.height = this.imgElement.height;\n\t\t\t\t\t\t\tthis.drawOn();\n\t\t\t\t\t\t};\n\t\t\t\t\t}\n\t\t\t\t},\n\t\t\t});\n\t}\n\n\tprivate initializeSectors(): void {\n\t\tthis.service\n\t\t\t.getMapWithSectors()\n\t\t\t.pipe(takeUntil(this.unsubscribe$))\n\t\t\t.subscribe({\n\t\t\t\tnext: (map) => { \n this.sectors = map!.sectors \n this.drawOn(); \n\t\t\t\t},\n\t\t\t});\n\t}\n}\n","
\n \n \n \n
\n","","import { Component, OnInit, Input, ViewEncapsulation, OnDestroy, Output, EventEmitter, OnChanges } from '@angular/core';\nimport { MatDialog } from '@angular/material/dialog';\nimport { Subject } from 'rxjs';\nimport { takeUntil } from 'rxjs/operators';\nimport { MapV2Service } from './mapv2.service';\nimport { Map } from './models/Map';\nimport { MapV2PlacesComponent } from './mapv2-places/mapv2-places.component';\nimport { MapV2Change } from './models/MapV2Change';\n\n@Component({\n selector: 'mapv2',\n templateUrl: './mapv2.component.html',\n styleUrls: ['./mapv2.component.scss'],\n encapsulation: ViewEncapsulation.None,\n})\nexport class MapV2Component implements OnInit, OnDestroy, OnChanges {\n public map: Map | null;\n private unsubscribe$: Subject;\n\n @Input()\n public eventId!: string;\n\n @Input()\n public sectorId?: string;\n\n @Output()\n public change: EventEmitter;\n\n constructor(\n private service: MapV2Service,\n private dialog: MatDialog,\n ) {\n this.unsubscribe$ = new Subject();\n this.change = new EventEmitter();\n this.map = null;\n }\n\n public ngOnInit(): void {\n this.service.loadSectors(this.eventId);\n this.service.loadMap(this.eventId)\n .then(map => {\n this.map = map;\n\n this.service.isShowing()\n .pipe(takeUntil(this.unsubscribe$))\n .subscribe({\n next: (show) => {\n if (show) {\n this.dialog.open(MapV2PlacesComponent, {\n disableClose: true,\n autoFocus: false,\n panelClass: 'mapv2-dialog',\n maxWidth: '100vw',\n });\n } else {\n this.dialog.closeAll();\n }\n }\n });\n\n this.service.listenReserves()\n .pipe(takeUntil(this.unsubscribe$))\n .subscribe({\n next: (event) => {\n if (event) {\n this.change.emit(event);\n }\n }\n });\n });\n }\n\n public ngOnDestroy(): void {\n this.unsubscribe$.complete();\n this.unsubscribe$.next();\n }\n\n public ngOnChanges(): void {\n if (this.sectorId) {\n this.service.setSelectedSectorById(this.sectorId);\n }\n }\n}\n","import {\n Component,\n OnInit,\n Input,\n Output,\n ViewChild,\n EventEmitter,\n} from '@angular/core';\nimport { EventModel } from '../../../models/event.model';\nimport { environment } from '../../../../environments/environment';\nimport { AlertService } from 'src/app/services/alert.service';\ndeclare let seatsio: any;\n\n@Component({\n selector: 'app-seatsio',\n templateUrl: './seatsio.component.html',\n styleUrls: ['./seatsio.component.scss'],\n})\nexport class SeatsioComponent implements OnInit {\n @Input() event!: EventModel | undefined;\n\n @Output() selectedSeats: EventEmitter = new EventEmitter();\n\n @Output() deselectedSeats: EventEmitter = new EventEmitter();\n\n @Output() sendLoadingSeatsIo: EventEmitter = new EventEmitter();\n\n public config!: any;\n\n public blockFullTickets = [\"10fab674-9b56-4fec-9c5f-cbd48067e05d\", \"f170acf1-57c9-4ecb-8f64-91d4ec669272\", \"2c35cd19-7fe5-4444-a1ab-9f34a2730a6e\", \"ad900232-9f77-4805-90ef-6e1275009213\", \"8632884b-10f0-4530-962f-7f4f1210bbab\", \"c0c1e338-161e-49b0-8437-c1f1544cfbcd\"]\n\n private prices: Array = [];\n\n @ViewChild('chart', { static: true }) chart!: any;\n\n constructor(private alertService: AlertService) {}\n\n ngOnInit(): void {\n this.loadScript()\n .then(() => {\n this.renderChart();\n })\n .catch((error) => {\n this.alertService.toast({\n icon: 'error',\n title: 'Erro',\n text: error.message,\n });\n });\n }\n\n loadScript(): Promise {\n return new Promise((resolve, reject) => {\n const script = document.createElement('script');\n script.src = 'https://cdn-sa.seatsio.net/chart.js';\n script.async = true;\n script.onload = () => resolve();\n script.onerror = () =>\n reject(new Error('Erro ao carregar o script do Seats.io'));\n document.body.appendChild(script);\n });\n }\n\n /*\n inicia seatsio com os valores e tipos dos ingressos\n */\n async renderChart() {\n if (this.event !== undefined) {\n // faz loop nos setores\n this.event!.sectors!.forEach((sector: any) => {\n // verifica quais setores tem assento\n if (sector.useSeats == true) {\n // variável para salvar a categoria (id do setor) e o tipo de ticket (id, preço e nome)\n let category: any = { category: sector.id, ticketTypes: [] };\n // faz loop nos tickets\n this.event!.tickets!.sort((a: any, b: any) => a.position - b.position)!.forEach((ticket: any) => {\n // verifica se o ingresso pertence ao setor que tem assento, caso tenha irá salvar na variável category\n if (sector.id == ticket.sectorId) {\n category.ticketTypes[category.ticketTypes.length] = {\n ticketType: ticket.id,\n price: ticket.price,\n label: ticket.name,\n };\n }\n });\n // salva categoria na variável prices que será usada no setasio\n this.prices[this.prices.length] = category;\n }\n });\n\n this.chart = await new seatsio.SeatingChart({\n divId: 'chart',\n region: 'sa',\n workspaceKey: environment.seatsioWorkspaceKey,\n event: this.event!.seatsioEventKey,\n language: 'pt',\n height: '300px',\n width: '100%',\n session: 'continue',\n showSeatLabels: true,\n pricing: this.prices,\n priceFormatter: (price: any) => {\n return (\n 'R$ ' + price.toLocaleString('pt-br', { minimumFractionDigits: 2 })\n );\n },\n onHoldSucceeded: (object) => { \n let ticketName = \"\"\n this.prices.forEach(function(price) {\n price.ticketTypes.filter(function(ticket) { \n if (ticket.ticketType == object[0].selectedTicketType) {\n ticketName = ticket.label\n } \n })\n })\n \n if (this.blockFullTickets.indexOf(object[0].selectedTicketType) > -1) {\n this.alertService.toast({\n icon: 'error',\n title: 'Erro',\n text: 'Ingresso ' + ticketName + ' não está disponível',\n });\n object[0].deselect(); \n } \n },\n onReleaseHoldFailed: function(object) {\n object[0].deselect();\n },\n onChartRenderingFailed: (chart: any) => {\n chart.destroy();\n this.sendLoading(false);\n this.alertService.toast({\n icon: 'error',\n title: 'Erro',\n text: 'Erro ao criar mapa de assentos. Para tentar novamente recarregue a página.',\n });\n },\n onRenderStarted: () => {\n // this.orderService.removeSeatsIoTickets();\n this.sendLoading(true);\n },\n onHoldTokenExpired: () => {\n // this.orderService.removeSeatsIoTickets();\n },\n onChartRendered: (chart: any) => {\n this.sendLoading(false);\n // this.chart.chart.clearSelection();\n // this.orderService.removeSeatsIoTickets();\n },\n // ao selecionar um assento, irá chamar uma função que irá guardar o assento selecionado e o preço\n onObjectSelected: (re: any) => {\n if (this.chart.selectedSeats.length > this.event!.limitCPF!) {\n this.alertService.toast({\n icon: 'error',\n title: 'Erro',\n text: 'Você já atingiu o limite de ingressos para este evento.',\n });\n re.deselect();\n\n return;\n }\n\n re.pricing.ticketTypes.forEach((element: any) => {\n if (element.ticketType == re.selectedTicketType) {\n this.getSelectedObjects(re);\n }\n });\n },\n\n // ao deselecionar um assento, irá chamar uma funcção que irá remover o assento selecionado pelo id do assento\n onObjectDeselected: (re: any) => {\n // this.chart.chart.listSelectedObjects().then((re: any) => {\n // if (re.length == 0) {\n // this.orderService.removeSeatsIoTickets();\n // }\n // });\n this.getDeselectedObjects(re);\n },\n }).render();\n }\n }\n\n /*\n pega os objetos selecionados e os manda para o componente pai\n */\n getSelectedObjects(selectedSeat: any) {\n this.event!.tickets!.forEach((ticket: any) => {\n // verifica se o ticket bate com o ticket selecionado e manda as informações do assento e do ticket para componete pai\n if (ticket.id == selectedSeat.selectedTicketType) {\n let emit: any = { ticket, selectedSeat };\n this.selectedSeats.emit(emit);\n }\n });\n }\n\n sendLoading(loading: boolean) {\n this.sendLoadingSeatsIo.emit(loading);\n }\n\n /*\n pega o id do assento deselecionado e o manda para o componente pai para ser removido\n */\n getDeselectedObjects(deselectedSeat: string) {\n this.deselectedSeats.emit(deselectedSeat);\n }\n}\n","\n\n
\n\n\n","\n\n
\n \n \n
\n
\n
\n
\n
\n
\n
\n\n
\n \n
\n
\n\n\n\n\n\n\n\n
\n
\n

{{selectedTicketName}} - {{selectedPlace.attrs.name}}

\n \n
\n
\n
\n \n

Total: R$ {{priceTotalPlace() | number:'1.2-2'}}

\n

{{selectedTicketName}}

\n
\n
\n
\n

Mesa com 4 cadeiras (Podendo adicionar até 2 cadeiras extras)

\n

Disponível: {{selectedPlace.attrs.configs.qtdDisponible}}

\n

Total: R$ {{priceTotalPlace() | number:'1.2-2'}}

\n
\n
\n \n

Disponível: {{selectedPlace.attrs.configs.qtdDisponible}}

\n

Total: R$ {{priceTotalPlace() | number:'1.2-2'}}

\n
\n
\n \n
\n
\n
\n
\n
\n \n\n \n \n

Esgotado {{item.ticketName}}
{{item.lotName}} - R$ {{item.unitPrice | number:'1.2-2'}}

\n

{{item.ticketName}}
{{item.lotName}} - R$ {{item.unitPrice | number:'1.2-2'}}

\n
\n
\n\n \n\n Selecione o ingresso\n
\n
\n
\n
\n x\n
\n
\n
\n\n
\n
\n \n
\n
\n\n
\n

\n
\n
\n
\n \n \n
\n\n\n
\n
\n","import { Component, OnInit, Input, ɵConsole, ViewChild, OnChanges, TemplateRef, ChangeDetectorRef, Output, EventEmitter } from '@angular/core';\nimport { FormArray, FormBuilder, Validators, FormGroup } from '@angular/forms';\nimport * as Konva from '../../../../assets/konva.js';\nimport * as Hammer from '../../../../assets/hammer.konva.js';\n//import * as TouchEmulator from '../../../assets/touch-emulator.js';\nimport { EventService } from 'src/app/services/event.service'\nimport CanvasStage from 'src/app/models/native-map/canvas-stage.model';\nimport CanvasLayerImage from 'src/app/models/native-map/canvas-layer-image.model';\nimport CanvasLayerPlace from 'src/app/models/native-map/canvas-layer-place.model';\nimport { AlertService } from '../../../services/alert.service';\nimport CanvasPlace from 'src/app/models/native-map/canvas-place.model';\nimport { FORMERR } from 'dns';\nimport { NumberSymbol } from '@angular/common';\nimport { Platform } from '@angular/cdk/platform';\nimport { GeneralHelper } from 'src/app/helpers/general.helper';\nimport { BsModalService, BsModalRef } from 'ngx-bootstrap/modal';\nimport { OrderService } from 'src/app/services/order.service';\n\n@Component({\n selector: 'app-map-place',\n templateUrl: './map-place.component.html',\n styleUrls: ['./map-place.component.css']\n})\n\nexport class MapPlaceComponent implements OnInit {\n\n //@Input() baseClass: TicketBySectorComponent;\n\n @ViewChild('selectTicketPlace') selectTicketModal!: TemplateRef;\n\n\n public blockedEvents = ['0b1f8c9a-f63d-4e33-a7ea-f9cd627de224', 'b20e3f73-8dc5-45e8-8a15-e66b0ba33c33', 'ea264f86-4a1e-4b35-98b4-1206c159a555', '05079705-0733-4b09-b51a-b40e2ca646db']\n public blockedTickets = ['b8564e3d-6de4-4094-a623-fb7ede754f4b', 'e58e2750-ffd5-40c1-a447-d553236ea728', '7164ca14-b156-437a-a671-289c5d300672', '0d9fa757-d621-4aa4-bf33-d4efbff6e02d',\n 'a892d2c5-aa0b-43c2-85a7-b449e68aabe7', '560972da-0726-4aed-8f3e-93270c7c8ef3', 'c8e204f0-fb19-4d63-8c8a-7b7331df14bd', '7d8652a4-535d-4371-a3e8-7d993e76a35e']\n\n public selectedTicketName: string = \"\"\n\n // evento contendo o setor e ingressos\n @Input() event?: any;\n\n @Input() ticketCupom: string = '';\n\n @Input() ticketDescription: string | undefined = '';\n\n // id do setor selecionado\n @Input() sectorId?: string;\n\n // envia o assento, tickets selecionados ao componente pai\n @Output() sendSelectedSeat: EventEmitter = new EventEmitter();\n\n /**\n * Aqui vai comportar o formulario do modal\n */\n public ticketSelectForm: FormArray = this.fb.array([]);\n\n public loadingModal: boolean = false\n\n /**\n * Lista de tickets permitidos para seleção do lugar selecionado\n */\n public permittedTicketsFromPlace: Array<{\n ticketId: string,\n ticketName: string,\n ticketDateId: string,\n lotId: string,\n fees: [],\n disabled?: boolean,\n finished?: string,\n type: string,\n position: number,\n ticketTags: string,\n sectorId: string,\n isMapPlace: boolean,\n placeId: string,\n placeName: string,\n orderMapReserveCode: string,\n unitPriceWithFee: number,\n unitPrice: number,\n fee: any\n }> = [];\n\n /**\n * Configurações do lugar selecionado\n */\n public selectedPlace;\n\n\n public stage: any;\n\n public scale: number = 1;\n\n public zIndexLayerCount: number = 0;\n\n public ticketSelectFormShowError: boolean = false;\n\n public modalRef?: BsModalRef;\n\n /**\n * Se estiver true, está editando os ingressos do lugar\n */\n public onEditPlace: boolean = false;\n\n public loadingMap: boolean = false;\n\n /**\n * Esta movendo o mouse ou o dedo na tela\n */\n public blockClickPlace: boolean = false;\n\n public loadingConfirmPlace: boolean = false;\n\n public margin: number = 30;\n public marginW: number = 0;\n public marginH: number = 0;\n\n public iniX: number = 0;\n public iniY: number = 0;\n\n public amountSelectedTickets: number = 0\n\n /**\n * Mostra / oculta a seleção de tickets no modal de lugares\n */\n public modalShowSelectTickets: boolean = false;\n\n public isEspecialEvent: boolean = false;\n\n // Add a flag to track initial load\n private initialLoadComplete = false;\n\n constructor(\n private cdr: ChangeDetectorRef,\n public platform: Platform,\n private fb: FormBuilder,\n private alertService: AlertService,\n private eventService: EventService,\n private generalHelper: GeneralHelper,\n private modalService: BsModalService,\n private orderService: OrderService) { }\n\n ngOnInit() {\n if (this.sectorId && !this.initialLoadComplete) {\n this.loadMapPlace();\n this.initialLoadComplete = true;\n }\n\n var canvas_dom = (document.getElementById('canvas') as any);\n canvas_dom.addEventListener(\"touchmove\", function (event) {\n event.preventDefault();\n });\n\n canvas_dom.addEventListener(\"touchstart\", function (event) {\n event.preventDefault();\n });\n\n canvas_dom.addEventListener(\"touchend\", function (event) {\n event.preventDefault();\n });\n\n canvas_dom.addEventListener(\"touchcancel\", function (event) {\n event.preventDefault();\n });\n\n window.addEventListener(\"resize\", () => {\n let width = this.getWidthMap();\n if (this.stage && width) {\n this.stage.setWidth(width);\n this.stage.batchDraw();\n }\n });\n }\n\n ngOnChanges(changes: any) {\n // Only reload if:\n // 1. Initial load hasn't happened and we have sectorId, or\n // 2. sectorId has changed after initial load\n if (changes.sectorId && changes.sectorId.currentValue) {\n if (!this.initialLoadComplete || !changes.sectorId.firstChange) {\n this.sectorId = changes.sectorId.currentValue;\n this.loadMapPlace();\n this.initialLoadComplete = true;\n }\n }\n }\n\n getWidthMap() {\n let div = document.getElementById('box-map-place');\n return (div && div.clientWidth) ? div.clientWidth : null\n }\n\n getHeightMap() {\n let div = document.getElementById('box-map-place');\n return (div && div.clientHeight) ? div.clientHeight : 0\n }\n\n getHeightZoomBar() {\n return this.getHeightMap() - 80;\n }\n\n\n\n /**\n * Aqui vamos carregar o mapa na tela\n */\n\n loadMapPlace() {\n\n Konva.pixelRatio = 1;\n Konva.hitOnDragEnabled = true;\n Konva.captureTouchEventsEnabled = true;\n this.loadingMap = true;\n\n if (this.stage) {\n this.stage.destroy();\n }\n\n this.eventService.getMap({ sectorId: this.sectorId, orderMapReserveCode: this.uniqueIdGenerate() })\n .subscribe((res: any) => {\n\n let getNumber = (number: number | undefined) => {\n return (number) ? number : 0\n }\n\n //Se já tem um mapa cadastrado para o setor, vamos carregá-lo na tela.\n let data = res[0];\n let iniX: number, endX: number, iniY: number, endY: number, defineScale: number = 1;\n let isMobile = false;\n\n if (window.screen.width <= 1000) {\n isMobile = true;\n }\n\n\n //Palco\n let stageRegistered: CanvasStage = JSON.parse(data.canvas);\n\n let attrs = stageRegistered.attrs;\n attrs.container = 'canvas';\n attrs.idDB = data.id;\n attrs.width = 100;\n attrs.height = !isMobile ? 500 : 350;\n this.stage = new Konva.Stage(attrs);\n this.scale = this.stage.scaleX();\n\n // attach modified version of Hammer.js\n // \"domEvents\" property will allow triggering events on group\n // instead of \"hammertime\" instance\n var hammertime = new Hammer(this.stage, { domEvents: true });\n\n // add rotate gesture\n hammertime.get('rotate').set({ enable: true });\n\n let text, cloneCircle, cloneRect;\n //Layers\n for (let l = 0; l < data.layers.length; l++) {\n let layerRegistered = data.layers[l];\n let layerRegisteredCanvas: CanvasLayerImage | CanvasLayerPlace = JSON.parse(layerRegistered.canvas);\n layerRegisteredCanvas.attrs.draggable = false;\n layerRegisteredCanvas.attrs.idDB = layerRegistered.id;\n\n let attrs = layerRegisteredCanvas.attrs;\n delete attrs.configs;\n\n let layer;\n //A layer é do tipo background, então faremos as tratativas para carregar uma layer desse tipo\n if (attrs.type == 'background') {\n layer = new Konva.FastLayer(attrs);\n layer.transformsEnabled('position');\n for (let bi = 0; bi < layerRegisteredCanvas.children.length; bi++) {\n\n if (layerRegisteredCanvas.children[bi].attrs.type == 'background-image') {\n\n let attrs: any = layerRegisteredCanvas.children[bi].attrs;\n\n let image = new Image();\n let imageType = this.generalHelper.getFileTypeFromBase64(attrs.imageBase64);\n image.src = \"data:\" + imageType + \";base64,\" + attrs.imageBase64;\n\n\n //\n delete attrs.imageBase64;\n //\n image.onload = () => {\n attrs.image = image;\n attrs.width = image.width;\n attrs.height = image.height;\n var bg = new Konva.Image(attrs);\n\n bg.transformsEnabled('position');\n layer.add(bg);\n layer.draw();\n\n let posItemXIni = getNumber(layer.attrs.x);\n let posItemXEnd = getNumber(layer.attrs.x) + getNumber(image.width);\n\n let posItemYIni = getNumber(layer.attrs.y);\n let posItemYEnd = getNumber(layer.attrs.y) + getNumber(image.height);\n\n //Vamos pegar o menor número de x existente e o maior numero de x existente\n iniX = (!iniX || iniX > posItemXIni) ? posItemXIni : iniX;\n endX = (!endX || endX < posItemXEnd) ? posItemXEnd : endX;\n\n iniY = (!iniY || iniY > posItemYIni) ? posItemYIni : iniY;\n endY = (!endY || endY < posItemYEnd) ? posItemYEnd : endY;\n\n }\n }\n }\n } else { //Se a layer nao é do tipo background, é do tipo que comporta lugares.\n // Só existe esses 2 tipos hoje.\n layer = new Konva.Layer(attrs);\n layer.transformsEnabled('position');\n var attrsLayer = attrs;\n\n //Grupo\n for (let p = 0; p < layerRegistered.places.length; p++) {\n let placeRegistered = layerRegistered.places[p];\n let placeRegisteredCanvas: CanvasPlace = JSON.parse(layerRegistered.places[p].canvas);\n let attrs = placeRegisteredCanvas.attrs;\n attrs.idDB = placeRegistered.id;\n //delete attrs.configs;\n attrs.configs.qtdPerson = placeRegistered.qtdPerson;\n attrs.configs.qtdDisponible = placeRegistered.qtdDisponible;\n //Grupo que vai encapsular o quadrado ou circulo do lugar + texto com nome do lugar\n let group = new Konva.Group(attrs);\n //Indica que o grupo não será redimensionado (melhoria desempenho)\n group.transformsEnabled('position');\n\n //Se tem lugar disponível, o grupo é clicavel, se não tem lugar disponível não é clicável e para de \"ouvir\" ações de clicks (melhoria desempenho)\n if (attrs.configs.qtdDisponible > 0) {\n this.onClickPlace(group, attrs.id);\n } else {\n group.listening(false);\n }\n\n //Itens do grupo\n for (let i = 0; i < placeRegisteredCanvas.children.length; i++) {\n let item = placeRegisteredCanvas.children[i];\n let posItemXIni, posItemXEnd, posItemYIni, posItemYEnd, width, height;\n\n\n //Agora vamos preparar o texto e o quadrado ou circulo\n\n\n if (item.className == 'Circle' || item.className == 'Rect') {\n let attrs = item.attrs;\n // delete attrs.stroke;\n //attrs.listening = false;\n\n //Se não está disponível, vamos acinzentá-lo\n if (group.attrs.configs.qtdDisponible == 0) {\n attrs.fill = 'rgba(204,204,204,1)';\n }\n\n // Se está no carrinho, marca com a cor de selecionado\n if (this.orderService.getAllTickets().filter(v => v.placeId == group.attrs.idDB).length > 0) {\n attrs.fill = 'rgba(247, 220, 43, 1)';\n }\n\n\n if (item.className == 'Circle') {\n\n //Posição absoluta do item\n posItemXIni = getNumber(layer.attrs.x) + getNumber(group.attrs.x) + getNumber(item.attrs.x) - (getNumber(item.attrs.radius));\n posItemXEnd = getNumber(layer.attrs.x) + getNumber(group.attrs.x) + getNumber(item.attrs.x) + (getNumber(item.attrs.radius));\n\n posItemYIni = getNumber(layer.attrs.y) + getNumber(group.attrs.y) + getNumber(item.attrs.y) - (getNumber(item.attrs.radius));\n posItemYEnd = getNumber(layer.attrs.y) + getNumber(group.attrs.y) + getNumber(item.attrs.y) + (getNumber(item.attrs.radius));\n\n if (cloneCircle && cloneCircle.attrs.fill == attrs.fill) {\n\n let clone = cloneCircle.clone({ x: attrs.x, y: attrs.y });\n clone.cache();\n group.add(clone);\n\n } else {\n let placebox = new Konva.Circle(attrs);\n placebox.transformsEnabled('position');\n placebox.hitStrokeWidth(0);\n placebox.perfectDrawEnabled(false);\n group.add(placebox);\n placebox.cache();\n\n cloneCircle = placebox.clone();\n\n }\n\n }\n\n if (item.className == 'Rect') {\n //Posição absoluta do item\n posItemXIni = getNumber(layer.attrs.x) + getNumber(group.attrs.x) + getNumber(item.attrs.x);\n posItemXEnd = getNumber(layer.attrs.x) + getNumber(group.attrs.x) + getNumber(item.attrs.x) + (getNumber(item.attrs.width));\n\n posItemYIni = getNumber(layer.attrs.y) + getNumber(group.attrs.y) + getNumber(item.attrs.y);\n posItemYEnd = getNumber(layer.attrs.y) + getNumber(group.attrs.y) + getNumber(item.attrs.y) + (getNumber(item.attrs.height));\n\n\n if (cloneRect && cloneRect.attrs.fill == attrs.fill) {\n let clone = cloneRect.clone(attrs);\n clone.cache();\n group.add(clone);\n } else {\n let placebox = new Konva.Rect(attrs);\n placebox.transformsEnabled('position');\n placebox.hitStrokeWidth(0);\n placebox.perfectDrawEnabled(false);\n group.add(placebox);\n placebox.cache();\n cloneRect = placebox.clone();\n }\n }\n\n let iniX: number = 0;\n let endX: number = 0;\n\n let iniY: number = 0;\n let endY: number = 0;\n //Vamos pegar o menor número de x existente e o maior numero de x existente\n iniX = (!iniX || iniX > posItemXIni) ? posItemXIni : iniX;\n endX = (!endX || endX < posItemXEnd) ? posItemXEnd : endX;\n\n iniY = (!iniY || iniY > posItemYIni) ? posItemYIni : iniY;\n endY = (!endY || endY < posItemYEnd) ? posItemYEnd : endY;\n\n }\n\n if (item.className == 'Text') {\n let attrs = item.attrs;\n\n // if(this.baseClass.selectedSectorId == 'b55ba11f-2d5a-4298-a878-ce5962ada11f'){\n // item.attrs.width = 20;\n // item.attrs.offsetX = 10;\n // item.attrs.offsetY = 5;\n // }\n\n //attrs.listening = false;\n text = new Konva.Text(attrs);\n text.transformsEnabled('position');\n text.hitStrokeWidth(0);\n text.perfectDrawEnabled(false);\n group.add(text);\n }\n //}\n\n }\n layer.add(group);\n }\n }\n\n this.stage.add(layer);\n this.stage.container().style.cursor = 'pointer';\n\n layer.zIndex(this.zIndexLayerCount);\n this.zIndexLayerCount += 1;\n\n }\n\n\n\n this.loadingMap = false;\n\n this.initZoom();\n this.initPosition();\n\n this.loadingMap = false;\n setTimeout(() => {\n let divWidth = this.getWidthMap();\n let divHeight = this.getHeightMap() - 149;\n this.stage.setWidth(divWidth);\n // this.stage.batchDraw();\n if (this.event.id == \"0b1f8c9a-f63d-4e33-a7ea-f9cd627de224\") {\n this.scale = 0.3\n this.stage.scale({ x: this.scale, y: this.scale });\n\n this.stage.position({ x: -250, y: - (this.iniY * this.scale) + (this.marginH / 2) });\n\n this.stage.batchDraw();\n\n } else if (this.event.id == \"0680522e-20a3-446f-827c-567d99552196\" || this.event.id == \"e6a8866d-d0d5-4a5a-b478-b537aeed3941\") {\n if (window.innerWidth > 800) {\n this.scale = 0.2\n this.stage.scale({ x: this.scale, y: this.scale });\n this.stage.position({ x: -(this.iniX * this.scale) + (divWidth! / 5), y: - (this.iniY * this.scale) + (divHeight! / 5), });\n // this.stage.position({x: -((this.iniX * this.scale) + (divWidth! ) )/2, y:- (this.iniY * this.scale) + (divHeight! / 5), });\n this.stage.batchDraw();\n } else {\n this.scale = 0.1\n this.stage.scale({ x: this.scale, y: this.scale });\n this.stage.position({ x: -(this.iniX * this.scale) + (divWidth! / 12), y: - (this.iniY * this.scale) + (divHeight! / 5), });\n // this.stage.position({x: -((this.iniX * this.scale) + (divWidth! ) )/2, y:- (this.iniY * this.scale) + (divHeight! / 5), });\n this.stage.batchDraw();\n }\n\n } else {\n this.scale = 0.7\n this.stage.scale({ x: this.scale, y: this.scale });\n this.stage.position({ x: divWidth! / 5, y: divHeight! / 5, });\n this.stage.batchDraw();\n }\n\n // let divWidth = this.getWidthMap();\n // let divHeight = this.getHeightMap();\n // this.stage.setWidth(divWidth);\n //\n // this.marginW = 30;\n // this.marginH = 30;\n //\n // this.iniX = iniX;\n // this.iniY = iniY;\n //\n // let widthMapInner = endX - iniX;\n // let heightMapInner = endY - iniY;\n //\n // if( (divWidth! * this.scale / widthMapInner) < (this.stage.height() * this.scale / heightMapInner)){\n // this.marginW = this.margin;\n // }else{\n // this.marginW = (divWidth! - widthMapInner) - this.margin;\n // }\n //\n //\n // //this.marginH = (divHeight - heightMapInner) / 2;\n // this.marginH = 30;\n //\n // let newScaleBasedWidth = (divWidth! - this.marginW) * this.scale / widthMapInner;\n // let newScaleBasedHeight = (this.stage.height() - this.marginH) * this.scale / heightMapInner;\n //\n // let newScale = (newScaleBasedWidth < newScaleBasedHeight) ? newScaleBasedWidth : newScaleBasedHeight;\n // //let newScale = newScaleBasedWidth;\n //\n // this.stage.scale({ x: newScale, y: newScale });\n // let newHeight = (heightMapInner * newScale) + this.marginH;\n // this.stage.height((newHeight < 300) ? 300 : newHeight);\n // this.scale = newScale;\n //\n // this.stage.position({x: -(iniX * newScale) + (this.marginW / 2), y:- (iniY * newScale) + (this.marginH / 2) });\n //\n //\n // this.stage.batchDraw();\n }, 100);\n\n\n });\n\n }\n\n getRelativePosition(x: number, y: number) {\n if (!this.stage) {\n return null;\n }\n return {\n x: x / this.scale - (this.stage.x() / this.scale),\n y: y / this.scale - (this.stage.y() / this.scale),\n };\n }\n\n /**\n * Ação para dar zoom rolando o scroll do mouse\n */\n initZoom() {\n var scaleBy = 1.21;\n\n let zoomMouseWheel = (eve) => {\n eve.evt.preventDefault();\n var oldScale = this.stage.scaleX();\n\n var mousePointTo = {\n x: this.getPointerPosition().x,\n y: this.getPointerPosition().y\n };\n\n var newScale = eve.evt.deltaY > 0 ? oldScale * scaleBy : oldScale / scaleBy;\n this.stage.scale({ x: newScale, y: newScale });\n this.scale = newScale;\n\n var newPos = {\n x:\n -(mousePointTo.x - this.stage.getPointerPosition().x / newScale) *\n newScale,\n y:\n -(mousePointTo.y - this.stage.getPointerPosition().y / newScale) *\n newScale\n };\n this.stage.position(newPos);\n this.stage.batchDraw();\n }\n\n let zoomPinchMobile = (eve) => {\n eve.evt.preventDefault();\n var oldScale = this.stage.scaleX();\n\n var mousePointTo = {\n x: this.getPointerPosition().x,\n y: this.getPointerPosition().y\n };\n\n var newScale = eve.evt.gesture.scale;\n this.stage.scale({ x: newScale, y: newScale });\n this.scale = newScale;\n\n var newPos = {\n x:\n -(mousePointTo.x - this.stage.getPointerPosition().x / newScale) *\n newScale,\n y:\n -(mousePointTo.y - this.stage.getPointerPosition().y / newScale) *\n newScale\n };\n this.stage.position(newPos);\n this.stage.batchDraw();\n }\n\n this.stage.on('wheel', eve => {\n zoomMouseWheel(eve);\n // eve.preventDefault();\n });\n\n this.stage.on('rotatestart', eve => {\n this.blockClickPlace = true;\n });\n\n this.stage.on('rotate', eve => {\n zoomPinchMobile(eve);\n eve.preventDefault();\n });\n\n this.stage.on('rotateend', eve => {\n this.blockClickPlace = false;\n });\n }\n\n /**\n * Para capturar a posição do mouse/toque na tela use essa função.\n */\n getPointerPosition() {\n return {\n x: this.stage.getPointerPosition().x / this.scale - (this.stage.x() / this.scale),\n y: this.stage.getPointerPosition().y / this.scale - (this.stage.y() / this.scale),\n };\n }\n\n /**\n * Ação para movimentar mapa na tela\n */\n initPosition() {\n\n let positionMoveStart = false;\n\n let startPosition: any = {};\n\n let initDrag = () => {\n positionMoveStart = true;\n\n startPosition = {\n x: this.getPointerPosition().x,\n y: this.getPointerPosition().y\n };\n }\n\n\n let endDrag = () => {\n positionMoveStart = false;\n };\n\n let move = () => {\n if (positionMoveStart) {\n let calc = {\n x:\n -(startPosition.x - this.stage.getPointerPosition().x / this.scale) *\n this.scale,\n y:\n -(startPosition.y - this.stage.getPointerPosition().y / this.scale) *\n this.scale\n };\n\n\n this.stage.position(calc);\n this.stage.batchDraw();\n }\n };\n\n\n this.stage.on('mousedown', eve => {\n this.blockClickPlace = false;\n initDrag();\n /*if(eve){\n eve.preventDefault();\n }*/\n });\n\n this.stage.on('touchstart', eve => {\n this.blockClickPlace = false;\n initDrag();\n eve.preventDefault();\n });\n\n this.stage.on('mouseup', eve => {\n endDrag();\n //e.preventDefault();\n });\n\n this.stage.on('touchend', eve => {\n endDrag();\n eve.preventDefault();\n });\n\n this.stage.on('mousemove', eve => {\n this.blockClickPlace = true;\n move();\n });\n\n this.stage.on('touchmove', eve => {\n this.blockClickPlace = false;\n move();\n eve.preventDefault();\n });\n\n this.stage.on('touchcancel', eve => {\n eve.preventDefault();\n });\n\n }\n\n onClickPlace(place, idPlace) {\n let actionPlace = () => {\n \n if (!this.blockClickPlace) {\n this.selectedPlace = place;\n this.loadModal();\n if (this.modalShowSelectTickets == false) {\n let ticket = this.event.tickets.filter((ticket) => {\n if (ticket.ticketDateId == this.selectedPlace.attrs.configs.tickets[0]) {\n return ticket\n }\n })\n\n this.selectedTicketName = ticket[0][\"name\"]\n }\n\n this.onEditPlace = (this.orderService.getAllTickets().filter(v => v.placeId == this.selectedPlace.attrs.idDB).length > 0);\n\n\n }\n }\n\n place.on('click', eve => {\n actionPlace();\n });\n\n place.on('touchend', eve => {\n actionPlace();\n });\n }\n\n loadModal() {\n this.loadingModal = true\n this.modalRef = this.modalService.show(this.selectTicketModal);\n this.ticketSelectFormShowError = false;\n this.modalShowSelectTickets = true;\n\n this.loadingModal = false\n // let event = this.baseClass.baseClass.event;\n this.ticketSelectForm = this.fb.array([]);\n /**\n * Com base no lugar selecionado, vamos captar somente os ingressos permitidos nesse lugar para exibir no selectbox\n */\n this.permittedTicketsFromPlace = [];\n this.event.tickets.forEach((ticket, iT) => {\n if (ticket.sectorId == this.sectorId) {\n if (this.selectedPlace.attrs.configs.tickets.indexOf(ticket.ticketDateId) != -1) {\n this.permittedTicketsFromPlace.push(\n {\n ticketId: ticket.id,\n ticketName: ticket.name,\n fees: ticket.fees,\n ticketDateId: ticket.ticketDateId,\n lotId: ticket.lotId,\n type: ticket.type,\n disabled: this.blockedTickets.indexOf(ticket.id) > -1 && this.blockedEvents.indexOf(this?.event.id) > -1 ? true : false,\n finished: this.blockedTickets.indexOf(ticket.id) > -1 && this.blockedEvents.indexOf(this?.event.id) > -1 ? 'Esgotado' : '',\n placeName: this.selectedPlace.attrs.name,\n ticketTags: this.ticketCupom,\n isMapPlace: true,\n placeId: this.selectedPlace.attrs.idDB,\n orderMapReserveCode: '',\n position: ticket.position,\n sectorId: ticket.sectorId,\n unitPriceWithFee: ticket.price + ticket.fee,\n unitPrice: ticket.price,\n fee: ticket.fee\n }\n );\n }\n }\n });\n\n\n // Se só tem 1 ingresso pra selecionar no selectbox, ele já pode sair selecionado automaticamente\n let firstTicketSelected = (this.permittedTicketsFromPlace.length == 1) ? this.permittedTicketsFromPlace[0].ticketDateId : null;\n /**\n * Se o lugar é do tipo 'single', o usuário é obrigado a selecionar a quantidade de ingressos que o lugar comporta.\n */\n if (this.selectedPlace.attrs.configs.type == 'single') {\n for (let i = 0; i < this.selectedPlace.attrs.configs.quantity; i++) {\n this.ticketSelectForm.push(this.fb.group({\n 'dateTicketId': [firstTicketSelected, Validators.required]\n }));\n }\n //Se estiver editando, marca os ingressos selecionados\n if (this.onEditPlace) {\n let selectedTickets = this.orderService.getAllTickets().filter(v => v.placeId == this.selectedPlace.attrs.idDB);\n selectedTickets.forEach((value, index, array) => {\n this.ticketSelectForm.at(index).get('dateTicketId')?.setValue(value.ticketDateId);\n });\n }\n\n //Se o lugar é do tipo single, e só tem 1 ingresso pra selecionar, nem precisa mostrar os selectbox de seleção, já sairá selecionado o unico ingresso que tem.\n if (this.permittedTicketsFromPlace.length == 1) {\n this.modalShowSelectTickets = false;\n }\n }\n /**\n * Se o lugar é do tipo 'shared', o usuário pode selecionar 1 ou n ingressos de acordo com o limite disponível\n */\n else if (this.selectedPlace.attrs.configs.type == 'shared') {\n\n\n\n if (this.onEditPlace) {\n let selectedTickets = this.orderService.getAllTickets().filter(v => v.placeId == this.selectedPlace.attrs.idDB);\n selectedTickets.forEach((value, index, array) => {\n this.ticketSelectForm.push(this.fb.group({\n 'dateTicketId': [value.ticketDateId, Validators.required]\n }));\n });\n } else {\n this.ticketSelectForm.push(this.fb.group({\n 'dateTicketId': [firstTicketSelected, Validators.required]\n }));\n }\n\n } else {\n this.alertService.toast({ icon: 'error', title: 'Erro', text: 'Tipo do lugar não identificado' });\n }\n\n }\n\n getTicketChange(eve: any) {\n this.selectedTicketName = eve.ticketName\n }\n\n /**\n * O formulário do modal foi submetido\n */\n submitSelectedTickets() {\n if (!this.ticketSelectForm.valid) {\n this.ticketSelectFormShowError = true;\n } else if (this.ticketSelectForm.value.length == 0) {\n this.alertService.toast({ icon: 'error', title: 'Erro', text: 'Adicione pelo menos 1 pessoa' });\n } else if (this.isEspecialEvent &&\n this.ticketSelectForm.value.length < 4) {\n this.alertService.toast({ icon: 'error', title: 'Erro', text: 'Adicione pelo menos 4 pessoas' });\n } else {\n let data = {\n code: this.uniqueIdGenerate(),\n places: [\n {\n placeId: this.selectedPlace.attrs.idDB,\n qtdPerson: this.ticketSelectForm.value.length\n }\n ]\n };\n\n \n this.loadingConfirmPlace = true;\n console.log('data', this.ticketSelectForm.value);\n this.orderService.newMapReserve(data).subscribe(res => {\n this.loadingConfirmPlace = false;\n let placebox = this.selectedPlace.children.filter(v => (v.attrs.type == 'placebox'))[0];\n placebox.fill('rgba(247, 220, 43, 1)');\n placebox.clearCache();\n\n this.stage.batchDraw();\n this.modalRef?.hide();\n this.amountSelectedTickets = this.amountSelectedTickets + 1\n // adiciona a seleção feita no modal no carrinho\n // this.orderService.emptyAllTickets()\n for (let i = 0; i < this.ticketSelectForm.value.length; i++) {\n let selected = this.ticketSelectForm.value[i];\n\n const placeAlreadyInCart = this.orderService\n .getAllTickets()\n .filter(\n (ticket) =>\n ticket.placeId == this.selectedPlace.attrs.idDB\n );\n\n if (placeAlreadyInCart?.length >= this.selectedPlace.attrs.configs.qtdDisponible) {\n continue;\n }\n\n let ticket = this.permittedTicketsFromPlace.filter(v => v.ticketDateId == selected.dateTicketId)[0];\n let ticketOrder = {\n fee: ticket.fee,\n fees: ticket.fees,\n id: ticket.ticketId,\n orderMapReserveCode: data.code != null ? data.code : undefined,\n ticketDateId: ticket.ticketDateId,\n name: ticket.ticketName,\n price: ticket.unitPrice,\n qty: 1,\n isMapPlace: ticket.isMapPlace,\n placeName: ticket.placeName,\n position: ticket.position,\n lotId: ticket.lotId,\n sectorId: ticket.sectorId,\n placeId: this.selectedPlace.attrs.idDB,\n unitPrice: ticket.unitPrice.toString(),\n unitPriceWithFee: ticket.unitPriceWithFee.toString(),\n }\n this.sendSelectedSeat.emit([this.amountSelectedTickets, this.sectorId]);\n console.log('ticketOrder', ticketOrder);\n this.orderService.addTicket(ticketOrder);\n }\n\n // let ticket = this.permittedTicketsFromPlace.filter(v => v.ticketDateId == selected.dateTicketId)[0];\n // this.baseClass.cartTikets.push(\n // {\n // ticketId: ticket.ticketId,\n // ticketName: ticket.ticketName,\n // ticketDateId: ticket.ticketDateId,\n // lotId: ticket.lotId,\n // lotName: ticket.lotName,\n // quantity: 1,\n // unitPrice: ticket.unitPrice,\n // unitPriceWithoutFee: ticket.unitPriceWithoutFee,\n // customer: null,\n // placeId: this.selectedPlace.attrs.idDB,\n // placeName: this.selectedPlace.attrs.name,\n // fee: ticket.fee\n // }\n // );\n // }\n });\n\n\n // this.orderService.newReserve(data).then(responseve => {\n // this.loadingConfirmPlace = false;\n // let placebox = this.selectedPlace.children.filter(v => (v.attrs.type == 'placebox'))[0];\n //\n // placebox.fill('rgba(247, 220, 43, 1)');\n // placebox.clearCache();\n //\n // this.stage.batchDraw();\n // // this.modalService.dismissAll();\n //\n // /**\n // * Se O lugar selecionado já está adicionado no carrinho, vamos remover para adicionar a nova seleção feita no modal para o lugar\n // */\n //\n // // this.baseClass.cartTikets = this.baseClass.cartTikets.filter(v => v.placeId != this.selectedPlace.attrs.idDB);\n //\n // /**\n // * Adiciona a seleção feita no modal no carrinho\n // */\n // for(let i=0; i < this.ticketSelectForm.value.length; i++){\n // let selected = this.ticketSelectForm.value[i];\n //\n // // let ticket = this.permittedTicketsFromPlace.filter(v => v.ticketDateId == selected.dateTicketId)[0];\n // // this.baseClass.cartTikets.push(\n // // {\n // // ticketId: ticket.ticketId,\n // // ticketName: ticket.ticketName,\n // // ticketDateId: ticket.ticketDateId,\n // // lotId: ticket.lotId,\n // // lotName: ticket.lotName,\n // // quantity: 1,\n // // unitPrice: ticket.unitPrice,\n // // unitPriceWithoutFee: ticket.unitPriceWithoutFee,\n // // customer: null,\n // // placeId: this.selectedPlace.attrs.idDB,\n // // placeName: this.selectedPlace.attrs.name,\n // // fee: ticket.fee\n // // }\n // // );\n // }\n // }).catch(errorResponseve => {\n // this.loadingConfirmPlace = false;\n // //this.validatorsInputErrorComponent.loadErrors(errorResponse, null);\n // });\n\n }\n\n }\n\n newTicket() {\n let disponible = this.selectedPlace.attrs.configs.qtdDisponible;\n if (disponible > this.ticketSelectForm.value.length) {\n this.ticketSelectForm.push(this.fb.group({\n 'dateTicketId': [null, Validators.required]\n }));\n } else {\n this.alertService.toast({ icon: 'error', title: 'Limite de ingressos atingido', text: 'Você só pode selecionar ' + disponible + ' ingressos para este lugar.' });\n }\n }\n\n removeTicket(position: number) {\n this.ticketSelectForm.removeAt(position);\n }\n\n cancelPlace() {\n if (this.amountSelectedTickets >= 1) {\n this.amountSelectedTickets = this.amountSelectedTickets - 1\n }\n this.sendSelectedSeat.emit([this.amountSelectedTickets, this.sectorId]);\n\n //Remove do carrinho\n this.orderService.removeTicketByPlaceId(this.selectedPlace.attrs.idDB);\n\n let placebox = this.selectedPlace.children.filter(v => (v.attrs.type == 'placebox'))[0];\n\n placebox.fill(placebox.attrs.fillDefined);\n placebox.clearCache();\n\n this.stage.batchDraw();\n\n this.modalRef?.hide();\n\n }\n\n\n /**\n * Rolou a barra de rolagem do zoom\n */\n changeZoomSlider() {\n this.stage.scale({ x: this.scale, y: this.scale });\n\n this.stage.position({ x: -450, y: - (this.iniY * this.scale) + (this.marginH / 2) });\n\n this.stage.batchDraw();\n }\n\n zoomIn() {\n this.scale += 0.1;\n this.stage.scale({ x: this.scale, y: this.scale });\n\n this.stage.position({ x: -(this.iniX * this.scale) + (this.marginW / 2), y: - (this.iniY * this.scale) + (this.marginH / 2) });\n\n this.stage.batchDraw();\n }\n\n zoomOut() {\n this.scale -= 0.1;\n this.stage.scale({ x: this.scale, y: this.scale });\n\n this.stage.position({ x: -(this.iniX * this.scale) + (this.marginW / 2), y: - (this.iniY * this.scale) + (this.marginH / 2) });\n\n this.stage.batchDraw();\n }\n\n\n instructionsStatus() {\n return localStorage.getItem('instructions_understand');\n }\n\n okUnderstand() {\n localStorage.setItem('instructions_understand', '1');\n }\n\n uniqueIdGenerate() {\n\n if (!localStorage.getItem('map_session_reserve')) {\n localStorage.setItem('map_session_reserve', this.generalHelper.guid());\n }\n\n return localStorage.getItem('map_session_reserve');\n }\n\n priceTotalPlace() {\n let total = 0;\n for (let i = 0; i < this.ticketSelectForm.controls.length; i++) {\n let search = this.permittedTicketsFromPlace.find(v => v?.ticketDateId == this.ticketSelectForm.at(i).get('dateTicketId')?.value);\n if (search) {\n total += search.unitPrice + search.fee;\n }\n }\n\n return total;\n }\n\n\n\n}\n","import { Component, EventEmitter, Input, OnInit, Output } from '@angular/core';\nimport { OrderService } from 'src/app/services/order.service';\nimport { AlertService } from 'src/app/services/alert.service';\n\n@Component({\n selector: 'app-qty',\n templateUrl: './qty.component.html',\n styleUrls: ['./qty.component.scss']\n})\nexport class QtyComponent implements OnInit {\n @Input() value: number = 0;\n @Input() min: number = 0;\n @Input() max: number = 99;\n @Input() target: any = null;\n @Input() allowAdd: boolean = true;\n @Input() allowRemove: boolean = true;\n @Output() change = new EventEmitter();\n\n constructor(private orderService: OrderService, private alertService: AlertService) {}\n\n public ngOnInit(): void {}\n\n public add(): void {\n var ticketAtlanta = this.orderService.getAllTickets().filter((re): any => {\n if (re.id == \"440b4e15-8157-46a7-9f52-c562fa651ad7\" && this.target.id == \"440b4e15-8157-46a7-9f52-c562fa651ad7\" ) {\n return re\n }\n })\n\n if (ticketAtlanta.length >=2) { \n this.alertService.toast({\n icon: 'error',\n title: 'Erro',\n text: 'Só é permitido adicionar um ingresso',\n }); \n return \n }\n\n if (this.allowAdd && (this.max === null || this.value < this.max)) {\n this.value++;\n }\n this.change.emit({\n target: this.target,\n qty: this.value,\n action: 'add'\n });\n }\n\n public remove(): void {\n if (this.allowRemove && this.min !== null && this.value > this.min) {\n this.value--;\n }\n this.change.emit({\n target: this.target,\n qty: this.value,\n action: 'remove'\n });\n }\n}\n\nexport type QtyEventType = {\n target: any;\n qty: number;\n action: 'add' | 'remove';\n}\n","
\n \n \n \n
","import { Injectable } from '@angular/core';\n\n@Injectable({\n providedIn: 'root'\n})\nexport class ArraysHelper {\n\n emptyItemRemove(data: any, noRemove: Array = [], removeEmpty: boolean = true, removeNull: boolean = true){\n let newData = Object.assign(data, {});\n\n let isArray = Array.isArray(data);\n if(isArray){\n for(let i=0; i < data.length; i++){\n this.emptyItemRemove(data[i]);\n }\n }else{\n for(var key in newData) {\n var valueItem = newData[key];\n if(Array.isArray(valueItem)){\n for(let i=0; i < valueItem.length; i++){\n this.emptyItemRemove(valueItem[i]);\n }\n }else{\n // console.log(key);\n // console.log(valueItem);\n //console.log(\"/////\");\n if( (valueItem === '' && removeEmpty === true) || (valueItem === null && removeNull === true)){\n if(noRemove.indexOf(key) == -1){\n\n delete newData[key];\n }\n }\n }\n }\n }\n return newData;\n }\n\n emptyItemReplace(data: any, replaceFrom: string, replaceTo: string){\n let newData = Object.assign(data, {});\n\n let isArray = Array.isArray(data);\n if(isArray){\n for(let i=0; i < data.length; i++){\n this.emptyItemReplace(data[i], replaceFrom, replaceTo);\n }\n }else{\n for(var key in newData) {\n var valueItem = newData[key];\n if(Array.isArray(valueItem)){\n for(let i=0; i < valueItem.length; i++){\n this.emptyItemReplace(valueItem[i], replaceFrom, replaceTo);\n }\n }else{\n if(valueItem === replaceFrom){\n newData[key] = replaceTo;\n }\n }\n }\n }\n return newData;\n }\n\n serializeDate(dates){\n let dt = dates.map(element => {\n return (new Date(element.dateStartEvent) as Date).toLocaleString('pt-BR', { year: 'numeric', month: 'numeric', day: 'numeric', hour: 'numeric', minute: 'numeric' });\n });\n return dt.join('/');\n }\n\n serializeDate2(dates){\n let dt = dates.map(element => {\n return element.dateStartEvent; // return (new Date(element.dateStartEvent) as Date).toLocaleString('pt-BR', { year: 'numeric', month: 'numeric', day: 'numeric', hour: 'numeric', minute: 'numeric' });\n });\n return dt; //.join('/');\n }\n\n dateTimeBR(date){\n return new Date(date).toLocaleString();\n }\n\n toCurrency(value: number){\n // return (value == null) ? 0 : value.toFixed(2).toString().replace('.', ',');\n return (value == null) ? '0,00' : new Intl.NumberFormat('pt-BR', { style: 'currency', currency: 'BRL' }).format(value);\n }\n}\n","
\n
\n
\n
\n
\n
\n

Formulário {{id+1}}

\n
\n
\n \n \n
\n
\n

Insira um cpf

\n
\n
\n

Cpf tem que ser válido

\n
\n
\n
\n\n
\n
\n
\n \n \n
\n
\n

Insira um nome

\n
\n
\n

Insira o nome completo

\n
\n
\n

Insira o nome completo

\n
\n
\n
\n\n
\n
\n
\n \n \n
\n
\n

Insira um email

\n
\n
\n

Insira um email válido

\n
\n
\n
\n
\n
\n
\n \n \n
\n
\n

Insira um número de celular válido

\n
\n
\n
\n
\n\n
\n
\n \n \n
\n
\n

Insira o modelo

\n
\n
\n
\n
\n
\n
\n \n \n
\n
\n

Insira a versão

\n
\n
\n
\n
\n
\n
\n \n \n
\n
\n

Insira o ano/modelo

\n
\n
\n
\n
\n
\n
\n \n \n
\n
\n

Insira a placa

\n
\n
\n
\n
\n
\n
\n \n
\n
\n

Escolha o tamanho da camisa

\n
\n
\n
\n
\n\n
\n \n \n
\n\n
\n\n \n
\n
\n
\n
\n
\n","import { Component, OnInit, Output, Input, EventEmitter, ViewChildren, QueryList } from '@angular/core';\nimport { FormGroup, FormBuilder, Validators, FormArray } from '@angular/forms';\nimport { MyProfileService } from 'src/app/services/my-profile.service';\nimport { OrderService } from 'src/app/services/order.service';\nimport { ArraysHelper } from '../../../helpers/arrays'\nimport { FormHelper } from '../../../helpers/form.helper';\nimport { AlertService } from '../../../services/alert.service'\n@Component({\n selector: 'app-form-porsche-event',\n templateUrl: './form-porsche-event.component.html',\n styleUrls: ['./form-porsche-event.component.scss']\n})\nexport class FormPorscheEventComponent implements OnInit {\n\n constructor(private formBuilder: FormBuilder,\n private myProfileService: MyProfileService,\n private orderService: OrderService,\n private arrayHelper: ArraysHelper,\n private formHelper: FormHelper,\n private alertService: AlertService) { }\n\n public formPorscheOwner!: FormGroup\n\n public tickets: any[] = []\n public submitted: boolean = false\n\n @Output() sendPorscheOwner: EventEmitter = new EventEmitter();\n @Input() quantityTickets!: number;\n @ViewChildren('cpfCustomer') cpfCustomer!: QueryList\n\n ngOnInit(): void {\n this.formPorscheOwner = this.formBuilder.group({\n 'owner': this.formBuilder.array([])\n })\n\n\n for (let id = 0; id < this.quantityTickets; id++) {\n let owner = this.formBuilder.group({\n 'id': [''],\n 'name': ['', [Validators.required, Validators.minLength(5)]],\n 'email': ['', [Validators.required, Validators.email]],\n 'phone': ['', Validators.required],\n 'cpf': ['', Validators.required],\n 'additionalInformation': this.formBuilder.group({\n 'model': ['', Validators.required],\n 'version': ['', Validators.required],\n 'yearModel': ['', Validators.required],\n 'plate': ['', Validators.required],\n 'sizeShirt': ['', Validators.required],\n 'question': ['']\n })\n }, {\n // verifica se o cpf é válido, se o nome é completo e se os emails batem\n validators: [this.formHelper.testCpf, this.formHelper.testFullName]\n });\n (this.formPorscheOwner.get('owner') as FormArray).push(owner);\n\n this.tickets[this.tickets.length] = 'Ingresso'\n }\n\n\n }\n\n getOwner() {\n if (this.formPorscheOwner.status == 'VALID') {\n this.sendPorscheOwner.emit(true);\n let value = this.arrayHelper.emptyItemRemove(this.formPorscheOwner.value.owner);\n this.orderService.defineAdditionalCustomer(value)\n } else {\n this.alertService.toast({icon: 'error', title: 'Preencha todos os campos', text: 'Alguns campos não estão preenchidos. Por favor, preencha todos os campos necessários corretamente'})\n }\n this.submitted = true;\n }\n\n /*\n Verifica se tem customer com o cpf informado, s tiver, preenche os campos do formulário em\n que está sendo digitado o cpf, para ser preenchido com as informações do customer\n */\n checkCustomerRegister(eve: any, index: number) {\n //this.loadingUserInformation = true\n this.cpfCustomer.toArray().forEach((cpfCustomer: any, id: number) => {\n if (this.cpfCustomer.toArray()[id].nativeElement.id == index) {\n if (this.cpfCustomer.toArray()[id].nativeElement.value.length == 14) {\n this.myProfileService.checkCustomerRegisterWithCpf(eve.srcElement.value).subscribe((res: any) => {\n if (res.length >= 1) {\n ((this.formPorscheOwner!.get('owner') as FormArray)!.at(index)!.get('id')!.setValue(res[0].id));\n ((this.formPorscheOwner!.get('owner') as FormArray)!.at(index)!.get('name')!.setValue(res[0].name));\n ((this.formPorscheOwner!.get('owner') as FormArray)!.at(index)!.get('email')!.setValue(res[0].email));\n ((this.formPorscheOwner!.get('owner') as FormArray)!.at(index)!.get('phone')!.setValue(res[0].phones[0]))\n } else {\n ((this.formPorscheOwner!.get('owner') as FormArray)!.at(index)!.get('id')!.setValue(''));\n ((this.formPorscheOwner!.get('owner') as FormArray)!.at(index)!.get('name')!.setValue(''));\n ((this.formPorscheOwner!.get('owner') as FormArray)!.at(index)!.get('email')!.setValue(''));\n ((this.formPorscheOwner!.get('owner') as FormArray)!.at(index)!.get('phone')!.setValue(''))\n }\n })\n }\n }\n })\n }\n\n}\n","import { Pipe, PipeTransform } from '@angular/core';\n\n@Pipe({\n name: 'filter'\n})\nexport class FilterPipe implements PipeTransform {\n transform(items: any[] | undefined, field: string, value: any): any[] {\n if (!items) {\n return [];\n }\n \n if (!field || !value) {\n return items;\n }\n\n return items.filter((item) =>\n normalize(item[field]).includes(normalize(value))\n );\n }\n\n}\n\nfunction normalize(value: string) {\n const map: any = {\n 'a': 'á|à|ã|â|À|Á|Ã|Â',\n 'e': 'é|è|ê|É|È|Ê',\n 'i': 'í|ì|î|Í|Ì|Î',\n 'o': 'ó|ò|ô|õ|Ó|Ò|Ô|Õ',\n 'u': 'ú|ù|û|ü|Ú|Ù|Û|Ü',\n 'c': 'ç|Ç',\n 'n': 'ñ|Ñ'\n };\n\n value = value.toLowerCase();\n\n for (let pattern in map) {\n value = value.replace(new RegExp(map[pattern], 'g'), pattern);\n };\n\n return value;\n}","import { Pipe, PipeTransform } from '@angular/core';\n\n@Pipe({\n name: 'isOnlyOneTicketByCustomer'\n})\nexport class IsOnlyOneTicketByCustomer implements PipeTransform {\n transform(array: string[], ticketId: string): boolean {\n return array.includes(ticketId);\n }\n}","
\n
\n

\n Troque 1kg de alimento não perecível na bilheteria do Parque de\n Exposições
\n No dia do show.\n

\n
\n \n

Vendas encerradas.

\n
\n

Vendas somente no Estádio Jonas Duarte

\n
\n
\n

LOTE PROMOCIONAL ENCERRADO!

\n

REABERTURA DAS VENDAS EM BREVE.

\n
\n
\n
\n\n
\n
\n
\n \n \n
\n\n
\n \n
\n\n
\n
\n
\n

\n {{ event.name }}\n

\n \n
\n
\n\n
\n \n
\n\n
\n
\n
\n
\n
\n
\n
\n
\n Sobre o evento\n
\n \n
\n
\n \n

\n \n
\n
\n
\n
\n \n
\n
\n
\n
\n Sobre o evento\n
\n
\n
Evento: Ws Experience - Goiania.
\n
Data: 08 e 09 de Outubro de 2022.
\n
Local: Estacionamento do Serra Dourada
\n
Evento Exclusivo para maiores de 18 anos.
\n
Horario de inicio dia 08: 14h00m 
\n
Horario de inici0 dia 09: 14h00m
\n

\n
 
\n

\n
* • O EVENTO*
\n

\n
\n O WS EXPERIENCE acontecerá nos dias 08 e 09 de outubro\n e proporcionará uma experiência diferente, dois dias,\n dois eventos e duas experiências completamente\n diferentes.\n
\n

\n
• GAROTA VIP - 08/10
\n

\n
\n O Garota Vip tem como principais características o\n tradicional show mais longo do Wesley Safadão,\n convidados especiais e será open bar nas áreas:\n “Lounges”, “Ninguém é de Ferro” e “Virote”.\n
\n

\n
• BLOCO VAI SAFADÃO - 09/10
\n

\n
\n O Bloco Vai Safadão, tem como principais\n características o show no Trio, Abadá e também conta\n com atrações especiais. (Evento sem open bar).\n
\n

\n
*• INGRESSOS *
\n

\n
\n Disponibilizamos um ingresso “passaporte”, válido para\n os dois dias. Ou seja, te dará direito as duas\n experiências, incluindo a retirado do abadá.\n
\n

\n
 
\n

\n
Setores:
\n

\n
Revoada - Area Sem Open Bar.
\n

\n
\n Virote - (Open - Agua, Cerveja e Refrigerante. Somente\n Sábado\n
\n
08/10/22)
\n
Garcons e Banheiros Exclusivos.
\n
Evento Exclusivo para maiores de 18 anos.
\n

\n
 
\n

\n
\n Ninguém é de Ferro - (Open - Agua, Cerveja,\n Refrigerante, Vodka,\n
\n
Gin e Whisk. Somente Sábado 08/10/22)
\n
Garcons e Banheiros Exclusivos.
\n
Evento Exclusivo para maiores de 18 anos.
\n

\n
\n • OS LOUNGES TAMBÉM VALEM PARA OS 2 DIAS, COMO\n RESERVAR?\n
\n

\n
\n Sim, os ingressos de lounges também são válidos para\n os dois dias e eles podem ser adquiridos através do\n contato: Gustavo Cesar - (62)982158535\n
\n

\n
Evento Exclusivo para maiores de 18 anos.
\n

\n
• OPEN BAR
\n

\n
\n O evento contará com Open bar somente no Garota Vip\n (08/10) e nas áreas: “Lounges, Ninguém É De Ferro” e\n “Virote”. No Bloco Vai Safadão (09/10) o evento não\n terá open bar. \n
\n

\n
Política de meia-entrada
\n

\n
https://www.ingressosa.com/half-price-policy
\n

\n
O que e ingresso meia solidário?
\n

\n
\n O ingresso solidário é uma opção para as pessoas que\n não se enquadram na meia-entrada, é um ingresso com\n desconto, mediante a entrega de 1kg de alimento não\n perecível por ingresso na entrada do evento.\n
\n

\n
Termos de Uso “INGRESSO SA”
\n

\n
https://www.ingressosa.com/terms-of-us
\n

\n
Procon
\n

\n
https://www.procon.go.gov.br/
\n

\n
Telefone: 151
\n
\n
\n
\n
\n
\n\n
\n
\n
\n
\n Localização\n
\n \n
\n
\n \n \n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n \n
\n
\n \n
\n\n

\n {{ event.startDate }}\n

\n \n

\n de {{ event[\"dates\"][0] | date:'dd/MM' }} a {{event[\"dateEnd\"] | date:'dd/MM'}}\n

\n
\n
\n
\n

04 e 05 de março

\n
\n
\n

04 e 05 de março

\n
\n
\n

Dia 18 a dia 28 de maio

\n
\n
\n

07 a 23 de Fevereiro

\n
\n
\n

27 de Fevereiro até 04 de Março

\n
\n
\n

DIAS 09 e 10/06

\n
\n
\n

30 e 31 de dezembro

\n
\n
\n

04/10 a 04/11

\n
\n
\n

12 a 15 de outubro

\n
\n
\n

04/10 a 02/11

\n
\n
\n

04/10 a 02/11

\n
\n
\n

07 e 08 de Setembro

\n
\n
\n

23 e 24 de Maio

\n
\n\n
\n

14 e 15 de Fevereiro

\n
\n
\n

28/02 até 03/03

\n
\n
\n

01 a 03 de Março

\n
\n
\n

DIA 18/04 ao DIA 19/04

\n
\n
\n

27/02 a 04/03

\n
\n
\n

19 e 20 de Abril

\n
\n
\n

04 e 05 de Abril

\n
\n
\n

02 e 03 de Maio

\n
\n
\n

De 30/04 a 03/05 de 2025

\n
\n
\n

23 de Junho, Véspera de Feriado

\n
\n
\n

30/04 a 03/05

\n
\n \n

{{ event.startTime }}

\n
\n \n \n
\n \n
\n
\n
\n \n
{{ event.address }}
\n
\n

{{ event.city }} - {{ event.uf }}

\n
\n \n

Lisboa

\n

Porto

\n

Bostom

\n

Miami

\n
\n
\n \n \n
\n \n
\n
\n\n
\n
\n \n
\n
\n
\n
\n
\n \n \n
\n
\n
\n
\n

{{ ticketCupomError }}

\n
\n
\n
\n \n
\n
\n
\n \n \n
\n
\n
\n
\n
\n

{{ ticketCupomError }}

\n
\n\n
\n

{{ ticketCupomError }}

\n
\n
\n
\n \n
\n
\n
\n

Pode comprar:

\n Sócio\n {{\n quantityPctValuePartner\n }} \n Convidado\n {{\n quantityPctValueInvited\n }} \n Extra\n {{\n quantityPctValueExtra\n }}\n
\n
\n
\n \n

\n Não há ingressos disponíveis para você.\n

\n
\n
\n\n
\n
\n \n
\n
\n\n
\n
\n \n
\n \n
\n
\n
\n = 1\">\n \n
\n \n

\n {{sectorName}} /\n \n

\n \n \n

\n INFERIOR / SUPERIOR\n

\n
\n
\n
\n

CLIQUE NO MAPA ABAIXO E CONFIRA OS INGRESSOS DE CADA SETOR\n

\n\n \n \n \n
\n
\n
\n \n
\n
\n {{ sector.name }}\n
\n
\n
\n\n\n
\n \n
\n
\n\n
\n
\n
\n \n
\n \n

MESAS ESGOTADAS\n

\n
\n
\n
\n

Ingressos esgotados

\n
\n \n
\n

Meia entrada

\n \n
\n
\n \n\n
= 1\">\n \n
\n\n
\n
\n
\n
\n\n\n \n \n \n
\n\n \n
\n
\n

\n {{ ticket.name }}\n

\n {{ ticket.type }}\n
\n

\n Inteira\n

\n

\n Meia\n

\n

\n Meia Solidária\n

\n

\n Cortesia\n

\n

-

\n

\n Unissex\n

\n

\n Masculino\n

\n

\n Feminino\n

\n

\n Cortesia\n

\n

\n \n

\n
\n

\n {{ ticket.batch }}\n

\n
\n

\n Classificação indicativa: +{{\n ticket.parentRating\n }}\n

\n
\n
\n

\n \n

\n

\n R$\n {{\n amount(ticket) | number : \"1.2-2\"\n }}\n

\n

\n R$\n {{\n ticket.price | number : \"1.2-2\"\n }}\n (Valor)\n

\n

\n R$\n {{\n ticket.fee | number : \"1.2-2\"\n }}\n (Taxa)\n

\n
\n
\n
\n
\n \n \n \n
\n \n
\n
\n

\n {{ ticket.name }}\n

\n
\n

\n Inteira\n

\n
\n -1 || removeAccents(ticket.name).toLowerCase().indexOf('solidaria') > -1 else showHalf\">\n -1\">Solidário\n -1\">Solidária\n
\n \n

Meia

\n
\n
\n

\n Meia Solidária\n

\n

\n Cortesia\n

\n

-

\n

\n Unissex\n

\n

\n Masculino\n

\n

\n Feminino\n

\n

\n Cortesia\n

\n

\n \n

\n
\n \n
\n

\n Promocional\n

\n

\n Promocional\n

\n

\n Meia Solidária\n

\n

\n Cortesia\n

\n

-

\n

\n Unissex\n

\n

\n Masculino\n

\n

\n Feminino\n

\n

\n Cortesia\n

\n

\n \n

\n
\n
\n

\n {{ ticket.batch }}\n

\n
\n

\n Classificação indicativa: +{{\n ticket.parentRating\n }}\n

\n
\n
\n

\n \n

\n

\n R$\n {{\n amount(ticket)\n | number : \"1.2-2\"\n }}\n

\n

\n R$\n {{\n ticket.price | number : \"1.2-2\"\n }}\n (Valor)\n

\n

\n R$\n {{\n ticket.fee | number : \"1.2-2\"\n }}\n (Taxa)\n

\n
\n
\n \n
\n \n \n \n
\n
\n

\n {{ ticket.name }}\n

\n
\n

\n Inteira\n

\n
\n -1 || removeAccents(ticket.name).toLowerCase().indexOf('solidaria') > -1 else showHalf\">\n -1\">Solidário\n -1\">Solidária\n
\n \n

Meia

\n
\n
\n

\n Meia Solidária\n

\n

\n Cortesia\n

\n

-

\n

\n Unissex\n

\n

\n Masculino\n

\n

\n Feminino\n

\n

\n Cortesia\n

\n

\n \n

\n
\n

\n {{ ticket.batch }}\n

\n
\n

\n Classificação indicativa: +{{\n ticket.parentRating\n }}\n

\n
\n
\n

\n \n

\n

\n R$\n {{\n amount(ticket)\n | number : \"1.2-2\"\n }}\n

\n

\n R$\n {{\n ticket.price | number : \"1.2-2\"\n }}\n (Valor)\n

\n

\n R$\n {{\n ticket.fee | number : \"1.2-2\"\n }}\n (Taxa)\n

\n
\n
\n \n \n
\n \n
\n

\n {{ ticket.name }}\n

\n

\n {{ ticket.batch }}\n

\n

\n Classificação indicativa: +{{\n ticket.parentRating\n }}\n

\n
\n
\n

\n \n

\n

\n R$\n {{\n amount(ticket)\n | number : \"1.2-2\"\n }}\n

\n

\n R$\n {{\n ticket.price\n | number : \"1.2-2\"\n }}\n (Valor)\n

\n

\n R$\n {{\n ticket.fee | number : \"1.2-2\"\n }}\n (Taxa)\n

\n
\n
\n
\n
\n 0\">\n
\n \n \n
\n
\n \n \n \n \n \n \n \n
\n \n
\n \n \n \n \n
\n \n
\n \n
\n \n \n \n
\n
\n \n
\n
\n
\n
\n\n \n
\n NIVEL 2 CAMAROTE B\n
\n
\n

ESGOTADOS

\n
\n
\n \n
\n \n
\n \n
\n
\n\n \n \n \n \n \n \n
\n\n \n
\n\n
\n \n \n\n \n
\n
\n
\n
\n

\n Escolha o seu lugar (clique, segure e arraste\n para movimentar o mapa)\n

\n \n
\n
\n
\n \n \n
\n
\n
\n {{ sector.name }}\n
\n
\n \n
\n
\n\n \n \n \n \n \n
\n
\n\n
\n
\n \n
\n
\n
\n
\n
\n
\n \n
\n \n
\n
\n
\n \n
\n
\n \n \n
\n \n
\n
\n
\n
\n
\n
\n
\n \n \n\n \n
\n

Meia entrada

\n \n
\n
\n

POLÍTICA DE MEIA-ENTRADA

\n\n

\n De acordo com o decreto nº 8.537 de 5 de outubro de 2015 que\n regulamenta a nova lei da meia-entrada (Lei n° 12.933/2013) e o\n Estatuto da Juventude (Lei n° 12.852/2013), a venda de meia-entrada\n está sujeita a disponibilidade da cota de 40% sobre o total de\n ingressos disponível para o evento.\n

\n
\n
\n

\n Sobre o benefício da Meia-Entrada\n

\n
    \n
  • \n O direito à Meia-Entrada é garantido por leis federais e\n regionais. As leis federais têm abrangência em todo território\n nacional e as leis regionais têm eficácia restrita ao território\n onde foram publicadas.\n
  • \n
  • \n As leis federais atualmente em vigor garantem o benefício da Meia\n entrada para idosos, estudantes, pessoas com deficiência e jovens\n de baixa renda, com idade entre 15 e 29 anos. As pessoas com\n direito ao benefício com base em leis regionais variam de acordo\n com o Estado ou Município que publicou a lei.\n
  • \n
  • \n É obrigatória a apresentação no estabelecimento, quando do acesso\n ao evento, da documentação que comprove o direito ao benefício de\n acordo com a legislação em vigor. A Ingresso SA não se\n responsabiliza pela não entrada no evento caso não ocorra a\n comprovação ou o não reconhecimento do benefício por parte do\n estabelecimento.\n
  • \n
\n\n

Estatuto do Idoso

\n
    \n
  • \n De acordo com a Lei Federal no. 10741/2003, mais conhecida como\n Estatuto do Idoso, as pessoas com idade igual ou superior a 60\n anos tem direito à Meia-Entrada para eventos artísticos e de\n lazer.\n
  • \n
\n\n

Lei da meia entrada

\n
    \n
  • \n A Lei Federal nº 12933/2013, também conhecida como Lei da\n Meia-Entrada, garante o benefício do pagamento de Meia-Entrada\n para estudantes, pessoas com deficiência e jovens, de baixa renda,\n com idade entre 15 e 29 anos.\n
  • \n
  • \n Somente farão jus ao benefício alunos da educação básica e\n educação superior, conforme previsto no Título V da Lei no 9.394,\n de 20.12.1996. A lei não estende o benefício a cursos livres, tais\n como cursos de inglês e informática.\n
  • \n
  • \n Pessoas com deficiência e quando necessário, seus acompanhantes,\n têm direito ao benefício.\n
  • \n
  • \n Jovens de 15 a 29 anos, cuja renda familiar mensal seja de até 02\n salários mínimos, desde que inscritos no Cadastro Único para\n Programas Sociais do Governo Federal, podem adquirir os ingressos\n com 50% de desconto.\n
  • \n
  • \n A concessão do direito ao benefício da Meia-Entrada é assegurada\n em 40% (quarenta por cento) do total dos ingressos disponíveis\n para cada evento.\n
  • \n
\n\n

Leis Regionais que garantem a Meia-Entrada

\n
    \n
  • \n Alguns Estados e Municípios publicaram leis com eficácia regional\n como, por exemplo, a Lei Estadual (SP) 10.858/01, alterada pela\n Lei 14.729/12; Lei Municipal (Porto Alegre/RS) 7366/1993,\n regulamentada pelo Decreto 11.110, a Lei Municipal 9070/2005, de\n Belo Horizonte, a Lei Estadual (RJ) 3364/2000 e a Lei Municipal\n (Rio de Janeiro) 3424/2002.\n
  • \n
  • Verifique a legislação vigente no seu Estado ou Município.
  • \n
\n\n

SOBRE OS DOCUMENTOS VÁLIDOS

\n
\n

ESTUDANTES

\n

\n\n

\n Carteira de Identificação Estudantil (CIE), emitida pela Associação\n Nacional de Pós-Graduandos (ANPG), União Nacional dos Estudantes\n (UNE), União Brasileira dos Estudantes Secundaristas (Ubes),\n entidades estudantis estaduais e municipais, Diretórios Centrais dos\n Estudantes, Centros e Diretórios Acadêmicos de nível médio e\n superior, conforme modelo único nacionalmente padronizado que você\n pode conferir neste link. (Art. 3º, §1º do Decreto 8.537/15)\n

\n Os elementos indispensáveis da CIE são (Art. 3º, §2º e 2º, VI do\n Decreto 8.537/15):\n

\n\n

I - nome completo e data de nascimento do estudante;

\n
\n

II - foto recente do estudante;

\n
\n

\n III - nome da instituição de ensino na qual o estudante esteja\n matriculado;\n

\n

IV - grau de escolaridade; e

\n
\n

\n V - data de validade até o dia 31 de março do ano subsequente ao de\n sua expedição.\n

\n
\n

\n Lei Federal 12.933/13, Decreto Federal 8.537/15 e Medida Cautelar\n Provisória concedida pelo STF em 29/12/2015.\n

\n\n

\n

IDOSOS (pessoas com mais de 60 anos)

\n
\n

Documento de identidade oficial com foto.

\n
\n

Lei Federal 10.741/03 (Art. 23).

\n

\n\n

\n PESSOAS COM DEFICIÊNCIA (e acompanhante, quando necessário)\n

\n
\n

\n Cartão de Benefício de Prestação Continuada da Assistência Social da\n Pessoa com Deficiência ou de documento emitido pelo Instituto\n Nacional do Seguro Social - INSS que ateste a aposentadoria de\n acordo com os critérios estabelecidos na Lei Complementar nº 142, de\n 8 de maio de 2013. No momento de utilização dos ingressos, esses\n documentos deverão estar acompanhados de documento de identidade\n oficial com foto. (Art. 6º do Decreto 8.537/15)\n

\n\n
\n
\n Lei Federal 12.933/13 e Decreto Federal 8.537/15\n\n
\n
\n

\n MENORES DE 21 ANOS (verifique a lei do seu estado/município\n antes de realizar sua compra)\n

\n
\n

Carteira de identidade ou documento com foto válido.

\n\n

\n

PROFFISIONAIS DA EDUCAÇÃO

\n
\n

Lei Estadual RJ n° 3.364/00 e Lei Municipal BH n° 9.070/2005

\n

\n RJ - PROFESSORES E PROFISSIONAIS da rede pública municipal de ensino\n do Rio de Janeiro.\n

\n

\n Carteira funcional emitida pela Secretaria Municipal de Educação do\n Rio de Janeiro.\n

\n

\n Leis Municipais n° 3.424/02, com alterações introduzidas pela Lei\n Municipal nº 5.844/15.\n

\n

\n

\n SP - PROFESSORES, DIRETORES, COORDENADORES PEDAGÓGICOS, SUPERVISORES\n E TITULARES de cargos do quadro de apoio das escolas das redes\n estadual e municipais de São Paulo\n

\n

\n

\n Carteira funcional emitida pela Secretaria da Educação de São Paulo\n ou holerite acompanhado de documento oficial com foto.\n

\n

\n

\n Lei Estadual n° 14.729/12, com alterações introduzidas pela Lei\n Estadual n°15.298/14.\n

\n\n
\n
\n

\n DOADORES DE SANGUE (registrados nos bancos de sangue dos\n hospitais estaduais)\n

\n
\n

\n Existem leis municipais e estaduais que regulamentam o benefício de\n meia-entrada para doadores de sangue. Consulte a legislação do\n município onde o cinema se localiza e, confirmado o direito de uso,\n você poderá comprar meia-entrada pelo nosso site, bastando inserir o\n número do RG no momento da compra e apresentar a carteira de doador\n de sangue na entrada da sala.\n

\n
\n
\n

JOVENS DE BAIXA RENDA

\n
\n

\n Carteira de Identidade Jovem emitida pela Secretaria Nacional de\n Juventude, acompanhada de documento de identidade oficial com foto.\n (Art. 5º do Decreto 8.537/15)\n

\n
\n

Lei Federal 12.933/13 e Decreto Federal 8.537/15

\n
\n
\n
\n
\n\n \n
\n

\n Informações do Proprietário e do veículo\n

\n \n
\n
\n Formulário de cadastro do proprietário (informações necessárias)\n\n \n
\n
\n\n \n
\n

\n Titular dos ingressos\n

\n

\n Forma de Pagamento\n

\n \n
\n
\n \n \n
\n
\n
\n
\n
\n
\n
\n \n \n
\n
\n
\n
\n \n \n
\n
\n
\n
\n \n \n
\n
\n
\n
\n \n \n
\n
\n
\n
\n
\n
\n
\n \n
\n
\n
\n\n \n
\n
\n

Detalhes da compra

\n\n
\n
\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n
IngressoQtdValor
\n

\n {{ ticket.name }}\n

\n

\n Lugar: {{ ticket.placeName }}\n

\n

{{ ticket.batch }}

\n
\n {{ countTickets(ticket.id, ticket.placeName) }}\n \n R$ {{ amount(ticket) | number : \"1.2-2\" }}\n
\n

\n Total: R$ {{ amount() | number : \"1.2-2\" }}\n

\n
\n
\n
\n
\n
\n
\n
\n
\n \n \n \n \n \n \n \n \n \n \n \n \n \n
\n Dinheiro\n \n \n
\n Pix ou Cartão\n \n \n
\n
\n
\n
\n \n
\n
\n
\n\n \n
\n

\n Copie e envie o link de pagamento para o cliente\n

\n \n NÃO\n \n
\n
\n
\n \n
\n
","import { Component, OnDestroy, Input, OnInit, EventEmitter, TemplateRef, ElementRef, ViewChild, Renderer2, Output } from '@angular/core';\nimport { BsModalService, BsModalRef } from 'ngx-bootstrap/modal';\nimport Swiper, { SwiperOptions } from 'swiper';\nimport { SwiperConfig } from '../../../config/swiper.config'\nimport { Subject, takeUntil, catchError, pipe, of, map } from 'rxjs';\nimport { EventService } from 'src/app/services/event.service';\nimport { ScriptService } from 'src/app/services/script.service';\nimport { MyProfileService } from 'src/app/services/my-profile.service';\nimport { environment } from '../../../../environments/environment';\nimport { EventModel } from 'src/app/models/event.model';\nimport { TicketModel } from 'src/app/models/ticket.model';\nimport { SectorModel } from 'src/app/models/sector.model';\nimport { TicketHoldersComponent } from '../../dialogs/ticket-holders/ticket-holders.component';\nimport { ActivatedRoute, Router } from '@angular/router';\nimport { OrderService } from 'src/app/services/order.service';\nimport { QtyEventType } from '../../components/qty/qty.component';\nimport { AlertService } from 'src/app/services/alert.service';\nimport { AuthService } from 'src/app/services/auth.service';\nimport { FormGroup, FormBuilder, Validators } from '@angular/forms';\nimport { FormHelper } from '../../../helpers/form.helper';\nimport { EventData, JsonLDService } from 'src/app/services/structure-data';\nimport { MapV2Change } from '../../components/mapv2/models/MapV2Change';\nimport { MapV2Service } from '../../components/mapv2/mapv2.service';\nimport { MapView } from '../../components/mapv2/models/Map';\nimport { Title, Meta } from \"@angular/platform-browser\";\nimport { select, Store } from '@ngrx/store';\nimport { PdvSelectors } from 'src/app/store/pdv/selectors';\n\ndeclare let gapi: any;\ndeclare const $: any;\n\nexport enum CustomerDataRequirementTypeEnum {\n Obrigatory = 'Obrigatory',\n Optional = 'Optional',\n NotRequired = 'NotRequired',\n}\n\ndeclare const window: any;\n\n@Component({\n selector: 'app-event',\n templateUrl: './event.component.html',\n styleUrls: ['./event.component.scss'],\n})\nexport class EventComponent implements OnInit, OnDestroy {\n public event?: EventModel;\n public sectors?: SectorModel[];\n public tickets?: TicketModel[];\n public ticketscupom?: TicketModel[] = []\n public paymentMethod: any;\n public canShowMapPlace: boolean = false;\n public selectedSector?: string;\n public indexSector: number = 0; // index of selected sector\n public sectorsSwiperConfig: SwiperOptions = SwiperConfig.sectors;\n public buyInOtherSector: boolean = false;\n public swiper?: Swiper;\n public sectorsSwiper?: Swiper;\n public eventId: string = \"\"\n public titularModalRef?: BsModalRef;\n public mapModalRef?: BsModalRef;\n public halfEntryModalInformationRef?: BsModalRef;\n public openFormPorscheModalRef?: BsModalRef;\n public openPaymentConfirmationModalRef?: BsModalRef;\n public site: string = \"https://ingressosa.com\"\n public customerName: string = '';\n public loadingBuyedTickets: boolean = false;\n public customerTicketsBuyed: number = 0\n public ticketCupom: string = ''; // cupom de desconto\n public ticketCupomError: string = '';\n private unsubscribe$ = new Subject();\n public hasSeatsChart: boolean = false; // tem ou não seatsio\n public selectedSeats: Array = []; // assentos selecionados caso tenha\n public loadingSeatsIo: boolean = false;\n public totalPriceSeats: number = 0; // preço total dos assentos selecionados\n public comissaryId: null | string = null;\n public loading: boolean = false;\n public showFullTickets: boolean = false;\n public hideFullTicket: boolean = false;\n public isCupom: boolean = false;\n public voucherlink: string = \"\";\n public comissionerMode: boolean | undefined = false;\n public order?: any;\n public eventName?: any;\n public ticketsWithSeats: any = [];\n public allTickets: any = [];\n public orderId: string = '';\n public selectedTickets: any = [];\n private orderMapReserveCode?: string;\n public paymentCompleted: boolean = false;\n public numberOrder: string = '';\n public ticketOrderSubmit: any = [];\n public eventClosed: boolean = false;\n public selectedPaymentMethodId: string = '';\n public selectedPaymentMethod: string = '';\n public selectedPaymentMethodName: string = \"\"\n public ownerPorscheTicket: boolean = false;\n public ownerPorscheTicketQuantity: number = 0;\n public seatsIOSectors: String[] = []\n // campos para integração com a Feng\n public siteFeng = document.location.host == 'feng.meubilhete.com';\n public fengIntegration = false;\n public fengPlans: any[] = [];\n public fengDiscountKey = '';\n public fengDiscountValue: number = 0;\n public quantityPctValuePartner: number = 0;\n public quantityPctValueInvited: number = 0;\n public quantityPctValueExtra: number = 0;\n public fengEndedSells: boolean = false;\n public hasAnalitycs: boolean = false\n @Input() showBanner: boolean = true\n @Output() sendBanner = new EventEmitter();\n public categorySports:boolean = false\n\n public eventSlug: string | null = '';\n public showMap: boolean = false\n public isCountDown0 = false;\n public showEventInfo = true;\n\n public quantityPctValuePartnerFixed: number = 0;\n public quantityPctValueInvitedFixed: number = 0;\n public quantityPctValueExtraFixed: number = 0;\n public formHolder!: FormGroup;\n public selectedSeatSector = \"\"\n public amountSelectedSeatSector: number = 0\n public customerDataRequirementType: CustomerDataRequirementTypeEnum = CustomerDataRequirementTypeEnum.NotRequired;\n public ticketHoldersSubmitted: boolean = false;\n public allSectorsUseSetsio: boolean = false\n public showCupom: boolean = true;\n\n logo$ = this.store.pipe(\n select(PdvSelectors.selectCompany),\n map(function (company) {\n return company?.images?.logosite ?? ''\n })\n );\n\n // Lista de ingressos únicos por cliente\n public ticketIdForOnlyOneCustomer = [\n '188f2b98-1c05-44be-985d-4694f9d2730e',\n '5e28efdf-cb41-4f58-8ff8-ab67ecfbc158',\n '82c075cc-8fec-47d1-9eb3-4ae0f4747285',\n '8fd5498d-713b-4e44-9cdd-0d3162194d82',\n 'c82df187-7620-4a12-a272-80f7fc818ec8',\n 'eb9e3da0-4be1-485b-958a-9b1e0640798b',\n ];\n\n public showPub: boolean = true\n public hideAdvertising: any = ['5cc1ee13-cefb-48df-82da-d1911bf1ec9e',\n '9b7d31fd-bc18-4b79-b982-8671fceee58e',\n '680cbfcd-9730-4699-924b-07de354e002a',\n '144d318c-4651-4cbe-a46c-f8abce994b87',\n '8632884b-10f0-4530-962f-7f4f1210bbab',\n 'af52b9f4-d133-4ef5-a620-64d5d568eac8']\n\n @ViewChild('sellLink') sellLink!: any;\n company$ = this.store.pipe(\n select(PdvSelectors.selectCompany),\n map((company) => company ?? null)\n );\n constructor(\n private modalService: BsModalService,\n private eventService: EventService,\n private orderService: OrderService,\n private alertService: AlertService,\n private scriptService: ScriptService,\n private renderer: Renderer2,\n private authService: AuthService,\n private activatedRoute: ActivatedRoute,\n private router: Router,\n private myProfileService: MyProfileService,\n private formBuilder: FormBuilder,\n private formHelper: FormHelper,\n private JsonLDService: JsonLDService,\n private mapV2Service: MapV2Service,\n private titleService: Title,\n private metaService: Meta,\n private store: Store,\n ) { }\n\n ngOnInit(): void {\n this.checkFeng();\n this.loadEvent();\n\n this.voucherlink = environment.voucherlink\n\n if (environment.site != null) {\n this.site = environment.site\n }\n\n if (\n this.authService.getCustomer() != null &&\n this.authService.getCustomer().modeComissioner != null &&\n this.authService.getCustomer().modeComissioner == true\n ) {\n this.comissionerMode = true;\n }\n\n this.formHolder = this.formBuilder.group(\n {\n doc: ['', Validators.required],\n email: ['', [Validators.required, Validators.email]],\n phone: [''],\n name: ['', Validators.required],\n },\n {\n validators: [this.formHelper.testCpf, this.formHelper.testFullName],\n }\n );\n\n // if (environment.newIntegration == true) {\n // let user = this.authService.getCustomer() as any\n // user.newIntegration = true\n // this.authService.saveCustomer(user);\n // }\n\n this.showCupom = environment.showCupom !== false;\n\n this.checkNewIntegration();\n }\n\n\n removeAccents(s) {\n let r = s.toLowerCase();\n r = r.replace(new RegExp(/\\s/g), \"\");\n r = r.replace(new RegExp(/[àáâãäå]/g), \"a\");\n r = r.replace(new RegExp(/æ/g), \"ae\");\n r = r.replace(new RegExp(/ç/g), \"c\");\n r = r.replace(new RegExp(/[èéêë]/g), \"e\");\n r = r.replace(new RegExp(/[ìíîï]/g), \"i\");\n r = r.replace(new RegExp(/ñ/g), \"n\");\n r = r.replace(new RegExp(/[òóôõö]/g), \"o\");\n r = r.replace(new RegExp(/œ/g), \"oe\");\n r = r.replace(new RegExp(/[ùúûü]/g), \"u\");\n r = r.replace(new RegExp(/[ýÿ]/g), \"y\");\n r = r.replace(new RegExp(/\\W/g), \"\");\n return r;\n }\n\n\n ngOnDestroy(): void {\n this.unsubscribe$.next(null);\n this.unsubscribe$.complete();\n this.removePub()\n this.scriptService.defineDefaultMeta()\n this.scriptService.removeAnalytics(\"event\")\n this.scriptService.removeTagManager(\"eventtag\")\n this.scriptService.removeTagManageriFrame(\"eventtagf\")\n }\n\n removePub() {\n for (let i = 0; i < document.getElementsByTagName(\"script\").length; i++) {\n if (document.getElementsByTagName(\"script\")[i].id != null) {\n if (document.getElementsByTagName(\"script\")[i].id == \"CleverCoreLoader79488\") {\n document.getElementsByTagName(\"script\")[i].src = \"\"\n document.getElementsByTagName(\"script\")[i].id = \"\"\n }\n }\n }\n\n for (let i = 0; i < document.getElementsByTagName(\"div\").length; i++) {\n if (document.getElementsByTagName(\"div\")[i].id != null) {\n if (document.getElementsByTagName(\"div\")[i].id.indexOf(\"clever-79488-\") > -1) {\n document.getElementsByTagName(\"div\")[i].remove()\n }\n }\n }\n }\n\n getCustomerTickets() {\n this.loadingBuyedTickets = true\n this.eventService.getCustomerBuyedTickets(this!.event!.id).subscribe((re) => {\n this.loadingBuyedTickets = false\n this.customerTicketsBuyed = re.total\n })\n }\n\n\n /*\n checa se tem comissário\n */\n checkComissioner() {\n // id se houver comissário\n let rfr = this.activatedRoute.snapshot.queryParams['rfr'];\n let url = this.activatedRoute.snapshot.queryParams['url'];\n\n if (rfr != null && rfr !== '') {\n // caso haja comissário irá salvar em uma variável que será passada ao método de pagamento\n this.comissaryId = rfr;\n if (!this.authService.isLoggednIn()) {\n this.router.navigateByUrl(\n 'auth/login?redirect=checkout&eventId=' +\n this.event?.id +\n '&rfr=' +\n rfr\n );\n } else {\n this.router.navigateByUrl(\n 'payment-method/' +\n this.activatedRoute.snapshot.paramMap.get('id') +\n '?rfr=' +\n rfr\n );\n }\n }\n }\n\n /*\n checa nova integração\n */\n checkNewIntegration() {\n // id se houver comissário\n let rfr = this.activatedRoute.snapshot.queryParams['rfr'];\n let url = this.activatedRoute.snapshot.queryParams['url'];\n if (rfr != null && rfr !== '' && url != null && url !== '') {\n this.eventService.loadEventOrder(rfr).subscribe((re: any) => {\n if (!re || re.length == 0) {\n this.alertService.toast({\n icon: 'error',\n title: 'Erro',\n text: 'Não foi possível encontrar o seu pedido',\n });\n return\n }\n\n let user = re[0].customer;\n user.phones = re[0].customer.phones;\n //delete user.phones;\n this.authService.saveCustomer(user);\n\n this.alertService.toast({\n icon: 'success',\n title: 'Usuário logado',\n text: 'Usuário logado',\n });\n\n this.router\n .navigateByUrl('/', { skipLocationChange: true })\n .then(() => {\n this.router.navigateByUrl(\n 'payment-method/' +\n this.activatedRoute.snapshot.paramMap.get('id') +\n '?rfr=' +\n rfr +\n '&url=stisa'\n );\n });\n });\n // caso haja comissário irá salvar em uma variável que será passada ao método de pagamento\n // if (!this.authService.isLoggednIn()) {\n // this.router.navigateByUrl('auth/login?redirect=checkout&eventId='+this.event?.id+'&rfr='+rfr);\n // } else {\n // this.router.navigateByUrl('payment-method/'+this.activatedRoute.snapshot.paramMap.get('id')+'?rfr='+rfr);\n // }\n }\n }\n\n public selectSector(sectorId: string): void {\n this.selectedSector = undefined\n const index = this.sectors?.findIndex((s) => s.id == sectorId);\n if (index != -1) {\n this.selectedSector = sectorId;\n this.indexSector = index as number;\n this.selectedSeats = [];\n this.totalPriceSeats = 0;\n }\n }\n\n\n\n public mapV2Change(event: MapV2Change): void {\n this.selectedSector = event.sectorId;\n this.indexSector = this.sectors!.findIndex((s) => s.id == event.sectorId);\n if (this.indexSector <= -1) {\n this.alertService.toast({ icon: 'error', title: 'Erro', text: 'Ingressos indisponíveis para o setor escolhido' })\n return\n }\n\n // this.sectorsSwiper?.slideTo(this.indexSector);\n // this.sectorsSwiper?.el.scrollIntoView({ block: 'start', inline: 'end', behavior: 'smooth' });\n\n // const deslocamento = this.sectorsSwiper!.el.offsetTop + 80;\n // window.scrollTo({ top: deslocamento, behavior: 'smooth' });\n // let sector = document.getElementById(\"sector\"+this.selectedSector);\n\n // sector!.scrollIntoView({ behavior: \"smooth\", block: \"start\" });\n let sector = document.getElementById(\"sector\" + this.selectedSector)\n\n let y = sector!.getBoundingClientRect().top + window.pageYOffset + (-95);\n\n\n window.scroll(0, y);\n\n\n if (event.place && event.ticket) {\n // Obter ticket selecionado\n const ticket = this.tickets!.find((t) => t.id == event.ticket!.id);\n if (ticket) {\n // Relaciona o place ao ticket\n ticket.mapv2Id = event.place.mapId;\n ticket.mapv2Row = event.place.row;\n ticket.mapv2Number = event.place.number;\n\n if (event.place.isReserved) {\n const qtyEventType: QtyEventType = {\n target: ticket,\n qty: 1,\n action: 'add',\n };\n\n for (let i = 0; i < event.place.quantity; i++) {\n this.qtyChanged(qtyEventType);\n qtyEventType.qty++;\n }\n } else {\n const qtyEventType: QtyEventType = {\n target: ticket,\n qty: event.place.quantity,\n action: 'remove',\n };\n\n for (let i = 0; i < event.place.quantity; i++) {\n this.qtyChanged(qtyEventType);\n qtyEventType.qty--;\n }\n }\n }\n }\n }\n\n openPaymentConfirmationModal(paymentConfirmationModal: TemplateRef) {\n this.openPaymentConfirmationModalRef = this.modalService.show(\n paymentConfirmationModal, { backdrop: 'static' }\n );\n }\n\n getHolder() {\n if (this.formHolder.status == 'INVALID') {\n this.alertService.toast({\n icon: 'error',\n title: 'Erro',\n text: 'Preencha todos os campos antes de continuar',\n });\n return;\n } else {\n this.swiper?.slideNext();\n }\n }\n\n checkCustomerRegister(eve: any) {\n if (eve.srcElement.value.length == 14) {\n this.myProfileService\n .checkCustomerRegisterWithCpf(eve.srcElement.value)\n .subscribe((res: any) => {\n if (res.length >= 1) {\n this.formHolder!.get('name')!.setValue(res[0].name);\n this.formHolder!.get('email')!.setValue(res[0].email);\n this.formHolder!.get('phone')!.setValue(res[0].phones[0]);\n }\n });\n }\n }\n\n /*\n checa feng\n */\n checkFeng() {\n // console.log(this.route);\n let sessionId = this.activatedRoute.snapshot.queryParams['session'];\n if (sessionId != null && sessionId !== '') {\n // checa se tem feng, se tiver loga o usuário\n this.myProfileService\n .checkToken(\n sessionId,\n this.activatedRoute.snapshot.paramMap.get('id') as string\n )\n .pipe(\n catchError((error: any) => {\n this.alertService.toast({\n icon: 'error',\n title: 'Erro',\n text: error.error.error.errors[0].msg,\n });\n return of(error);\n })\n )\n .subscribe((res: any) => {\n\n let user = res.user;\n user.token = res.token;\n user.phones = res.user.phones;\n this.authService.saveCustomer(user);\n\n this.alertService.toast({\n icon: 'success',\n title: 'Usuário logado',\n text: 'Bem vindo ' + res?.user?.name || '',\n });\n\n this.loadEvent();\n });\n }\n }\n\n public get termsOfUseAccepted() {\n return this.orderService.termsOfUseAccepted();\n }\n\n public get halfTickets() {\n const tickets = this.tickets?.filter((ticket) => {\n if (ticket.type == 'Half' || ticket.type == \"SolidarityTicket\") {\n return true;\n }\n return false;\n });\n\n return tickets ?? [];\n }\n\n public get fullTickets() {\n const tickets = this.tickets?.filter((ticket) => {\n if (ticket.type == 'Full') {\n return true;\n }\n return false;\n });\n\n return tickets ?? [];\n }\n\n /*\n preços dos ingressos que foram adicionados usando o componente de ingressos por quantidade\n */\n public amount(ticket?: any): number {\n let fees = true\n if (this.selectedPaymentMethodName == \"Dinheiro\") {\n fees = false\n }\n return this.orderService.amount(ticket, fees);\n }\n\n /*\n conta os tickets que vem do componente de ingressos pro quantidade\n */\n public countTickets(ticketId?: string, placeName?: string): number {\n return this.orderService.countTickets(ticketId, placeName);\n }\n\n public changeQty(eve: QtyEventType): void {\n if (this.event?.allowMapV2 && this.mapV2Service.hasPlaces(this.selectedSector as string)) {\n this.mapV2Service.setView(MapView.PLACES);\n this.mapV2Service.show();\n } else {\n this.qtyChanged(eve);\n }\n }\n\n private qtyChanged(eve: QtyEventType): void {\n if (eve.action == 'add') {\n // Verifica se o ticket id pertence a regra de somente um ingresso para um cliente\n if (this.ticketIdForOnlyOneCustomer.includes(eve.target.id)) {\n return;\n }\n\n // se ingressos estiverem no modo cupom\n if (this.isCupom == true) {\n if (eve.target.ticketTagsQuantity != null && eve.target.ticketTagsQuantity !== 0) {\n // verifica se a quantidade de ingressos escolhidos é mais que a quantidade disponível, se for, exibe um erro\n if (eve.qty > eve.target.ticketTagsQuantity) {\n this.alertService.toast({\n icon: 'error',\n title: 'Erro',\n text: 'A quantidade de ingressos é mais do que a quantidade disponível. Você tem ' + eve.target.ticketTagsQuantity + ' ingresso(s) para o cupom ' + this.ticketCupom\n });\n return;\n }\n }\n }\n\n if (this.fengIntegration == true) {\n if (eve.target.fengPlansPartner && eve.target.fengPlansPartner.length > 0) {\n if (this.quantityPctValuePartner! == 0) {\n this.alertService.toast({ icon: 'error', title: 'Erro', text: 'Não há mais este desconto disponível' }); this.quantityPctValuePartner = 0;\n return;\n }\n }\n else if (eve.target.fengPlansExtra && eve.target.fengPlansExtra.length > 0) {\n if (this.quantityPctValueExtra! == 0) {\n this.alertService.toast({ icon: 'error', title: 'Erro', text: 'Não há mais este desconto disponível' });\n return;\n }\n }\n else if (eve.target.fengPlansInvited && eve.target.fengPlansInvited.length > 0) {\n if (this.quantityPctValueInvited! == 0) {\n this.alertService.toast({ icon: 'error', title: 'Erro', text: 'Não há mais este desconto disponível' });\n return;\n }\n }\n\n for (let i = 0; i < this.orderService.getAllTickets().length; i++) {\n if (this.orderService.getAllTickets()[i].sectorId !== eve.target.sectorId) {\n this.alertService.toast({ icon: 'error', title: 'Erro', text: 'Não pode comprar ingressos em setores diferentes.' });\n return;\n }\n }\n }\n }\n \n let ticket = {\n batch: eve.target.batch,\n description: eve.target.description,\n fee: eve.target.fee,\n fees: eve.target.fees,\n ownerPorscheTicket: eve.target.id == 'f66f2e5c-58a0-4531-b3ef-035e3b5bb7af' ? true : false,\n id: eve.target.id,\n ticketTags: this.ticketCupom,\n ticketDateId: eve.target.ticketDateId,\n name: eve.target.name,\n position: eve.target.position,\n price: eve.target.price,\n fengPlansExtra: eve.target.fengPlansExtra,\n fengPlansInvited: eve.target.fengPlansInvited,\n fengPlansPartner: eve.target.fengPlansPartner,\n qty: eve.qty == 0 ? eve.qty + 1 : eve.qty,\n lotId: eve.target.lotId,\n sectorId: eve.target.sectorId,\n unitPrice: eve.target.priceks,\n blacklist: eve.target.blacklist,\n mapv2Id: eve.target.mapv2Id,\n mapv2Row: eve.target.mapv2Row,\n mapv2Number: eve.target.mapv2Number,\n useFacialRecognition: eve.target.useFacialRecognition,\n };\n\n if (this.fengIntegration == true) {\n if (eve.action == 'add') {\n // console.log(this.canNewFengDiscount(eve.target));\n\n if (this.canNewFengDiscount(eve.target) == true) {\n this.changeCountFengDiscount(eve.target, eve.qty, eve.action);\n }\n }\n\n if (eve.action == 'remove') {\n // this.orderService.removeTicket(ticket.id);\n this.changeCountFengDiscount(eve.target, eve.qty, eve.action);\n }\n }\n\n if (eve.action == 'add') {\n this.orderService.addTicket(ticket);\n } else {\n this.orderService.removeTicket(eve.target.id);\n }\n }\n\n public showTicketHolders() {\n const modal = this.modalService.show(TicketHoldersComponent, {\n class: 'modal-dialog-centered modal-lg page-mobile',\n initialState: {\n customerDataRequirementType: this.customerDataRequirementType\n },\n });\n\n modal.content?.onComplete.pipe(takeUntil(this.unsubscribe$))\n .subscribe(isCompleted => {\n if (isCompleted) {\n this.ticketHoldersSubmitted = true;\n this.hideTicketHolders();\n this.buy();\n }\n });\n }\n\n public hideTicketHolders() {\n this.modalService.hide();\n }\n\n public termsOfUseChanged(ev: any) {\n this.orderService.setTermsOfUse(ev.target.checked);\n }\n\n public buy() {\n let numberTickets: any = [];\n this.orderService.getAllTickets().forEach((element) => {\n if (\n element.isMapPlace == null ||\n element.isMapPlace == undefined ||\n element.isMapPlace == false\n ) {\n numberTickets[numberTickets.length] = element;\n }\n });\n\n if (this.event!.limitByCPF! > 0) {\n const limit = this.event!.limitByCPF! - this.customerTicketsBuyed;\n const qttToBuy = this.orderService.getAllTickets().length\n if (this.authService.getCustomer() != null && this.authService.getCustomer().doc != null) {\n if (limit <= 0) {\n this.alertService.toast({\n icon: 'error',\n title: 'Limite atingido',\n text: 'O CPF ' + this.authService.getCustomer().doc + ' já excedeu o numero de compras para esse evento.',\n });\n return\n } else if (limit - qttToBuy < 0 && this.customerTicketsBuyed == 0) {\n this.alertService.toast({\n icon: 'error',\n title: 'Você escolheu mais ingressos do que o permitido',\n text: 'Limite excedido para o CPF ' + this.authService.getCustomer().doc +\n ' este CPF só pode comprar ' + limit + ' ingresso(s) deste evento, porém tentou comprar ' + qttToBuy,\n });\n return\n } else if (limit - qttToBuy < 0 && this.customerTicketsBuyed != 0) {\n this.alertService.toast({\n icon: 'error',\n title: 'Você escolheu mais ingressos do que o permitido',\n text: 'Limite excedido para o CPF ' + this.authService.getCustomer().doc +\n ' este CPF pode comprar somente mais ' + limit + ' ingresso(s) deste evento',\n });\n return\n }\n } \n // else {\n // this.alertService.toast({\n // icon: 'error',\n // title: 'Login necessário!',\n // text: 'É preciso estar logado para comprar esses ingressos pois exige verificação de CPF'\n // });\n // return\n // }\n\n } else {\n if (this.event?.limitCPF && numberTickets.length > this.event.limitCPF) {\n this.alertService.toast({\n icon: 'error',\n title: 'Limite de ingressos excedido',\n text: `Só é permitido ${this.event.limitCPF} ingressos por CPF.`,\n });\n return\n }\n }\n\n\n\n if (!this.orderService.termsOfUseAccepted()) {\n this.alertService.toast({\n icon: 'error',\n title: 'Aceite os termos de uso',\n text: 'Você precisa aceitar os termos de uso para prosseguir.',\n });\n } else if (this.orderService.countTickets() == 0) {\n this.alertService.toast({\n icon: 'error',\n title: 'Selecione os ingressos',\n text: 'Selecione no mínimo 1 ingresso para continuar.',\n });\n } else if (this.orderService.existsBlacklist()) {\n this.alertService.toast({\n icon: 'error',\n title: 'Blacklist',\n text: `CPF bloqueado para adquirir o ingresso. ${this.orderService.ticketNameBlacklist()}`,\n });\n } else if (this.customerDataRequirementType != CustomerDataRequirementTypeEnum.NotRequired && !this.ticketHoldersSubmitted) {\n this.showTicketHolders()\n } else if (!this.authService.isLoggednIn()) {\n this.router.navigateByUrl('/auth/login?redirect=checkout&org=' + this.router.url);\n } else {\n\n if (this.comissaryId !== null) {\n this.router.navigateByUrl('/payment-method?rfr=' + this.comissaryId);\n } else {\n this.orderService.currentOrder\n .pipe(takeUntil(this.unsubscribe$))\n .subscribe(order => {\n if (order != null) {\n if (order.event != null) {\n if (order.tickets.length >= 1) {\n this.router.navigateByUrl('/payment-method/');\n } else {\n this.alertService.toast({\n icon: 'error',\n title: 'Escolha um ingresso',\n text: 'Você precisa escolher um ingresso para continuar',\n });\n }\n } else {\n window.location.reload()\n }\n } else {\n window.location.reload()\n }\n })\n }\n }\n }\n\n openHalfEntryModalInformation(halfEntryModalInformation: TemplateRef) {\n this.halfEntryModalInformationRef = this.modalService.show(\n halfEntryModalInformation,\n { class: 'modal-dialog-scrollable modal-lg' }\n );\n }\n\n openFormPorsche(formPorscheModal: TemplateRef) {\n let owner = this.orderService.getAllTickets().filter((ticket: any) => {\n if (ticket.id == 'f66f2e5c-58a0-4531-b3ef-035e3b5bb7af') {\n return ticket;\n }\n });\n\n if (owner.length >= 1) {\n this.ownerPorscheTicket = true;\n this.ownerPorscheTicketQuantity = owner.length;\n } else {\n this.ownerPorscheTicket = false;\n }\n\n if (this.ownerPorscheTicket == true) {\n if (!this.orderService.termsOfUseAccepted()) {\n this.alertService.toast({\n icon: 'error',\n title: 'Aceite os termos de uso',\n text: 'Você precisa aceitar os termos de uso para prosseguir.',\n });\n } else if (this.orderService.countTickets() == 0) {\n this.alertService.toast({\n icon: 'error',\n title: 'Selecione os ingressos',\n text: 'Selecione no mínimo 1 ingresso para continuar.',\n });\n } else if (this.orderService.existsBlacklist()) {\n this.alertService.toast({\n icon: 'error',\n title: 'Blacklist',\n text: `CPF bloqueado para adquirir o ingresso. ${this.orderService.ticketNameBlacklist()}`,\n });\n } else if (\n this.event?.limitCPF &&\n this.orderService.countTickets() > this.event.limitCPF\n ) {\n this.alertService.toast({\n icon: 'error',\n title: 'Limite de ingressos excedido',\n text: 'Só é permitido ' + this.event.limitCPF + ' ingressos por CPF.',\n });\n } else {\n this.openFormPorscheModalRef = this.modalService.show(\n formPorscheModal,\n { class: 'modal-dialog-scrollable' }\n );\n }\n } else {\n this.buy();\n }\n }\n\n public getPorscheOwner(eve: any) {\n if (eve == true) {\n this.buy();\n this.openFormPorscheModalRef?.hide();\n }\n }\n\n loadOrder() {\n this.orderService.currentOrder\n .pipe(takeUntil(this.unsubscribe$))\n .subscribe((order) => {\n this.order = order;\n this.eventName = order!.event!.name;\n\n this.selectedTickets = this.order.tickets.filter(\n (ticket, index, self) => {\n return (\n index === self.findIndex((ticket2) => ticket2.id === ticket.id) &&\n ticket.placeName == undefined\n );\n }\n );\n\n this.ticketsWithSeats = this.order.tickets.filter(\n (ticket, index, self) => {\n return (\n index ===\n self.findIndex(\n (ticket2) => ticket2.placeName === ticket.placeName\n ) && ticket.placeName !== undefined\n );\n }\n );\n\n this.order.tickets.forEach((ticket, index) => {\n if (ticket.orderMapReserveCode != null) {\n this.orderMapReserveCode = ticket.orderMapReserveCode;\n }\n });\n\n this.allTickets.length = 0;\n this.allTickets = this.allTickets\n .concat(this.selectedTickets, this.ticketsWithSeats)\n .filter((ticket: any) => {\n return ticket !== undefined;\n });\n });\n }\n\n public sell(titularModal: TemplateRef) {\n if (this.orderService.countTickets() == 0) {\n this.alertService.toast({\n icon: 'error',\n title: 'Selecione os ingressos',\n text: 'Selecione no mínimo 1 ingresso para continuar.',\n });\n } else {\n this.loadOrder();\n this.titularModalRef = this.modalService.show(titularModal, { backdrop: 'static' });\n }\n }\n\n createSellOrder() {\n\n let pdvCommissary = \"\"\n\n // faz loop em todos o tickets\n this.allTickets.forEach((ticket) => {\n\n \n \n // faz loop nos tickets baseado na quantidade de ingressos selecionados de certo ticket\n for (\n let index = 0;\n index < this.countTickets(ticket.id, ticket.placeName);\n index++\n ) {\n // adiciona cada ticket a um array de tickets que será adicionado na flag tickets na variável params\n this.ticketOrderSubmit[this.ticketOrderSubmit.length] = {\n ticketName: ticket.name,\n lotName: ticket.batch,\n ticketDateId: ticket.ticketDateId,\n lotId: ticket.lotId,\n quantity: ticket.qty,\n placeName: ticket.placeName,\n placeId: ticket.placeId,\n placeHoldToken: ticket.placeHoldToken,\n unitPrice: this.selectedPaymentMethodName == \"Dinheiro\" ? parseFloat(ticket.price).toFixed(2) : parseFloat((ticket.price + ticket.fee).toFixed(2)),\n unitPriceWithoutFee: ticket.price,\n customer: {\n name: this.formHolder!.get('name')!.value,\n doc: this.formHolder!.get('doc')!.value,\n email: this.formHolder!.get('email')!.value,\n phones: [this.formHolder!.get('phone')!.value.trim()],\n loading: false,\n },\n customerRequired: null,\n comissionerId: this.authService.getCustomer().comissionerId,\n };\n }\n });\n\n // parametros que serão enviados no checkout\n let params = {\n order: {\n amount: parseFloat(this.amount().toFixed(2)),\n ticketTags: this.orderService.getOrderEvent().ticketTags,\n orderMapReserveCode: this.orderMapReserveCode,\n paymentInChange: true,\n },\n tickets: this.ticketOrderSubmit, // array de tickets selecionados\n paymentMethods:\n this.selectedPaymentMethod == ''\n ? []\n : [\n {\n amount: parseFloat(this.amount().toFixed(2)),\n installments: 1,\n paymentMethodId: this.selectedPaymentMethod,\n },\n ],\n customer: {\n id: this.authService.getCustomer().id,\n name: this.authService.getCustomer().name,\n doc: this.authService.getCustomer().doc,\n email: this.authService.getCustomer().email,\n phones: [this.authService.getCustomer().phone[0]],\n },\n };\n\n this.loading = true;\n\n // envia compra a API\n this.orderService\n .sendPayment(params)\n .pipe(\n catchError((error: any) => {\n this.loading = false;\n this.orderService.removeAllTickets();\n this.allTickets.length = 0;\n this.alertService.toast({\n icon: 'error',\n title: 'Erro',\n text: error.error.errors[0].msg,\n });\n this.ticketOrderSubmit.length = 0; // em caso de erro, esvazia o arrays de tickets\n if (this.openPaymentConfirmationModalRef) {\n this.openPaymentConfirmationModalRef.hide();\n this.selectedPaymentMethodName = \"\"\n }\n return of(error);\n })\n )\n .subscribe((res: any) => {\n // se tudo estiver ok, gera a pre order\n\n if (res.payments.length == 0) {\n this.ticketOrderSubmit.length = 0; // em caso de erro, esvazia o arrays de ticket\n this.paymentCompleted = false;\n this.swiper?.slideNext();\n this.orderId = res.order.id;\n this.numberOrder = res.order.autoincrement;\n this.loading = false;\n }\n\n\n if (res.payments.length !== 0 && res.payments[0].success == true) {\n this.swiper?.slideNext();\n this.orderId = res.order.id;\n this.numberOrder = res.order.autoincrement;\n this.paymentCompleted = true;\n this.ticketOrderSubmit.length = 0; // em caso de erro, esvazia o arrays de ticket\n this.loading = false;\n }\n\n this.loading = false;\n\n if (this.openPaymentConfirmationModalRef) {\n this.openPaymentConfirmationModalRef.hide();\n this.selectedPaymentMethodName = '';\n }\n\n });\n }\n\n openCloseMap(sectorId: string, mapModal: TemplateRef) {\n if (this.showMap == true && this.selectedSector == sectorId) {\n this.showMap = false; \n this.selectedSeatSector = \"\"\n } else if (this.showMap == false) {\n this.showMap = true;\n this.mapModalRef = this.modalService.show(\n mapModal,\n { class: 'modal-dialog-scrollable modal-lg' }\n );\n } else if (this.showMap == true && this.selectedSector != sectorId) {\n this.modalService.hide()\n this.showMap = true;\n }\n this.selectedSector = sectorId\n }\n\n copySellLink() {\n (document!.getElementById('selllink') as any)!.select();\n document.execCommand('copy');\n }\n\n public onSwiper(swiper: any) {\n this.swiper = swiper;\n }\n\n public holdersSubmitted(e: any) {\n e.preventDefault();\n this.swiper?.slideNext();\n }\n\n public cardSubmitted(e: any) {\n e.preventDefault();\n this.swiper?.slideTo(0);\n }\n\n /*\n pega os assentos selecionados no componente seatsio caso tenha de acordo com o tipo do assento (seats ou generalAdmissionArea)\n */\n public getSelectedSeats(eve: any): void {\n if (this.selectedSeats!.length < this.event!.limitCPF!) {\n // ingresso com assento\n eve.ticket = {\n description: null,\n fee: eve.ticket.fee,\n pdvs: eve.ticket.pdvs,\n fees: eve.ticket.fees,\n id: eve.ticket.id,\n ticketDateId: eve.ticket.ticketDateId,\n lotId: eve.ticket.lotId,\n name: eve.ticket.name,\n position: 1,\n price: eve.ticket.price,\n qty: 1,\n isSeatsIo: true,\n objectType: eve.selectedSeat.objectType,\n placeHoldToken: eve.selectedSeat.chart.holdToken,\n sectorId: eve.ticket.sectorId,\n placeName: eve.selectedSeat.id, // nome/id do assento escolhido\n };\n\n // salva os assentos selecionados bem como o preço e o tipo do ingresso em uma variável\n this.selectedSeats[this.selectedSeats.length] = {\n ticketId: eve.ticket.id,\n ticketDateId: eve.ticket.ticketDateId,\n lotId: eve.ticket.lotId,\n pdvs: eve.ticket.pdvs,\n batchName: eve.ticket.batch,\n ticketName: eve.ticket.name,\n quantity: 1,\n ticketTags: this.ticketCupom,\n price: eve.ticket.price,\n fees: eve.ticket.fees,\n customer: null,\n placeId: null,\n isSeatsIo: true,\n objectType: eve.selectedSeat.objectType,\n placeName: eve.selectedSeat.id,\n placeHoldToken: eve.selectedSeat.chart.holdToken,\n fee: eve.ticket.fee,\n };\n\n this.calculateTotalPricesSeats('+' + (eve.ticket.price + eve.ticket.fee));\n\n // passa o ingresso com assento para a função addTickets para poderemos identificar quando o ingresso está ou não salvo e\n // define true para sabermos que o ingresso vem do seatsio pois o seatsio soma valores toda vez que é iniciado (ao trocar de aba e retornar)\n this.orderService.addTicket(eve.ticket, true);\n }\n }\n\n /*\n remove tickets selecionados no seatsio no order service toda vez que aba mudar, pois os ingressos são carregados\n automaticamente pelo seatsio quando o chart é renderizado, do contrário irá somar novamente com os valores existentes\n */\n public removeTicketsFromOrderService() {\n this.selectedSeats.forEach((seats: any) => {\n this.orderService.removeTicket(seats.ticketId);\n });\n }\n\n closeMapModal() {\n this.mapModalRef?.hide(); \n this.showMap = false; \n document?.getElementById(\"next\")?.scrollIntoView({ behavior: \"smooth\"})\n }\n\n /*\n remove os assentos selecionados da variável selectedSeats pelo id do assento\n */\n public removeSelectedSeats(eve: any): void {\n this.selectedSeats.forEach((seat: any, id: number) => {\n if (seat.placeName == eve.id) {\n this.selectedSeats.splice(id, 1);\n this.orderService.removeTicketByPlaceName(eve.id);\n this.calculateTotalPricesSeats('-' + (seat.price + seat.fee));\n }\n });\n }\n\n getLoadingSeatsIo(eve: any) {\n this.loadingSeatsIo = eve;\n }\n\n getOpenEvent(eve: any) {\n if (eve == \"open\") {\n this.showEventInfo = true\n this.isCountDown0 = true\n }\n \n }\n\n /*\n calcula o preço dos assentos selecionados\n */\n private calculateTotalPricesSeats(price: string): void {\n this.totalPriceSeats = this.totalPriceSeats + parseInt(price);\n }\n\n /*\n busca o evento no serviço\n */\n private loadEvent() {\n const id = this.activatedRoute.snapshot.paramMap.get('id');\n const slug = this.activatedRoute.snapshot.paramMap.get('slug');\n this.eventSlug = slug\n this.eventId = id as any\n const params: any = {};\n\n if (slug) {\n params.slug = slug;\n } else {\n params.eventId = id;\n }\n //console.log(this.comissionerMode);\n\n if (\n this.authService.getCustomer() != null &&\n this.authService.getCustomer().modeComissioner != null &&\n this.authService.getCustomer().modeComissioner == true\n ) {\n params.comissionerId = this.authService.getCustomer().comissionerId;\n }\n\n\n // console.log(params);\n\n this.eventService\n .find(params)\n .pipe(\n takeUntil(this.unsubscribe$),\n catchError((error: any) => {\n console.log(error);\n this.loading = false;\n //this.alertService.toast({ icon: 'error', title: 'Erro',text: error.error.errors[0].msg});\n if (error.error.errors[0].msg == 'Vendas encerradas.') {\n this.fengEndedSells = true;\n } else {\n this.router.navigateByUrl('/?tag=' + params.slug);\n }\n return of(error);\n })\n )\n .subscribe((event) => {\n if (event.error == undefined) {\n this.event = event;\n console.log(this.event);\n \n console.log(this.event);\n \n\n if (this.event?.categories != null && this.event?.categories.length != null && this.event.categories.length >=1 && this.event.categories[0].name != null && this.event.categories[0].name.toLowerCase() == \"esportes\") {\n this.categorySports = true\n }\n\n if (this?.event?.id == \"53ef9bc2-02a6-4f8b-a9ca-bb452fbe98db\"){\n this.showEventInfo = false\n }\n\n this.sendBanner.emit(this.event?.banner)\n this.loadScript()\n this.titleService.setTitle(this!.event!.name);\n this.metaService.updateTag({ property: 'description', content: this!.event!.description as string });\n this.metaService.updateTag({ property: 'og:title', content: this!.event!.name });\n this.metaService.updateTag({ property: 'og:image', content: this!.event!.banner as string });\n if (this.authService.getProducer() != null && this.authService.getProducer().user != null && this.authService.getProducer().user.producerOwnerId != null && this.authService.getProducer().user.producerOwnerId == \"28164152-03a1-4bce-b96f-9fe223d32d98\" && this.hideAdvertising.indexOf(this.event?.id) > -1) {\n this.showPub = false\n this.removePub()\n }\n\n this.scriptService.loadAnalytics(this.event?.googleAnalyticsKey as string, \"event\")\n\n if (this?.event?.googleTagManagerKey != null) {\n this.scriptService.loadTagManager(this.event?.googleTagManagerKey as string, \"eventtag\")\n }\n\n if (this.showPub == true && this.hideAdvertising.indexOf(this.event?.id) <= -1) {\n this.loadScript2();\n }\n\n\n\n this.checkComissioner();\n\n // se a opção de esconder inteiras estiver marcada, vai exibir botões para exibir e ocultar inteiras\n if (this.event?.hideFullTickets == true) {\n this.hideFullTicket = true;\n }\n\n if (this.event?.seatsioEventKey != null) {\n this.hasSeatsChart = true;\n }\n\n if (this.event?.fbPixel != null && this.event?.fbPixel !== \"\") {\n this.loadScript3(this.event?.fbPixel)\n }\n\n if (this.authService.isLoggednIn()) {\n this.getCustomerTickets()\n }\n // console.log(this.event?.integrations);\n\n if (\n this.event?.integrations &&\n this.event?.integrations.indexOf('Feng') != -1 &&\n this.authService.isLoggednIn() &&\n this.authService.getCustomer().fengPlanId\n ) {\n this.fengIntegration = true;\n\n if (this.event!.tickets!.length < 1) {\n this.eventClosed = true;\n this.customerName = this.authService.getCustomer().name;\n }\n\n\n if (this.authService.isLoggednIn()) {\n this.quantityPctValuePartner = this.authService.getCustomer()\n .quantityPctValuePartner as number;\n this.quantityPctValueInvited = this.authService.getCustomer()\n .quantityPctValueInvited as number;\n this.quantityPctValueExtra = this.authService.getCustomer()\n .quantityPctValueExtra as number;\n\n this.quantityPctValuePartnerFixed = this.quantityPctValuePartner;\n this.quantityPctValueInvitedFixed = this.quantityPctValueInvited;\n this.quantityPctValueExtraFixed = this.quantityPctValueExtra;\n }\n } else {\n this.fengIntegration = false;\n }\n\n // console.log(this.fengIntegration)\n\n\n this.sectors = event.sectors;\n this.tickets = event.tickets;\n this.event!.fengIntegration = this.fengIntegration;\n\n\n let sectorsWithSeats = 0\n this.sectors?.forEach((sector) => {\n if (sector.useSeats != null && sector.useSeats == true) {\n this.seatsIOSectors[this.seatsIOSectors.length] = sector.name\n }\n })\n\n // if(sectorsWithSeats == this.sectors!.length){\n // this.allSectorsUseSetsio = true\n // }\n\n this.orderService.setEvent(this.event!);\n if (event.sectors) {\n this.selectedSector = event.sectors[0].id;\n }\n if (this.activatedRoute.snapshot.queryParamMap.get('checkout')) {\n this.buy();\n }\n\n if (this.event?.useGoogleEvents) {\n this.loadStructureData(event);\n }\n }\n\n let cupom = this.activatedRoute.snapshot.queryParams['cupom'];\n if (cupom != null && cupom !== '') {\n this.ticketCupom = this.activatedRoute.snapshot.queryParams['cupom'];\n this.sendCupomTicket();\n }\n\n this.orderService.getAllTickets().forEach((ticket: any) => {\n this.changeCountFengDiscount(ticket, 1, 'add');\n });\n\n this.checkCustomerDataRequirementType();\n });\n }\n\n checkCustomerDataRequirementType() {\n if (!this.event) {\n return\n }\n if (this.event.skipCustomerDataOnPdv == true) {\n this.customerDataRequirementType = CustomerDataRequirementTypeEnum.NotRequired;\n } else if (this.event.requireCustomerDataOnPdv == true) {\n this.customerDataRequirementType = CustomerDataRequirementTypeEnum.Obrigatory;\n } else {\n this.customerDataRequirementType = CustomerDataRequirementTypeEnum.Optional;\n }\n }\n\n /*\n aplica cupom\n */\n sendCupomTicket() {\n if (this.ticketCupom == '') {\n this.ticketCupomError = 'Informe um código';\n return;\n } else {\n this.ticketCupomError = '';\n }\n\n this.loading = true;\n // envia o cupom de desconto usando id ou slug do evento\n let params: any = {\n ticketTags: '',\n };\n\n params.ticketTags = this.ticketCupom;\n params.eventId = this.event!.id;\n // if (this.event!.slugs && this.event!.slugs!.length > 0) {\n // params.slug = this.event!.slugs[0]!.slug;\n // } else {\n // params.id = this.event!.id;\n // }\n\n // busca ingressos no evento que tem o cupom se tiver algum\n this.eventService\n .getCupomTicket(params)\n .pipe(\n takeUntil(this.unsubscribe$),\n catchError((error: any) => {\n this.alertService.toast({\n icon: 'error',\n title: 'Falha ao aplicar cupons',\n text: 'Nenhum ingresso encontrado para o código digitado',\n });\n this.loading = false;\n return of(error);\n })\n )\n .subscribe((res: any) => {\n if (res.id != null) {\n this.orderService.removeAllTickets();\n res.ticketTags = this.ticketCupom;\n\n this.loading = false;\n this.isCupom = true;\n\n this.event = res;\n \n if (this.event?.categories != null && this.event?.categories.length != null && this.event.categories.length >=1 && this.event.categories[0].name != null && this.event.categories[0].name.toLowerCase() == \"esportes\") {\n this.categorySports = true\n }\n\n this.sendBanner.emit(this.event?.banner)\n\n this.orderService.setEvent(res);\n // atribui novos setores e ingressos aos setores e ingressos existentes, substituindo-os\n this.sectors = res.sectors;\n this.tickets = res.tickets;\n\n\n // define o sector selecionado como o primeiro\n this.selectedSector = res.sectors[0].id;\n\n let ticketQuantity = 0\n\n res.tickets.forEach((ticket) => {\n if (ticket.ticketTagsQuantity != null) {\n ticketQuantity = ticketQuantity + ticket.ticketTagsQuantity\n }\n });\n\n this.alertService.toast({\n icon: 'success',\n title: 'Cupom ativado!',\n text: 'Ingressos do cupom ' + this.ticketCupom + ' carregados.' \n //Quantidade para uso: ' + ticketQuantity,\n });\n }\n });\n }\n\n public loadScript() {\n if (window != null) {\n this.hasAnalitycs = true\n this.company$.subscribe((res) => {\n if (res != null && res[\"googleAnalyticsKey\"] != null) {\n this.hasAnalitycs = true\n let script = document.createElement('script');\n script.setAttribute(\n 'src',\n 'https://www.googletagmanager.com/gtag/js?id=' + res[\"googleAnalyticsKey\"]\n );\n let dataLayer = window.dataLayer || [];\n function gtag(type, content) {\n dataLayer[dataLayer.length] = arguments;\n }\n gtag('js', new Date());\n\n gtag('config', res[\"googleAnalyticsKey\"]);\n\n let userData = { user_data: null }\n if (this.authService.isLoggednIn() == true) {\n (userData as any).user_data = {\n email_address: this.authService.getCustomer()[\"email\"],\n phone_number: this.authService.getCustomer()[\"phone\"][0],\n address: {\n first_name: this.authService.getCustomer()[\"name\"].split(\" \")[0],\n last_name: this.authService.getCustomer()[\"name\"].split(\" \")[1],\n street: this.authService.getCustomer()[\"addressStreet\"] + \" \" + this.authService.getCustomer()[\"addressNumber\"],\n city: this.authService.getCustomer()[\"addressDistrict\"],\n region: this.authService.getCustomer()[\"addressState\"],\n postal_code: this.authService.getCustomer()[\"addressPostalCode\"],\n country: 'br'\n }\n }\n } \n window.dataLayer = window.dataLayer || [];\n window.dataLayer[window.dataLayer.length] = {\n event: 'view_item', // nome do evento. Não alterar esse campo.\n page_event: {\n userData,\n page_name: this.event!.name\n }\n } \n } \n })\n }\n }\n\n loadScript2() {\n if (environment.enableCleverAdvertising) {\n (function (document, window) {\n var a, c = document.createElement(\"script\"), f = window.frameElement;\n\n c.id = \"CleverCoreLoader79488\";\n c.src = \"https://scripts.cleverwebserver.com/22de7571ff776767c3f3385a9138a14d.js\";\n\n c.async = !0;\n c.type = \"text/javascript\";\n c.setAttribute(\"data-target\", window.name || (f && f.getAttribute(\"id\")));\n c.setAttribute(\"data-callback\", \"put-your-callback-function-here\");\n c.setAttribute(\"data-callback-url-click\", \"put-your-click-macro-here\");\n c.setAttribute(\"data-callback-url-view\", \"put-your-view-macro-here\");\n\n\n try {\n a = parent.document.getElementsByTagName(\"script\")[0] || document.getElementsByTagName(\"script\")[0];\n } catch (e) {\n a = !1;\n }\n\n a || (a = document.getElementsByTagName(\"head\")[0] || document.getElementsByTagName(\"body\")[0]);\n a.parentNode.insertBefore(c, a);\n })(document, window);\n }\n }\n\n loadStructureData(event) {\n const eventData: EventData = {\n name: event.name,\n description: event.description,\n startDate: event.dates[0].dateStartEvent,\n //endDate?: string,\n location: {\n name: event.address,\n streetAddress: event.address,\n addressLocality: event.city,\n //postalCode: string,\n addressRegion: event.state,\n addressCountry: 'BR',\n },\n images: [event.imageWeb],\n companyName: environment.name,\n companyUrl: document.location.origin,\n eventUrl: document.location.origin + document.location.pathname,\n };\n this.JsonLDService.insertSchema(this.JsonLDService.eventSchema(eventData));\n }\n\n // fb pixel\n public loadScript3(fbPixel: any) {\n\n (function (f: any, b: any, e: any, v: any, n: any, t: any, s: any) {\n if (f.fbq) return; n = f.fbq = function () {\n n.callMethod ?\n n.callMethod.apply(n, arguments) : n.queue.push(arguments)\n }; if (!f._fbq) f._fbq = n;\n n.push = n; n.loaded = !0; n.version = '2.0'; n.queue = []; t = b.createElement(e); t.async = !0;\n t.src = v; s = b.getElementsByTagName(e)[0]; s.parentNode.insertBefore(t, s)\n })(window, document, 'script', 'https://connect.facebook.net/en_US/fbevents.js', null, null, null);\n (window as any).fbq.disablePushState = true; //not recommended, but can be done\n (window as any).fbq('init', fbPixel);\n (window as any).fbq('track', 'PageView');\n (window as any).fbq('track', 'ViewContent');\n // console.log('Facebook pixel init run!')\n\n\n // if (window != null) {\n // let fbPixelSource = document.createElement('script');\n // fbPixelSource.setAttribute('src','https://connect.facebook.net/en_US/fbevents.js');\n // //document.head.appendChild(fbPixelSrc);\n // let scripts = (document.getElementsByTagName('script') as unknown as Array);\n // document.getElementsByTagName(\"head\")[0].appendChild(fbPixelSource);\n // scripts.forEach((script: any) => {\n // if (script.src == 'https://connect.facebook.net/en_US/fbevents.js') {\n // fbq.disablePushState = true;\n // fbq('init', fbPixel);\n // fbq('track', 'ViewContent');\n // }\n // });\n\n }\n\n getSelectedMapPlace(eve: any) {\n console.log(eve);\n this.amountSelectedSeatSector = eve[0]\n this.selectedSeatSector = eve[1] \n }\n\n mapTicketDescription(sectorId: string) {\n let tickets = this.tickets?.filter((ticket) => {\n if (ticket.sectorId == sectorId) {\n return ticket\n }\n return\n })\n\n return tickets![0]!.description\n }\n\n canNewFengDiscount(ticket: any) {\n if (\n !(\n (ticket.fengPlansExtra && ticket.fengPlansExtra.length > 0) ||\n (ticket.fengPlansInvited && ticket.fengPlansInvited.length > 0) ||\n (ticket.fengPlansPartner && ticket.fengPlansPartner.length > 0)\n )\n ) {\n return true;\n }\n\n this.orderService.getAllTickets().forEach((savedTicket: any) => {\n if (savedTicket.sectorId !== this.selectedSector) {\n this.buyInOtherSector = true;\n } else {\n this.buyInOtherSector = false;\n }\n });\n\n // if (ticket.sectorId !== this.selectedSector) {\n // buyInOtherSector = true;\n // }\n\n // this.tickets?.forEach((ticketSelected: any) => {\n // if (ticketSelected.sectorId !== ticket.sectorId) {\n // buyInOtherSector = true;\n // }\n // });\n\n if (this.buyInOtherSector == true) {\n this.alertService.toast({\n icon: 'error',\n title: 'Erro',\n text: 'Não pode comprar ingressos em setores diferentes.',\n });\n }\n\n if (ticket.fengPlansPartner && ticket.fengPlansPartner.length > 0) {\n if (this.quantityPctValuePartner <= 0) return false;\n } else if (ticket.fengPlansExtra && ticket.fengPlansExtra.length > 0) {\n if (this.quantityPctValueExtra <= 0) return false;\n } else if (ticket.fengPlansInvited && ticket.fengPlansInvited.length > 0) {\n //console.log(this.quantityPctValueInvited);\n\n if (this.quantityPctValueInvited <= 0) return false;\n }\n return true;\n }\n\n changeCountFengDiscount(ticket: any, count: number, action: string) {\n let countInvited = 0;\n\n if (ticket.fengPlansExtra && ticket.fengPlansExtra.length) {\n if (action == 'remove') {\n this.quantityPctValueExtra += 1;\n } else {\n this.quantityPctValueExtra -= 1;\n }\n }\n if (ticket.fengPlansInvited && ticket.fengPlansInvited.length > 0) {\n if (action == 'remove') {\n this.quantityPctValueInvited += 1;\n } else {\n this.quantityPctValueInvited -= 1;\n }\n }\n if (ticket.fengPlansPartner && ticket.fengPlansPartner.length > 0) {\n if (action == 'remove') {\n this.quantityPctValuePartner += 1;\n } else {\n this.quantityPctValuePartner -= 1;\n }\n }\n }\n}","import { __awaiter } from 'tslib';\nimport * as i0 from '@angular/core';\nimport { Injectable, Component, Input, NgModule } from '@angular/core';\n\nimport * as ɵngcc0 from '@angular/core';\nclass SeatsioService {\n showDesigner(config) {\n return __awaiter(this, void 0, void 0, function* () {\n const seatsioInstance = yield this.getSeatsio(config.region, config.chartJsUrl);\n delete config['chartJsUrl'];\n delete config['region'];\n return new seatsioInstance.SeatingChartDesigner(config).render();\n });\n }\n showSeatingChart(config) {\n return __awaiter(this, void 0, void 0, function* () {\n const seatsioInstance = yield this.getSeatsio(config.region, config.chartJsUrl);\n delete config['chartJsUrl'];\n delete config['region'];\n return new seatsioInstance.SeatingChart(config).render();\n });\n }\n showEventManager(config) {\n return __awaiter(this, void 0, void 0, function* () {\n const seatsioInstance = yield this.getSeatsio(config.region, config.chartJsUrl);\n delete config['chartJsUrl'];\n delete config['region'];\n return new seatsioInstance.EventManager(config).render();\n });\n }\n showChartManager(config) {\n return __awaiter(this, void 0, void 0, function* () {\n const seatsioInstance = yield this.getSeatsio(config.region, config.chartJsUrl);\n delete config['chartJsUrl'];\n delete config['region'];\n return new seatsioInstance.ChartManager(config).render();\n });\n }\n getSeatsio(region, chartJsUrl) {\n if (typeof seatsio !== 'undefined') {\n return Promise.resolve(seatsio);\n }\n return this.loadSeatsio(region, chartJsUrl);\n }\n loadSeatsio(region, chartJsUrl = 'https://cdn-{region}.seatsio.net/chart.js') {\n return new Promise((resolve, reject) => {\n const script = document.createElement('script');\n script.onload = () => resolve(seatsio);\n script.onerror = () => reject(`Could not load ${script.src}`);\n script.src = chartJsUrl.replace('{region}', region);\n document.head.appendChild(script);\n });\n }\n ngOnDestroy() {\n }\n ngOnInit() {\n }\n}\nSeatsioService.ɵfac = function SeatsioService_Factory(t) { return new (t || SeatsioService)(); };\n/** @nocollapse */ SeatsioService.ɵprov = i0.ɵɵdefineInjectable({ factory: function SeatsioService_Factory() { return new SeatsioService(); }, token: SeatsioService, providedIn: \"root\" });\n(function () { (typeof ngDevMode === \"undefined\" || ngDevMode) && ɵngcc0.ɵsetClassMetadata(SeatsioService, [{\n type: Injectable,\n args: [{\n providedIn: 'root'\n }]\n }], null, null); })();\n\nclass SeatsioComponent {\n constructor(seatsioService) {\n this.id = 'chart';\n this.seatsioService = seatsioService;\n }\n render(config) {\n throw new Error('Not implemented');\n }\n ngOnInit() {\n return __awaiter(this, void 0, void 0, function* () {\n if (this.config['divId']) {\n this.id = this.config['divId'];\n }\n if ('onRenderStarted' in this.config) {\n this.config['onRenderStarted']();\n }\n this.chart = yield this.render(this.config);\n });\n }\n ngOnDestroy() {\n if (this.chart) {\n this.chart.destroy();\n }\n }\n}\nSeatsioComponent.ɵfac = function SeatsioComponent_Factory(t) { return new (t || SeatsioComponent)(ɵngcc0.ɵɵdirectiveInject(SeatsioService)); };\nSeatsioComponent.ɵcmp = /*@__PURE__*/ ɵngcc0.ɵɵdefineComponent({ type: SeatsioComponent, selectors: [[\"ng-component\"]], inputs: { id: \"id\", config: \"config\", class: \"class\" }, decls: 0, vars: 0, template: function SeatsioComponent_Template(rf, ctx) { }, encapsulation: 2 });\n/**\n * @type {function(): !Array<(null|{\n * type: ?,\n * decorators: (undefined|!Array<{type: !Function, args: (undefined|!Array)}>),\n * })>}\n * @nocollapse\n */\nSeatsioComponent.ctorParameters = () => [\n { type: SeatsioService }\n];\n/** @type {!Object)}>>} */\nSeatsioComponent.propDecorators = {\n id: [{ type: Input }],\n config: [{ type: Input }],\n class: [{ type: Input }]\n};\n(function () { (typeof ngDevMode === \"undefined\" || ngDevMode) && ɵngcc0.ɵsetClassMetadata(SeatsioComponent, [{\n type: Component,\n args: [{ template: '' }]\n }], function () { return [{ type: SeatsioService }]; }, { id: [{\n type: Input\n }], config: [{\n type: Input\n }], class: [{\n type: Input\n }] }); })();\n\nclass SeatsioDesignerComponent extends SeatsioComponent {\n constructor(seatsioService) {\n super(seatsioService);\n }\n render(config) {\n return this.seatsioService.showDesigner(this.config);\n }\n}\nSeatsioDesignerComponent.ɵfac = function SeatsioDesignerComponent_Factory(t) { return new (t || SeatsioDesignerComponent)(ɵngcc0.ɵɵdirectiveInject(SeatsioService)); };\nSeatsioDesignerComponent.ɵcmp = /*@__PURE__*/ ɵngcc0.ɵɵdefineComponent({ type: SeatsioDesignerComponent, selectors: [[\"si-seatsio-designer\"]], features: [ɵngcc0.ɵɵProvidersFeature([SeatsioService]), ɵngcc0.ɵɵInheritDefinitionFeature], decls: 1, vars: 4, consts: [[2, \"height\", \"100vh\", 3, \"id\"]], template: function SeatsioDesignerComponent_Template(rf, ctx) { if (rf & 1) {\n ɵngcc0.ɵɵelement(0, \"div\", 0);\n } if (rf & 2) {\n ɵngcc0.ɵɵclassMap(ctx.class);\n ɵngcc0.ɵɵpropertyInterpolate(\"id\", ctx.id);\n } }, styles: [\"\"] });\n/**\n * @type {function(): !Array<(null|{\n * type: ?,\n * decorators: (undefined|!Array<{type: !Function, args: (undefined|!Array)}>),\n * })>}\n * @nocollapse\n */\nSeatsioDesignerComponent.ctorParameters = () => [\n { type: SeatsioService }\n];\n(function () { (typeof ngDevMode === \"undefined\" || ngDevMode) && ɵngcc0.ɵsetClassMetadata(SeatsioDesignerComponent, [{\n type: Component,\n args: [{\n selector: 'si-seatsio-designer',\n template: \"
\\n
\\n\",\n providers: [SeatsioService],\n styles: [\"\"]\n }]\n }], function () { return [{ type: SeatsioService }]; }, null); })();\n\nclass SeatsioSeatingChartComponent extends SeatsioComponent {\n constructor(seatsioService) {\n super(seatsioService);\n }\n render(config) {\n return this.seatsioService.showSeatingChart(this.config);\n }\n}\nSeatsioSeatingChartComponent.ɵfac = function SeatsioSeatingChartComponent_Factory(t) { return new (t || SeatsioSeatingChartComponent)(ɵngcc0.ɵɵdirectiveInject(SeatsioService)); };\nSeatsioSeatingChartComponent.ɵcmp = /*@__PURE__*/ ɵngcc0.ɵɵdefineComponent({ type: SeatsioSeatingChartComponent, selectors: [[\"si-seatsio-seating-chart\"]], features: [ɵngcc0.ɵɵProvidersFeature([SeatsioService]), ɵngcc0.ɵɵInheritDefinitionFeature], decls: 1, vars: 4, consts: [[2, \"height\", \"100vh\", 3, \"id\"]], template: function SeatsioSeatingChartComponent_Template(rf, ctx) { if (rf & 1) {\n ɵngcc0.ɵɵelement(0, \"div\", 0);\n } if (rf & 2) {\n ɵngcc0.ɵɵclassMap(ctx.class);\n ɵngcc0.ɵɵpropertyInterpolate(\"id\", ctx.id);\n } }, styles: [\"\"] });\n/**\n * @type {function(): !Array<(null|{\n * type: ?,\n * decorators: (undefined|!Array<{type: !Function, args: (undefined|!Array)}>),\n * })>}\n * @nocollapse\n */\nSeatsioSeatingChartComponent.ctorParameters = () => [\n { type: SeatsioService }\n];\n(function () { (typeof ngDevMode === \"undefined\" || ngDevMode) && ɵngcc0.ɵsetClassMetadata(SeatsioSeatingChartComponent, [{\n type: Component,\n args: [{\n selector: 'si-seatsio-seating-chart',\n template: \"
\\n
\\n\",\n providers: [SeatsioService],\n styles: [\"\"]\n }]\n }], function () { return [{ type: SeatsioService }]; }, null); })();\n\nclass SeatsioEventManagerComponent extends SeatsioComponent {\n constructor(seatsioService) {\n super(seatsioService);\n }\n render(config) {\n return this.seatsioService.showEventManager(this.config);\n }\n}\nSeatsioEventManagerComponent.ɵfac = function SeatsioEventManagerComponent_Factory(t) { return new (t || SeatsioEventManagerComponent)(ɵngcc0.ɵɵdirectiveInject(SeatsioService)); };\nSeatsioEventManagerComponent.ɵcmp = /*@__PURE__*/ ɵngcc0.ɵɵdefineComponent({ type: SeatsioEventManagerComponent, selectors: [[\"si-seatsio-event-manager\"]], features: [ɵngcc0.ɵɵProvidersFeature([SeatsioService]), ɵngcc0.ɵɵInheritDefinitionFeature], decls: 1, vars: 4, consts: [[2, \"height\", \"100vh\", 3, \"id\"]], template: function SeatsioEventManagerComponent_Template(rf, ctx) { if (rf & 1) {\n ɵngcc0.ɵɵelement(0, \"div\", 0);\n } if (rf & 2) {\n ɵngcc0.ɵɵclassMap(ctx.class);\n ɵngcc0.ɵɵpropertyInterpolate(\"id\", ctx.id);\n } }, styles: [\"\"] });\n/**\n * @type {function(): !Array<(null|{\n * type: ?,\n * decorators: (undefined|!Array<{type: !Function, args: (undefined|!Array)}>),\n * })>}\n * @nocollapse\n */\nSeatsioEventManagerComponent.ctorParameters = () => [\n { type: SeatsioService }\n];\n(function () { (typeof ngDevMode === \"undefined\" || ngDevMode) && ɵngcc0.ɵsetClassMetadata(SeatsioEventManagerComponent, [{\n type: Component,\n args: [{\n selector: 'si-seatsio-event-manager',\n template: \"
\\n
\\n\",\n providers: [SeatsioService],\n styles: [\"\"]\n }]\n }], function () { return [{ type: SeatsioService }]; }, null); })();\n\nclass SeatsioChartManagerComponent extends SeatsioComponent {\n constructor(seatsioService) {\n super(seatsioService);\n }\n render(config) {\n return this.seatsioService.showChartManager(config);\n }\n}\nSeatsioChartManagerComponent.ɵfac = function SeatsioChartManagerComponent_Factory(t) { return new (t || SeatsioChartManagerComponent)(ɵngcc0.ɵɵdirectiveInject(SeatsioService)); };\nSeatsioChartManagerComponent.ɵcmp = /*@__PURE__*/ ɵngcc0.ɵɵdefineComponent({ type: SeatsioChartManagerComponent, selectors: [[\"si-seatsio-chart-manager\"]], features: [ɵngcc0.ɵɵProvidersFeature([SeatsioService]), ɵngcc0.ɵɵInheritDefinitionFeature], decls: 1, vars: 4, consts: [[2, \"height\", \"100vh\", 3, \"id\"]], template: function SeatsioChartManagerComponent_Template(rf, ctx) { if (rf & 1) {\n ɵngcc0.ɵɵelement(0, \"div\", 0);\n } if (rf & 2) {\n ɵngcc0.ɵɵclassMap(ctx.class);\n ɵngcc0.ɵɵpropertyInterpolate(\"id\", ctx.id);\n } }, styles: [\"\"] });\n/**\n * @type {function(): !Array<(null|{\n * type: ?,\n * decorators: (undefined|!Array<{type: !Function, args: (undefined|!Array)}>),\n * })>}\n * @nocollapse\n */\nSeatsioChartManagerComponent.ctorParameters = () => [\n { type: SeatsioService }\n];\n(function () { (typeof ngDevMode === \"undefined\" || ngDevMode) && ɵngcc0.ɵsetClassMetadata(SeatsioChartManagerComponent, [{\n type: Component,\n args: [{\n selector: 'si-seatsio-chart-manager',\n template: \"
\\n
\\n\",\n providers: [SeatsioService],\n styles: [\"\"]\n }]\n }], function () { return [{ type: SeatsioService }]; }, null); })();\n\nclass SeatsioAngularModule {\n}\nSeatsioAngularModule.ɵfac = function SeatsioAngularModule_Factory(t) { return new (t || SeatsioAngularModule)(); };\nSeatsioAngularModule.ɵmod = /*@__PURE__*/ ɵngcc0.ɵɵdefineNgModule({ type: SeatsioAngularModule });\nSeatsioAngularModule.ɵinj = /*@__PURE__*/ ɵngcc0.ɵɵdefineInjector({ imports: [[]] });\n(function () { (typeof ngDevMode === \"undefined\" || ngDevMode) && ɵngcc0.ɵsetClassMetadata(SeatsioAngularModule, [{\n type: NgModule,\n args: [{\n declarations: [\n SeatsioComponent,\n SeatsioDesignerComponent,\n SeatsioSeatingChartComponent,\n SeatsioEventManagerComponent,\n SeatsioChartManagerComponent\n ],\n imports: [],\n exports: [\n SeatsioDesignerComponent,\n SeatsioSeatingChartComponent,\n SeatsioEventManagerComponent,\n SeatsioChartManagerComponent\n ]\n }]\n }], null, null); })();\n(function () { (typeof ngJitMode === \"undefined\" || ngJitMode) && ɵngcc0.ɵɵsetNgModuleScope(SeatsioAngularModule, { declarations: [SeatsioComponent, SeatsioDesignerComponent, SeatsioSeatingChartComponent, SeatsioEventManagerComponent, SeatsioChartManagerComponent], exports: [SeatsioDesignerComponent, SeatsioSeatingChartComponent, SeatsioEventManagerComponent, SeatsioChartManagerComponent] }); })();\n\n/*\n * Public API Surface of seatsio-angular\n */\n\n/**\n * Generated bundle index. Do not edit.\n */\n\nexport { SeatsioAngularModule, SeatsioChartManagerComponent, SeatsioDesignerComponent, SeatsioEventManagerComponent, SeatsioSeatingChartComponent, SeatsioService, SeatsioComponent as ɵa };\n\n","import { NgModule } from '@angular/core';\nimport { CommonModule } from '@angular/common';\n\nimport { SeatsioComponent } from './seatsio.component';\nimport { SeatsioAngularModule } from '@seatsio/seatsio-angular';\n\n@NgModule({\n declarations: [\n SeatsioComponent\n ],\n imports: [\n CommonModule,\n SeatsioAngularModule,\n ],\n exports: [SeatsioComponent]\n})\nexport class SeatsioModule { }\n","import { NgModule } from '@angular/core';\nimport { CommonModule } from '@angular/common';\nimport { MapPlaceComponent } from './map-place.component';\nimport { FormsModule, ReactiveFormsModule } from '@angular/forms';\nimport { MatSliderModule } from '@angular/material/slider';\n//import { PlatformModule } from '@angular/cdk/platform';\n//import { BrowserAnimationsModule } from '@angular/platform-browser/animations';\nimport { NgSelectModule } from '@ng-select/ng-select';\nimport { HammerGestureConfig } from '@angular/platform-browser';\nimport { SpinnerModule } from '../spinner/spinner.module';\n//import \"hammerjs\";\nimport { HAMMER_GESTURE_CONFIG } from '@angular/platform-browser';\n\n@NgModule({\n declarations: [MapPlaceComponent],\n imports: [\n CommonModule,\n FormsModule,\n ReactiveFormsModule,\n MatSliderModule,\n NgSelectModule,\n SpinnerModule,\n // PlatformModule,\n // BrowserAnimationsModule\n ],\n exports: [MapPlaceComponent],\n providers: [\n { provide: HAMMER_GESTURE_CONFIG, useClass: HammerGestureConfig }\n ]\n})\nexport class MapPlaceModule { }\n","import { NgModule } from '@angular/core';\nimport { CommonModule } from '@angular/common';\nimport { FormsModule } from '@angular/forms';\n\nimport { QtyComponent } from './qty.component';\n\n@NgModule({\n declarations: [\n QtyComponent\n ],\n imports: [\n CommonModule,\n FormsModule\n ],\n exports: [QtyComponent]\n})\nexport class QtyModule { }\n","import { NgModule } from '@angular/core';\nimport { Routes, RouterModule } from '@angular/router';\nimport { EventComponent } from './event.component';\n\nconst routes: Routes = [\n {\n path: '',\n component: EventComponent\n }\n];\n\n@NgModule({\n imports: [RouterModule.forChild(routes)],\n exports: [RouterModule]\n})\nexport class EventRoutingModule { }\n","import { NgModule } from '@angular/core';\nimport { CommonModule } from '@angular/common';\nimport { FilterPipe } from './filter.pipe';\n\n\n\n@NgModule({\n declarations: [FilterPipe],\n imports: [\n CommonModule\n ],\n exports: [FilterPipe]\n})\nexport class FilterModule { }\n","import { NgModule } from '@angular/core';\nimport { CommonModule } from '@angular/common';\nimport { TicketHoldersComponent } from './ticket-holders.component';\nimport { SwiperModule } from 'swiper/angular';\nimport { FormsModule, ReactiveFormsModule } from '@angular/forms';\nimport { NgxMaskModule } from 'ngx-mask';\n\n@NgModule({\n declarations: [TicketHoldersComponent],\n imports: [\n CommonModule,\n FormsModule,\n ReactiveFormsModule,\n SwiperModule,\n NgxMaskModule.forRoot()\n ]\n})\nexport class TicketHoldersModule { }\n","import { NgModule } from '@angular/core';\nimport { CommonModule } from '@angular/common';\nimport { RouterModule } from '@angular/router';\nimport { FormPorscheEventComponent } from './form-porsche-event.component';\n\nimport { FormsModule } from '@angular/forms';\nimport { NgxMaskModule, IConfig } from 'ngx-mask'\nimport { ReactiveFormsModule } from '@angular/forms';\nconst maskConfig: Partial = {\n validation: false,\n};\n\n@NgModule({\n declarations: [FormPorscheEventComponent],\n imports: [\n CommonModule,\n FormsModule,\n ReactiveFormsModule,\n NgxMaskModule.forRoot(),\n RouterModule\n ],\n exports: [FormPorscheEventComponent]\n})\nexport class FormPorscheEventModule { }\n","import { NgModule } from '@angular/core';\nimport { CommonModule } from '@angular/common';\nimport { NgxSkeletonLoaderModule } from 'ngx-skeleton-loader';\nimport { RouterModule } from '@angular/router';\nimport { CountdownComponent } from './countdown.component';\n\n@NgModule({\n declarations: [\n CountdownComponent\n ],\n imports: [\n CommonModule,\n NgxSkeletonLoaderModule,\n RouterModule\n ],\n exports: [\n CountdownComponent\n ],\n})\nexport class CountdownModule { }\n","import { NgModule } from '@angular/core';\nimport { CommonModule } from '@angular/common';\nimport { ModalModule } from 'ngx-bootstrap/modal';\nimport { NgxSkeletonLoaderModule } from 'ngx-skeleton-loader';\nimport { SwiperModule } from 'swiper/angular';\nimport { SeatsioModule } from '../../components/seatsio/seatsio.module';\nimport { MapPlaceModule } from '../../components/map-place/map-place.module';\nimport { FormsModule } from '@angular/forms';\nimport { QtyModule } from '../../components/qty/qty.module';\nimport { EventRoutingModule } from './event-routing.module';\nimport { EventComponent } from './event.component';\nimport { FilterModule } from 'src/app/pipes/filter/filter.module';\nimport { TicketHoldersModule } from '../../dialogs/ticket-holders/ticket-holders.module';\nimport { ReactiveFormsModule } from '@angular/forms';\nimport { SpinnerModule } from '../../components/spinner/spinner.module';\nimport { SortByModule } from 'src/app/pipes/sort-by/sort-by.module';\nimport { NgxMaskModule, IConfig } from 'ngx-mask'\nimport { FormPorscheEventModule } from '../../components/form-porsche-event/form-porsche-event.module'\nimport { MapV2Module } from '../../components/mapv2/mapv2.module';\nimport { IsOnlyOneTicketByCustomer } from './pipes/IsOnlyOneTicketByCustomer.pipe';\nimport { CountdownModule } from '../../components/countdown/countdown.module';\nconst maskConfig: Partial = {\n validation: false,\n};\n\n@NgModule({\n declarations: [\n EventComponent,\n IsOnlyOneTicketByCustomer\n ],\n imports: [\n CommonModule,\n FormsModule,\n CountdownModule,\n SeatsioModule,\n MapPlaceModule,\n EventRoutingModule,\n SwiperModule,\n FormPorscheEventModule,\n NgxMaskModule.forRoot(maskConfig),\n ReactiveFormsModule,\n SpinnerModule,\n NgxSkeletonLoaderModule,\n QtyModule,\n FilterModule,\n TicketHoldersModule,\n ModalModule.forRoot(),\n SortByModule,\n MapV2Module\n ],\n exports: [\n EventComponent\n ]\n})\nexport class EventModule { }\n","\n/*! This is slightly modified version of hammer library to make it work with Konva framework\n * Modified by Anton Lavrenov.\n * Original code:\n * Hammer.JS - v2.0.7 - 2016-04-22\n * http://hammerjs.github.io/\n * that version is slightly modified by Anton Lavrenov\n * to make it work with Konva framework\n * Copyright (c) 2016 Jorik Tangelder;\n * Licensed under the MIT license */\n(function(window, document, exportName, undefined) {\n 'use strict';\n \n var VENDOR_PREFIXES = ['', 'webkit', 'Moz', 'MS', 'ms', 'o'];\n var TEST_ELEMENT = document.createElement('div');\n \n var TYPE_FUNCTION = 'function';\n \n var round = Math.round;\n var abs = Math.abs;\n var now = Date.now;\n \n /**\n * set a timeout with a given scope\n * @param {Function} fn\n * @param {Number} timeout\n * @param {Object} context\n * @returns {number}\n */\n function setTimeoutContext(fn, timeout, context) {\n return setTimeout(bindFn(fn, context), timeout);\n }\n \n /**\n * if the argument is an array, we want to execute the fn on each entry\n * if it aint an array we don't want to do a thing.\n * this is used by all the methods that accept a single and array argument.\n * @param {*|Array} arg\n * @param {String} fn\n * @param {Object} [context]\n * @returns {Boolean}\n */\n function invokeArrayArg(arg, fn, context) {\n if (Array.isArray(arg)) {\n each(arg, context[fn], context);\n return true;\n }\n return false;\n }\n \n /**\n * walk objects and arrays\n * @param {Object} obj\n * @param {Function} iterator\n * @param {Object} context\n */\n function each(obj, iterator, context) {\n var i;\n \n if (!obj) {\n return;\n }\n \n if (obj.forEach) {\n obj.forEach(iterator, context);\n } else if (obj.length !== undefined) {\n i = 0;\n while (i < obj.length) {\n iterator.call(context, obj[i], i, obj);\n i++;\n }\n } else {\n for (i in obj) {\n obj.hasOwnProperty(i) && iterator.call(context, obj[i], i, obj);\n }\n }\n }\n \n /**\n * wrap a method with a deprecation warning and stack trace\n * @param {Function} method\n * @param {String} name\n * @param {String} message\n * @returns {Function} A new function wrapping the supplied method.\n */\n function deprecate(method, name, message) {\n var deprecationMessage =\n 'DEPRECATED METHOD: ' + name + '\\n' + message + ' AT \\n';\n return function() {\n var e = new Error('get-stack-trace');\n var stack =\n e && e.stack\n ? e.stack\n .replace(/^[^\\(]+?[\\n$]/gm, '')\n .replace(/^\\s+at\\s+/gm, '')\n .replace(/^Object.\\s*\\(/gm, '{anonymous}()@')\n : 'Unknown Stack Trace';\n \n var log = window.console && (window.console.warn || window.console.log);\n if (log) {\n log.call(window.console, deprecationMessage, stack);\n }\n return method.apply(this, arguments);\n };\n }\n \n /**\n * extend object.\n * means that properties in dest will be overwritten by the ones in src.\n * @param {Object} target\n * @param {...Object} objects_to_assign\n * @returns {Object} target\n */\n var assign;\n if (typeof Object.assign !== 'function') {\n assign = function assign(target) {\n if (target === undefined || target === null) {\n throw new TypeError('Cannot convert undefined or null to object');\n }\n \n var output = Object(target);\n for (var index = 1; index < arguments.length; index++) {\n var source = arguments[index];\n if (source !== undefined && source !== null) {\n for (var nextKey in source) {\n if (source.hasOwnProperty(nextKey)) {\n output[nextKey] = source[nextKey];\n }\n }\n }\n }\n return output;\n };\n } else {\n assign = Object.assign;\n }\n \n /**\n * extend object.\n * means that properties in dest will be overwritten by the ones in src.\n * @param {Object} dest\n * @param {Object} src\n * @param {Boolean} [merge=false]\n * @returns {Object} dest\n */\n var extend = deprecate(\n function extend(dest, src, merge) {\n var keys = Object.keys(src);\n var i = 0;\n while (i < keys.length) {\n if (!merge || (merge && dest[keys[i]] === undefined)) {\n dest[keys[i]] = src[keys[i]];\n }\n i++;\n }\n return dest;\n },\n 'extend',\n 'Use `assign`.'\n );\n \n /**\n * merge the values from src in the dest.\n * means that properties that exist in dest will not be overwritten by src\n * @param {Object} dest\n * @param {Object} src\n * @returns {Object} dest\n */\n var merge = deprecate(\n function merge(dest, src) {\n return extend(dest, src, true);\n },\n 'merge',\n 'Use `assign`.'\n );\n \n /**\n * simple class inheritance\n * @param {Function} child\n * @param {Function} base\n * @param {Object} [properties]\n */\n function inherit(child, base, properties) {\n var baseP = base.prototype,\n childP;\n \n childP = child.prototype = Object.create(baseP);\n childP.constructor = child;\n childP._super = baseP;\n \n if (properties) {\n assign(childP, properties);\n }\n }\n \n /**\n * simple function bind\n * @param {Function} fn\n * @param {Object} context\n * @returns {Function}\n */\n function bindFn(fn, context) {\n return function boundFn() {\n return fn.apply(context, arguments);\n };\n }\n \n /**\n * let a boolean value also be a function that must return a boolean\n * this first item in args will be used as the context\n * @param {Boolean|Function} val\n * @param {Array} [args]\n * @returns {Boolean}\n */\n function boolOrFn(val, args) {\n if (typeof val == TYPE_FUNCTION) {\n return val.apply(args ? args[0] || undefined : undefined, args);\n }\n return val;\n }\n \n /**\n * use the val2 when val1 is undefined\n * @param {*} val1\n * @param {*} val2\n * @returns {*}\n */\n function ifUndefined(val1, val2) {\n return val1 === undefined ? val2 : val1;\n }\n \n /**\n * addEventListener with multiple events at once\n * @param {EventTarget} target\n * @param {String} types\n * @param {Function} handler\n */\n function addEventListeners(target, types, handler) {\n each(splitStr(types), function(type) {\n target.addEventListener(type, handler, false);\n });\n }\n \n /**\n * removeEventListener with multiple events at once\n * @param {EventTarget} target\n * @param {String} types\n * @param {Function} handler\n */\n function removeEventListeners(target, types, handler) {\n each(splitStr(types), function(type) {\n target.removeEventListener(type, handler, false);\n });\n }\n \n /**\n * find if a node is in the given parent\n * @method hasParent\n * @param {HTMLElement} node\n * @param {HTMLElement} parent\n * @return {Boolean} found\n */\n function hasParent(node, parent) {\n while (node) {\n if (node == parent) {\n return true;\n }\n node = node.parentNode;\n }\n return false;\n }\n \n /**\n * small indexOf wrapper\n * @param {String} str\n * @param {String} find\n * @returns {Boolean} found\n */\n function inStr(str, find) {\n return str.indexOf(find) > -1;\n }\n \n /**\n * split string on whitespace\n * @param {String} str\n * @returns {Array} words\n */\n function splitStr(str) {\n return str.trim().split(/\\s+/g);\n }\n \n /**\n * find if a array contains the object using indexOf or a simple polyFill\n * @param {Array} src\n * @param {String} find\n * @param {String} [findByKey]\n * @return {Boolean|Number} false when not found, or the index\n */\n function inArray(src, find, findByKey) {\n if (src.indexOf && !findByKey) {\n return src.indexOf(find);\n } else {\n var i = 0;\n while (i < src.length) {\n if (\n (findByKey && src[i][findByKey] == find) ||\n (!findByKey && src[i] === find)\n ) {\n return i;\n }\n i++;\n }\n return -1;\n }\n }\n \n /**\n * convert array-like objects to real arrays\n * @param {Object} obj\n * @returns {Array}\n */\n function toArray(obj) {\n return Array.prototype.slice.call(obj, 0);\n }\n \n /**\n * unique array with objects based on a key (like 'id') or just by the array's value\n * @param {Array} src [{id:1},{id:2},{id:1}]\n * @param {String} [key]\n * @param {Boolean} [sort=False]\n * @returns {Array} [{id:1},{id:2}]\n */\n function uniqueArray(src, key, sort) {\n var results = [];\n var values = [];\n var i = 0;\n \n while (i < src.length) {\n var val = key ? src[i][key] : src[i];\n if (inArray(values, val) < 0) {\n results.push(src[i]);\n }\n values[i] = val;\n i++;\n }\n \n if (sort) {\n if (!key) {\n results = results.sort();\n } else {\n results = results.sort(function sortUniqueArray(a, b) {\n return a[key] > b[key];\n });\n }\n }\n \n return results;\n }\n \n /**\n * get the prefixed property\n * @param {Object} obj\n * @param {String} property\n * @returns {String|Undefined} prefixed\n */\n function prefixed(obj, property) {\n var prefix, prop;\n var camelProp = property[0].toUpperCase() + property.slice(1);\n \n var i = 0;\n while (i < VENDOR_PREFIXES.length) {\n prefix = VENDOR_PREFIXES[i];\n prop = prefix ? prefix + camelProp : property;\n \n if (prop in obj) {\n return prop;\n }\n i++;\n }\n return undefined;\n }\n \n /**\n * get a unique id\n * @returns {number} uniqueId\n */\n var _uniqueId = 1;\n function uniqueId() {\n return _uniqueId++;\n }\n \n /**\n * get the window object of an element\n * @param {HTMLElement} element\n * @returns {DocumentView|Window}\n */\n function getWindowForElement(element) {\n var doc = element.ownerDocument || element;\n return doc.defaultView || doc.parentWindow || window;\n }\n \n var MOBILE_REGEX = /mobile|tablet|ip(ad|hone|od)|android/i;\n \n var SUPPORT_TOUCH = 'ontouchstart' in window;\n \n // temporary disable pointer events, because Konva doesn't fully support it yet\n // var SUPPORT_POINTER_EVENTS = prefixed(window, 'PointerEvent') !== undefined;\n var SUPPORT_POINTER_EVENTS = false;\n \n // var SUPPORT_ONLY_TOUCH =\n // SUPPORT_TOUCH && MOBILE_REGEX.test(navigator.userAgent);\n var SUPPORT_ONLY_TOUCH = true;\n \n var INPUT_TYPE_TOUCH = 'touch';\n var INPUT_TYPE_PEN = 'pen';\n var INPUT_TYPE_MOUSE = 'mouse';\n var INPUT_TYPE_KINECT = 'kinect';\n \n var COMPUTE_INTERVAL = 25;\n \n var INPUT_START = 1;\n var INPUT_MOVE = 2;\n var INPUT_END = 4;\n var INPUT_CANCEL = 8;\n \n var DIRECTION_NONE = 1;\n var DIRECTION_LEFT = 2;\n var DIRECTION_RIGHT = 4;\n var DIRECTION_UP = 8;\n var DIRECTION_DOWN = 16;\n \n var DIRECTION_HORIZONTAL = DIRECTION_LEFT | DIRECTION_RIGHT;\n var DIRECTION_VERTICAL = DIRECTION_UP | DIRECTION_DOWN;\n var DIRECTION_ALL = DIRECTION_HORIZONTAL | DIRECTION_VERTICAL;\n \n var PROPS_XY = ['x', 'y'];\n var PROPS_CLIENT_XY = ['clientX', 'clientY'];\n \n /**\n * create new input type manager\n * @param {Manager} manager\n * @param {Function} callback\n * @returns {Input}\n * @constructor\n */\n function Input(manager, callback) {\n var self = this;\n this.manager = manager;\n this.callback = callback;\n this.element = manager.element;\n this.target = manager.options.inputTarget;\n \n // smaller wrapper around the handler, for the scope and the enabled state of the manager,\n // so when disabled the input events are completely bypassed.\n this.domHandler = function(ev) {\n if (boolOrFn(manager.options.enable, [manager])) {\n self.handler(ev);\n }\n };\n \n this.init();\n }\n \n Input.prototype = {\n /**\n * should handle the inputEvent data and trigger the callback\n * @virtual\n */\n handler: function() {},\n \n /**\n * bind the events\n */\n init: function() {\n this.evEl && addEventListeners(this.element, this.evEl, this.domHandler);\n this.evTarget &&\n addEventListeners(this.target, this.evTarget, this.domHandler);\n this.evWin &&\n addEventListeners(\n getWindowForElement(this.element),\n this.evWin,\n this.domHandler\n );\n },\n \n /**\n * unbind the events\n */\n destroy: function() {\n this.evEl &&\n removeEventListeners(this.element, this.evEl, this.domHandler);\n this.evTarget &&\n removeEventListeners(this.target, this.evTarget, this.domHandler);\n this.evWin &&\n removeEventListeners(\n getWindowForElement(this.element),\n this.evWin,\n this.domHandler\n );\n }\n };\n \n /**\n * create new input type manager\n * called by the Manager constructor\n * @param {Hammer} manager\n * @returns {Input}\n */\n function createInputInstance(manager) {\n var Type;\n var inputClass = manager.options.inputClass;\n \n if (inputClass) {\n Type = inputClass;\n } else if (SUPPORT_POINTER_EVENTS) {\n Type = PointerEventInput;\n } else if (SUPPORT_ONLY_TOUCH) {\n Type = TouchInput;\n } else if (!SUPPORT_TOUCH) {\n Type = MouseInput;\n } else {\n Type = TouchMouseInput;\n }\n return new Type(manager, inputHandler);\n }\n \n /**\n * handle input events\n * @param {Manager} manager\n * @param {String} eventType\n * @param {Object} input\n */\n function inputHandler(manager, eventType, input) {\n var pointersLen = input.pointers.length;\n var changedPointersLen = input.changedPointers.length;\n var isFirst =\n eventType & INPUT_START && pointersLen - changedPointersLen === 0;\n var isFinal =\n eventType & (INPUT_END | INPUT_CANCEL) &&\n pointersLen - changedPointersLen === 0;\n \n input.isFirst = !!isFirst;\n input.isFinal = !!isFinal;\n \n if (isFirst) {\n manager.session = {};\n }\n \n // source event is the normalized value of the domEvents\n // like 'touchstart, mouseup, pointerdown'\n input.eventType = eventType;\n \n // compute scale, rotation etc\n computeInputData(manager, input);\n \n // emit secret event\n manager.emit('hammer.input', input);\n \n manager.recognize(input);\n manager.session.prevInput = input;\n }\n \n /**\n * extend the data with some usable properties like scale, rotate, velocity etc\n * @param {Object} manager\n * @param {Object} input\n */\n function computeInputData(manager, input) {\n var session = manager.session;\n var pointers = input.pointers;\n var pointersLength = pointers.length;\n \n // store the first input to calculate the distance and direction\n if (!session.firstInput) {\n session.firstInput = simpleCloneInputData(input);\n }\n \n // to compute scale and rotation we need to store the multiple touches\n if (pointersLength > 1 && !session.firstMultiple) {\n session.firstMultiple = simpleCloneInputData(input);\n } else if (pointersLength === 1) {\n session.firstMultiple = false;\n }\n \n var firstInput = session.firstInput;\n var firstMultiple = session.firstMultiple;\n var offsetCenter = firstMultiple ? firstMultiple.center : firstInput.center;\n \n var center = (input.center = getCenter(pointers));\n input.timeStamp = now();\n input.deltaTime = input.timeStamp - firstInput.timeStamp;\n \n input.angle = getAngle(offsetCenter, center);\n input.distance = getDistance(offsetCenter, center);\n \n computeDeltaXY(session, input);\n input.offsetDirection = getDirection(input.deltaX, input.deltaY);\n \n var overallVelocity = getVelocity(\n input.deltaTime,\n input.deltaX,\n input.deltaY\n );\n input.overallVelocityX = overallVelocity.x;\n input.overallVelocityY = overallVelocity.y;\n input.overallVelocity =\n abs(overallVelocity.x) > abs(overallVelocity.y)\n ? overallVelocity.x\n : overallVelocity.y;\n \n input.scale = firstMultiple\n ? getScale(firstMultiple.pointers, pointers)\n : 1;\n input.rotation = firstMultiple\n ? getRotation(firstMultiple.pointers, pointers)\n : 0;\n \n input.maxPointers = !session.prevInput\n ? input.pointers.length\n : input.pointers.length > session.prevInput.maxPointers\n ? input.pointers.length\n : session.prevInput.maxPointers;\n \n computeIntervalInputData(session, input);\n \n // find the correct target\n var target = manager.element;\n if (hasParent(input.srcEvent.target, target)) {\n target = input.srcEvent.target;\n }\n input.target = target;\n }\n \n function computeDeltaXY(session, input) {\n var center = input.center;\n var offset = session.offsetDelta || {};\n var prevDelta = session.prevDelta || {};\n var prevInput = session.prevInput || {};\n \n if (input.eventType === INPUT_START || prevInput.eventType === INPUT_END) {\n prevDelta = session.prevDelta = {\n x: prevInput.deltaX || 0,\n y: prevInput.deltaY || 0\n };\n \n offset = session.offsetDelta = {\n x: center.x,\n y: center.y\n };\n }\n \n input.deltaX = prevDelta.x + (center.x - offset.x);\n input.deltaY = prevDelta.y + (center.y - offset.y);\n }\n \n /**\n * velocity is calculated every x ms\n * @param {Object} session\n * @param {Object} input\n */\n function computeIntervalInputData(session, input) {\n var last = session.lastInterval || input,\n deltaTime = input.timeStamp - last.timeStamp,\n velocity,\n velocityX,\n velocityY,\n direction;\n \n if (\n input.eventType != INPUT_CANCEL &&\n (deltaTime > COMPUTE_INTERVAL || last.velocity === undefined)\n ) {\n var deltaX = input.deltaX - last.deltaX;\n var deltaY = input.deltaY - last.deltaY;\n \n var v = getVelocity(deltaTime, deltaX, deltaY);\n velocityX = v.x;\n velocityY = v.y;\n velocity = abs(v.x) > abs(v.y) ? v.x : v.y;\n direction = getDirection(deltaX, deltaY);\n \n session.lastInterval = input;\n } else {\n // use latest velocity info if it doesn't overtake a minimum period\n velocity = last.velocity;\n velocityX = last.velocityX;\n velocityY = last.velocityY;\n direction = last.direction;\n }\n \n input.velocity = velocity;\n input.velocityX = velocityX;\n input.velocityY = velocityY;\n input.direction = direction;\n }\n \n /**\n * create a simple clone from the input used for storage of firstInput and firstMultiple\n * @param {Object} input\n * @returns {Object} clonedInputData\n */\n function simpleCloneInputData(input) {\n // make a simple copy of the pointers because we will get a reference if we don't\n // we only need clientXY for the calculations\n var pointers = [];\n var i = 0;\n while (i < input.pointers.length) {\n pointers[i] = {\n clientX: round(input.pointers[i].clientX),\n clientY: round(input.pointers[i].clientY)\n };\n i++;\n }\n \n return {\n timeStamp: now(),\n pointers: pointers,\n center: getCenter(pointers),\n deltaX: input.deltaX,\n deltaY: input.deltaY\n };\n }\n \n /**\n * get the center of all the pointers\n * @param {Array} pointers\n * @return {Object} center contains `x` and `y` properties\n */\n function getCenter(pointers) {\n var pointersLength = pointers.length;\n \n // no need to loop when only one touch\n if (pointersLength === 1) {\n return {\n x: round(pointers[0].clientX),\n y: round(pointers[0].clientY)\n };\n }\n \n var x = 0,\n y = 0,\n i = 0;\n while (i < pointersLength) {\n x += pointers[i].clientX;\n y += pointers[i].clientY;\n i++;\n }\n \n return {\n x: round(x / pointersLength),\n y: round(y / pointersLength)\n };\n }\n \n /**\n * calculate the velocity between two points. unit is in px per ms.\n * @param {Number} deltaTime\n * @param {Number} x\n * @param {Number} y\n * @return {Object} velocity `x` and `y`\n */\n function getVelocity(deltaTime, x, y) {\n return {\n x: x / deltaTime || 0,\n y: y / deltaTime || 0\n };\n }\n \n /**\n * get the direction between two points\n * @param {Number} x\n * @param {Number} y\n * @return {Number} direction\n */\n function getDirection(x, y) {\n if (x === y) {\n return DIRECTION_NONE;\n }\n \n if (abs(x) >= abs(y)) {\n return x < 0 ? DIRECTION_LEFT : DIRECTION_RIGHT;\n }\n return y < 0 ? DIRECTION_UP : DIRECTION_DOWN;\n }\n \n /**\n * calculate the absolute distance between two points\n * @param {Object} p1 {x, y}\n * @param {Object} p2 {x, y}\n * @param {Array} [props] containing x and y keys\n * @return {Number} distance\n */\n function getDistance(p1, p2, props) {\n if (!props) {\n props = PROPS_XY;\n }\n var x = p2[props[0]] - p1[props[0]],\n y = p2[props[1]] - p1[props[1]];\n \n return Math.sqrt(x * x + y * y);\n }\n \n /**\n * calculate the angle between two coordinates\n * @param {Object} p1\n * @param {Object} p2\n * @param {Array} [props] containing x and y keys\n * @return {Number} angle\n */\n function getAngle(p1, p2, props) {\n if (!props) {\n props = PROPS_XY;\n }\n var x = p2[props[0]] - p1[props[0]],\n y = p2[props[1]] - p1[props[1]];\n return (Math.atan2(y, x) * 180) / Math.PI;\n }\n \n /**\n * calculate the rotation degrees between two pointersets\n * @param {Array} start array of pointers\n * @param {Array} end array of pointers\n * @return {Number} rotation\n */\n function getRotation(start, end) {\n return (\n getAngle(end[1], end[0], PROPS_CLIENT_XY) +\n getAngle(start[1], start[0], PROPS_CLIENT_XY)\n );\n }\n \n /**\n * calculate the scale factor between two pointersets\n * no scale is 1, and goes down to 0 when pinched together, and bigger when pinched out\n * @param {Array} start array of pointers\n * @param {Array} end array of pointers\n * @return {Number} scale\n */\n function getScale(start, end) {\n return (\n getDistance(end[0], end[1], PROPS_CLIENT_XY) /\n getDistance(start[0], start[1], PROPS_CLIENT_XY)\n );\n }\n \n var MOUSE_INPUT_MAP = {\n mousedown: INPUT_START,\n mousemove: INPUT_MOVE,\n mouseup: INPUT_END\n };\n \n var MOUSE_ELEMENT_EVENTS = 'mousedown';\n var MOUSE_WINDOW_EVENTS = 'mousemove mouseup';\n \n /**\n * Mouse events input\n * @constructor\n * @extends Input\n */\n function MouseInput() {\n this.evEl = MOUSE_ELEMENT_EVENTS;\n this.evWin = MOUSE_WINDOW_EVENTS;\n \n this.pressed = false; // mousedown state\n \n Input.apply(this, arguments);\n }\n \n inherit(MouseInput, Input, {\n /**\n * handle mouse events\n * @param {Object} ev\n */\n handler: function MEhandler(ev) {\n var eventType = MOUSE_INPUT_MAP[ev.type];\n \n // on start we want to have the left mouse button down\n if (eventType & INPUT_START && ev.button === 0) {\n this.pressed = true;\n }\n \n if (eventType & INPUT_MOVE && ev.which !== 1) {\n eventType = INPUT_END;\n }\n \n // mouse must be down\n if (!this.pressed) {\n return;\n }\n \n if (eventType & INPUT_END) {\n this.pressed = false;\n }\n \n this.callback(this.manager, eventType, {\n pointers: [ev],\n changedPointers: [ev],\n pointerType: INPUT_TYPE_MOUSE,\n srcEvent: ev\n });\n }\n });\n \n var POINTER_INPUT_MAP = {\n pointerdown: INPUT_START,\n pointermove: INPUT_MOVE,\n pointerup: INPUT_END,\n pointercancel: INPUT_CANCEL,\n pointerout: INPUT_CANCEL\n };\n \n // in IE10 the pointer types is defined as an enum\n var IE10_POINTER_TYPE_ENUM = {\n 2: INPUT_TYPE_TOUCH,\n 3: INPUT_TYPE_PEN,\n 4: INPUT_TYPE_MOUSE,\n 5: INPUT_TYPE_KINECT // see https://twitter.com/jacobrossi/status/480596438489890816\n };\n \n var POINTER_ELEMENT_EVENTS = 'pointerdown';\n var POINTER_WINDOW_EVENTS = 'pointermove pointerup pointercancel';\n \n // IE10 has prefixed support, and case-sensitive\n if (window.MSPointerEvent && !window.PointerEvent) {\n POINTER_ELEMENT_EVENTS = 'MSPointerDown';\n POINTER_WINDOW_EVENTS = 'MSPointerMove MSPointerUp MSPointerCancel';\n }\n \n /**\n * Pointer events input\n * @constructor\n * @extends Input\n */\n function PointerEventInput() {\n this.evEl = POINTER_ELEMENT_EVENTS;\n this.evWin = POINTER_WINDOW_EVENTS;\n \n Input.apply(this, arguments);\n \n this.store = this.manager.session.pointerEvents = [];\n }\n \n inherit(PointerEventInput, Input, {\n /**\n * handle mouse events\n * @param {Object} ev\n */\n handler: function PEhandler(ev) {\n var store = this.store;\n var removePointer = false;\n \n var eventTypeNormalized = ev.type.toLowerCase().replace('ms', '');\n var eventType = POINTER_INPUT_MAP[eventTypeNormalized];\n var pointerType =\n IE10_POINTER_TYPE_ENUM[ev.pointerType] || ev.pointerType;\n \n var isTouch = pointerType == INPUT_TYPE_TOUCH;\n \n // get index of the event in the store\n var storeIndex = inArray(store, ev.pointerId, 'pointerId');\n \n // start and mouse must be down\n if (eventType & INPUT_START && (ev.button === 0 || isTouch)) {\n if (storeIndex < 0) {\n store.push(ev);\n storeIndex = store.length - 1;\n }\n } else if (eventType & (INPUT_END | INPUT_CANCEL)) {\n removePointer = true;\n }\n \n // it not found, so the pointer hasn't been down (so it's probably a hover)\n if (storeIndex < 0) {\n return;\n }\n \n // update the event in the store\n store[storeIndex] = ev;\n \n this.callback(this.manager, eventType, {\n pointers: store,\n changedPointers: [ev],\n pointerType: pointerType,\n srcEvent: ev\n });\n \n if (removePointer) {\n // remove from the store\n store.splice(storeIndex, 1);\n }\n }\n });\n \n var SINGLE_TOUCH_INPUT_MAP = {\n touchstart: INPUT_START,\n touchmove: INPUT_MOVE,\n touchend: INPUT_END,\n touchcancel: INPUT_CANCEL\n };\n \n var SINGLE_TOUCH_TARGET_EVENTS = 'touchstart';\n var SINGLE_TOUCH_WINDOW_EVENTS = 'touchstart touchmove touchend touchcancel';\n \n /**\n * Touch events input\n * @constructor\n * @extends Input\n */\n function SingleTouchInput() {\n this.evTarget = SINGLE_TOUCH_TARGET_EVENTS;\n this.evWin = SINGLE_TOUCH_WINDOW_EVENTS;\n this.started = false;\n \n Input.apply(this, arguments);\n }\n \n inherit(SingleTouchInput, Input, {\n handler: function TEhandler(ev) {\n var type = SINGLE_TOUCH_INPUT_MAP[ev.type];\n \n // should we handle the touch events?\n if (type === INPUT_START) {\n this.started = true;\n }\n \n if (!this.started) {\n return;\n }\n \n var touches = normalizeSingleTouches.call(this, ev, type);\n \n // when done, reset the started state\n if (\n type & (INPUT_END | INPUT_CANCEL) &&\n touches[0].length - touches[1].length === 0\n ) {\n this.started = false;\n }\n \n this.callback(this.manager, type, {\n pointers: touches[0],\n changedPointers: touches[1],\n pointerType: INPUT_TYPE_TOUCH,\n srcEvent: ev\n });\n }\n });\n \n /**\n * @this {TouchInput}\n * @param {Object} ev\n * @param {Number} type flag\n * @returns {undefined|Array} [all, changed]\n */\n function normalizeSingleTouches(ev, type) {\n var all = toArray(ev.touches);\n var changed = toArray(ev.changedTouches);\n \n if (type & (INPUT_END | INPUT_CANCEL)) {\n all = uniqueArray(all.concat(changed), 'identifier', true);\n }\n \n return [all, changed];\n }\n \n var TOUCH_INPUT_MAP = {\n touchstart: INPUT_START,\n touchmove: INPUT_MOVE,\n touchend: INPUT_END,\n touchcancel: INPUT_CANCEL\n };\n \n var TOUCH_TARGET_EVENTS = 'touchstart touchmove touchend touchcancel';\n \n /**\n * Multi-user touch events input\n * @constructor\n * @extends Input\n */\n function TouchInput() {\n this.evTarget = TOUCH_TARGET_EVENTS;\n this.targetIds = {};\n \n Input.apply(this, arguments);\n }\n \n inherit(TouchInput, Input, {\n handler: function MTEhandler(ev) {\n var type = TOUCH_INPUT_MAP[ev.type];\n var touches = getTouches.call(this, ev, type);\n if (!touches) {\n return;\n }\n \n this.callback(this.manager, type, {\n pointers: touches[0],\n changedPointers: touches[1],\n pointerType: INPUT_TYPE_TOUCH,\n srcEvent: ev\n });\n }\n });\n \n /**\n * @this {TouchInput}\n * @param {Object} ev\n * @param {Number} type flag\n * @returns {undefined|Array} [all, changed]\n */\n function getTouches(ev, type) {\n var allTouches = toArray(ev.touches);\n var targetIds = this.targetIds;\n \n // when there is only one touch, the process can be simplified\n if (type & (INPUT_START | INPUT_MOVE) && allTouches.length === 1) {\n targetIds[allTouches[0].identifier] = true;\n return [allTouches, allTouches];\n }\n \n var i,\n targetTouches,\n changedTouches = toArray(ev.changedTouches),\n changedTargetTouches = [],\n target = this.target;\n \n // get target touches from touches\n targetTouches = allTouches.filter(function(touch) {\n return true;\n });\n \n // collect touches\n if (type === INPUT_START) {\n i = 0;\n while (i < targetTouches.length) {\n targetIds[targetTouches[i].identifier] = true;\n i++;\n }\n }\n \n // filter changed touches to only contain touches that exist in the collected target ids\n i = 0;\n while (i < changedTouches.length) {\n if (targetIds[changedTouches[i].identifier]) {\n changedTargetTouches.push(changedTouches[i]);\n }\n \n // cleanup removed touches\n if (type & (INPUT_END | INPUT_CANCEL)) {\n delete targetIds[changedTouches[i].identifier];\n }\n i++;\n }\n \n if (!changedTargetTouches.length) {\n return;\n }\n \n return [\n // merge targetTouches with changedTargetTouches so it contains ALL touches, including 'end' and 'cancel'\n uniqueArray(\n targetTouches.concat(changedTargetTouches),\n 'identifier',\n true\n ),\n changedTargetTouches\n ];\n }\n \n /**\n * Combined touch and mouse input\n *\n * Touch has a higher priority then mouse, and while touching no mouse events are allowed.\n * This because touch devices also emit mouse events while doing a touch.\n *\n * @constructor\n * @extends Input\n */\n \n var DEDUP_TIMEOUT = 2500;\n var DED_DISTANCE = 25;\n \n function TouchMouseInput() {\n Input.apply(this, arguments);\n \n var handler = bindFn(this.handler, this);\n this.touch = new TouchInput(this.manager, handler);\n this.mouse = new MouseInput(this.manager, handler);\n \n this.primaryTouch = null;\n this.lastTouches = [];\n }\n \n inherit(TouchMouseInput, Input, {\n /**\n * handle mouse and touch events\n * @param {Hammer} manager\n * @param {String} inputEvent\n * @param {Object} inputData\n */\n handler: function TMEhandler(manager, inputEvent, inputData) {\n var isTouch = inputData.pointerType == INPUT_TYPE_TOUCH,\n isMouse = inputData.pointerType == INPUT_TYPE_MOUSE;\n \n if (\n isMouse &&\n inputData.sourceCapabilities &&\n inputData.sourceCapabilities.firesTouchEvents\n ) {\n return;\n }\n \n // when we're in a touch event, record touches to de-dupe synthetic mouse event\n if (isTouch) {\n recordTouches.call(this, inputEvent, inputData);\n } else if (isMouse && isSyntheticEvent.call(this, inputData)) {\n return;\n }\n \n this.callback(manager, inputEvent, inputData);\n },\n \n /**\n * remove the event listeners\n */\n destroy: function destroy() {\n this.touch.destroy();\n this.mouse.destroy();\n }\n });\n \n function recordTouches(eventType, eventData) {\n if (eventType & INPUT_START) {\n this.primaryTouch = eventData.changedPointers[0].identifier;\n setLastTouch.call(this, eventData);\n } else if (eventType & (INPUT_END | INPUT_CANCEL)) {\n setLastTouch.call(this, eventData);\n }\n }\n \n function setLastTouch(eventData) {\n var touch = eventData.changedPointers[0];\n \n if (touch.identifier === this.primaryTouch) {\n var lastTouch = { x: touch.clientX, y: touch.clientY };\n this.lastTouches.push(lastTouch);\n var lts = this.lastTouches;\n var removeLastTouch = function() {\n var i = lts.indexOf(lastTouch);\n if (i > -1) {\n lts.splice(i, 1);\n }\n };\n setTimeout(removeLastTouch, DEDUP_TIMEOUT);\n }\n }\n \n function isSyntheticEvent(eventData) {\n var x = eventData.srcEvent.clientX,\n y = eventData.srcEvent.clientY;\n for (var i = 0; i < this.lastTouches.length; i++) {\n var t = this.lastTouches[i];\n var dx = Math.abs(x - t.x),\n dy = Math.abs(y - t.y);\n if (dx <= DEDUP_DISTANCE && dy <= DEDUP_DISTANCE) {\n return true;\n }\n }\n return false;\n }\n \n var PREFIXED_TOUCH_ACTION = prefixed(TEST_ELEMENT.style, 'touchAction');\n var NATIVE_TOUCH_ACTION = PREFIXED_TOUCH_ACTION !== undefined;\n \n // magical touchAction value\n var TOUCH_ACTION_COMPUTE = 'compute';\n var TOUCH_ACTION_AUTO = 'auto';\n var TOUCH_ACTION_MANIPULATION = 'manipulation'; // not implemented\n var TOUCH_ACTION_NONE = 'none';\n var TOUCH_ACTION_PAN_X = 'pan-x';\n var TOUCH_ACTION_PAN_Y = 'pan-y';\n var TOUCH_ACTION_MAP = getTouchActionProps();\n \n /**\n * Touch Action\n * sets the touchAction property or uses the js alternative\n * @param {Manager} manager\n * @param {String} value\n * @constructor\n */\n function TouchAction(manager, value) {\n this.manager = manager;\n this.set(value);\n }\n \n TouchAction.prototype = {\n /**\n * set the touchAction value on the element or enable the polyfill\n * @param {String} value\n */\n set: function(value) {\n // find out the touch-action by the event handlers\n if (value == TOUCH_ACTION_COMPUTE) {\n value = this.compute();\n }\n \n if (\n NATIVE_TOUCH_ACTION &&\n this.manager.element.style &&\n TOUCH_ACTION_MAP[value]\n ) {\n this.manager.element.style[PREFIXED_TOUCH_ACTION] = value;\n }\n this.actions = value.toLowerCase().trim();\n },\n \n /**\n * just re-set the touchAction value\n */\n update: function() {\n this.set(this.manager.options.touchAction);\n },\n \n /**\n * compute the value for the touchAction property based on the recognizer's settings\n * @returns {String} value\n */\n compute: function() {\n var actions = [];\n each(this.manager.recognizers, function(recognizer) {\n if (boolOrFn(recognizer.options.enable, [recognizer])) {\n actions = actions.concat(recognizer.getTouchAction());\n }\n });\n return cleanTouchActions(actions.join(' '));\n },\n \n /**\n * this method is called on each input cycle and provides the preventing of the browser behavior\n * @param {Object} input\n */\n preventDefaults: function(input) {\n var srcEvent = input.srcEvent;\n var direction = input.offsetDirection;\n \n // if the touch action did prevented once this session\n if (this.manager.session.prevented) {\n srcEvent.preventDefault();\n return;\n }\n \n var actions = this.actions;\n var hasNone =\n inStr(actions, TOUCH_ACTION_NONE) &&\n !TOUCH_ACTION_MAP[TOUCH_ACTION_NONE];\n var hasPanY =\n inStr(actions, TOUCH_ACTION_PAN_Y) &&\n !TOUCH_ACTION_MAP[TOUCH_ACTION_PAN_Y];\n var hasPanX =\n inStr(actions, TOUCH_ACTION_PAN_X) &&\n !TOUCH_ACTION_MAP[TOUCH_ACTION_PAN_X];\n \n if (hasNone) {\n //do not prevent defaults if this is a tap gesture\n \n var isTapPointer = input.pointers.length === 1;\n var isTapMovement = input.distance < 2;\n var isTapTouchTime = input.deltaTime < 250;\n \n if (isTapPointer && isTapMovement && isTapTouchTime) {\n return;\n }\n }\n \n if (hasPanX && hasPanY) {\n // `pan-x pan-y` means browser handles all scrolling/panning, do not prevent\n return;\n }\n \n if (\n hasNone ||\n (hasPanY && direction & DIRECTION_HORIZONTAL) ||\n (hasPanX && direction & DIRECTION_VERTICAL)\n ) {\n return this.preventSrc(srcEvent);\n }\n },\n \n /**\n * call preventDefault to prevent the browser's default behavior (scrolling in most cases)\n * @param {Object} srcEvent\n */\n preventSrc: function(srcEvent) {\n this.manager.session.prevented = true;\n srcEvent.preventDefault();\n }\n };\n \n /**\n * when the touchActions are collected they are not a valid value, so we need to clean things up. *\n * @param {String} actions\n * @returns {*}\n */\n function cleanTouchActions(actions) {\n // none\n if (inStr(actions, TOUCH_ACTION_NONE)) {\n return TOUCH_ACTION_NONE;\n }\n \n var hasPanX = inStr(actions, TOUCH_ACTION_PAN_X);\n var hasPanY = inStr(actions, TOUCH_ACTION_PAN_Y);\n \n // if both pan-x and pan-y are set (different recognizers\n // for different directions, e.g. horizontal pan but vertical swipe?)\n // we need none (as otherwise with pan-x pan-y combined none of these\n // recognizers will work, since the browser would handle all panning\n if (hasPanX && hasPanY) {\n return TOUCH_ACTION_NONE;\n }\n \n // pan-x OR pan-y\n if (hasPanX || hasPanY) {\n return hasPanX ? TOUCH_ACTION_PAN_X : TOUCH_ACTION_PAN_Y;\n }\n \n // manipulation\n if (inStr(actions, TOUCH_ACTION_MANIPULATION)) {\n return TOUCH_ACTION_MANIPULATION;\n }\n \n return TOUCH_ACTION_AUTO;\n }\n \n function getTouchActionProps() {\n if (!NATIVE_TOUCH_ACTION) {\n return false;\n }\n var touchMap = {};\n var cssSupports = window.CSS && window.CSS.supports;\n ['auto', 'manipulation', 'pan-y', 'pan-x', 'pan-x pan-y', 'none'].forEach(\n function(val) {\n // If css.supports is not supported but there is native touch-action assume it supports\n // all values. This is the case for IE 10 and 11.\n touchMap[val] = cssSupports\n ? window.CSS.supports('touch-action', val)\n : true;\n }\n );\n return touchMap;\n }\n \n /**\n * Recognizer flow explained; *\n * All recognizers have the initial state of POSSIBLE when a input session starts.\n * The definition of a input session is from the first input until the last input, with all it's movement in it. *\n * Example session for mouse-input: mousedown -> mousemove -> mouseup\n *\n * On each recognizing cycle (see Manager.recognize) the .recognize() method is executed\n * which determines with state it should be.\n *\n * If the recognizer has the state FAILED, CANCELLED or RECOGNIZED (equals ENDED), it is reset to\n * POSSIBLE to give it another change on the next cycle.\n *\n * Possible\n * |\n * +-----+---------------+\n * | |\n * +-----+-----+ |\n * | | |\n * Failed Cancelled |\n * +-------+------+\n * | |\n * Recognized Began\n * |\n * Changed\n * |\n * Ended/Recognized\n */\n var STATE_POSSIBLE = 1;\n var STATE_BEGAN = 2;\n var STATE_CHANGED = 4;\n var STATE_ENDED = 8;\n var STATE_RECOGNIZED = STATE_ENDED;\n var STATE_CANCELLED = 16;\n var STATE_FAILED = 32;\n \n /**\n * Recognizer\n * Every recognizer needs to extend from this class.\n * @constructor\n * @param {Object} options\n */\n function Recognizer(options) {\n this.options = assign({}, this.defaults, options || {});\n \n this.id = uniqueId();\n \n this.manager = null;\n \n // default is enable true\n this.options.enable = ifUndefined(this.options.enable, true);\n \n this.state = STATE_POSSIBLE;\n \n this.simultaneous = {};\n this.requireFail = [];\n }\n \n Recognizer.prototype = {\n /**\n * @virtual\n * @type {Object}\n */\n defaults: {},\n \n /**\n * set options\n * @param {Object} options\n * @return {Recognizer}\n */\n set: function(options) {\n assign(this.options, options);\n \n // also update the touchAction, in case something changed about the directions/enabled state\n this.manager && this.manager.touchAction.update();\n return this;\n },\n \n /**\n * recognize simultaneous with an other recognizer.\n * @param {Recognizer} otherRecognizer\n * @returns {Recognizer} this\n */\n recognizeWith: function(otherRecognizer) {\n if (invokeArrayArg(otherRecognizer, 'recognizeWith', this)) {\n return this;\n }\n \n var simultaneous = this.simultaneous;\n otherRecognizer = getRecognizerByNameIfManager(otherRecognizer, this);\n if (!simultaneous[otherRecognizer.id]) {\n simultaneous[otherRecognizer.id] = otherRecognizer;\n otherRecognizer.recognizeWith(this);\n }\n return this;\n },\n \n /**\n * drop the simultaneous link. it doesnt remove the link on the other recognizer.\n * @param {Recognizer} otherRecognizer\n * @returns {Recognizer} this\n */\n dropRecognizeWith: function(otherRecognizer) {\n if (invokeArrayArg(otherRecognizer, 'dropRecognizeWith', this)) {\n return this;\n }\n \n otherRecognizer = getRecognizerByNameIfManager(otherRecognizer, this);\n delete this.simultaneous[otherRecognizer.id];\n return this;\n },\n \n /**\n * recognizer can only run when an other is failing\n * @param {Recognizer} otherRecognizer\n * @returns {Recognizer} this\n */\n requireFailure: function(otherRecognizer) {\n if (invokeArrayArg(otherRecognizer, 'requireFailure', this)) {\n return this;\n }\n \n var requireFail = this.requireFail;\n otherRecognizer = getRecognizerByNameIfManager(otherRecognizer, this);\n if (inArray(requireFail, otherRecognizer) === -1) {\n requireFail.push(otherRecognizer);\n otherRecognizer.requireFailure(this);\n }\n return this;\n },\n \n /**\n * drop the requireFailure link. it does not remove the link on the other recognizer.\n * @param {Recognizer} otherRecognizer\n * @returns {Recognizer} this\n */\n dropRequireFailure: function(otherRecognizer) {\n if (invokeArrayArg(otherRecognizer, 'dropRequireFailure', this)) {\n return this;\n }\n \n otherRecognizer = getRecognizerByNameIfManager(otherRecognizer, this);\n var index = inArray(this.requireFail, otherRecognizer);\n if (index > -1) {\n this.requireFail.splice(index, 1);\n }\n return this;\n },\n \n /**\n * has require failures boolean\n * @returns {boolean}\n */\n hasRequireFailures: function() {\n return this.requireFail.length > 0;\n },\n \n /**\n * if the recognizer can recognize simultaneous with an other recognizer\n * @param {Recognizer} otherRecognizer\n * @returns {Boolean}\n */\n canRecognizeWith: function(otherRecognizer) {\n return !!this.simultaneous[otherRecognizer.id];\n },\n \n /**\n * You should use `tryEmit` instead of `emit` directly to check\n * that all the needed recognizers has failed before emitting.\n * @param {Object} input\n */\n emit: function(input) {\n var self = this;\n var state = this.state;\n \n function emit(event) {\n self.manager.emit(event, input);\n }\n \n // 'panstart' and 'panmove'\n if (state < STATE_ENDED) {\n emit(self.options.event + stateStr(state));\n }\n \n emit(self.options.event); // simple 'eventName' events\n \n if (input.additionalEvent) {\n // additional event(panleft, panright, pinchin, pinchout...)\n emit(input.additionalEvent);\n }\n \n // panend and pancancel\n if (state >= STATE_ENDED) {\n emit(self.options.event + stateStr(state));\n }\n },\n \n /**\n * Check that all the require failure recognizers has failed,\n * if true, it emits a gesture event,\n * otherwise, setup the state to FAILED.\n * @param {Object} input\n */\n tryEmit: function(input) {\n if (this.canEmit()) {\n return this.emit(input);\n }\n // it's failing anyway\n this.state = STATE_FAILED;\n },\n \n /**\n * can we emit?\n * @returns {boolean}\n */\n canEmit: function() {\n var i = 0;\n while (i < this.requireFail.length) {\n if (!(this.requireFail[i].state & (STATE_FAILED | STATE_POSSIBLE))) {\n return false;\n }\n i++;\n }\n return true;\n },\n \n /**\n * update the recognizer\n * @param {Object} inputData\n */\n recognize: function(inputData) {\n // make a new copy of the inputData\n // so we can change the inputData without messing up the other recognizers\n var inputDataClone = assign({}, inputData);\n \n // is is enabled and allow recognizing?\n if (!boolOrFn(this.options.enable, [this, inputDataClone])) {\n this.reset();\n this.state = STATE_FAILED;\n return;\n }\n \n // reset when we've reached the end\n if (this.state & (STATE_RECOGNIZED | STATE_CANCELLED | STATE_FAILED)) {\n this.state = STATE_POSSIBLE;\n }\n \n this.state = this.process(inputDataClone);\n \n // the recognizer has recognized a gesture\n // so trigger an event\n if (\n this.state &\n (STATE_BEGAN | STATE_CHANGED | STATE_ENDED | STATE_CANCELLED)\n ) {\n this.tryEmit(inputDataClone);\n }\n },\n \n /**\n * return the state of the recognizer\n * the actual recognizing happens in this method\n * @virtual\n * @param {Object} inputData\n * @returns {Const} STATE\n */\n process: function(inputData) {}, // jshint ignore:line\n \n /**\n * return the preferred touch-action\n * @virtual\n * @returns {Array}\n */\n getTouchAction: function() {},\n \n /**\n * called when the gesture isn't allowed to recognize\n * like when another is being recognized or it is disabled\n * @virtual\n */\n reset: function() {}\n };\n \n /**\n * get a usable string, used as event postfix\n * @param {Const} state\n * @returns {String} state\n */\n function stateStr(state) {\n if (state & STATE_CANCELLED) {\n return 'cancel';\n } else if (state & STATE_ENDED) {\n return 'end';\n } else if (state & STATE_CHANGED) {\n return 'move';\n } else if (state & STATE_BEGAN) {\n return 'start';\n }\n return '';\n }\n \n /**\n * direction cons to string\n * @param {Const} direction\n * @returns {String}\n */\n function directionStr(direction) {\n if (direction == DIRECTION_DOWN) {\n return 'down';\n } else if (direction == DIRECTION_UP) {\n return 'up';\n } else if (direction == DIRECTION_LEFT) {\n return 'left';\n } else if (direction == DIRECTION_RIGHT) {\n return 'right';\n }\n return '';\n }\n \n /**\n * get a recognizer by name if it is bound to a manager\n * @param {Recognizer|String} otherRecognizer\n * @param {Recognizer} recognizer\n * @returns {Recognizer}\n */\n function getRecognizerByNameIfManager(otherRecognizer, recognizer) {\n var manager = recognizer.manager;\n if (manager) {\n return manager.get(otherRecognizer);\n }\n return otherRecognizer;\n }\n \n /**\n * This recognizer is just used as a base for the simple attribute recognizers.\n * @constructor\n * @extends Recognizer\n */\n function AttrRecognizer() {\n Recognizer.apply(this, arguments);\n }\n \n inherit(AttrRecognizer, Recognizer, {\n /**\n * @namespace\n * @memberof AttrRecognizer\n */\n defaults: {\n /**\n * @type {Number}\n * @default 1\n */\n pointers: 1\n },\n \n /**\n * Used to check if it the recognizer receives valid input, like input.distance > 10.\n * @memberof AttrRecognizer\n * @param {Object} input\n * @returns {Boolean} recognized\n */\n attrTest: function(input) {\n var optionPointers = this.options.pointers;\n return optionPointers === 0 || input.pointers.length === optionPointers;\n },\n \n /**\n * Process the input and return the state for the recognizer\n * @memberof AttrRecognizer\n * @param {Object} input\n * @returns {*} State\n */\n process: function(input) {\n var state = this.state;\n var eventType = input.eventType;\n \n var isRecognized = state & (STATE_BEGAN | STATE_CHANGED);\n var isValid = this.attrTest(input);\n \n // on cancel input and we've recognized before, return STATE_CANCELLED\n if (isRecognized && (eventType & INPUT_CANCEL || !isValid)) {\n return state | STATE_CANCELLED;\n } else if (isRecognized || isValid) {\n if (eventType & INPUT_END) {\n return state | STATE_ENDED;\n } else if (!(state & STATE_BEGAN)) {\n return STATE_BEGAN;\n }\n return state | STATE_CHANGED;\n }\n return STATE_FAILED;\n }\n });\n \n /**\n * Pan\n * Recognized when the pointer is down and moved in the allowed direction.\n * @constructor\n * @extends AttrRecognizer\n */\n function PanRecognizer() {\n AttrRecognizer.apply(this, arguments);\n \n this.pX = null;\n this.pY = null;\n }\n \n inherit(PanRecognizer, AttrRecognizer, {\n /**\n * @namespace\n * @memberof PanRecognizer\n */\n defaults: {\n event: 'pan',\n threshold: 10,\n pointers: 1,\n direction: DIRECTION_ALL\n },\n \n getTouchAction: function() {\n var direction = this.options.direction;\n var actions = [];\n if (direction & DIRECTION_HORIZONTAL) {\n actions.push(TOUCH_ACTION_PAN_Y);\n }\n if (direction & DIRECTION_VERTICAL) {\n actions.push(TOUCH_ACTION_PAN_X);\n }\n return actions;\n },\n \n directionTest: function(input) {\n var options = this.options;\n var hasMoved = true;\n var distance = input.distance;\n var direction = input.direction;\n var x = input.deltaX;\n var y = input.deltaY;\n \n // lock to axis?\n if (!(direction & options.direction)) {\n if (options.direction & DIRECTION_HORIZONTAL) {\n direction =\n x === 0 ? DIRECTION_NONE : x < 0 ? DIRECTION_LEFT : DIRECTION_RIGHT;\n hasMoved = x != this.pX;\n distance = Math.abs(input.deltaX);\n } else {\n direction =\n y === 0 ? DIRECTION_NONE : y < 0 ? DIRECTION_UP : DIRECTION_DOWN;\n hasMoved = y != this.pY;\n distance = Math.abs(input.deltaY);\n }\n }\n input.direction = direction;\n return (\n hasMoved &&\n distance > options.threshold &&\n direction & options.direction\n );\n },\n \n attrTest: function(input) {\n return (\n AttrRecognizer.prototype.attrTest.call(this, input) &&\n (this.state & STATE_BEGAN ||\n (!(this.state & STATE_BEGAN) && this.directionTest(input)))\n );\n },\n \n emit: function(input) {\n this.pX = input.deltaX;\n this.pY = input.deltaY;\n \n var direction = directionStr(input.direction);\n \n if (direction) {\n input.additionalEvent = this.options.event + direction;\n }\n this._super.emit.call(this, input);\n }\n });\n \n /**\n * Pinch\n * Recognized when two or more pointers are moving toward (zoom-in) or away from each other (zoom-out).\n * @constructor\n * @extends AttrRecognizer\n */\n function PinchRecognizer() {\n AttrRecognizer.apply(this, arguments);\n }\n \n inherit(PinchRecognizer, AttrRecognizer, {\n /**\n * @namespace\n * @memberof PinchRecognizer\n */\n defaults: {\n event: 'pinch',\n threshold: 0,\n pointers: 2\n },\n \n getTouchAction: function() {\n return [TOUCH_ACTION_NONE];\n },\n \n attrTest: function(input) {\n return (\n this._super.attrTest.call(this, input) &&\n (Math.abs(input.scale - 1) > this.options.threshold ||\n this.state & STATE_BEGAN)\n );\n },\n \n emit: function(input) {\n if (input.scale !== 1) {\n var inOut = input.scale < 1 ? 'in' : 'out';\n input.additionalEvent = this.options.event + inOut;\n }\n this._super.emit.call(this, input);\n }\n });\n \n /**\n * Press\n * Recognized when the pointer is down for x ms without any movement.\n * @constructor\n * @extends Recognizer\n */\n function PressRecognizer() {\n Recognizer.apply(this, arguments);\n \n this._timer = null;\n this._input = null;\n }\n \n inherit(PressRecognizer, Recognizer, {\n /**\n * @namespace\n * @memberof PressRecognizer\n */\n defaults: {\n event: 'press',\n pointers: 1,\n time: 251, // minimal time of the pointer to be pressed\n threshold: 9 // a minimal movement is ok, but keep it low\n },\n \n getTouchAction: function() {\n return [TOUCH_ACTION_AUTO];\n },\n \n process: function(input) {\n var options = this.options;\n var validPointers = input.pointers.length === options.pointers;\n var validMovement = input.distance < options.threshold;\n var validTime = input.deltaTime > options.time;\n \n this._input = input;\n \n // we only allow little movement\n // and we've reached an end event, so a tap is possible\n if (\n !validMovement ||\n !validPointers ||\n (input.eventType & (INPUT_END | INPUT_CANCEL) && !validTime)\n ) {\n this.reset();\n } else if (input.eventType & INPUT_START) {\n this.reset();\n this._timer = setTimeoutContext(\n function() {\n this.state = STATE_RECOGNIZED;\n this.tryEmit();\n },\n options.time,\n this\n );\n } else if (input.eventType & INPUT_END) {\n return STATE_RECOGNIZED;\n }\n return STATE_FAILED;\n },\n \n reset: function() {\n clearTimeout(this._timer);\n },\n \n emit: function(input) {\n if (this.state !== STATE_RECOGNIZED) {\n return;\n }\n \n if (input && input.eventType & INPUT_END) {\n this.manager.emit(this.options.event + 'up', input);\n } else {\n this._input.timeStamp = now();\n this.manager.emit(this.options.event, this._input);\n }\n }\n });\n \n /**\n * Rotate\n * Recognized when two or more pointer are moving in a circular motion.\n * @constructor\n * @extends AttrRecognizer\n */\n function RotateRecognizer() {\n AttrRecognizer.apply(this, arguments);\n }\n \n inherit(RotateRecognizer, AttrRecognizer, {\n /**\n * @namespace\n * @memberof RotateRecognizer\n */\n defaults: {\n event: 'rotate',\n threshold: 0,\n pointers: 2\n },\n \n getTouchAction: function() {\n return [TOUCH_ACTION_NONE];\n },\n \n attrTest: function(input) {\n return (\n this._super.attrTest.call(this, input) &&\n (Math.abs(input.rotation) > this.options.threshold ||\n this.state & STATE_BEGAN)\n );\n }\n });\n \n /**\n * Swipe\n * Recognized when the pointer is moving fast (velocity), with enough distance in the allowed direction.\n * @constructor\n * @extends AttrRecognizer\n */\n function SwipeRecognizer() {\n AttrRecognizer.apply(this, arguments);\n }\n \n inherit(SwipeRecognizer, AttrRecognizer, {\n /**\n * @namespace\n * @memberof SwipeRecognizer\n */\n defaults: {\n event: 'swipe',\n threshold: 10,\n velocity: 0.3,\n direction: DIRECTION_HORIZONTAL | DIRECTION_VERTICAL,\n pointers: 1\n },\n \n getTouchAction: function() {\n return PanRecognizer.prototype.getTouchAction.call(this);\n },\n \n attrTest: function(input) {\n var direction = this.options.direction;\n var velocity;\n \n if (direction & (DIRECTION_HORIZONTAL | DIRECTION_VERTICAL)) {\n velocity = input.overallVelocity;\n } else if (direction & DIRECTION_HORIZONTAL) {\n velocity = input.overallVelocityX;\n } else if (direction & DIRECTION_VERTICAL) {\n velocity = input.overallVelocityY;\n }\n \n return (\n this._super.attrTest.call(this, input) &&\n direction & input.offsetDirection &&\n input.distance > this.options.threshold &&\n input.maxPointers == this.options.pointers &&\n abs(velocity) > this.options.velocity &&\n input.eventType & INPUT_END\n );\n },\n \n emit: function(input) {\n var direction = directionStr(input.offsetDirection);\n if (direction) {\n this.manager.emit(this.options.event + direction, input);\n }\n \n this.manager.emit(this.options.event, input);\n }\n });\n \n /**\n * A tap is ecognized when the pointer is doing a small tap/click. Multiple taps are recognized if they occur\n * between the given interval and position. The delay option can be used to recognize multi-taps without firing\n * a single tap.\n *\n * The eventData from the emitted event contains the property `tapCount`, which contains the amount of\n * multi-taps being recognized.\n * @constructor\n * @extends Recognizer\n */\n function TapRecognizer() {\n Recognizer.apply(this, arguments);\n \n // previous time and center,\n // used for tap counting\n this.pTime = false;\n this.pCenter = false;\n \n this._timer = null;\n this._input = null;\n this.count = 0;\n }\n \n inherit(TapRecognizer, Recognizer, {\n /**\n * @namespace\n * @memberof PinchRecognizer\n */\n defaults: {\n event: 'tap',\n pointers: 1,\n taps: 1,\n interval: 300, // max time between the multi-tap taps\n time: 250, // max time of the pointer to be down (like finger on the screen)\n threshold: 9, // a minimal movement is ok, but keep it low\n posThreshold: 10 // a multi-tap can be a bit off the initial position\n },\n \n getTouchAction: function() {\n return [TOUCH_ACTION_MANIPULATION];\n },\n \n process: function(input) {\n var options = this.options;\n \n var validPointers = input.pointers.length === options.pointers;\n var validMovement = input.distance < options.threshold;\n var validTouchTime = input.deltaTime < options.time;\n \n this.reset();\n \n if (input.eventType & INPUT_START && this.count === 0) {\n return this.failTimeout();\n }\n \n // we only allow little movement\n // and we've reached an end event, so a tap is possible\n if (validMovement && validTouchTime && validPointers) {\n if (input.eventType != INPUT_END) {\n return this.failTimeout();\n }\n \n var validInterval = this.pTime\n ? input.timeStamp - this.pTime < options.interval\n : true;\n var validMultiTap =\n !this.pCenter ||\n getDistance(this.pCenter, input.center) < options.posThreshold;\n \n this.pTime = input.timeStamp;\n this.pCenter = input.center;\n \n if (!validMultiTap || !validInterval) {\n this.count = 1;\n } else {\n this.count += 1;\n }\n \n this._input = input;\n \n // if tap count matches we have recognized it,\n // else it has began recognizing...\n var tapCount = this.count % options.taps;\n if (tapCount === 0) {\n // no failing requirements, immediately trigger the tap event\n // or wait as long as the multitap interval to trigger\n if (!this.hasRequireFailures()) {\n return STATE_RECOGNIZED;\n } else {\n this._timer = setTimeoutContext(\n function() {\n this.state = STATE_RECOGNIZED;\n this.tryEmit();\n },\n options.interval,\n this\n );\n return STATE_BEGAN;\n }\n }\n }\n return STATE_FAILED;\n },\n \n failTimeout: function() {\n this._timer = setTimeoutContext(\n function() {\n this.state = STATE_FAILED;\n },\n this.options.interval,\n this\n );\n return STATE_FAILED;\n },\n \n reset: function() {\n clearTimeout(this._timer);\n },\n \n emit: function() {\n if (this.state == STATE_RECOGNIZED) {\n this._input.tapCount = this.count;\n this.manager.emit(this.options.event, this._input);\n }\n }\n });\n \n /**\n * Simple way to create a manager with a default set of recognizers.\n * @param {HTMLElement} element\n * @param {Object} [options]\n * @constructor\n */\n function Hammer(element, options) {\n options = options || {};\n options.recognizers = ifUndefined(\n options.recognizers,\n Hammer.defaults.preset\n );\n return new Manager(element, options);\n }\n \n /**\n * @const {string}\n */\n Hammer.VERSION = '2.0.7';\n \n /**\n * default settings\n * @namespace\n */\n Hammer.defaults = {\n /**\n * set if DOM events are being triggered.\n * But this is slower and unused by simple implementations, so disabled by default.\n * @type {Boolean}\n * @default false\n */\n domEvents: false,\n \n /**\n * The value for the touchAction property/fallback.\n * When set to `compute` it will magically set the correct value based on the added recognizers.\n * @type {String}\n * @default compute\n */\n touchAction: TOUCH_ACTION_COMPUTE,\n \n /**\n * @type {Boolean}\n * @default true\n */\n enable: true,\n \n /**\n * EXPERIMENTAL FEATURE -- can be removed/changed\n * Change the parent input target element.\n * If Null, then it is being set the to main element.\n * @type {Null|EventTarget}\n * @default null\n */\n inputTarget: null,\n \n /**\n * force an input class\n * @type {Null|Function}\n * @default null\n */\n inputClass: null,\n \n /**\n * Default recognizer setup when calling `Hammer()`\n * When creating a new Manager these will be skipped.\n * @type {Array}\n */\n preset: [\n // RecognizerClass, options, [recognizeWith, ...], [requireFailure, ...]\n [RotateRecognizer, { enable: false }],\n [PinchRecognizer, { enable: false }, ['rotate']],\n [SwipeRecognizer, { direction: DIRECTION_HORIZONTAL }],\n [PanRecognizer, { direction: DIRECTION_HORIZONTAL }, ['swipe']],\n [TapRecognizer],\n [TapRecognizer, { event: 'doubletap', taps: 2 }, ['tap']],\n [PressRecognizer]\n ],\n \n /**\n * Some CSS properties can be used to improve the working of Hammer.\n * Add them to this method and they will be set when creating a new Manager.\n * @namespace\n */\n cssProps: {\n /**\n * Disables text selection to improve the dragging gesture. Mainly for desktop browsers.\n * @type {String}\n * @default 'none'\n */\n userSelect: 'none',\n \n /**\n * Disable the Windows Phone grippers when pressing an element.\n * @type {String}\n * @default 'none'\n */\n touchSelect: 'none',\n \n /**\n * Disables the default callout shown when you touch and hold a touch target.\n * On iOS, when you touch and hold a touch target such as a link, Safari displays\n * a callout containing information about the link. This property allows you to disable that callout.\n * @type {String}\n * @default 'none'\n */\n touchCallout: 'none',\n \n /**\n * Specifies whether zooming is enabled. Used by IE10>\n * @type {String}\n * @default 'none'\n */\n contentZooming: 'none',\n \n /**\n * Specifies that an entire element should be draggable instead of its contents. Mainly for desktop browsers.\n * @type {String}\n * @default 'none'\n */\n userDrag: 'none',\n \n /**\n * Overrides the highlight color shown when the user taps a link or a JavaScript\n * clickable element in iOS. This property obeys the alpha value, if specified.\n * @type {String}\n * @default 'rgba(0,0,0,0)'\n */\n tapHighlightColor: 'rgba(0,0,0,0)'\n }\n };\n \n var STOP = 1;\n var FORCED_STOP = 2;\n \n /**\n * Manager\n * @param {HTMLElement} element\n * @param {Object} [options]\n * @constructor\n */\n function Manager(element, options) {\n this.options = assign({}, Hammer.defaults, options || {});\n \n this.options.inputTarget = this.options.inputTarget || element;\n \n this.handlers = {};\n this.session = {};\n this.recognizers = [];\n this.oldCssProps = {};\n \n this.element = element;\n this.input = createInputInstance(this);\n this.touchAction = new TouchAction(this, this.options.touchAction);\n \n toggleCssProps(this, true);\n \n each(\n this.options.recognizers,\n function(item) {\n var recognizer = this.add(new item[0](item[1]));\n item[2] && recognizer.recognizeWith(item[2]);\n item[3] && recognizer.requireFailure(item[3]);\n },\n this\n );\n }\n \n Manager.prototype = {\n /**\n * set options\n * @param {Object} options\n * @returns {Manager}\n */\n set: function(options) {\n assign(this.options, options);\n \n // Options that need a little more setup\n if (options.touchAction) {\n this.touchAction.update();\n }\n if (options.inputTarget) {\n // Clean up existing event listeners and reinitialize\n this.input.destroy();\n this.input.target = options.inputTarget;\n this.input.init();\n }\n return this;\n },\n \n /**\n * stop recognizing for this session.\n * This session will be discarded, when a new [input]start event is fired.\n * When forced, the recognizer cycle is stopped immediately.\n * @param {Boolean} [force]\n */\n stop: function(force) {\n this.session.stopped = force ? FORCED_STOP : STOP;\n },\n \n /**\n * run the recognizers!\n * called by the inputHandler function on every movement of the pointers (touches)\n * it walks through all the recognizers and tries to detect the gesture that is being made\n * @param {Object} inputData\n */\n recognize: function(inputData) {\n var session = this.session;\n if (session.stopped) {\n return;\n }\n \n // run the touch-action polyfill\n this.touchAction.preventDefaults(inputData);\n \n var recognizer;\n var recognizers = this.recognizers;\n \n // this holds the recognizer that is being recognized.\n // so the recognizer's state needs to be BEGAN, CHANGED, ENDED or RECOGNIZED\n // if no recognizer is detecting a thing, it is set to `null`\n var curRecognizer = session.curRecognizer;\n \n // reset when the last recognizer is recognized\n // or when we're in a new session\n if (\n !curRecognizer ||\n (curRecognizer && curRecognizer.state & STATE_RECOGNIZED)\n ) {\n curRecognizer = session.curRecognizer = null;\n }\n \n var i = 0;\n while (i < recognizers.length) {\n recognizer = recognizers[i];\n \n // find out if we are allowed try to recognize the input for this one.\n // 1. allow if the session is NOT forced stopped (see the .stop() method)\n // 2. allow if we still haven't recognized a gesture in this session, or the this recognizer is the one\n // that is being recognized.\n // 3. allow if the recognizer is allowed to run simultaneous with the current recognized recognizer.\n // this can be setup with the `recognizeWith()` method on the recognizer.\n if (\n session.stopped !== FORCED_STOP && // 1\n (!curRecognizer ||\n recognizer == curRecognizer || // 2\n recognizer.canRecognizeWith(curRecognizer))\n ) {\n // 3\n recognizer.recognize(inputData);\n } else {\n recognizer.reset();\n }\n \n // if the recognizer has been recognizing the input as a valid gesture, we want to store this one as the\n // current active recognizer. but only if we don't already have an active recognizer\n if (\n !curRecognizer &&\n recognizer.state & (STATE_BEGAN | STATE_CHANGED | STATE_ENDED)\n ) {\n curRecognizer = session.curRecognizer = recognizer;\n }\n i++;\n }\n },\n \n /**\n * get a recognizer by its event name.\n * @param {Recognizer|String} recognizer\n * @returns {Recognizer|Null}\n */\n get: function(recognizer) {\n if (recognizer instanceof Recognizer) {\n return recognizer;\n }\n \n var recognizers = this.recognizers;\n for (var i = 0; i < recognizers.length; i++) {\n if (recognizers[i].options.event == recognizer) {\n return recognizers[i];\n }\n }\n return null;\n },\n \n /**\n * add a recognizer to the manager\n * existing recognizers with the same event name will be removed\n * @param {Recognizer} recognizer\n * @returns {Recognizer|Manager}\n */\n add: function(recognizer) {\n if (invokeArrayArg(recognizer, 'add', this)) {\n return this;\n }\n \n // remove existing\n var existing = this.get(recognizer.options.event);\n if (existing) {\n this.remove(existing);\n }\n \n this.recognizers.push(recognizer);\n recognizer.manager = this;\n \n this.touchAction.update();\n return recognizer;\n },\n \n /**\n * remove a recognizer by name or instance\n * @param {Recognizer|String} recognizer\n * @returns {Manager}\n */\n remove: function(recognizer) {\n if (invokeArrayArg(recognizer, 'remove', this)) {\n return this;\n }\n \n recognizer = this.get(recognizer);\n \n // let's make sure this recognizer exists\n if (recognizer) {\n var recognizers = this.recognizers;\n var index = inArray(recognizers, recognizer);\n \n if (index !== -1) {\n recognizers.splice(index, 1);\n this.touchAction.update();\n }\n }\n \n return this;\n },\n \n /**\n * bind event\n * @param {String} events\n * @param {Function} handler\n * @returns {EventEmitter} this\n */\n on: function(events, handler) {\n if (events === undefined) {\n return;\n }\n if (handler === undefined) {\n return;\n }\n \n var handlers = this.handlers;\n each(splitStr(events), function(event) {\n handlers[event] = handlers[event] || [];\n handlers[event].push(handler);\n });\n return this;\n },\n \n /**\n * unbind event, leave emit blank to remove all handlers\n * @param {String} events\n * @param {Function} [handler]\n * @returns {EventEmitter} this\n */\n off: function(events, handler) {\n if (events === undefined) {\n return;\n }\n \n var handlers = this.handlers;\n each(splitStr(events), function(event) {\n if (!handler) {\n delete handlers[event];\n } else {\n handlers[event] &&\n handlers[event].splice(inArray(handlers[event], handler), 1);\n }\n });\n return this;\n },\n \n /**\n * emit event to the listeners\n * @param {String} event\n * @param {Object} data\n */\n emit: function(event, data) {\n // we also want to trigger dom events\n if (this.options.domEvents) {\n triggerDomEvent(event, data);\n }\n \n // no handlers, so skip it all\n var handlers = this.handlers[event] && this.handlers[event].slice();\n if (!handlers || !handlers.length) {\n return;\n }\n \n data.type = event;\n data.preventDefault = function() {\n data.srcEvent.preventDefault();\n };\n \n var i = 0;\n while (i < handlers.length) {\n handlers[i](data);\n i++;\n }\n },\n \n /**\n * destroy the manager and unbinds all events\n * it doesn't unbind dom events, that is the user own responsibility\n */\n destroy: function() {\n this.element && toggleCssProps(this, false);\n \n this.handlers = {};\n this.session = {};\n this.input.destroy();\n this.element = null;\n }\n };\n \n /**\n * add/remove the css properties as defined in manager.options.cssProps\n * @param {Manager} manager\n * @param {Boolean} add\n */\n function toggleCssProps(manager, add) {\n var element = manager.element;\n if (!element.style) {\n return;\n }\n var prop;\n each(manager.options.cssProps, function(value, name) {\n prop = prefixed(element.style, name);\n if (add) {\n manager.oldCssProps[prop] = element.style[prop];\n element.style[prop] = value;\n } else {\n element.style[prop] = manager.oldCssProps[prop] || '';\n }\n });\n if (!add) {\n manager.oldCssProps = {};\n }\n }\n \n /**\n * trigger dom event\n * @param {String} event\n * @param {Object} data\n */\n function triggerDomEvent(event, data) {\n var gestureEvent = document.createEvent('Event');\n gestureEvent.initEvent(event, true, true);\n gestureEvent.gesture = data;\n data.target.dispatchEvent(gestureEvent);\n }\n \n assign(Hammer, {\n INPUT_START: INPUT_START,\n INPUT_MOVE: INPUT_MOVE,\n INPUT_END: INPUT_END,\n INPUT_CANCEL: INPUT_CANCEL,\n \n STATE_POSSIBLE: STATE_POSSIBLE,\n STATE_BEGAN: STATE_BEGAN,\n STATE_CHANGED: STATE_CHANGED,\n STATE_ENDED: STATE_ENDED,\n STATE_RECOGNIZED: STATE_RECOGNIZED,\n STATE_CANCELLED: STATE_CANCELLED,\n STATE_FAILED: STATE_FAILED,\n \n DIRECTION_NONE: DIRECTION_NONE,\n DIRECTION_LEFT: DIRECTION_LEFT,\n DIRECTION_RIGHT: DIRECTION_RIGHT,\n DIRECTION_UP: DIRECTION_UP,\n DIRECTION_DOWN: DIRECTION_DOWN,\n DIRECTION_HORIZONTAL: DIRECTION_HORIZONTAL,\n DIRECTION_VERTICAL: DIRECTION_VERTICAL,\n DIRECTION_ALL: DIRECTION_ALL,\n \n Manager: Manager,\n Input: Input,\n TouchAction: TouchAction,\n \n TouchInput: TouchInput,\n MouseInput: MouseInput,\n PointerEventInput: PointerEventInput,\n TouchMouseInput: TouchMouseInput,\n SingleTouchInput: SingleTouchInput,\n \n Recognizer: Recognizer,\n AttrRecognizer: AttrRecognizer,\n Tap: TapRecognizer,\n Pan: PanRecognizer,\n Swipe: SwipeRecognizer,\n Pinch: PinchRecognizer,\n Rotate: RotateRecognizer,\n Press: PressRecognizer,\n \n on: addEventListeners,\n off: removeEventListeners,\n each: each,\n merge: merge,\n extend: extend,\n assign: assign,\n inherit: inherit,\n bindFn: bindFn,\n prefixed: prefixed\n });\n \n // this prevents errors when Hammer is loaded in the presence of an AMD\n // style loader but by script tag, not by the loader.\n var freeGlobal =\n typeof window !== 'undefined'\n ? window\n : typeof self !== 'undefined'\n ? self\n : {}; // jshint ignore:line\n freeGlobal.Hammer = Hammer;\n \n if (typeof define === 'function' && define.amd) {\n define(function() {\n return Hammer;\n });\n } else if (typeof module != 'undefined' && module.exports) {\n module.exports = Hammer;\n } else {\n window[exportName] = Hammer;\n }\n })(window, document, 'Hammer');\n ","(function (global, factory) {\n typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :\n typeof define === 'function' && define.amd ? define(factory) :\n (global = typeof globalThis !== 'undefined' ? globalThis : global || self, global.Konva = factory());\n})(this, (function () { 'use strict';\n\n /*\r\n * Konva JavaScript Framework v8.3.14\r\n * http://konvajs.org/\r\n * Licensed under the MIT\r\n * Date: Wed Nov 09 2022\r\n *\r\n * Original work Copyright (C) 2011 - 2013 by Eric Rowell (KineticJS)\r\n * Modified work Copyright (C) 2014 - present by Anton Lavrenov (Konva)\r\n *\r\n * @license\r\n */\r\n var PI_OVER_180 = Math.PI / 180;\r\n /**\r\n * @namespace Konva\r\n */\r\n function detectBrowser() {\r\n return (typeof window !== 'undefined' &&\r\n // browser case\r\n ({}.toString.call(window) === '[object Window]' ||\r\n // electron case\r\n {}.toString.call(window) === '[object global]'));\r\n }\r\n const glob = typeof global !== 'undefined'\r\n ? global\r\n : typeof window !== 'undefined'\r\n ? window\r\n : typeof WorkerGlobalScope !== 'undefined'\r\n ? self\r\n : {};\r\n const Konva$2 = {\r\n _global: glob,\r\n version: '8.3.14',\r\n isBrowser: detectBrowser(),\r\n isUnminified: /param/.test(function (param) { }.toString()),\r\n dblClickWindow: 400,\r\n getAngle(angle) {\r\n return Konva$2.angleDeg ? angle * PI_OVER_180 : angle;\r\n },\r\n enableTrace: false,\r\n pointerEventsEnabled: true,\r\n /**\r\n * Should Konva automatically update canvas on any changes. Default is true.\r\n * @property autoDrawEnabled\r\n * @default true\r\n * @name autoDrawEnabled\r\n * @memberof Konva\r\n * @example\r\n * Konva.autoDrawEnabled = true;\r\n */\r\n autoDrawEnabled: true,\r\n /**\r\n * Should we enable hit detection while dragging? For performance reasons, by default it is false.\r\n * But on some rare cases you want to see hit graph and check intersections. Just set it to true.\r\n * @property hitOnDragEnabled\r\n * @default false\r\n * @name hitOnDragEnabled\r\n * @memberof Konva\r\n * @example\r\n * Konva.hitOnDragEnabled = true;\r\n */\r\n hitOnDragEnabled: false,\r\n /**\r\n * Should we capture touch events and bind them to the touchstart target? That is how it works on DOM elements.\r\n * The case: we touchstart on div1, then touchmove out of that element into another element div2.\r\n * DOM will continue trigger touchmove events on div1 (not div2). Because events are \"captured\" into initial target.\r\n * By default Konva do not do that and will trigger touchmove on another element, while pointer is moving.\r\n * @property capturePointerEventsEnabled\r\n * @default false\r\n * @name capturePointerEventsEnabled\r\n * @memberof Konva\r\n * @example\r\n * Konva.capturePointerEventsEnabled = true;\r\n */\r\n capturePointerEventsEnabled: false,\r\n _mouseListenClick: false,\r\n _touchListenClick: false,\r\n _pointerListenClick: false,\r\n _mouseInDblClickWindow: false,\r\n _touchInDblClickWindow: false,\r\n _pointerInDblClickWindow: false,\r\n _mouseDblClickPointerId: null,\r\n _touchDblClickPointerId: null,\r\n _pointerDblClickPointerId: null,\r\n /**\r\n * Global pixel ratio configuration. KonvaJS automatically detect pixel ratio of current device.\r\n * But you may override such property, if you want to use your value. Set this value before any components initializations.\r\n * @property pixelRatio\r\n * @default undefined\r\n * @name pixelRatio\r\n * @memberof Konva\r\n * @example\r\n * // before any Konva code:\r\n * Konva.pixelRatio = 1;\r\n */\r\n pixelRatio: (typeof window !== 'undefined' && window.devicePixelRatio) || 1,\r\n /**\r\n * Drag distance property. If you start to drag a node you may want to wait until pointer is moved to some distance from start point,\r\n * only then start dragging. Default is 3px.\r\n * @property dragDistance\r\n * @default 0\r\n * @memberof Konva\r\n * @example\r\n * Konva.dragDistance = 10;\r\n */\r\n dragDistance: 3,\r\n /**\r\n * Use degree values for angle properties. You may set this property to false if you want to use radian values.\r\n * @property angleDeg\r\n * @default true\r\n * @memberof Konva\r\n * @example\r\n * node.rotation(45); // 45 degrees\r\n * Konva.angleDeg = false;\r\n * node.rotation(Math.PI / 2); // PI/2 radian\r\n */\r\n angleDeg: true,\r\n /**\r\n * Show different warnings about errors or wrong API usage\r\n * @property showWarnings\r\n * @default true\r\n * @memberof Konva\r\n * @example\r\n * Konva.showWarnings = false;\r\n */\r\n showWarnings: true,\r\n /**\r\n * Configure what mouse buttons can be used for drag and drop.\r\n * Default value is [0] - only left mouse button.\r\n * @property dragButtons\r\n * @default true\r\n * @memberof Konva\r\n * @example\r\n * // enable left and right mouse buttons\r\n * Konva.dragButtons = [0, 2];\r\n */\r\n dragButtons: [0, 1],\r\n /**\r\n * returns whether or not drag and drop is currently active\r\n * @method\r\n * @memberof Konva\r\n */\r\n isDragging() {\r\n return Konva$2['DD'].isDragging;\r\n },\r\n /**\r\n * returns whether or not a drag and drop operation is ready, but may\r\n * not necessarily have started\r\n * @method\r\n * @memberof Konva\r\n */\r\n isDragReady() {\r\n return !!Konva$2['DD'].node;\r\n },\r\n /**\r\n * Should Konva release canvas elements on destroy. Default is true.\r\n * Useful to avoid memory leak issues in Safari on macOS/iOS.\r\n * @property releaseCanvasOnDestroy\r\n * @default true\r\n * @name releaseCanvasOnDestroy\r\n * @memberof Konva\r\n * @example\r\n * Konva.releaseCanvasOnDestroy = true;\r\n */\r\n releaseCanvasOnDestroy: true,\r\n // user agent\r\n document: glob.document,\r\n // insert Konva into global namespace (window)\r\n // it is required for npm packages\r\n _injectGlobal(Konva) {\r\n glob.Konva = Konva;\r\n },\r\n };\r\n const _registerNode = (NodeClass) => {\r\n Konva$2[NodeClass.prototype.getClassName()] = NodeClass;\r\n };\r\n Konva$2._injectGlobal(Konva$2);\n\n /*\r\n * Last updated November 2011\r\n * By Simon Sarris\r\n * www.simonsarris.com\r\n * sarris@acm.org\r\n *\r\n * Free to use and distribute at will\r\n * So long as you are nice to people, etc\r\n */\r\n /*\r\n * The usage of this class was inspired by some of the work done by a forked\r\n * project, KineticJS-Ext by Wappworks, which is based on Simon's Transform\r\n * class. Modified by Eric Rowell\r\n */\r\n /**\r\n * Transform constructor.\r\n * In most of the cases you don't need to use it in your app. Because it is for internal usage in Konva core.\r\n * But there is a documentation for that class in case you still want\r\n * to make some manual calculations.\r\n * @constructor\r\n * @param {Array} [m] Optional six-element matrix\r\n * @memberof Konva\r\n */\r\n class Transform {\r\n constructor(m = [1, 0, 0, 1, 0, 0]) {\r\n this.dirty = false;\r\n this.m = (m && m.slice()) || [1, 0, 0, 1, 0, 0];\r\n }\r\n reset() {\r\n this.m[0] = 1;\r\n this.m[1] = 0;\r\n this.m[2] = 0;\r\n this.m[3] = 1;\r\n this.m[4] = 0;\r\n this.m[5] = 0;\r\n }\r\n /**\r\n * Copy Konva.Transform object\r\n * @method\r\n * @name Konva.Transform#copy\r\n * @returns {Konva.Transform}\r\n * @example\r\n * const tr = shape.getTransform().copy()\r\n */\r\n copy() {\r\n return new Transform(this.m);\r\n }\r\n copyInto(tr) {\r\n tr.m[0] = this.m[0];\r\n tr.m[1] = this.m[1];\r\n tr.m[2] = this.m[2];\r\n tr.m[3] = this.m[3];\r\n tr.m[4] = this.m[4];\r\n tr.m[5] = this.m[5];\r\n }\r\n /**\r\n * Transform point\r\n * @method\r\n * @name Konva.Transform#point\r\n * @param {Object} point 2D point(x, y)\r\n * @returns {Object} 2D point(x, y)\r\n */\r\n point(point) {\r\n var m = this.m;\r\n return {\r\n x: m[0] * point.x + m[2] * point.y + m[4],\r\n y: m[1] * point.x + m[3] * point.y + m[5],\r\n };\r\n }\r\n /**\r\n * Apply translation\r\n * @method\r\n * @name Konva.Transform#translate\r\n * @param {Number} x\r\n * @param {Number} y\r\n * @returns {Konva.Transform}\r\n */\r\n translate(x, y) {\r\n this.m[4] += this.m[0] * x + this.m[2] * y;\r\n this.m[5] += this.m[1] * x + this.m[3] * y;\r\n return this;\r\n }\r\n /**\r\n * Apply scale\r\n * @method\r\n * @name Konva.Transform#scale\r\n * @param {Number} sx\r\n * @param {Number} sy\r\n * @returns {Konva.Transform}\r\n */\r\n scale(sx, sy) {\r\n this.m[0] *= sx;\r\n this.m[1] *= sx;\r\n this.m[2] *= sy;\r\n this.m[3] *= sy;\r\n return this;\r\n }\r\n /**\r\n * Apply rotation\r\n * @method\r\n * @name Konva.Transform#rotate\r\n * @param {Number} rad Angle in radians\r\n * @returns {Konva.Transform}\r\n */\r\n rotate(rad) {\r\n var c = Math.cos(rad);\r\n var s = Math.sin(rad);\r\n var m11 = this.m[0] * c + this.m[2] * s;\r\n var m12 = this.m[1] * c + this.m[3] * s;\r\n var m21 = this.m[0] * -s + this.m[2] * c;\r\n var m22 = this.m[1] * -s + this.m[3] * c;\r\n this.m[0] = m11;\r\n this.m[1] = m12;\r\n this.m[2] = m21;\r\n this.m[3] = m22;\r\n return this;\r\n }\r\n /**\r\n * Returns the translation\r\n * @method\r\n * @name Konva.Transform#getTranslation\r\n * @returns {Object} 2D point(x, y)\r\n */\r\n getTranslation() {\r\n return {\r\n x: this.m[4],\r\n y: this.m[5],\r\n };\r\n }\r\n /**\r\n * Apply skew\r\n * @method\r\n * @name Konva.Transform#skew\r\n * @param {Number} sx\r\n * @param {Number} sy\r\n * @returns {Konva.Transform}\r\n */\r\n skew(sx, sy) {\r\n var m11 = this.m[0] + this.m[2] * sy;\r\n var m12 = this.m[1] + this.m[3] * sy;\r\n var m21 = this.m[2] + this.m[0] * sx;\r\n var m22 = this.m[3] + this.m[1] * sx;\r\n this.m[0] = m11;\r\n this.m[1] = m12;\r\n this.m[2] = m21;\r\n this.m[3] = m22;\r\n return this;\r\n }\r\n /**\r\n * Transform multiplication\r\n * @method\r\n * @name Konva.Transform#multiply\r\n * @param {Konva.Transform} matrix\r\n * @returns {Konva.Transform}\r\n */\r\n multiply(matrix) {\r\n var m11 = this.m[0] * matrix.m[0] + this.m[2] * matrix.m[1];\r\n var m12 = this.m[1] * matrix.m[0] + this.m[3] * matrix.m[1];\r\n var m21 = this.m[0] * matrix.m[2] + this.m[2] * matrix.m[3];\r\n var m22 = this.m[1] * matrix.m[2] + this.m[3] * matrix.m[3];\r\n var dx = this.m[0] * matrix.m[4] + this.m[2] * matrix.m[5] + this.m[4];\r\n var dy = this.m[1] * matrix.m[4] + this.m[3] * matrix.m[5] + this.m[5];\r\n this.m[0] = m11;\r\n this.m[1] = m12;\r\n this.m[2] = m21;\r\n this.m[3] = m22;\r\n this.m[4] = dx;\r\n this.m[5] = dy;\r\n return this;\r\n }\r\n /**\r\n * Invert the matrix\r\n * @method\r\n * @name Konva.Transform#invert\r\n * @returns {Konva.Transform}\r\n */\r\n invert() {\r\n var d = 1 / (this.m[0] * this.m[3] - this.m[1] * this.m[2]);\r\n var m0 = this.m[3] * d;\r\n var m1 = -this.m[1] * d;\r\n var m2 = -this.m[2] * d;\r\n var m3 = this.m[0] * d;\r\n var m4 = d * (this.m[2] * this.m[5] - this.m[3] * this.m[4]);\r\n var m5 = d * (this.m[1] * this.m[4] - this.m[0] * this.m[5]);\r\n this.m[0] = m0;\r\n this.m[1] = m1;\r\n this.m[2] = m2;\r\n this.m[3] = m3;\r\n this.m[4] = m4;\r\n this.m[5] = m5;\r\n return this;\r\n }\r\n /**\r\n * return matrix\r\n * @method\r\n * @name Konva.Transform#getMatrix\r\n */\r\n getMatrix() {\r\n return this.m;\r\n }\r\n /**\r\n * convert transformation matrix back into node's attributes\r\n * @method\r\n * @name Konva.Transform#decompose\r\n * @returns {Konva.Transform}\r\n */\r\n decompose() {\r\n var a = this.m[0];\r\n var b = this.m[1];\r\n var c = this.m[2];\r\n var d = this.m[3];\r\n var e = this.m[4];\r\n var f = this.m[5];\r\n var delta = a * d - b * c;\r\n let result = {\r\n x: e,\r\n y: f,\r\n rotation: 0,\r\n scaleX: 0,\r\n scaleY: 0,\r\n skewX: 0,\r\n skewY: 0,\r\n };\r\n // Apply the QR-like decomposition.\r\n if (a != 0 || b != 0) {\r\n var r = Math.sqrt(a * a + b * b);\r\n result.rotation = b > 0 ? Math.acos(a / r) : -Math.acos(a / r);\r\n result.scaleX = r;\r\n result.scaleY = delta / r;\r\n result.skewX = (a * c + b * d) / delta;\r\n result.skewY = 0;\r\n }\r\n else if (c != 0 || d != 0) {\r\n var s = Math.sqrt(c * c + d * d);\r\n result.rotation =\r\n Math.PI / 2 - (d > 0 ? Math.acos(-c / s) : -Math.acos(c / s));\r\n result.scaleX = delta / s;\r\n result.scaleY = s;\r\n result.skewX = 0;\r\n result.skewY = (a * c + b * d) / delta;\r\n }\r\n else ;\r\n result.rotation = Util._getRotation(result.rotation);\r\n return result;\r\n }\r\n }\r\n // CONSTANTS\r\n var OBJECT_ARRAY = '[object Array]', OBJECT_NUMBER = '[object Number]', OBJECT_STRING = '[object String]', OBJECT_BOOLEAN = '[object Boolean]', PI_OVER_DEG180 = Math.PI / 180, DEG180_OVER_PI = 180 / Math.PI, HASH$1 = '#', EMPTY_STRING$1 = '', ZERO = '0', KONVA_WARNING = 'Konva warning: ', KONVA_ERROR = 'Konva error: ', RGB_PAREN = 'rgb(', COLORS = {\r\n aliceblue: [240, 248, 255],\r\n antiquewhite: [250, 235, 215],\r\n aqua: [0, 255, 255],\r\n aquamarine: [127, 255, 212],\r\n azure: [240, 255, 255],\r\n beige: [245, 245, 220],\r\n bisque: [255, 228, 196],\r\n black: [0, 0, 0],\r\n blanchedalmond: [255, 235, 205],\r\n blue: [0, 0, 255],\r\n blueviolet: [138, 43, 226],\r\n brown: [165, 42, 42],\r\n burlywood: [222, 184, 135],\r\n cadetblue: [95, 158, 160],\r\n chartreuse: [127, 255, 0],\r\n chocolate: [210, 105, 30],\r\n coral: [255, 127, 80],\r\n cornflowerblue: [100, 149, 237],\r\n cornsilk: [255, 248, 220],\r\n crimson: [220, 20, 60],\r\n cyan: [0, 255, 255],\r\n darkblue: [0, 0, 139],\r\n darkcyan: [0, 139, 139],\r\n darkgoldenrod: [184, 132, 11],\r\n darkgray: [169, 169, 169],\r\n darkgreen: [0, 100, 0],\r\n darkgrey: [169, 169, 169],\r\n darkkhaki: [189, 183, 107],\r\n darkmagenta: [139, 0, 139],\r\n darkolivegreen: [85, 107, 47],\r\n darkorange: [255, 140, 0],\r\n darkorchid: [153, 50, 204],\r\n darkred: [139, 0, 0],\r\n darksalmon: [233, 150, 122],\r\n darkseagreen: [143, 188, 143],\r\n darkslateblue: [72, 61, 139],\r\n darkslategray: [47, 79, 79],\r\n darkslategrey: [47, 79, 79],\r\n darkturquoise: [0, 206, 209],\r\n darkviolet: [148, 0, 211],\r\n deeppink: [255, 20, 147],\r\n deepskyblue: [0, 191, 255],\r\n dimgray: [105, 105, 105],\r\n dimgrey: [105, 105, 105],\r\n dodgerblue: [30, 144, 255],\r\n firebrick: [178, 34, 34],\r\n floralwhite: [255, 255, 240],\r\n forestgreen: [34, 139, 34],\r\n fuchsia: [255, 0, 255],\r\n gainsboro: [220, 220, 220],\r\n ghostwhite: [248, 248, 255],\r\n gold: [255, 215, 0],\r\n goldenrod: [218, 165, 32],\r\n gray: [128, 128, 128],\r\n green: [0, 128, 0],\r\n greenyellow: [173, 255, 47],\r\n grey: [128, 128, 128],\r\n honeydew: [240, 255, 240],\r\n hotpink: [255, 105, 180],\r\n indianred: [205, 92, 92],\r\n indigo: [75, 0, 130],\r\n ivory: [255, 255, 240],\r\n khaki: [240, 230, 140],\r\n lavender: [230, 230, 250],\r\n lavenderblush: [255, 240, 245],\r\n lawngreen: [124, 252, 0],\r\n lemonchiffon: [255, 250, 205],\r\n lightblue: [173, 216, 230],\r\n lightcoral: [240, 128, 128],\r\n lightcyan: [224, 255, 255],\r\n lightgoldenrodyellow: [250, 250, 210],\r\n lightgray: [211, 211, 211],\r\n lightgreen: [144, 238, 144],\r\n lightgrey: [211, 211, 211],\r\n lightpink: [255, 182, 193],\r\n lightsalmon: [255, 160, 122],\r\n lightseagreen: [32, 178, 170],\r\n lightskyblue: [135, 206, 250],\r\n lightslategray: [119, 136, 153],\r\n lightslategrey: [119, 136, 153],\r\n lightsteelblue: [176, 196, 222],\r\n lightyellow: [255, 255, 224],\r\n lime: [0, 255, 0],\r\n limegreen: [50, 205, 50],\r\n linen: [250, 240, 230],\r\n magenta: [255, 0, 255],\r\n maroon: [128, 0, 0],\r\n mediumaquamarine: [102, 205, 170],\r\n mediumblue: [0, 0, 205],\r\n mediumorchid: [186, 85, 211],\r\n mediumpurple: [147, 112, 219],\r\n mediumseagreen: [60, 179, 113],\r\n mediumslateblue: [123, 104, 238],\r\n mediumspringgreen: [0, 250, 154],\r\n mediumturquoise: [72, 209, 204],\r\n mediumvioletred: [199, 21, 133],\r\n midnightblue: [25, 25, 112],\r\n mintcream: [245, 255, 250],\r\n mistyrose: [255, 228, 225],\r\n moccasin: [255, 228, 181],\r\n navajowhite: [255, 222, 173],\r\n navy: [0, 0, 128],\r\n oldlace: [253, 245, 230],\r\n olive: [128, 128, 0],\r\n olivedrab: [107, 142, 35],\r\n orange: [255, 165, 0],\r\n orangered: [255, 69, 0],\r\n orchid: [218, 112, 214],\r\n palegoldenrod: [238, 232, 170],\r\n palegreen: [152, 251, 152],\r\n paleturquoise: [175, 238, 238],\r\n palevioletred: [219, 112, 147],\r\n papayawhip: [255, 239, 213],\r\n peachpuff: [255, 218, 185],\r\n peru: [205, 133, 63],\r\n pink: [255, 192, 203],\r\n plum: [221, 160, 203],\r\n powderblue: [176, 224, 230],\r\n purple: [128, 0, 128],\r\n rebeccapurple: [102, 51, 153],\r\n red: [255, 0, 0],\r\n rosybrown: [188, 143, 143],\r\n royalblue: [65, 105, 225],\r\n saddlebrown: [139, 69, 19],\r\n salmon: [250, 128, 114],\r\n sandybrown: [244, 164, 96],\r\n seagreen: [46, 139, 87],\r\n seashell: [255, 245, 238],\r\n sienna: [160, 82, 45],\r\n silver: [192, 192, 192],\r\n skyblue: [135, 206, 235],\r\n slateblue: [106, 90, 205],\r\n slategray: [119, 128, 144],\r\n slategrey: [119, 128, 144],\r\n snow: [255, 255, 250],\r\n springgreen: [0, 255, 127],\r\n steelblue: [70, 130, 180],\r\n tan: [210, 180, 140],\r\n teal: [0, 128, 128],\r\n thistle: [216, 191, 216],\r\n transparent: [255, 255, 255, 0],\r\n tomato: [255, 99, 71],\r\n turquoise: [64, 224, 208],\r\n violet: [238, 130, 238],\r\n wheat: [245, 222, 179],\r\n white: [255, 255, 255],\r\n whitesmoke: [245, 245, 245],\r\n yellow: [255, 255, 0],\r\n yellowgreen: [154, 205, 5],\r\n }, RGB_REGEX = /rgb\\((\\d{1,3}),(\\d{1,3}),(\\d{1,3})\\)/, animQueue = [];\r\n const req = (typeof requestAnimationFrame !== 'undefined' && requestAnimationFrame) ||\r\n function (f) {\r\n setTimeout(f, 60);\r\n };\r\n /**\r\n * @namespace Util\r\n * @memberof Konva\r\n */\r\n const Util = {\r\n /*\r\n * cherry-picked utilities from underscore.js\r\n */\r\n _isElement(obj) {\r\n return !!(obj && obj.nodeType == 1);\r\n },\r\n _isFunction(obj) {\r\n return !!(obj && obj.constructor && obj.call && obj.apply);\r\n },\r\n _isPlainObject(obj) {\r\n return !!obj && obj.constructor === Object;\r\n },\r\n _isArray(obj) {\r\n return Object.prototype.toString.call(obj) === OBJECT_ARRAY;\r\n },\r\n _isNumber(obj) {\r\n return (Object.prototype.toString.call(obj) === OBJECT_NUMBER &&\r\n !isNaN(obj) &&\r\n isFinite(obj));\r\n },\r\n _isString(obj) {\r\n return Object.prototype.toString.call(obj) === OBJECT_STRING;\r\n },\r\n _isBoolean(obj) {\r\n return Object.prototype.toString.call(obj) === OBJECT_BOOLEAN;\r\n },\r\n // arrays are objects too\r\n isObject(val) {\r\n return val instanceof Object;\r\n },\r\n isValidSelector(selector) {\r\n if (typeof selector !== 'string') {\r\n return false;\r\n }\r\n var firstChar = selector[0];\r\n return (firstChar === '#' ||\r\n firstChar === '.' ||\r\n firstChar === firstChar.toUpperCase());\r\n },\r\n _sign(number) {\r\n if (number === 0) {\r\n // that is not what sign usually returns\r\n // but that is what we need\r\n return 1;\r\n }\r\n if (number > 0) {\r\n return 1;\r\n }\r\n else {\r\n return -1;\r\n }\r\n },\r\n requestAnimFrame(callback) {\r\n animQueue.push(callback);\r\n if (animQueue.length === 1) {\r\n req(function () {\r\n const queue = animQueue;\r\n animQueue = [];\r\n queue.forEach(function (cb) {\r\n cb();\r\n });\r\n });\r\n }\r\n },\r\n createCanvasElement() {\r\n var canvas = document.createElement('canvas');\r\n // on some environments canvas.style is readonly\r\n try {\r\n canvas.style = canvas.style || {};\r\n }\r\n catch (e) { }\r\n return canvas;\r\n },\r\n createImageElement() {\r\n return document.createElement('img');\r\n },\r\n _isInDocument(el) {\r\n while ((el = el.parentNode)) {\r\n if (el == document) {\r\n return true;\r\n }\r\n }\r\n return false;\r\n },\r\n /*\r\n * arg can be an image object or image data\r\n */\r\n _urlToImage(url, callback) {\r\n // if arg is a string, then it's a data url\r\n var imageObj = Util.createImageElement();\r\n imageObj.onload = function () {\r\n callback(imageObj);\r\n };\r\n imageObj.src = url;\r\n },\r\n _rgbToHex(r, g, b) {\r\n return ((1 << 24) + (r << 16) + (g << 8) + b).toString(16).slice(1);\r\n },\r\n _hexToRgb(hex) {\r\n hex = hex.replace(HASH$1, EMPTY_STRING$1);\r\n var bigint = parseInt(hex, 16);\r\n return {\r\n r: (bigint >> 16) & 255,\r\n g: (bigint >> 8) & 255,\r\n b: bigint & 255,\r\n };\r\n },\r\n /**\r\n * return random hex color\r\n * @method\r\n * @memberof Konva.Util\r\n * @example\r\n * shape.fill(Konva.Util.getRandomColor());\r\n */\r\n getRandomColor() {\r\n var randColor = ((Math.random() * 0xffffff) << 0).toString(16);\r\n while (randColor.length < 6) {\r\n randColor = ZERO + randColor;\r\n }\r\n return HASH$1 + randColor;\r\n },\r\n /**\r\n * get RGB components of a color\r\n * @method\r\n * @memberof Konva.Util\r\n * @param {String} color\r\n * @example\r\n * // each of the following examples return {r:0, g:0, b:255}\r\n * var rgb = Konva.Util.getRGB('blue');\r\n * var rgb = Konva.Util.getRGB('#0000ff');\r\n * var rgb = Konva.Util.getRGB('rgb(0,0,255)');\r\n */\r\n getRGB(color) {\r\n var rgb;\r\n // color string\r\n if (color in COLORS) {\r\n rgb = COLORS[color];\r\n return {\r\n r: rgb[0],\r\n g: rgb[1],\r\n b: rgb[2],\r\n };\r\n }\r\n else if (color[0] === HASH$1) {\r\n // hex\r\n return this._hexToRgb(color.substring(1));\r\n }\r\n else if (color.substr(0, 4) === RGB_PAREN) {\r\n // rgb string\r\n rgb = RGB_REGEX.exec(color.replace(/ /g, ''));\r\n return {\r\n r: parseInt(rgb[1], 10),\r\n g: parseInt(rgb[2], 10),\r\n b: parseInt(rgb[3], 10),\r\n };\r\n }\r\n else {\r\n // default\r\n return {\r\n r: 0,\r\n g: 0,\r\n b: 0,\r\n };\r\n }\r\n },\r\n // convert any color string to RGBA object\r\n // from https://github.com/component/color-parser\r\n colorToRGBA(str) {\r\n str = str || 'black';\r\n return (Util._namedColorToRBA(str) ||\r\n Util._hex3ColorToRGBA(str) ||\r\n Util._hex6ColorToRGBA(str) ||\r\n Util._rgbColorToRGBA(str) ||\r\n Util._rgbaColorToRGBA(str) ||\r\n Util._hslColorToRGBA(str));\r\n },\r\n // Parse named css color. Like \"green\"\r\n _namedColorToRBA(str) {\r\n var c = COLORS[str.toLowerCase()];\r\n if (!c) {\r\n return null;\r\n }\r\n return {\r\n r: c[0],\r\n g: c[1],\r\n b: c[2],\r\n a: 1,\r\n };\r\n },\r\n // Parse rgb(n, n, n)\r\n _rgbColorToRGBA(str) {\r\n if (str.indexOf('rgb(') === 0) {\r\n str = str.match(/rgb\\(([^)]+)\\)/)[1];\r\n var parts = str.split(/ *, */).map(Number);\r\n return {\r\n r: parts[0],\r\n g: parts[1],\r\n b: parts[2],\r\n a: 1,\r\n };\r\n }\r\n },\r\n // Parse rgba(n, n, n, n)\r\n _rgbaColorToRGBA(str) {\r\n if (str.indexOf('rgba(') === 0) {\r\n str = str.match(/rgba\\(([^)]+)\\)/)[1];\r\n var parts = str.split(/ *, */).map((n, index) => {\r\n if (n.slice(-1) === '%') {\r\n return index === 3 ? parseInt(n) / 100 : (parseInt(n) / 100) * 255;\r\n }\r\n return Number(n);\r\n });\r\n return {\r\n r: parts[0],\r\n g: parts[1],\r\n b: parts[2],\r\n a: parts[3],\r\n };\r\n }\r\n },\r\n // Parse #nnnnnn\r\n _hex6ColorToRGBA(str) {\r\n if (str[0] === '#' && str.length === 7) {\r\n return {\r\n r: parseInt(str.slice(1, 3), 16),\r\n g: parseInt(str.slice(3, 5), 16),\r\n b: parseInt(str.slice(5, 7), 16),\r\n a: 1,\r\n };\r\n }\r\n },\r\n // Parse #nnn\r\n _hex3ColorToRGBA(str) {\r\n if (str[0] === '#' && str.length === 4) {\r\n return {\r\n r: parseInt(str[1] + str[1], 16),\r\n g: parseInt(str[2] + str[2], 16),\r\n b: parseInt(str[3] + str[3], 16),\r\n a: 1,\r\n };\r\n }\r\n },\r\n // Code adapted from https://github.com/Qix-/color-convert/blob/master/conversions.js#L244\r\n _hslColorToRGBA(str) {\r\n // Check hsl() format\r\n if (/hsl\\((\\d+),\\s*([\\d.]+)%,\\s*([\\d.]+)%\\)/g.test(str)) {\r\n // Extract h, s, l\r\n const [_, ...hsl] = /hsl\\((\\d+),\\s*([\\d.]+)%,\\s*([\\d.]+)%\\)/g.exec(str);\r\n const h = Number(hsl[0]) / 360;\r\n const s = Number(hsl[1]) / 100;\r\n const l = Number(hsl[2]) / 100;\r\n let t2;\r\n let t3;\r\n let val;\r\n if (s === 0) {\r\n val = l * 255;\r\n return {\r\n r: Math.round(val),\r\n g: Math.round(val),\r\n b: Math.round(val),\r\n a: 1,\r\n };\r\n }\r\n if (l < 0.5) {\r\n t2 = l * (1 + s);\r\n }\r\n else {\r\n t2 = l + s - l * s;\r\n }\r\n const t1 = 2 * l - t2;\r\n const rgb = [0, 0, 0];\r\n for (let i = 0; i < 3; i++) {\r\n t3 = h + (1 / 3) * -(i - 1);\r\n if (t3 < 0) {\r\n t3++;\r\n }\r\n if (t3 > 1) {\r\n t3--;\r\n }\r\n if (6 * t3 < 1) {\r\n val = t1 + (t2 - t1) * 6 * t3;\r\n }\r\n else if (2 * t3 < 1) {\r\n val = t2;\r\n }\r\n else if (3 * t3 < 2) {\r\n val = t1 + (t2 - t1) * (2 / 3 - t3) * 6;\r\n }\r\n else {\r\n val = t1;\r\n }\r\n rgb[i] = val * 255;\r\n }\r\n return {\r\n r: Math.round(rgb[0]),\r\n g: Math.round(rgb[1]),\r\n b: Math.round(rgb[2]),\r\n a: 1,\r\n };\r\n }\r\n },\r\n /**\r\n * check intersection of two client rectangles\r\n * @method\r\n * @memberof Konva.Util\r\n * @param {Object} r1 - { x, y, width, height } client rectangle\r\n * @param {Object} r2 - { x, y, width, height } client rectangle\r\n * @example\r\n * const overlapping = Konva.Util.haveIntersection(shape1.getClientRect(), shape2.getClientRect());\r\n */\r\n haveIntersection(r1, r2) {\r\n return !(r2.x > r1.x + r1.width ||\r\n r2.x + r2.width < r1.x ||\r\n r2.y > r1.y + r1.height ||\r\n r2.y + r2.height < r1.y);\r\n },\r\n cloneObject(obj) {\r\n var retObj = {};\r\n for (var key in obj) {\r\n if (this._isPlainObject(obj[key])) {\r\n retObj[key] = this.cloneObject(obj[key]);\r\n }\r\n else if (this._isArray(obj[key])) {\r\n retObj[key] = this.cloneArray(obj[key]);\r\n }\r\n else {\r\n retObj[key] = obj[key];\r\n }\r\n }\r\n return retObj;\r\n },\r\n cloneArray(arr) {\r\n return arr.slice(0);\r\n },\r\n degToRad(deg) {\r\n return deg * PI_OVER_DEG180;\r\n },\r\n radToDeg(rad) {\r\n return rad * DEG180_OVER_PI;\r\n },\r\n _degToRad(deg) {\r\n Util.warn('Util._degToRad is removed. Please use public Util.degToRad instead.');\r\n return Util.degToRad(deg);\r\n },\r\n _radToDeg(rad) {\r\n Util.warn('Util._radToDeg is removed. Please use public Util.radToDeg instead.');\r\n return Util.radToDeg(rad);\r\n },\r\n _getRotation(radians) {\r\n return Konva$2.angleDeg ? Util.radToDeg(radians) : radians;\r\n },\r\n _capitalize(str) {\r\n return str.charAt(0).toUpperCase() + str.slice(1);\r\n },\r\n throw(str) {\r\n throw new Error(KONVA_ERROR + str);\r\n },\r\n error(str) {\r\n console.error(KONVA_ERROR + str);\r\n },\r\n warn(str) {\r\n if (!Konva$2.showWarnings) {\r\n return;\r\n }\r\n console.warn(KONVA_WARNING + str);\r\n },\r\n each(obj, func) {\r\n for (var key in obj) {\r\n func(key, obj[key]);\r\n }\r\n },\r\n _inRange(val, left, right) {\r\n return left <= val && val < right;\r\n },\r\n _getProjectionToSegment(x1, y1, x2, y2, x3, y3) {\r\n var x, y, dist;\r\n var pd2 = (x1 - x2) * (x1 - x2) + (y1 - y2) * (y1 - y2);\r\n if (pd2 == 0) {\r\n x = x1;\r\n y = y1;\r\n dist = (x3 - x2) * (x3 - x2) + (y3 - y2) * (y3 - y2);\r\n }\r\n else {\r\n var u = ((x3 - x1) * (x2 - x1) + (y3 - y1) * (y2 - y1)) / pd2;\r\n if (u < 0) {\r\n x = x1;\r\n y = y1;\r\n dist = (x1 - x3) * (x1 - x3) + (y1 - y3) * (y1 - y3);\r\n }\r\n else if (u > 1.0) {\r\n x = x2;\r\n y = y2;\r\n dist = (x2 - x3) * (x2 - x3) + (y2 - y3) * (y2 - y3);\r\n }\r\n else {\r\n x = x1 + u * (x2 - x1);\r\n y = y1 + u * (y2 - y1);\r\n dist = (x - x3) * (x - x3) + (y - y3) * (y - y3);\r\n }\r\n }\r\n return [x, y, dist];\r\n },\r\n // line as array of points.\r\n // line might be closed\r\n _getProjectionToLine(pt, line, isClosed) {\r\n var pc = Util.cloneObject(pt);\r\n var dist = Number.MAX_VALUE;\r\n line.forEach(function (p1, i) {\r\n if (!isClosed && i === line.length - 1) {\r\n return;\r\n }\r\n var p2 = line[(i + 1) % line.length];\r\n var proj = Util._getProjectionToSegment(p1.x, p1.y, p2.x, p2.y, pt.x, pt.y);\r\n var px = proj[0], py = proj[1], pdist = proj[2];\r\n if (pdist < dist) {\r\n pc.x = px;\r\n pc.y = py;\r\n dist = pdist;\r\n }\r\n });\r\n return pc;\r\n },\r\n _prepareArrayForTween(startArray, endArray, isClosed) {\r\n var n, start = [], end = [];\r\n if (startArray.length > endArray.length) {\r\n var temp = endArray;\r\n endArray = startArray;\r\n startArray = temp;\r\n }\r\n for (n = 0; n < startArray.length; n += 2) {\r\n start.push({\r\n x: startArray[n],\r\n y: startArray[n + 1],\r\n });\r\n }\r\n for (n = 0; n < endArray.length; n += 2) {\r\n end.push({\r\n x: endArray[n],\r\n y: endArray[n + 1],\r\n });\r\n }\r\n var newStart = [];\r\n end.forEach(function (point) {\r\n var pr = Util._getProjectionToLine(point, start, isClosed);\r\n newStart.push(pr.x);\r\n newStart.push(pr.y);\r\n });\r\n return newStart;\r\n },\r\n _prepareToStringify(obj) {\r\n var desc;\r\n obj.visitedByCircularReferenceRemoval = true;\r\n for (var key in obj) {\r\n if (!(obj.hasOwnProperty(key) && obj[key] && typeof obj[key] == 'object')) {\r\n continue;\r\n }\r\n desc = Object.getOwnPropertyDescriptor(obj, key);\r\n if (obj[key].visitedByCircularReferenceRemoval ||\r\n Util._isElement(obj[key])) {\r\n if (desc.configurable) {\r\n delete obj[key];\r\n }\r\n else {\r\n return null;\r\n }\r\n }\r\n else if (Util._prepareToStringify(obj[key]) === null) {\r\n if (desc.configurable) {\r\n delete obj[key];\r\n }\r\n else {\r\n return null;\r\n }\r\n }\r\n }\r\n delete obj.visitedByCircularReferenceRemoval;\r\n return obj;\r\n },\r\n // very simplified version of Object.assign\r\n _assign(target, source) {\r\n for (var key in source) {\r\n target[key] = source[key];\r\n }\r\n return target;\r\n },\r\n _getFirstPointerId(evt) {\r\n if (!evt.touches) {\r\n // try to use pointer id or fake id\r\n return evt.pointerId || 999;\r\n }\r\n else {\r\n return evt.changedTouches[0].identifier;\r\n }\r\n },\r\n releaseCanvas(...canvases) {\r\n if (!Konva$2.releaseCanvasOnDestroy)\r\n return;\r\n canvases.forEach(c => {\r\n c.width = 0;\r\n c.height = 0;\r\n });\r\n }\r\n };\n\n function _formatValue(val) {\r\n if (Util._isString(val)) {\r\n return '\"' + val + '\"';\r\n }\r\n if (Object.prototype.toString.call(val) === '[object Number]') {\r\n return val;\r\n }\r\n if (Util._isBoolean(val)) {\r\n return val;\r\n }\r\n return Object.prototype.toString.call(val);\r\n }\r\n function RGBComponent(val) {\r\n if (val > 255) {\r\n return 255;\r\n }\r\n else if (val < 0) {\r\n return 0;\r\n }\r\n return Math.round(val);\r\n }\r\n function getNumberValidator() {\r\n if (Konva$2.isUnminified) {\r\n return function (val, attr) {\r\n if (!Util._isNumber(val)) {\r\n Util.warn(_formatValue(val) +\r\n ' is a not valid value for \"' +\r\n attr +\r\n '\" attribute. The value should be a number.');\r\n }\r\n return val;\r\n };\r\n }\r\n }\r\n function getNumberOrArrayOfNumbersValidator(noOfElements) {\r\n if (Konva$2.isUnminified) {\r\n return function (val, attr) {\r\n let isNumber = Util._isNumber(val);\r\n let isValidArray = Util._isArray(val) && val.length == noOfElements;\r\n if (!isNumber && !isValidArray) {\r\n Util.warn(_formatValue(val) +\r\n ' is a not valid value for \"' +\r\n attr +\r\n '\" attribute. The value should be a number or Array(' +\r\n noOfElements +\r\n ')');\r\n }\r\n return val;\r\n };\r\n }\r\n }\r\n function getNumberOrAutoValidator() {\r\n if (Konva$2.isUnminified) {\r\n return function (val, attr) {\r\n var isNumber = Util._isNumber(val);\r\n var isAuto = val === 'auto';\r\n if (!(isNumber || isAuto)) {\r\n Util.warn(_formatValue(val) +\r\n ' is a not valid value for \"' +\r\n attr +\r\n '\" attribute. The value should be a number or \"auto\".');\r\n }\r\n return val;\r\n };\r\n }\r\n }\r\n function getStringValidator() {\r\n if (Konva$2.isUnminified) {\r\n return function (val, attr) {\r\n if (!Util._isString(val)) {\r\n Util.warn(_formatValue(val) +\r\n ' is a not valid value for \"' +\r\n attr +\r\n '\" attribute. The value should be a string.');\r\n }\r\n return val;\r\n };\r\n }\r\n }\r\n function getStringOrGradientValidator() {\r\n if (Konva$2.isUnminified) {\r\n return function (val, attr) {\r\n const isString = Util._isString(val);\r\n const isGradient = Object.prototype.toString.call(val) === '[object CanvasGradient]' ||\r\n (val && val.addColorStop);\r\n if (!(isString || isGradient)) {\r\n Util.warn(_formatValue(val) +\r\n ' is a not valid value for \"' +\r\n attr +\r\n '\" attribute. The value should be a string or a native gradient.');\r\n }\r\n return val;\r\n };\r\n }\r\n }\r\n function getNumberArrayValidator() {\r\n if (Konva$2.isUnminified) {\r\n return function (val, attr) {\r\n // Retrieve TypedArray constructor as found in MDN (if TypedArray is available)\r\n // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypedArray#description\r\n const TypedArray = Int8Array ? Object.getPrototypeOf(Int8Array) : null;\r\n if (TypedArray && val instanceof TypedArray) {\r\n return val;\r\n }\r\n if (!Util._isArray(val)) {\r\n Util.warn(_formatValue(val) +\r\n ' is a not valid value for \"' +\r\n attr +\r\n '\" attribute. The value should be a array of numbers.');\r\n }\r\n else {\r\n val.forEach(function (item) {\r\n if (!Util._isNumber(item)) {\r\n Util.warn('\"' +\r\n attr +\r\n '\" attribute has non numeric element ' +\r\n item +\r\n '. Make sure that all elements are numbers.');\r\n }\r\n });\r\n }\r\n return val;\r\n };\r\n }\r\n }\r\n function getBooleanValidator() {\r\n if (Konva$2.isUnminified) {\r\n return function (val, attr) {\r\n var isBool = val === true || val === false;\r\n if (!isBool) {\r\n Util.warn(_formatValue(val) +\r\n ' is a not valid value for \"' +\r\n attr +\r\n '\" attribute. The value should be a boolean.');\r\n }\r\n return val;\r\n };\r\n }\r\n }\r\n function getComponentValidator(components) {\r\n if (Konva$2.isUnminified) {\r\n return function (val, attr) {\r\n // ignore validation on undefined value, because it will reset to defalt\r\n if (val === undefined || val === null) {\r\n return val;\r\n }\r\n if (!Util.isObject(val)) {\r\n Util.warn(_formatValue(val) +\r\n ' is a not valid value for \"' +\r\n attr +\r\n '\" attribute. The value should be an object with properties ' +\r\n components);\r\n }\r\n return val;\r\n };\r\n }\r\n }\n\n var GET = 'get', SET$1 = 'set';\r\n const Factory = {\r\n addGetterSetter(constructor, attr, def, validator, after) {\r\n Factory.addGetter(constructor, attr, def);\r\n Factory.addSetter(constructor, attr, validator, after);\r\n Factory.addOverloadedGetterSetter(constructor, attr);\r\n },\r\n addGetter(constructor, attr, def) {\r\n var method = GET + Util._capitalize(attr);\r\n constructor.prototype[method] =\r\n constructor.prototype[method] ||\r\n function () {\r\n var val = this.attrs[attr];\r\n return val === undefined ? def : val;\r\n };\r\n },\r\n addSetter(constructor, attr, validator, after) {\r\n var method = SET$1 + Util._capitalize(attr);\r\n if (!constructor.prototype[method]) {\r\n Factory.overWriteSetter(constructor, attr, validator, after);\r\n }\r\n },\r\n overWriteSetter(constructor, attr, validator, after) {\r\n var method = SET$1 + Util._capitalize(attr);\r\n constructor.prototype[method] = function (val) {\r\n if (validator && val !== undefined && val !== null) {\r\n val = validator.call(this, val, attr);\r\n }\r\n this._setAttr(attr, val);\r\n if (after) {\r\n after.call(this);\r\n }\r\n return this;\r\n };\r\n },\r\n addComponentsGetterSetter(constructor, attr, components, validator, after) {\r\n var len = components.length, capitalize = Util._capitalize, getter = GET + capitalize(attr), setter = SET$1 + capitalize(attr), n, component;\r\n // getter\r\n constructor.prototype[getter] = function () {\r\n var ret = {};\r\n for (n = 0; n < len; n++) {\r\n component = components[n];\r\n ret[component] = this.getAttr(attr + capitalize(component));\r\n }\r\n return ret;\r\n };\r\n var basicValidator = getComponentValidator(components);\r\n // setter\r\n constructor.prototype[setter] = function (val) {\r\n var oldVal = this.attrs[attr], key;\r\n if (validator) {\r\n val = validator.call(this, val);\r\n }\r\n if (basicValidator) {\r\n basicValidator.call(this, val, attr);\r\n }\r\n for (key in val) {\r\n if (!val.hasOwnProperty(key)) {\r\n continue;\r\n }\r\n this._setAttr(attr + capitalize(key), val[key]);\r\n }\r\n if (!val) {\r\n components.forEach((component) => {\r\n this._setAttr(attr + capitalize(component), undefined);\r\n });\r\n }\r\n this._fireChangeEvent(attr, oldVal, val);\r\n if (after) {\r\n after.call(this);\r\n }\r\n return this;\r\n };\r\n Factory.addOverloadedGetterSetter(constructor, attr);\r\n },\r\n addOverloadedGetterSetter(constructor, attr) {\r\n var capitalizedAttr = Util._capitalize(attr), setter = SET$1 + capitalizedAttr, getter = GET + capitalizedAttr;\r\n constructor.prototype[attr] = function () {\r\n // setting\r\n if (arguments.length) {\r\n this[setter](arguments[0]);\r\n return this;\r\n }\r\n // getting\r\n return this[getter]();\r\n };\r\n },\r\n addDeprecatedGetterSetter(constructor, attr, def, validator) {\r\n Util.error('Adding deprecated ' + attr);\r\n var method = GET + Util._capitalize(attr);\r\n var message = attr +\r\n ' property is deprecated and will be removed soon. Look at Konva change log for more information.';\r\n constructor.prototype[method] = function () {\r\n Util.error(message);\r\n var val = this.attrs[attr];\r\n return val === undefined ? def : val;\r\n };\r\n Factory.addSetter(constructor, attr, validator, function () {\r\n Util.error(message);\r\n });\r\n Factory.addOverloadedGetterSetter(constructor, attr);\r\n },\r\n backCompat(constructor, methods) {\r\n Util.each(methods, function (oldMethodName, newMethodName) {\r\n var method = constructor.prototype[newMethodName];\r\n var oldGetter = GET + Util._capitalize(oldMethodName);\r\n var oldSetter = SET$1 + Util._capitalize(oldMethodName);\r\n function deprecated() {\r\n method.apply(this, arguments);\r\n Util.error('\"' +\r\n oldMethodName +\r\n '\" method is deprecated and will be removed soon. Use \"\"' +\r\n newMethodName +\r\n '\" instead.');\r\n }\r\n constructor.prototype[oldMethodName] = deprecated;\r\n constructor.prototype[oldGetter] = deprecated;\r\n constructor.prototype[oldSetter] = deprecated;\r\n });\r\n },\r\n afterSetFilter() {\r\n this._filterUpToDate = false;\r\n },\r\n };\n\n function simplifyArray(arr) {\r\n var retArr = [], len = arr.length, util = Util, n, val;\r\n for (n = 0; n < len; n++) {\r\n val = arr[n];\r\n if (util._isNumber(val)) {\r\n val = Math.round(val * 1000) / 1000;\r\n }\r\n else if (!util._isString(val)) {\r\n val = val + '';\r\n }\r\n retArr.push(val);\r\n }\r\n return retArr;\r\n }\r\n var COMMA = ',', OPEN_PAREN = '(', CLOSE_PAREN = ')', OPEN_PAREN_BRACKET = '([', CLOSE_BRACKET_PAREN = '])', SEMICOLON = ';', DOUBLE_PAREN = '()', \r\n // EMPTY_STRING = '',\r\n EQUALS = '=', \r\n // SET = 'set',\r\n CONTEXT_METHODS = [\r\n 'arc',\r\n 'arcTo',\r\n 'beginPath',\r\n 'bezierCurveTo',\r\n 'clearRect',\r\n 'clip',\r\n 'closePath',\r\n 'createLinearGradient',\r\n 'createPattern',\r\n 'createRadialGradient',\r\n 'drawImage',\r\n 'ellipse',\r\n 'fill',\r\n 'fillText',\r\n 'getImageData',\r\n 'createImageData',\r\n 'lineTo',\r\n 'moveTo',\r\n 'putImageData',\r\n 'quadraticCurveTo',\r\n 'rect',\r\n 'restore',\r\n 'rotate',\r\n 'save',\r\n 'scale',\r\n 'setLineDash',\r\n 'setTransform',\r\n 'stroke',\r\n 'strokeText',\r\n 'transform',\r\n 'translate',\r\n ];\r\n var CONTEXT_PROPERTIES = [\r\n 'fillStyle',\r\n 'strokeStyle',\r\n 'shadowColor',\r\n 'shadowBlur',\r\n 'shadowOffsetX',\r\n 'shadowOffsetY',\r\n 'lineCap',\r\n 'lineDashOffset',\r\n 'lineJoin',\r\n 'lineWidth',\r\n 'miterLimit',\r\n 'font',\r\n 'textAlign',\r\n 'textBaseline',\r\n 'globalAlpha',\r\n 'globalCompositeOperation',\r\n 'imageSmoothingEnabled',\r\n ];\r\n const traceArrMax = 100;\r\n /**\r\n * Konva wrapper around native 2d canvas context. It has almost the same API of 2d context with some additional functions.\r\n * With core Konva shapes you don't need to use this object. But you will use it if you want to create\r\n * a [custom shape](/docs/react/Custom_Shape.html) or a [custom hit regions](/docs/events/Custom_Hit_Region.html).\r\n * For full information about each 2d context API use [MDN documentation](https://developer.mozilla.org/en-US/docs/Web/API/CanvasRenderingContext2D)\r\n * @constructor\r\n * @memberof Konva\r\n * @example\r\n * const rect = new Konva.Shape({\r\n * fill: 'red',\r\n * width: 100,\r\n * height: 100,\r\n * sceneFunc: (ctx, shape) => {\r\n * // ctx - is context wrapper\r\n * // shape - is instance of Konva.Shape, so it equals to \"rect\" variable\r\n * ctx.rect(0, 0, shape.getAttr('width'), shape.getAttr('height'));\r\n *\r\n * // automatically fill shape from props and draw hit region\r\n * ctx.fillStrokeShape(shape);\r\n * }\r\n * })\r\n */\r\n class Context {\r\n constructor(canvas) {\r\n this.canvas = canvas;\r\n if (Konva$2.enableTrace) {\r\n this.traceArr = [];\r\n this._enableTrace();\r\n }\r\n }\r\n /**\r\n * fill shape\r\n * @method\r\n * @name Konva.Context#fillShape\r\n * @param {Konva.Shape} shape\r\n */\r\n fillShape(shape) {\r\n if (shape.fillEnabled()) {\r\n this._fill(shape);\r\n }\r\n }\r\n _fill(shape) {\r\n // abstract\r\n }\r\n /**\r\n * stroke shape\r\n * @method\r\n * @name Konva.Context#strokeShape\r\n * @param {Konva.Shape} shape\r\n */\r\n strokeShape(shape) {\r\n if (shape.hasStroke()) {\r\n this._stroke(shape);\r\n }\r\n }\r\n _stroke(shape) {\r\n // abstract\r\n }\r\n /**\r\n * fill then stroke\r\n * @method\r\n * @name Konva.Context#fillStrokeShape\r\n * @param {Konva.Shape} shape\r\n */\r\n fillStrokeShape(shape) {\r\n if (shape.attrs.fillAfterStrokeEnabled) {\r\n this.strokeShape(shape);\r\n this.fillShape(shape);\r\n }\r\n else {\r\n this.fillShape(shape);\r\n this.strokeShape(shape);\r\n }\r\n }\r\n getTrace(relaxed, rounded) {\r\n var traceArr = this.traceArr, len = traceArr.length, str = '', n, trace, method, args;\r\n for (n = 0; n < len; n++) {\r\n trace = traceArr[n];\r\n method = trace.method;\r\n // methods\r\n if (method) {\r\n args = trace.args;\r\n str += method;\r\n if (relaxed) {\r\n str += DOUBLE_PAREN;\r\n }\r\n else {\r\n if (Util._isArray(args[0])) {\r\n str += OPEN_PAREN_BRACKET + args.join(COMMA) + CLOSE_BRACKET_PAREN;\r\n }\r\n else {\r\n if (rounded) {\r\n args = args.map((a) => typeof a === 'number' ? Math.floor(a) : a);\r\n }\r\n str += OPEN_PAREN + args.join(COMMA) + CLOSE_PAREN;\r\n }\r\n }\r\n }\r\n else {\r\n // properties\r\n str += trace.property;\r\n if (!relaxed) {\r\n str += EQUALS + trace.val;\r\n }\r\n }\r\n str += SEMICOLON;\r\n }\r\n return str;\r\n }\r\n clearTrace() {\r\n this.traceArr = [];\r\n }\r\n _trace(str) {\r\n var traceArr = this.traceArr, len;\r\n traceArr.push(str);\r\n len = traceArr.length;\r\n if (len >= traceArrMax) {\r\n traceArr.shift();\r\n }\r\n }\r\n /**\r\n * reset canvas context transform\r\n * @method\r\n * @name Konva.Context#reset\r\n */\r\n reset() {\r\n var pixelRatio = this.getCanvas().getPixelRatio();\r\n this.setTransform(1 * pixelRatio, 0, 0, 1 * pixelRatio, 0, 0);\r\n }\r\n /**\r\n * get canvas wrapper\r\n * @method\r\n * @name Konva.Context#getCanvas\r\n * @returns {Konva.Canvas}\r\n */\r\n getCanvas() {\r\n return this.canvas;\r\n }\r\n /**\r\n * clear canvas\r\n * @method\r\n * @name Konva.Context#clear\r\n * @param {Object} [bounds]\r\n * @param {Number} [bounds.x]\r\n * @param {Number} [bounds.y]\r\n * @param {Number} [bounds.width]\r\n * @param {Number} [bounds.height]\r\n */\r\n clear(bounds) {\r\n var canvas = this.getCanvas();\r\n if (bounds) {\r\n this.clearRect(bounds.x || 0, bounds.y || 0, bounds.width || 0, bounds.height || 0);\r\n }\r\n else {\r\n this.clearRect(0, 0, canvas.getWidth() / canvas.pixelRatio, canvas.getHeight() / canvas.pixelRatio);\r\n }\r\n }\r\n _applyLineCap(shape) {\r\n var lineCap = shape.getLineCap();\r\n if (lineCap) {\r\n this.setAttr('lineCap', lineCap);\r\n }\r\n }\r\n _applyOpacity(shape) {\r\n var absOpacity = shape.getAbsoluteOpacity();\r\n if (absOpacity !== 1) {\r\n this.setAttr('globalAlpha', absOpacity);\r\n }\r\n }\r\n _applyLineJoin(shape) {\r\n var lineJoin = shape.attrs.lineJoin;\r\n if (lineJoin) {\r\n this.setAttr('lineJoin', lineJoin);\r\n }\r\n }\r\n setAttr(attr, val) {\r\n this._context[attr] = val;\r\n }\r\n /**\r\n * arc function.\r\n * @method\r\n * @name Konva.Context#arc\r\n */\r\n arc(a0, a1, a2, a3, a4, a5) {\r\n this._context.arc(a0, a1, a2, a3, a4, a5);\r\n }\r\n /**\r\n * arcTo function.\r\n * @method\r\n * @name Konva.Context#arcTo\r\n */\r\n arcTo(a0, a1, a2, a3, a4) {\r\n this._context.arcTo(a0, a1, a2, a3, a4);\r\n }\r\n /**\r\n * beginPath function.\r\n * @method\r\n * @name Konva.Context#beginPath\r\n */\r\n beginPath() {\r\n this._context.beginPath();\r\n }\r\n /**\r\n * bezierCurveTo function.\r\n * @method\r\n * @name Konva.Context#bezierCurveTo\r\n */\r\n bezierCurveTo(a0, a1, a2, a3, a4, a5) {\r\n this._context.bezierCurveTo(a0, a1, a2, a3, a4, a5);\r\n }\r\n /**\r\n * clearRect function.\r\n * @method\r\n * @name Konva.Context#clearRect\r\n */\r\n clearRect(a0, a1, a2, a3) {\r\n this._context.clearRect(a0, a1, a2, a3);\r\n }\r\n /**\r\n * clip function.\r\n * @method\r\n * @name Konva.Context#clip\r\n */\r\n clip() {\r\n this._context.clip();\r\n }\r\n /**\r\n * closePath function.\r\n * @method\r\n * @name Konva.Context#closePath\r\n */\r\n closePath() {\r\n this._context.closePath();\r\n }\r\n /**\r\n * createImageData function.\r\n * @method\r\n * @name Konva.Context#createImageData\r\n */\r\n createImageData(a0, a1) {\r\n var a = arguments;\r\n if (a.length === 2) {\r\n return this._context.createImageData(a0, a1);\r\n }\r\n else if (a.length === 1) {\r\n return this._context.createImageData(a0);\r\n }\r\n }\r\n /**\r\n * createLinearGradient function.\r\n * @method\r\n * @name Konva.Context#createLinearGradient\r\n */\r\n createLinearGradient(a0, a1, a2, a3) {\r\n return this._context.createLinearGradient(a0, a1, a2, a3);\r\n }\r\n /**\r\n * createPattern function.\r\n * @method\r\n * @name Konva.Context#createPattern\r\n */\r\n createPattern(a0, a1) {\r\n return this._context.createPattern(a0, a1);\r\n }\r\n /**\r\n * createRadialGradient function.\r\n * @method\r\n * @name Konva.Context#createRadialGradient\r\n */\r\n createRadialGradient(a0, a1, a2, a3, a4, a5) {\r\n return this._context.createRadialGradient(a0, a1, a2, a3, a4, a5);\r\n }\r\n /**\r\n * drawImage function.\r\n * @method\r\n * @name Konva.Context#drawImage\r\n */\r\n drawImage(a0, a1, a2, a3, a4, a5, a6, a7, a8) {\r\n // this._context.drawImage(...arguments);\r\n var a = arguments, _context = this._context;\r\n if (a.length === 3) {\r\n _context.drawImage(a0, a1, a2);\r\n }\r\n else if (a.length === 5) {\r\n _context.drawImage(a0, a1, a2, a3, a4);\r\n }\r\n else if (a.length === 9) {\r\n _context.drawImage(a0, a1, a2, a3, a4, a5, a6, a7, a8);\r\n }\r\n }\r\n /**\r\n * ellipse function.\r\n * @method\r\n * @name Konva.Context#ellipse\r\n */\r\n ellipse(a0, a1, a2, a3, a4, a5, a6, a7) {\r\n this._context.ellipse(a0, a1, a2, a3, a4, a5, a6, a7);\r\n }\r\n /**\r\n * isPointInPath function.\r\n * @method\r\n * @name Konva.Context#isPointInPath\r\n */\r\n isPointInPath(x, y) {\r\n return this._context.isPointInPath(x, y);\r\n }\r\n /**\r\n * fill function.\r\n * @method\r\n * @name Konva.Context#fill\r\n */\r\n fill(path2d) {\r\n if (path2d) {\r\n this._context.fill(path2d);\r\n }\r\n else {\r\n this._context.fill();\r\n }\r\n }\r\n /**\r\n * fillRect function.\r\n * @method\r\n * @name Konva.Context#fillRect\r\n */\r\n fillRect(x, y, width, height) {\r\n this._context.fillRect(x, y, width, height);\r\n }\r\n /**\r\n * strokeRect function.\r\n * @method\r\n * @name Konva.Context#strokeRect\r\n */\r\n strokeRect(x, y, width, height) {\r\n this._context.strokeRect(x, y, width, height);\r\n }\r\n /**\r\n * fillText function.\r\n * @method\r\n * @name Konva.Context#fillText\r\n */\r\n fillText(text, x, y, maxWidth) {\r\n if (maxWidth) {\r\n this._context.fillText(text, x, y, maxWidth);\r\n }\r\n else {\r\n this._context.fillText(text, x, y);\r\n }\r\n }\r\n /**\r\n * measureText function.\r\n * @method\r\n * @name Konva.Context#measureText\r\n */\r\n measureText(text) {\r\n return this._context.measureText(text);\r\n }\r\n /**\r\n * getImageData function.\r\n * @method\r\n * @name Konva.Context#getImageData\r\n */\r\n getImageData(a0, a1, a2, a3) {\r\n return this._context.getImageData(a0, a1, a2, a3);\r\n }\r\n /**\r\n * lineTo function.\r\n * @method\r\n * @name Konva.Context#lineTo\r\n */\r\n lineTo(a0, a1) {\r\n this._context.lineTo(a0, a1);\r\n }\r\n /**\r\n * moveTo function.\r\n * @method\r\n * @name Konva.Context#moveTo\r\n */\r\n moveTo(a0, a1) {\r\n this._context.moveTo(a0, a1);\r\n }\r\n /**\r\n * rect function.\r\n * @method\r\n * @name Konva.Context#rect\r\n */\r\n rect(a0, a1, a2, a3) {\r\n this._context.rect(a0, a1, a2, a3);\r\n }\r\n /**\r\n * putImageData function.\r\n * @method\r\n * @name Konva.Context#putImageData\r\n */\r\n putImageData(a0, a1, a2) {\r\n this._context.putImageData(a0, a1, a2);\r\n }\r\n /**\r\n * quadraticCurveTo function.\r\n * @method\r\n * @name Konva.Context#quadraticCurveTo\r\n */\r\n quadraticCurveTo(a0, a1, a2, a3) {\r\n this._context.quadraticCurveTo(a0, a1, a2, a3);\r\n }\r\n /**\r\n * restore function.\r\n * @method\r\n * @name Konva.Context#restore\r\n */\r\n restore() {\r\n this._context.restore();\r\n }\r\n /**\r\n * rotate function.\r\n * @method\r\n * @name Konva.Context#rotate\r\n */\r\n rotate(a0) {\r\n this._context.rotate(a0);\r\n }\r\n /**\r\n * save function.\r\n * @method\r\n * @name Konva.Context#save\r\n */\r\n save() {\r\n this._context.save();\r\n }\r\n /**\r\n * scale function.\r\n * @method\r\n * @name Konva.Context#scale\r\n */\r\n scale(a0, a1) {\r\n this._context.scale(a0, a1);\r\n }\r\n /**\r\n * setLineDash function.\r\n * @method\r\n * @name Konva.Context#setLineDash\r\n */\r\n setLineDash(a0) {\r\n // works for Chrome and IE11\r\n if (this._context.setLineDash) {\r\n this._context.setLineDash(a0);\r\n }\r\n else if ('mozDash' in this._context) {\r\n // verified that this works in firefox\r\n this._context['mozDash'] = a0;\r\n }\r\n else if ('webkitLineDash' in this._context) {\r\n // does not currently work for Safari\r\n this._context['webkitLineDash'] = a0;\r\n }\r\n // no support for IE9 and IE10\r\n }\r\n /**\r\n * getLineDash function.\r\n * @method\r\n * @name Konva.Context#getLineDash\r\n */\r\n getLineDash() {\r\n return this._context.getLineDash();\r\n }\r\n /**\r\n * setTransform function.\r\n * @method\r\n * @name Konva.Context#setTransform\r\n */\r\n setTransform(a0, a1, a2, a3, a4, a5) {\r\n this._context.setTransform(a0, a1, a2, a3, a4, a5);\r\n }\r\n /**\r\n * stroke function.\r\n * @method\r\n * @name Konva.Context#stroke\r\n */\r\n stroke(path2d) {\r\n if (path2d) {\r\n this._context.stroke(path2d);\r\n }\r\n else {\r\n this._context.stroke();\r\n }\r\n }\r\n /**\r\n * strokeText function.\r\n * @method\r\n * @name Konva.Context#strokeText\r\n */\r\n strokeText(a0, a1, a2, a3) {\r\n this._context.strokeText(a0, a1, a2, a3);\r\n }\r\n /**\r\n * transform function.\r\n * @method\r\n * @name Konva.Context#transform\r\n */\r\n transform(a0, a1, a2, a3, a4, a5) {\r\n this._context.transform(a0, a1, a2, a3, a4, a5);\r\n }\r\n /**\r\n * translate function.\r\n * @method\r\n * @name Konva.Context#translate\r\n */\r\n translate(a0, a1) {\r\n this._context.translate(a0, a1);\r\n }\r\n _enableTrace() {\r\n var that = this, len = CONTEXT_METHODS.length, origSetter = this.setAttr, n, args;\r\n // to prevent creating scope function at each loop\r\n var func = function (methodName) {\r\n var origMethod = that[methodName], ret;\r\n that[methodName] = function () {\r\n args = simplifyArray(Array.prototype.slice.call(arguments, 0));\r\n ret = origMethod.apply(that, arguments);\r\n that._trace({\r\n method: methodName,\r\n args: args,\r\n });\r\n return ret;\r\n };\r\n };\r\n // methods\r\n for (n = 0; n < len; n++) {\r\n func(CONTEXT_METHODS[n]);\r\n }\r\n // attrs\r\n that.setAttr = function () {\r\n origSetter.apply(that, arguments);\r\n var prop = arguments[0];\r\n var val = arguments[1];\r\n if (prop === 'shadowOffsetX' ||\r\n prop === 'shadowOffsetY' ||\r\n prop === 'shadowBlur') {\r\n val = val / this.canvas.getPixelRatio();\r\n }\r\n that._trace({\r\n property: prop,\r\n val: val,\r\n });\r\n };\r\n }\r\n _applyGlobalCompositeOperation(node) {\r\n const op = node.attrs.globalCompositeOperation;\r\n var def = !op || op === 'source-over';\r\n if (!def) {\r\n this.setAttr('globalCompositeOperation', op);\r\n }\r\n }\r\n }\r\n CONTEXT_PROPERTIES.forEach(function (prop) {\r\n Object.defineProperty(Context.prototype, prop, {\r\n get() {\r\n return this._context[prop];\r\n },\r\n set(val) {\r\n this._context[prop] = val;\r\n },\r\n });\r\n });\r\n class SceneContext extends Context {\r\n constructor(canvas) {\r\n super(canvas);\r\n this._context = canvas._canvas.getContext('2d');\r\n }\r\n _fillColor(shape) {\r\n var fill = shape.fill();\r\n this.setAttr('fillStyle', fill);\r\n shape._fillFunc(this);\r\n }\r\n _fillPattern(shape) {\r\n this.setAttr('fillStyle', shape._getFillPattern());\r\n shape._fillFunc(this);\r\n }\r\n _fillLinearGradient(shape) {\r\n var grd = shape._getLinearGradient();\r\n if (grd) {\r\n this.setAttr('fillStyle', grd);\r\n shape._fillFunc(this);\r\n }\r\n }\r\n _fillRadialGradient(shape) {\r\n var grd = shape._getRadialGradient();\r\n if (grd) {\r\n this.setAttr('fillStyle', grd);\r\n shape._fillFunc(this);\r\n }\r\n }\r\n _fill(shape) {\r\n var hasColor = shape.fill(), fillPriority = shape.getFillPriority();\r\n // priority fills\r\n if (hasColor && fillPriority === 'color') {\r\n this._fillColor(shape);\r\n return;\r\n }\r\n var hasPattern = shape.getFillPatternImage();\r\n if (hasPattern && fillPriority === 'pattern') {\r\n this._fillPattern(shape);\r\n return;\r\n }\r\n var hasLinearGradient = shape.getFillLinearGradientColorStops();\r\n if (hasLinearGradient && fillPriority === 'linear-gradient') {\r\n this._fillLinearGradient(shape);\r\n return;\r\n }\r\n var hasRadialGradient = shape.getFillRadialGradientColorStops();\r\n if (hasRadialGradient && fillPriority === 'radial-gradient') {\r\n this._fillRadialGradient(shape);\r\n return;\r\n }\r\n // now just try and fill with whatever is available\r\n if (hasColor) {\r\n this._fillColor(shape);\r\n }\r\n else if (hasPattern) {\r\n this._fillPattern(shape);\r\n }\r\n else if (hasLinearGradient) {\r\n this._fillLinearGradient(shape);\r\n }\r\n else if (hasRadialGradient) {\r\n this._fillRadialGradient(shape);\r\n }\r\n }\r\n _strokeLinearGradient(shape) {\r\n var start = shape.getStrokeLinearGradientStartPoint(), end = shape.getStrokeLinearGradientEndPoint(), colorStops = shape.getStrokeLinearGradientColorStops(), grd = this.createLinearGradient(start.x, start.y, end.x, end.y);\r\n if (colorStops) {\r\n // build color stops\r\n for (var n = 0; n < colorStops.length; n += 2) {\r\n grd.addColorStop(colorStops[n], colorStops[n + 1]);\r\n }\r\n this.setAttr('strokeStyle', grd);\r\n }\r\n }\r\n _stroke(shape) {\r\n var dash = shape.dash(), \r\n // ignore strokeScaleEnabled for Text\r\n strokeScaleEnabled = shape.getStrokeScaleEnabled();\r\n if (shape.hasStroke()) {\r\n if (!strokeScaleEnabled) {\r\n this.save();\r\n var pixelRatio = this.getCanvas().getPixelRatio();\r\n this.setTransform(pixelRatio, 0, 0, pixelRatio, 0, 0);\r\n }\r\n this._applyLineCap(shape);\r\n if (dash && shape.dashEnabled()) {\r\n this.setLineDash(dash);\r\n this.setAttr('lineDashOffset', shape.dashOffset());\r\n }\r\n this.setAttr('lineWidth', shape.strokeWidth());\r\n if (!shape.getShadowForStrokeEnabled()) {\r\n this.setAttr('shadowColor', 'rgba(0,0,0,0)');\r\n }\r\n var hasLinearGradient = shape.getStrokeLinearGradientColorStops();\r\n if (hasLinearGradient) {\r\n this._strokeLinearGradient(shape);\r\n }\r\n else {\r\n this.setAttr('strokeStyle', shape.stroke());\r\n }\r\n shape._strokeFunc(this);\r\n if (!strokeScaleEnabled) {\r\n this.restore();\r\n }\r\n }\r\n }\r\n _applyShadow(shape) {\r\n var _a, _b, _c;\r\n var color = (_a = shape.getShadowRGBA()) !== null && _a !== void 0 ? _a : 'black', blur = (_b = shape.getShadowBlur()) !== null && _b !== void 0 ? _b : 5, offset = (_c = shape.getShadowOffset()) !== null && _c !== void 0 ? _c : {\r\n x: 0,\r\n y: 0,\r\n }, scale = shape.getAbsoluteScale(), ratio = this.canvas.getPixelRatio(), scaleX = scale.x * ratio, scaleY = scale.y * ratio;\r\n this.setAttr('shadowColor', color);\r\n this.setAttr('shadowBlur', blur * Math.min(Math.abs(scaleX), Math.abs(scaleY)));\r\n this.setAttr('shadowOffsetX', offset.x * scaleX);\r\n this.setAttr('shadowOffsetY', offset.y * scaleY);\r\n }\r\n }\r\n class HitContext extends Context {\r\n constructor(canvas) {\r\n super(canvas);\r\n this._context = canvas._canvas.getContext('2d', {\r\n willReadFrequently: true,\r\n });\r\n }\r\n _fill(shape) {\r\n this.save();\r\n this.setAttr('fillStyle', shape.colorKey);\r\n shape._fillFuncHit(this);\r\n this.restore();\r\n }\r\n strokeShape(shape) {\r\n if (shape.hasHitStroke()) {\r\n this._stroke(shape);\r\n }\r\n }\r\n _stroke(shape) {\r\n if (shape.hasHitStroke()) {\r\n // ignore strokeScaleEnabled for Text\r\n var strokeScaleEnabled = shape.getStrokeScaleEnabled();\r\n if (!strokeScaleEnabled) {\r\n this.save();\r\n var pixelRatio = this.getCanvas().getPixelRatio();\r\n this.setTransform(pixelRatio, 0, 0, pixelRatio, 0, 0);\r\n }\r\n this._applyLineCap(shape);\r\n var hitStrokeWidth = shape.hitStrokeWidth();\r\n var strokeWidth = hitStrokeWidth === 'auto' ? shape.strokeWidth() : hitStrokeWidth;\r\n this.setAttr('lineWidth', strokeWidth);\r\n this.setAttr('strokeStyle', shape.colorKey);\r\n shape._strokeFuncHit(this);\r\n if (!strokeScaleEnabled) {\r\n this.restore();\r\n }\r\n }\r\n }\r\n }\n\n // calculate pixel ratio\r\n var _pixelRatio;\r\n function getDevicePixelRatio() {\r\n if (_pixelRatio) {\r\n return _pixelRatio;\r\n }\r\n var canvas = Util.createCanvasElement();\r\n var context = canvas.getContext('2d');\r\n _pixelRatio = (function () {\r\n var devicePixelRatio = Konva$2._global.devicePixelRatio || 1, backingStoreRatio = context.webkitBackingStorePixelRatio ||\r\n context.mozBackingStorePixelRatio ||\r\n context.msBackingStorePixelRatio ||\r\n context.oBackingStorePixelRatio ||\r\n context.backingStorePixelRatio ||\r\n 1;\r\n return devicePixelRatio / backingStoreRatio;\r\n })();\r\n Util.releaseCanvas(canvas);\r\n return _pixelRatio;\r\n }\r\n /**\r\n * Canvas Renderer constructor. It is a wrapper around native canvas element.\r\n * Usually you don't need to use it manually.\r\n * @constructor\r\n * @abstract\r\n * @memberof Konva\r\n * @param {Object} config\r\n * @param {Number} config.width\r\n * @param {Number} config.height\r\n * @param {Number} config.pixelRatio\r\n */\r\n class Canvas {\r\n constructor(config) {\r\n this.pixelRatio = 1;\r\n this.width = 0;\r\n this.height = 0;\r\n this.isCache = false;\r\n var conf = config || {};\r\n var pixelRatio = conf.pixelRatio || Konva$2.pixelRatio || getDevicePixelRatio();\r\n this.pixelRatio = pixelRatio;\r\n this._canvas = Util.createCanvasElement();\r\n // set inline styles\r\n this._canvas.style.padding = '0';\r\n this._canvas.style.margin = '0';\r\n this._canvas.style.border = '0';\r\n this._canvas.style.background = 'transparent';\r\n this._canvas.style.position = 'absolute';\r\n this._canvas.style.top = '0';\r\n this._canvas.style.left = '0';\r\n }\r\n /**\r\n * get canvas context\r\n * @method\r\n * @name Konva.Canvas#getContext\r\n * @returns {CanvasContext} context\r\n */\r\n getContext() {\r\n return this.context;\r\n }\r\n getPixelRatio() {\r\n return this.pixelRatio;\r\n }\r\n setPixelRatio(pixelRatio) {\r\n var previousRatio = this.pixelRatio;\r\n this.pixelRatio = pixelRatio;\r\n this.setSize(this.getWidth() / previousRatio, this.getHeight() / previousRatio);\r\n }\r\n setWidth(width) {\r\n // take into account pixel ratio\r\n this.width = this._canvas.width = width * this.pixelRatio;\r\n this._canvas.style.width = width + 'px';\r\n var pixelRatio = this.pixelRatio, _context = this.getContext()._context;\r\n _context.scale(pixelRatio, pixelRatio);\r\n }\r\n setHeight(height) {\r\n // take into account pixel ratio\r\n this.height = this._canvas.height = height * this.pixelRatio;\r\n this._canvas.style.height = height + 'px';\r\n var pixelRatio = this.pixelRatio, _context = this.getContext()._context;\r\n _context.scale(pixelRatio, pixelRatio);\r\n }\r\n getWidth() {\r\n return this.width;\r\n }\r\n getHeight() {\r\n return this.height;\r\n }\r\n setSize(width, height) {\r\n this.setWidth(width || 0);\r\n this.setHeight(height || 0);\r\n }\r\n /**\r\n * to data url\r\n * @method\r\n * @name Konva.Canvas#toDataURL\r\n * @param {String} mimeType\r\n * @param {Number} quality between 0 and 1 for jpg mime types\r\n * @returns {String} data url string\r\n */\r\n toDataURL(mimeType, quality) {\r\n try {\r\n // If this call fails (due to browser bug, like in Firefox 3.6),\r\n // then revert to previous no-parameter image/png behavior\r\n return this._canvas.toDataURL(mimeType, quality);\r\n }\r\n catch (e) {\r\n try {\r\n return this._canvas.toDataURL();\r\n }\r\n catch (err) {\r\n Util.error('Unable to get data URL. ' +\r\n err.message +\r\n ' For more info read https://konvajs.org/docs/posts/Tainted_Canvas.html.');\r\n return '';\r\n }\r\n }\r\n }\r\n }\r\n /**\r\n * get/set pixel ratio.\r\n * KonvaJS automatically handles pixel ratio adustments in order to render crisp drawings\r\n * on all devices. Most desktops, low end tablets, and low end phones, have device pixel ratios\r\n * of 1. Some high end tablets and phones, like iPhones and iPads have a device pixel ratio\r\n * of 2. Some Macbook Pros, and iMacs also have a device pixel ratio of 2. Some high end Android devices have pixel\r\n * ratios of 2 or 3. Some browsers like Firefox allow you to configure the pixel ratio of the viewport. Unless otherwise\r\n * specificed, the pixel ratio will be defaulted to the actual device pixel ratio. You can override the device pixel\r\n * ratio for special situations, or, if you don't want the pixel ratio to be taken into account, you can set it to 1.\r\n * @name Konva.Canvas#pixelRatio\r\n * @method\r\n * @param {Number} pixelRatio\r\n * @returns {Number}\r\n * @example\r\n * // get\r\n * var pixelRatio = layer.getCanvas.pixelRatio();\r\n *\r\n * // set\r\n * layer.getCanvas().pixelRatio(3);\r\n */\r\n Factory.addGetterSetter(Canvas, 'pixelRatio', undefined, getNumberValidator());\r\n class SceneCanvas extends Canvas {\r\n constructor(config = { width: 0, height: 0 }) {\r\n super(config);\r\n this.context = new SceneContext(this);\r\n this.setSize(config.width, config.height);\r\n }\r\n }\r\n class HitCanvas extends Canvas {\r\n constructor(config = { width: 0, height: 0 }) {\r\n super(config);\r\n this.hitCanvas = true;\r\n this.context = new HitContext(this);\r\n this.setSize(config.width, config.height);\r\n }\r\n }\n\n const DD = {\r\n get isDragging() {\r\n var flag = false;\r\n DD._dragElements.forEach((elem) => {\r\n if (elem.dragStatus === 'dragging') {\r\n flag = true;\r\n }\r\n });\r\n return flag;\r\n },\r\n justDragged: false,\r\n get node() {\r\n // return first dragging node\r\n var node;\r\n DD._dragElements.forEach((elem) => {\r\n node = elem.node;\r\n });\r\n return node;\r\n },\r\n _dragElements: new Map(),\r\n // methods\r\n _drag(evt) {\r\n const nodesToFireEvents = [];\r\n DD._dragElements.forEach((elem, key) => {\r\n const { node } = elem;\r\n // we need to find pointer relative to that node\r\n const stage = node.getStage();\r\n stage.setPointersPositions(evt);\r\n // it is possible that user call startDrag without any event\r\n // it that case we need to detect first movable pointer and attach it into the node\r\n if (elem.pointerId === undefined) {\r\n elem.pointerId = Util._getFirstPointerId(evt);\r\n }\r\n const pos = stage._changedPointerPositions.find((pos) => pos.id === elem.pointerId);\r\n // not related pointer\r\n if (!pos) {\r\n return;\r\n }\r\n if (elem.dragStatus !== 'dragging') {\r\n var dragDistance = node.dragDistance();\r\n var distance = Math.max(Math.abs(pos.x - elem.startPointerPos.x), Math.abs(pos.y - elem.startPointerPos.y));\r\n if (distance < dragDistance) {\r\n return;\r\n }\r\n node.startDrag({ evt });\r\n // a user can stop dragging inside `dragstart`\r\n if (!node.isDragging()) {\r\n return;\r\n }\r\n }\r\n node._setDragPosition(evt, elem);\r\n nodesToFireEvents.push(node);\r\n });\r\n // call dragmove only after ALL positions are changed\r\n nodesToFireEvents.forEach((node) => {\r\n node.fire('dragmove', {\r\n type: 'dragmove',\r\n target: node,\r\n evt: evt,\r\n }, true);\r\n });\r\n },\r\n // dragBefore and dragAfter allows us to set correct order of events\r\n // setup all in dragbefore, and stop dragging only after pointerup triggered.\r\n _endDragBefore(evt) {\r\n const drawNodes = [];\r\n DD._dragElements.forEach((elem) => {\r\n const { node } = elem;\r\n // we need to find pointer relative to that node\r\n const stage = node.getStage();\r\n if (evt) {\r\n stage.setPointersPositions(evt);\r\n }\r\n const pos = stage._changedPointerPositions.find((pos) => pos.id === elem.pointerId);\r\n // that pointer is not related\r\n if (!pos) {\r\n return;\r\n }\r\n if (elem.dragStatus === 'dragging' || elem.dragStatus === 'stopped') {\r\n // if a node is stopped manually we still need to reset events:\r\n DD.justDragged = true;\r\n Konva$2._mouseListenClick = false;\r\n Konva$2._touchListenClick = false;\r\n Konva$2._pointerListenClick = false;\r\n elem.dragStatus = 'stopped';\r\n }\r\n const drawNode = elem.node.getLayer() ||\r\n (elem.node instanceof Konva$2['Stage'] && elem.node);\r\n if (drawNode && drawNodes.indexOf(drawNode) === -1) {\r\n drawNodes.push(drawNode);\r\n }\r\n });\r\n // draw in a sync way\r\n // because mousemove event may trigger BEFORE batch draw is called\r\n // but as we have not hit canvas updated yet, it will trigger incorrect mouseover/mouseout events\r\n drawNodes.forEach((drawNode) => {\r\n drawNode.draw();\r\n });\r\n },\r\n _endDragAfter(evt) {\r\n DD._dragElements.forEach((elem, key) => {\r\n if (elem.dragStatus === 'stopped') {\r\n elem.node.fire('dragend', {\r\n type: 'dragend',\r\n target: elem.node,\r\n evt: evt,\r\n }, true);\r\n }\r\n if (elem.dragStatus !== 'dragging') {\r\n DD._dragElements.delete(key);\r\n }\r\n });\r\n },\r\n };\r\n if (Konva$2.isBrowser) {\r\n window.addEventListener('mouseup', DD._endDragBefore, true);\r\n window.addEventListener('touchend', DD._endDragBefore, true);\r\n window.addEventListener('mousemove', DD._drag);\r\n window.addEventListener('touchmove', DD._drag);\r\n window.addEventListener('mouseup', DD._endDragAfter, false);\r\n window.addEventListener('touchend', DD._endDragAfter, false);\r\n }\n\n // CONSTANTS\r\n var ABSOLUTE_OPACITY = 'absoluteOpacity', ALL_LISTENERS = 'allEventListeners', ABSOLUTE_TRANSFORM = 'absoluteTransform', ABSOLUTE_SCALE = 'absoluteScale', CANVAS = 'canvas', CHANGE = 'Change', CHILDREN = 'children', KONVA = 'konva', LISTENING = 'listening', MOUSEENTER$1 = 'mouseenter', MOUSELEAVE$1 = 'mouseleave', SET = 'set', SHAPE = 'Shape', SPACE$1 = ' ', STAGE$1 = 'stage', TRANSFORM = 'transform', UPPER_STAGE = 'Stage', VISIBLE = 'visible', TRANSFORM_CHANGE_STR$1 = [\r\n 'xChange.konva',\r\n 'yChange.konva',\r\n 'scaleXChange.konva',\r\n 'scaleYChange.konva',\r\n 'skewXChange.konva',\r\n 'skewYChange.konva',\r\n 'rotationChange.konva',\r\n 'offsetXChange.konva',\r\n 'offsetYChange.konva',\r\n 'transformsEnabledChange.konva',\r\n ].join(SPACE$1);\r\n let idCounter$1 = 1;\r\n /**\r\n * Node constructor. Nodes are entities that can be transformed, layered,\r\n * and have bound events. The stage, layers, groups, and shapes all extend Node.\r\n * @constructor\r\n * @memberof Konva\r\n * @param {Object} config\r\n * @param {Number} [config.x]\n * @param {Number} [config.y]\n * @param {Number} [config.width]\n * @param {Number} [config.height]\n * @param {Boolean} [config.visible]\n * @param {Boolean} [config.listening] whether or not the node is listening for events\n * @param {String} [config.id] unique id\n * @param {String} [config.name] non-unique name\n * @param {Number} [config.opacity] determines node opacity. Can be any number between 0 and 1\n * @param {Object} [config.scale] set scale\n * @param {Number} [config.scaleX] set scale x\n * @param {Number} [config.scaleY] set scale y\n * @param {Number} [config.rotation] rotation in degrees\n * @param {Object} [config.offset] offset from center point and rotation point\n * @param {Number} [config.offsetX] set offset x\n * @param {Number} [config.offsetY] set offset y\n * @param {Boolean} [config.draggable] makes the node draggable. When stages are draggable, you can drag and drop\n * the entire stage by dragging any portion of the stage\n * @param {Number} [config.dragDistance]\n * @param {Function} [config.dragBoundFunc]\r\n */\r\n class Node {\r\n constructor(config) {\r\n this._id = idCounter$1++;\r\n this.eventListeners = {};\r\n this.attrs = {};\r\n this.index = 0;\r\n this._allEventListeners = null;\r\n this.parent = null;\r\n this._cache = new Map();\r\n this._attachedDepsListeners = new Map();\r\n this._lastPos = null;\r\n this._batchingTransformChange = false;\r\n this._needClearTransformCache = false;\r\n this._filterUpToDate = false;\r\n this._isUnderCache = false;\r\n this._dragEventId = null;\r\n this._shouldFireChangeEvents = false;\r\n // on initial set attrs wi don't need to fire change events\r\n // because nobody is listening to them yet\r\n this.setAttrs(config);\r\n this._shouldFireChangeEvents = true;\r\n // all change event listeners are attached to the prototype\r\n }\r\n hasChildren() {\r\n return false;\r\n }\r\n _clearCache(attr) {\r\n // if we want to clear transform cache\r\n // we don't really need to remove it from the cache\r\n // but instead mark as \"dirty\"\r\n // so we don't need to create a new instance next time\r\n if ((attr === TRANSFORM || attr === ABSOLUTE_TRANSFORM) &&\r\n this._cache.get(attr)) {\r\n this._cache.get(attr).dirty = true;\r\n }\r\n else if (attr) {\r\n this._cache.delete(attr);\r\n }\r\n else {\r\n this._cache.clear();\r\n }\r\n }\r\n _getCache(attr, privateGetter) {\r\n var cache = this._cache.get(attr);\r\n // for transform the cache can be NOT empty\r\n // but we still need to recalculate it if it is dirty\r\n var isTransform = attr === TRANSFORM || attr === ABSOLUTE_TRANSFORM;\r\n var invalid = cache === undefined || (isTransform && cache.dirty === true);\r\n // if not cached, we need to set it using the private getter method.\r\n if (invalid) {\r\n cache = privateGetter.call(this);\r\n this._cache.set(attr, cache);\r\n }\r\n return cache;\r\n }\r\n _calculate(name, deps, getter) {\r\n // if we are trying to calculate function for the first time\r\n // we need to attach listeners for change events\r\n if (!this._attachedDepsListeners.get(name)) {\r\n const depsString = deps.map((dep) => dep + 'Change.konva').join(SPACE$1);\r\n this.on(depsString, () => {\r\n this._clearCache(name);\r\n });\r\n this._attachedDepsListeners.set(name, true);\r\n }\r\n // just use cache function\r\n return this._getCache(name, getter);\r\n }\r\n _getCanvasCache() {\r\n return this._cache.get(CANVAS);\r\n }\r\n /*\r\n * when the logic for a cached result depends on ancestor propagation, use this\r\n * method to clear self and children cache\r\n */\r\n _clearSelfAndDescendantCache(attr) {\r\n this._clearCache(attr);\r\n // trigger clear cache, so transformer can use it\r\n if (attr === ABSOLUTE_TRANSFORM) {\r\n this.fire('absoluteTransformChange');\r\n }\r\n }\r\n /**\r\n * clear cached canvas\r\n * @method\r\n * @name Konva.Node#clearCache\r\n * @returns {Konva.Node}\r\n * @example\r\n * node.clearCache();\r\n */\r\n clearCache() {\r\n if (this._cache.has(CANVAS)) {\r\n const { scene, filter, hit } = this._cache.get(CANVAS);\r\n Util.releaseCanvas(scene, filter, hit);\r\n this._cache.delete(CANVAS);\r\n }\r\n this._clearSelfAndDescendantCache();\r\n this._requestDraw();\r\n return this;\r\n }\r\n /**\r\n * cache node to improve drawing performance, apply filters, or create more accurate\r\n * hit regions. For all basic shapes size of cache canvas will be automatically detected.\r\n * If you need to cache your custom `Konva.Shape` instance you have to pass shape's bounding box\r\n * properties. Look at [https://konvajs.org/docs/performance/Shape_Caching.html](https://konvajs.org/docs/performance/Shape_Caching.html) for more information.\r\n * @method\r\n * @name Konva.Node#cache\r\n * @param {Object} [config]\r\n * @param {Number} [config.x]\r\n * @param {Number} [config.y]\r\n * @param {Number} [config.width]\r\n * @param {Number} [config.height]\r\n * @param {Number} [config.offset] increase canvas size by `offset` pixel in all directions.\r\n * @param {Boolean} [config.drawBorder] when set to true, a red border will be drawn around the cached\r\n * region for debugging purposes\r\n * @param {Number} [config.pixelRatio] change quality (or pixel ratio) of cached image. pixelRatio = 2 will produce 2x sized cache.\r\n * @param {Boolean} [config.imageSmoothingEnabled] control imageSmoothingEnabled property of created canvas for cache\r\n * @param {Number} [config.hitCanvasPixelRatio] change quality (or pixel ratio) of cached hit canvas.\r\n * @returns {Konva.Node}\r\n * @example\r\n * // cache a shape with the x,y position of the bounding box at the center and\r\n * // the width and height of the bounding box equal to the width and height of\r\n * // the shape obtained from shape.width() and shape.height()\r\n * image.cache();\r\n *\r\n * // cache a node and define the bounding box position and size\r\n * node.cache({\r\n * x: -30,\r\n * y: -30,\r\n * width: 100,\r\n * height: 200\r\n * });\r\n *\r\n * // cache a node and draw a red border around the bounding box\r\n * // for debugging purposes\r\n * node.cache({\r\n * x: -30,\r\n * y: -30,\r\n * width: 100,\r\n * height: 200,\r\n * offset : 10,\r\n * drawBorder: true\r\n * });\r\n */\r\n cache(config) {\r\n var conf = config || {};\r\n var rect = {};\r\n // don't call getClientRect if we have all attributes\r\n // it means call it only if have one undefined\r\n if (conf.x === undefined ||\r\n conf.y === undefined ||\r\n conf.width === undefined ||\r\n conf.height === undefined) {\r\n rect = this.getClientRect({\r\n skipTransform: true,\r\n relativeTo: this.getParent(),\r\n });\r\n }\r\n var width = Math.ceil(conf.width || rect.width), height = Math.ceil(conf.height || rect.height), pixelRatio = conf.pixelRatio, x = conf.x === undefined ? Math.floor(rect.x) : conf.x, y = conf.y === undefined ? Math.floor(rect.y) : conf.y, offset = conf.offset || 0, drawBorder = conf.drawBorder || false, hitCanvasPixelRatio = conf.hitCanvasPixelRatio || 1;\r\n if (!width || !height) {\r\n Util.error('Can not cache the node. Width or height of the node equals 0. Caching is skipped.');\r\n return;\r\n }\r\n // let's just add 1 pixel extra,\r\n // because using Math.floor on x, y position may shift drawing\r\n width += offset * 2 + 1;\r\n height += offset * 2 + 1;\r\n x -= offset;\r\n y -= offset;\r\n // if (Math.floor(x) < x) {\r\n // x = Math.floor(x);\r\n // // width += 1;\r\n // }\r\n // if (Math.floor(y) < y) {\r\n // y = Math.floor(y);\r\n // // height += 1;\r\n // }\r\n // console.log({ x, y, width, height }, rect);\r\n var cachedSceneCanvas = new SceneCanvas({\r\n pixelRatio: pixelRatio,\r\n width: width,\r\n height: height,\r\n }), cachedFilterCanvas = new SceneCanvas({\r\n pixelRatio: pixelRatio,\r\n width: 0,\r\n height: 0,\r\n }), cachedHitCanvas = new HitCanvas({\r\n pixelRatio: hitCanvasPixelRatio,\r\n width: width,\r\n height: height,\r\n }), sceneContext = cachedSceneCanvas.getContext(), hitContext = cachedHitCanvas.getContext();\r\n cachedHitCanvas.isCache = true;\r\n cachedSceneCanvas.isCache = true;\r\n this._cache.delete(CANVAS);\r\n this._filterUpToDate = false;\r\n if (conf.imageSmoothingEnabled === false) {\r\n cachedSceneCanvas.getContext()._context.imageSmoothingEnabled = false;\r\n cachedFilterCanvas.getContext()._context.imageSmoothingEnabled = false;\r\n }\r\n sceneContext.save();\r\n hitContext.save();\r\n sceneContext.translate(-x, -y);\r\n hitContext.translate(-x, -y);\r\n // extra flag to skip on getAbsolute opacity calc\r\n this._isUnderCache = true;\r\n this._clearSelfAndDescendantCache(ABSOLUTE_OPACITY);\r\n this._clearSelfAndDescendantCache(ABSOLUTE_SCALE);\r\n this.drawScene(cachedSceneCanvas, this);\r\n this.drawHit(cachedHitCanvas, this);\r\n this._isUnderCache = false;\r\n sceneContext.restore();\r\n hitContext.restore();\r\n // this will draw a red border around the cached box for\r\n // debugging purposes\r\n if (drawBorder) {\r\n sceneContext.save();\r\n sceneContext.beginPath();\r\n sceneContext.rect(0, 0, width, height);\r\n sceneContext.closePath();\r\n sceneContext.setAttr('strokeStyle', 'red');\r\n sceneContext.setAttr('lineWidth', 5);\r\n sceneContext.stroke();\r\n sceneContext.restore();\r\n }\r\n this._cache.set(CANVAS, {\r\n scene: cachedSceneCanvas,\r\n filter: cachedFilterCanvas,\r\n hit: cachedHitCanvas,\r\n x: x,\r\n y: y,\r\n });\r\n this._requestDraw();\r\n return this;\r\n }\r\n /**\r\n * determine if node is currently cached\r\n * @method\r\n * @name Konva.Node#isCached\r\n * @returns {Boolean}\r\n */\r\n isCached() {\r\n return this._cache.has(CANVAS);\r\n }\r\n /**\r\n * Return client rectangle {x, y, width, height} of node. This rectangle also include all styling (strokes, shadows, etc).\r\n * The purpose of the method is similar to getBoundingClientRect API of the DOM.\r\n * @method\r\n * @name Konva.Node#getClientRect\r\n * @param {Object} config\r\n * @param {Boolean} [config.skipTransform] should we apply transform to node for calculating rect?\r\n * @param {Boolean} [config.skipShadow] should we apply shadow to the node for calculating bound box?\r\n * @param {Boolean} [config.skipStroke] should we apply stroke to the node for calculating bound box?\r\n * @param {Object} [config.relativeTo] calculate client rect relative to one of the parents\r\n * @returns {Object} rect with {x, y, width, height} properties\r\n * @example\r\n * var rect = new Konva.Rect({\r\n * width : 100,\r\n * height : 100,\r\n * x : 50,\r\n * y : 50,\r\n * strokeWidth : 4,\r\n * stroke : 'black',\r\n * offsetX : 50,\r\n * scaleY : 2\r\n * });\r\n *\r\n * // get client rect without think off transformations (position, rotation, scale, offset, etc)\r\n * rect.getClientRect({ skipTransform: true});\r\n * // returns {\r\n * // x : -2, // two pixels for stroke / 2\r\n * // y : -2,\r\n * // width : 104, // increased by 4 for stroke\r\n * // height : 104\r\n * //}\r\n *\r\n * // get client rect with transformation applied\r\n * rect.getClientRect();\r\n * // returns Object {x: -2, y: 46, width: 104, height: 208}\r\n */\r\n getClientRect(config) {\r\n // abstract method\r\n // redefine in Container and Shape\r\n throw new Error('abstract \"getClientRect\" method call');\r\n }\r\n _transformedRect(rect, top) {\r\n var points = [\r\n { x: rect.x, y: rect.y },\r\n { x: rect.x + rect.width, y: rect.y },\r\n { x: rect.x + rect.width, y: rect.y + rect.height },\r\n { x: rect.x, y: rect.y + rect.height },\r\n ];\r\n var minX, minY, maxX, maxY;\r\n var trans = this.getAbsoluteTransform(top);\r\n points.forEach(function (point) {\r\n var transformed = trans.point(point);\r\n if (minX === undefined) {\r\n minX = maxX = transformed.x;\r\n minY = maxY = transformed.y;\r\n }\r\n minX = Math.min(minX, transformed.x);\r\n minY = Math.min(minY, transformed.y);\r\n maxX = Math.max(maxX, transformed.x);\r\n maxY = Math.max(maxY, transformed.y);\r\n });\r\n return {\r\n x: minX,\r\n y: minY,\r\n width: maxX - minX,\r\n height: maxY - minY,\r\n };\r\n }\r\n _drawCachedSceneCanvas(context) {\r\n context.save();\r\n context._applyOpacity(this);\r\n context._applyGlobalCompositeOperation(this);\r\n const canvasCache = this._getCanvasCache();\r\n context.translate(canvasCache.x, canvasCache.y);\r\n var cacheCanvas = this._getCachedSceneCanvas();\r\n var ratio = cacheCanvas.pixelRatio;\r\n context.drawImage(cacheCanvas._canvas, 0, 0, cacheCanvas.width / ratio, cacheCanvas.height / ratio);\r\n context.restore();\r\n }\r\n _drawCachedHitCanvas(context) {\r\n var canvasCache = this._getCanvasCache(), hitCanvas = canvasCache.hit;\r\n context.save();\r\n context.translate(canvasCache.x, canvasCache.y);\r\n context.drawImage(hitCanvas._canvas, 0, 0, hitCanvas.width / hitCanvas.pixelRatio, hitCanvas.height / hitCanvas.pixelRatio);\r\n context.restore();\r\n }\r\n _getCachedSceneCanvas() {\r\n var filters = this.filters(), cachedCanvas = this._getCanvasCache(), sceneCanvas = cachedCanvas.scene, filterCanvas = cachedCanvas.filter, filterContext = filterCanvas.getContext(), len, imageData, n, filter;\r\n if (filters) {\r\n if (!this._filterUpToDate) {\r\n var ratio = sceneCanvas.pixelRatio;\r\n filterCanvas.setSize(sceneCanvas.width / sceneCanvas.pixelRatio, sceneCanvas.height / sceneCanvas.pixelRatio);\r\n try {\r\n len = filters.length;\r\n filterContext.clear();\r\n // copy cached canvas onto filter context\r\n filterContext.drawImage(sceneCanvas._canvas, 0, 0, sceneCanvas.getWidth() / ratio, sceneCanvas.getHeight() / ratio);\r\n imageData = filterContext.getImageData(0, 0, filterCanvas.getWidth(), filterCanvas.getHeight());\r\n // apply filters to filter context\r\n for (n = 0; n < len; n++) {\r\n filter = filters[n];\r\n if (typeof filter !== 'function') {\r\n Util.error('Filter should be type of function, but got ' +\r\n typeof filter +\r\n ' instead. Please check correct filters');\r\n continue;\r\n }\r\n filter.call(this, imageData);\r\n filterContext.putImageData(imageData, 0, 0);\r\n }\r\n }\r\n catch (e) {\r\n Util.error('Unable to apply filter. ' +\r\n e.message +\r\n ' This post my help you https://konvajs.org/docs/posts/Tainted_Canvas.html.');\r\n }\r\n this._filterUpToDate = true;\r\n }\r\n return filterCanvas;\r\n }\r\n return sceneCanvas;\r\n }\r\n /**\r\n * bind events to the node. KonvaJS supports mouseover, mousemove,\r\n * mouseout, mouseenter, mouseleave, mousedown, mouseup, wheel, contextmenu, click, dblclick, touchstart, touchmove,\r\n * touchend, tap, dbltap, dragstart, dragmove, and dragend events.\r\n * Pass in a string of events delimited by a space to bind multiple events at once\r\n * such as 'mousedown mouseup mousemove'. Include a namespace to bind an\r\n * event by name such as 'click.foobar'.\r\n * @method\r\n * @name Konva.Node#on\r\n * @param {String} evtStr e.g. 'click', 'mousedown touchstart', 'mousedown.foo touchstart.foo'\r\n * @param {Function} handler The handler function. The first argument of that function is event object. Event object has `target` as main target of the event, `currentTarget` as current node listener and `evt` as native browser event.\r\n * @returns {Konva.Node}\r\n * @example\r\n * // add click listener\r\n * node.on('click', function() {\r\n * console.log('you clicked me!');\r\n * });\r\n *\r\n * // get the target node\r\n * node.on('click', function(evt) {\r\n * console.log(evt.target);\r\n * });\r\n *\r\n * // stop event propagation\r\n * node.on('click', function(evt) {\r\n * evt.cancelBubble = true;\r\n * });\r\n *\r\n * // bind multiple listeners\r\n * node.on('click touchstart', function() {\r\n * console.log('you clicked/touched me!');\r\n * });\r\n *\r\n * // namespace listener\r\n * node.on('click.foo', function() {\r\n * console.log('you clicked/touched me!');\r\n * });\r\n *\r\n * // get the event type\r\n * node.on('click tap', function(evt) {\r\n * var eventType = evt.type;\r\n * });\r\n *\r\n * // get native event object\r\n * node.on('click tap', function(evt) {\r\n * var nativeEvent = evt.evt;\r\n * });\r\n *\r\n * // for change events, get the old and new val\r\n * node.on('xChange', function(evt) {\r\n * var oldVal = evt.oldVal;\r\n * var newVal = evt.newVal;\r\n * });\r\n *\r\n * // get event targets\r\n * // with event delegations\r\n * layer.on('click', 'Group', function(evt) {\r\n * var shape = evt.target;\r\n * var group = evt.currentTarget;\r\n * });\r\n */\r\n on(evtStr, handler) {\r\n this._cache && this._cache.delete(ALL_LISTENERS);\r\n if (arguments.length === 3) {\r\n return this._delegate.apply(this, arguments);\r\n }\r\n var events = evtStr.split(SPACE$1), len = events.length, n, event, parts, baseEvent, name;\r\n /*\r\n * loop through types and attach event listeners to\r\n * each one. eg. 'click mouseover.namespace mouseout'\r\n * will create three event bindings\r\n */\r\n for (n = 0; n < len; n++) {\r\n event = events[n];\r\n parts = event.split('.');\r\n baseEvent = parts[0];\r\n name = parts[1] || '';\r\n // create events array if it doesn't exist\r\n if (!this.eventListeners[baseEvent]) {\r\n this.eventListeners[baseEvent] = [];\r\n }\r\n this.eventListeners[baseEvent].push({\r\n name: name,\r\n handler: handler,\r\n });\r\n }\r\n return this;\r\n }\r\n /**\r\n * remove event bindings from the node. Pass in a string of\r\n * event types delimmited by a space to remove multiple event\r\n * bindings at once such as 'mousedown mouseup mousemove'.\r\n * include a namespace to remove an event binding by name\r\n * such as 'click.foobar'. If you only give a name like '.foobar',\r\n * all events in that namespace will be removed.\r\n * @method\r\n * @name Konva.Node#off\r\n * @param {String} evtStr e.g. 'click', 'mousedown touchstart', '.foobar'\r\n * @returns {Konva.Node}\r\n * @example\r\n * // remove listener\r\n * node.off('click');\r\n *\r\n * // remove multiple listeners\r\n * node.off('click touchstart');\r\n *\r\n * // remove listener by name\r\n * node.off('click.foo');\r\n */\r\n off(evtStr, callback) {\r\n var events = (evtStr || '').split(SPACE$1), len = events.length, n, t, event, parts, baseEvent, name;\r\n this._cache && this._cache.delete(ALL_LISTENERS);\r\n if (!evtStr) {\r\n // remove all events\r\n for (t in this.eventListeners) {\r\n this._off(t);\r\n }\r\n }\r\n for (n = 0; n < len; n++) {\r\n event = events[n];\r\n parts = event.split('.');\r\n baseEvent = parts[0];\r\n name = parts[1];\r\n if (baseEvent) {\r\n if (this.eventListeners[baseEvent]) {\r\n this._off(baseEvent, name, callback);\r\n }\r\n }\r\n else {\r\n for (t in this.eventListeners) {\r\n this._off(t, name, callback);\r\n }\r\n }\r\n }\r\n return this;\r\n }\r\n // some event aliases for third party integration like HammerJS\r\n dispatchEvent(evt) {\r\n var e = {\r\n target: this,\r\n type: evt.type,\r\n evt: evt,\r\n };\r\n this.fire(evt.type, e);\r\n return this;\r\n }\r\n addEventListener(type, handler) {\r\n // we have to pass native event to handler\r\n this.on(type, function (evt) {\r\n handler.call(this, evt.evt);\r\n });\r\n return this;\r\n }\r\n removeEventListener(type) {\r\n this.off(type);\r\n return this;\r\n }\r\n // like node.on\r\n _delegate(event, selector, handler) {\r\n var stopNode = this;\r\n this.on(event, function (evt) {\r\n var targets = evt.target.findAncestors(selector, true, stopNode);\r\n for (var i = 0; i < targets.length; i++) {\r\n evt = Util.cloneObject(evt);\r\n evt.currentTarget = targets[i];\r\n handler.call(targets[i], evt);\r\n }\r\n });\r\n }\r\n /**\r\n * remove a node from parent, but don't destroy. You can reuse the node later.\r\n * @method\r\n * @name Konva.Node#remove\r\n * @returns {Konva.Node}\r\n * @example\r\n * node.remove();\r\n */\r\n remove() {\r\n if (this.isDragging()) {\r\n this.stopDrag();\r\n }\r\n // we can have drag element but that is not dragged yet\r\n // so just clear it\r\n DD._dragElements.delete(this._id);\r\n this._remove();\r\n return this;\r\n }\r\n _clearCaches() {\r\n this._clearSelfAndDescendantCache(ABSOLUTE_TRANSFORM);\r\n this._clearSelfAndDescendantCache(ABSOLUTE_OPACITY);\r\n this._clearSelfAndDescendantCache(ABSOLUTE_SCALE);\r\n this._clearSelfAndDescendantCache(STAGE$1);\r\n this._clearSelfAndDescendantCache(VISIBLE);\r\n this._clearSelfAndDescendantCache(LISTENING);\r\n }\r\n _remove() {\r\n // every cached attr that is calculated via node tree\r\n // traversal must be cleared when removing a node\r\n this._clearCaches();\r\n var parent = this.getParent();\r\n if (parent && parent.children) {\r\n parent.children.splice(this.index, 1);\r\n parent._setChildrenIndices();\r\n this.parent = null;\r\n }\r\n }\r\n /**\r\n * remove and destroy a node. Kill it and delete forever! You should not reuse node after destroy().\r\n * If the node is a container (Group, Stage or Layer) it will destroy all children too.\r\n * @method\r\n * @name Konva.Node#destroy\r\n * @example\r\n * node.destroy();\r\n */\r\n destroy() {\r\n this.remove();\r\n this.clearCache();\r\n return this;\r\n }\r\n /**\r\n * get attr\r\n * @method\r\n * @name Konva.Node#getAttr\r\n * @param {String} attr\r\n * @returns {Integer|String|Object|Array}\r\n * @example\r\n * var x = node.getAttr('x');\r\n */\r\n getAttr(attr) {\r\n var method = 'get' + Util._capitalize(attr);\r\n if (Util._isFunction(this[method])) {\r\n return this[method]();\r\n }\r\n // otherwise get directly\r\n return this.attrs[attr];\r\n }\r\n /**\r\n * get ancestors\r\n * @method\r\n * @name Konva.Node#getAncestors\r\n * @returns {Array}\r\n * @example\r\n * shape.getAncestors().forEach(function(node) {\r\n * console.log(node.getId());\r\n * })\r\n */\r\n getAncestors() {\r\n var parent = this.getParent(), ancestors = [];\r\n while (parent) {\r\n ancestors.push(parent);\r\n parent = parent.getParent();\r\n }\r\n return ancestors;\r\n }\r\n /**\r\n * get attrs object literal\r\n * @method\r\n * @name Konva.Node#getAttrs\r\n * @returns {Object}\r\n */\r\n getAttrs() {\r\n return this.attrs || {};\r\n }\r\n /**\r\n * set multiple attrs at once using an object literal\r\n * @method\r\n * @name Konva.Node#setAttrs\r\n * @param {Object} config object containing key value pairs\r\n * @returns {Konva.Node}\r\n * @example\r\n * node.setAttrs({\r\n * x: 5,\r\n * fill: 'red'\r\n * });\r\n */\r\n setAttrs(config) {\r\n this._batchTransformChanges(() => {\r\n var key, method;\r\n if (!config) {\r\n return this;\r\n }\r\n for (key in config) {\r\n if (key === CHILDREN) {\r\n continue;\r\n }\r\n method = SET + Util._capitalize(key);\r\n // use setter if available\r\n if (Util._isFunction(this[method])) {\r\n this[method](config[key]);\r\n }\r\n else {\r\n // otherwise set directly\r\n this._setAttr(key, config[key]);\r\n }\r\n }\r\n });\r\n return this;\r\n }\r\n /**\r\n * determine if node is listening for events by taking into account ancestors.\r\n *\r\n * Parent | Self | isListening\r\n * listening | listening |\r\n * ----------+-----------+------------\r\n * T | T | T\r\n * T | F | F\r\n * F | T | F\r\n * F | F | F\r\n *\r\n * @method\r\n * @name Konva.Node#isListening\r\n * @returns {Boolean}\r\n */\r\n isListening() {\r\n return this._getCache(LISTENING, this._isListening);\r\n }\r\n _isListening(relativeTo) {\r\n const listening = this.listening();\r\n if (!listening) {\r\n return false;\r\n }\r\n const parent = this.getParent();\r\n if (parent && parent !== relativeTo && this !== relativeTo) {\r\n return parent._isListening(relativeTo);\r\n }\r\n else {\r\n return true;\r\n }\r\n }\r\n /**\r\n * determine if node is visible by taking into account ancestors.\r\n *\r\n * Parent | Self | isVisible\r\n * visible | visible |\r\n * ----------+-----------+------------\r\n * T | T | T\r\n * T | F | F\r\n * F | T | F\r\n * F | F | F\r\n * @method\r\n * @name Konva.Node#isVisible\r\n * @returns {Boolean}\r\n */\r\n isVisible() {\r\n return this._getCache(VISIBLE, this._isVisible);\r\n }\r\n _isVisible(relativeTo) {\r\n const visible = this.visible();\r\n if (!visible) {\r\n return false;\r\n }\r\n const parent = this.getParent();\r\n if (parent && parent !== relativeTo && this !== relativeTo) {\r\n return parent._isVisible(relativeTo);\r\n }\r\n else {\r\n return true;\r\n }\r\n }\r\n shouldDrawHit(top, skipDragCheck = false) {\r\n if (top) {\r\n return this._isVisible(top) && this._isListening(top);\r\n }\r\n var layer = this.getLayer();\r\n var layerUnderDrag = false;\r\n DD._dragElements.forEach((elem) => {\r\n if (elem.dragStatus !== 'dragging') {\r\n return;\r\n }\r\n else if (elem.node.nodeType === 'Stage') {\r\n layerUnderDrag = true;\r\n }\r\n else if (elem.node.getLayer() === layer) {\r\n layerUnderDrag = true;\r\n }\r\n });\r\n var dragSkip = !skipDragCheck && !Konva$2.hitOnDragEnabled && layerUnderDrag;\r\n return this.isListening() && this.isVisible() && !dragSkip;\r\n }\r\n /**\r\n * show node. set visible = true\r\n * @method\r\n * @name Konva.Node#show\r\n * @returns {Konva.Node}\r\n */\r\n show() {\r\n this.visible(true);\r\n return this;\r\n }\r\n /**\r\n * hide node. Hidden nodes are no longer detectable\r\n * @method\r\n * @name Konva.Node#hide\r\n * @returns {Konva.Node}\r\n */\r\n hide() {\r\n this.visible(false);\r\n return this;\r\n }\r\n getZIndex() {\r\n return this.index || 0;\r\n }\r\n /**\r\n * get absolute z-index which takes into account sibling\r\n * and ancestor indices\r\n * @method\r\n * @name Konva.Node#getAbsoluteZIndex\r\n * @returns {Integer}\r\n */\r\n getAbsoluteZIndex() {\r\n var depth = this.getDepth(), that = this, index = 0, nodes, len, n, child;\r\n function addChildren(children) {\r\n nodes = [];\r\n len = children.length;\r\n for (n = 0; n < len; n++) {\r\n child = children[n];\r\n index++;\r\n if (child.nodeType !== SHAPE) {\r\n nodes = nodes.concat(child.getChildren().slice());\r\n }\r\n if (child._id === that._id) {\r\n n = len;\r\n }\r\n }\r\n if (nodes.length > 0 && nodes[0].getDepth() <= depth) {\r\n addChildren(nodes);\r\n }\r\n }\r\n if (that.nodeType !== UPPER_STAGE) {\r\n addChildren(that.getStage().getChildren());\r\n }\r\n return index;\r\n }\r\n /**\r\n * get node depth in node tree. Returns an integer.\r\n * e.g. Stage depth will always be 0. Layers will always be 1. Groups and Shapes will always\r\n * be >= 2\r\n * @method\r\n * @name Konva.Node#getDepth\r\n * @returns {Integer}\r\n */\r\n getDepth() {\r\n var depth = 0, parent = this.parent;\r\n while (parent) {\r\n depth++;\r\n parent = parent.parent;\r\n }\r\n return depth;\r\n }\r\n // sometimes we do several attributes changes\r\n // like node.position(pos)\r\n // for performance reasons, lets batch transform reset\r\n // so it work faster\r\n _batchTransformChanges(func) {\r\n this._batchingTransformChange = true;\r\n func();\r\n this._batchingTransformChange = false;\r\n if (this._needClearTransformCache) {\r\n this._clearCache(TRANSFORM);\r\n this._clearSelfAndDescendantCache(ABSOLUTE_TRANSFORM);\r\n }\r\n this._needClearTransformCache = false;\r\n }\r\n setPosition(pos) {\r\n this._batchTransformChanges(() => {\r\n this.x(pos.x);\r\n this.y(pos.y);\r\n });\r\n return this;\r\n }\r\n getPosition() {\r\n return {\r\n x: this.x(),\r\n y: this.y(),\r\n };\r\n }\r\n /**\r\n * get position of first pointer (like mouse or first touch) relative to local coordinates of current node\r\n * @method\r\n * @name Konva.Node#getRelativePointerPosition\r\n * @returns {Konva.Node}\r\n * @example\r\n *\r\n * // let's think we have a rectangle at position x = 10, y = 10\r\n * // now we clicked at x = 15, y = 15 of the stage\r\n * // if you want to know position of the click, related to the rectangle you can use\r\n * rect.getRelativePointerPosition();\r\n */\r\n getRelativePointerPosition() {\r\n if (!this.getStage()) {\r\n return null;\r\n }\r\n // get pointer (say mouse or touch) position\r\n var pos = this.getStage().getPointerPosition();\r\n if (!pos) {\r\n return null;\r\n }\r\n var transform = this.getAbsoluteTransform().copy();\r\n // to detect relative position we need to invert transform\r\n transform.invert();\r\n // now we can find relative point\r\n return transform.point(pos);\r\n }\r\n /**\r\n * get absolute position of a node. That function can be used to calculate absolute position, but relative to any ancestor\r\n * @method\r\n * @name Konva.Node#getAbsolutePosition\r\n * @param {Object} Ancestor optional ancestor node\r\n * @returns {Konva.Node}\r\n * @example\r\n *\r\n * // returns absolute position relative to top-left corner of canvas\r\n * node.getAbsolutePosition();\r\n *\r\n * // calculate absolute position of node, inside stage\r\n * // so stage transforms are ignored\r\n * node.getAbsolutePosition(stage)\r\n */\r\n getAbsolutePosition(top) {\r\n let haveCachedParent = false;\r\n let parent = this.parent;\r\n while (parent) {\r\n if (parent.isCached()) {\r\n haveCachedParent = true;\r\n break;\r\n }\r\n parent = parent.parent;\r\n }\r\n if (haveCachedParent && !top) {\r\n // make fake top element\r\n // \"true\" is not a node, but it will just allow skip all caching\r\n top = true;\r\n }\r\n var absoluteMatrix = this.getAbsoluteTransform(top).getMatrix(), absoluteTransform = new Transform(), offset = this.offset();\r\n // clone the matrix array\r\n absoluteTransform.m = absoluteMatrix.slice();\r\n absoluteTransform.translate(offset.x, offset.y);\r\n return absoluteTransform.getTranslation();\r\n }\r\n setAbsolutePosition(pos) {\r\n var origTrans = this._clearTransform();\r\n // don't clear translation\r\n this.attrs.x = origTrans.x;\r\n this.attrs.y = origTrans.y;\r\n delete origTrans.x;\r\n delete origTrans.y;\r\n // important, use non cached value\r\n this._clearCache(TRANSFORM);\r\n var it = this._getAbsoluteTransform().copy();\r\n it.invert();\r\n it.translate(pos.x, pos.y);\r\n pos = {\r\n x: this.attrs.x + it.getTranslation().x,\r\n y: this.attrs.y + it.getTranslation().y,\r\n };\r\n this._setTransform(origTrans);\r\n this.setPosition({ x: pos.x, y: pos.y });\r\n this._clearCache(TRANSFORM);\r\n this._clearSelfAndDescendantCache(ABSOLUTE_TRANSFORM);\r\n return this;\r\n }\r\n _setTransform(trans) {\r\n var key;\r\n for (key in trans) {\r\n this.attrs[key] = trans[key];\r\n }\r\n // this._clearCache(TRANSFORM);\r\n // this._clearSelfAndDescendantCache(ABSOLUTE_TRANSFORM);\r\n }\r\n _clearTransform() {\r\n var trans = {\r\n x: this.x(),\r\n y: this.y(),\r\n rotation: this.rotation(),\r\n scaleX: this.scaleX(),\r\n scaleY: this.scaleY(),\r\n offsetX: this.offsetX(),\r\n offsetY: this.offsetY(),\r\n skewX: this.skewX(),\r\n skewY: this.skewY(),\r\n };\r\n this.attrs.x = 0;\r\n this.attrs.y = 0;\r\n this.attrs.rotation = 0;\r\n this.attrs.scaleX = 1;\r\n this.attrs.scaleY = 1;\r\n this.attrs.offsetX = 0;\r\n this.attrs.offsetY = 0;\r\n this.attrs.skewX = 0;\r\n this.attrs.skewY = 0;\r\n // return original transform\r\n return trans;\r\n }\r\n /**\r\n * move node by an amount relative to its current position\r\n * @method\r\n * @name Konva.Node#move\r\n * @param {Object} change\r\n * @param {Number} change.x\r\n * @param {Number} change.y\r\n * @returns {Konva.Node}\r\n * @example\r\n * // move node in x direction by 1px and y direction by 2px\r\n * node.move({\r\n * x: 1,\r\n * y: 2\r\n * });\r\n */\r\n move(change) {\r\n var changeX = change.x, changeY = change.y, x = this.x(), y = this.y();\r\n if (changeX !== undefined) {\r\n x += changeX;\r\n }\r\n if (changeY !== undefined) {\r\n y += changeY;\r\n }\r\n this.setPosition({ x: x, y: y });\r\n return this;\r\n }\r\n _eachAncestorReverse(func, top) {\r\n var family = [], parent = this.getParent(), len, n;\r\n // if top node is defined, and this node is top node,\r\n // there's no need to build a family tree. just execute\r\n // func with this because it will be the only node\r\n if (top && top._id === this._id) {\r\n // func(this);\r\n return;\r\n }\r\n family.unshift(this);\r\n while (parent && (!top || parent._id !== top._id)) {\r\n family.unshift(parent);\r\n parent = parent.parent;\r\n }\r\n len = family.length;\r\n for (n = 0; n < len; n++) {\r\n func(family[n]);\r\n }\r\n }\r\n /**\r\n * rotate node by an amount in degrees relative to its current rotation\r\n * @method\r\n * @name Konva.Node#rotate\r\n * @param {Number} theta\r\n * @returns {Konva.Node}\r\n */\r\n rotate(theta) {\r\n this.rotation(this.rotation() + theta);\r\n return this;\r\n }\r\n /**\r\n * move node to the top of its siblings\r\n * @method\r\n * @name Konva.Node#moveToTop\r\n * @returns {Boolean}\r\n */\r\n moveToTop() {\r\n if (!this.parent) {\r\n Util.warn('Node has no parent. moveToTop function is ignored.');\r\n return false;\r\n }\r\n var index = this.index, len = this.parent.getChildren().length;\r\n if (index < len - 1) {\r\n this.parent.children.splice(index, 1);\r\n this.parent.children.push(this);\r\n this.parent._setChildrenIndices();\r\n return true;\r\n }\r\n return false;\r\n }\r\n /**\r\n * move node up\r\n * @method\r\n * @name Konva.Node#moveUp\r\n * @returns {Boolean} flag is moved or not\r\n */\r\n moveUp() {\r\n if (!this.parent) {\r\n Util.warn('Node has no parent. moveUp function is ignored.');\r\n return false;\r\n }\r\n var index = this.index, len = this.parent.getChildren().length;\r\n if (index < len - 1) {\r\n this.parent.children.splice(index, 1);\r\n this.parent.children.splice(index + 1, 0, this);\r\n this.parent._setChildrenIndices();\r\n return true;\r\n }\r\n return false;\r\n }\r\n /**\r\n * move node down\r\n * @method\r\n * @name Konva.Node#moveDown\r\n * @returns {Boolean}\r\n */\r\n moveDown() {\r\n if (!this.parent) {\r\n Util.warn('Node has no parent. moveDown function is ignored.');\r\n return false;\r\n }\r\n var index = this.index;\r\n if (index > 0) {\r\n this.parent.children.splice(index, 1);\r\n this.parent.children.splice(index - 1, 0, this);\r\n this.parent._setChildrenIndices();\r\n return true;\r\n }\r\n return false;\r\n }\r\n /**\r\n * move node to the bottom of its siblings\r\n * @method\r\n * @name Konva.Node#moveToBottom\r\n * @returns {Boolean}\r\n */\r\n moveToBottom() {\r\n if (!this.parent) {\r\n Util.warn('Node has no parent. moveToBottom function is ignored.');\r\n return false;\r\n }\r\n var index = this.index;\r\n if (index > 0) {\r\n this.parent.children.splice(index, 1);\r\n this.parent.children.unshift(this);\r\n this.parent._setChildrenIndices();\r\n return true;\r\n }\r\n return false;\r\n }\r\n setZIndex(zIndex) {\r\n if (!this.parent) {\r\n Util.warn('Node has no parent. zIndex parameter is ignored.');\r\n return this;\r\n }\r\n if (zIndex < 0 || zIndex >= this.parent.children.length) {\r\n Util.warn('Unexpected value ' +\r\n zIndex +\r\n ' for zIndex property. zIndex is just index of a node in children of its parent. Expected value is from 0 to ' +\r\n (this.parent.children.length - 1) +\r\n '.');\r\n }\r\n var index = this.index;\r\n this.parent.children.splice(index, 1);\r\n this.parent.children.splice(zIndex, 0, this);\r\n this.parent._setChildrenIndices();\r\n return this;\r\n }\r\n /**\r\n * get absolute opacity\r\n * @method\r\n * @name Konva.Node#getAbsoluteOpacity\r\n * @returns {Number}\r\n */\r\n getAbsoluteOpacity() {\r\n return this._getCache(ABSOLUTE_OPACITY, this._getAbsoluteOpacity);\r\n }\r\n _getAbsoluteOpacity() {\r\n var absOpacity = this.opacity();\r\n var parent = this.getParent();\r\n if (parent && !parent._isUnderCache) {\r\n absOpacity *= parent.getAbsoluteOpacity();\r\n }\r\n return absOpacity;\r\n }\r\n /**\r\n * move node to another container\r\n * @method\r\n * @name Konva.Node#moveTo\r\n * @param {Container} newContainer\r\n * @returns {Konva.Node}\r\n * @example\r\n * // move node from current layer into layer2\r\n * node.moveTo(layer2);\r\n */\r\n moveTo(newContainer) {\r\n // do nothing if new container is already parent\r\n if (this.getParent() !== newContainer) {\r\n this._remove();\r\n newContainer.add(this);\r\n }\r\n return this;\r\n }\r\n /**\r\n * convert Node into an object for serialization. Returns an object.\r\n * @method\r\n * @name Konva.Node#toObject\r\n * @returns {Object}\r\n */\r\n toObject() {\r\n var obj = {}, attrs = this.getAttrs(), key, val, getter, defaultValue, nonPlainObject;\r\n obj.attrs = {};\r\n for (key in attrs) {\r\n val = attrs[key];\r\n // if value is object and object is not plain\r\n // like class instance, we should skip it and to not include\r\n nonPlainObject =\r\n Util.isObject(val) && !Util._isPlainObject(val) && !Util._isArray(val);\r\n if (nonPlainObject) {\r\n continue;\r\n }\r\n getter = typeof this[key] === 'function' && this[key];\r\n // remove attr value so that we can extract the default value from the getter\r\n delete attrs[key];\r\n defaultValue = getter ? getter.call(this) : null;\r\n // restore attr value\r\n attrs[key] = val;\r\n if (defaultValue !== val) {\r\n obj.attrs[key] = val;\r\n }\r\n }\r\n obj.className = this.getClassName();\r\n return Util._prepareToStringify(obj);\r\n }\r\n /**\r\n * convert Node into a JSON string. Returns a JSON string.\r\n * @method\r\n * @name Konva.Node#toJSON\r\n * @returns {String}\r\n */\r\n toJSON() {\r\n return JSON.stringify(this.toObject());\r\n }\r\n /**\r\n * get parent container\r\n * @method\r\n * @name Konva.Node#getParent\r\n * @returns {Konva.Node}\r\n */\r\n getParent() {\r\n return this.parent;\r\n }\r\n /**\r\n * get all ancestors (parent then parent of the parent, etc) of the node\r\n * @method\r\n * @name Konva.Node#findAncestors\r\n * @param {String} selector selector for search\r\n * @param {Boolean} [includeSelf] show we think that node is ancestro itself?\r\n * @param {Konva.Node} [stopNode] optional node where we need to stop searching (one of ancestors)\r\n * @returns {Array} [ancestors]\r\n * @example\r\n * // get one of the parent group\r\n * var parentGroups = node.findAncestors('Group');\r\n */\r\n findAncestors(selector, includeSelf, stopNode) {\r\n var res = [];\r\n if (includeSelf && this._isMatch(selector)) {\r\n res.push(this);\r\n }\r\n var ancestor = this.parent;\r\n while (ancestor) {\r\n if (ancestor === stopNode) {\r\n return res;\r\n }\r\n if (ancestor._isMatch(selector)) {\r\n res.push(ancestor);\r\n }\r\n ancestor = ancestor.parent;\r\n }\r\n return res;\r\n }\r\n isAncestorOf(node) {\r\n return false;\r\n }\r\n /**\r\n * get ancestor (parent or parent of the parent, etc) of the node that match passed selector\r\n * @method\r\n * @name Konva.Node#findAncestor\r\n * @param {String} selector selector for search\r\n * @param {Boolean} [includeSelf] show we think that node is ancestro itself?\r\n * @param {Konva.Node} [stopNode] optional node where we need to stop searching (one of ancestors)\r\n * @returns {Konva.Node} ancestor\r\n * @example\r\n * // get one of the parent group\r\n * var group = node.findAncestors('.mygroup');\r\n */\r\n findAncestor(selector, includeSelf, stopNode) {\r\n return this.findAncestors(selector, includeSelf, stopNode)[0];\r\n }\r\n // is current node match passed selector?\r\n _isMatch(selector) {\r\n if (!selector) {\r\n return false;\r\n }\r\n if (typeof selector === 'function') {\r\n return selector(this);\r\n }\r\n var selectorArr = selector.replace(/ /g, '').split(','), len = selectorArr.length, n, sel;\r\n for (n = 0; n < len; n++) {\r\n sel = selectorArr[n];\r\n if (!Util.isValidSelector(sel)) {\r\n Util.warn('Selector \"' +\r\n sel +\r\n '\" is invalid. Allowed selectors examples are \"#foo\", \".bar\" or \"Group\".');\r\n Util.warn('If you have a custom shape with such className, please change it to start with upper letter like \"Triangle\".');\r\n Util.warn('Konva is awesome, right?');\r\n }\r\n // id selector\r\n if (sel.charAt(0) === '#') {\r\n if (this.id() === sel.slice(1)) {\r\n return true;\r\n }\r\n }\r\n else if (sel.charAt(0) === '.') {\r\n // name selector\r\n if (this.hasName(sel.slice(1))) {\r\n return true;\r\n }\r\n }\r\n else if (this.className === sel || this.nodeType === sel) {\r\n return true;\r\n }\r\n }\r\n return false;\r\n }\r\n /**\r\n * get layer ancestor\r\n * @method\r\n * @name Konva.Node#getLayer\r\n * @returns {Konva.Layer}\r\n */\r\n getLayer() {\r\n var parent = this.getParent();\r\n return parent ? parent.getLayer() : null;\r\n }\r\n /**\r\n * get stage ancestor\r\n * @method\r\n * @name Konva.Node#getStage\r\n * @returns {Konva.Stage}\r\n */\r\n getStage() {\r\n return this._getCache(STAGE$1, this._getStage);\r\n }\r\n _getStage() {\r\n var parent = this.getParent();\r\n if (parent) {\r\n return parent.getStage();\r\n }\r\n else {\r\n return undefined;\r\n }\r\n }\r\n /**\r\n * fire event\r\n * @method\r\n * @name Konva.Node#fire\r\n * @param {String} eventType event type. can be a regular event, like click, mouseover, or mouseout, or it can be a custom event, like myCustomEvent\r\n * @param {Event} [evt] event object\r\n * @param {Boolean} [bubble] setting the value to false, or leaving it undefined, will result in the event\r\n * not bubbling. Setting the value to true will result in the event bubbling.\r\n * @returns {Konva.Node}\r\n * @example\r\n * // manually fire click event\r\n * node.fire('click');\r\n *\r\n * // fire custom event\r\n * node.fire('foo');\r\n *\r\n * // fire custom event with custom event object\r\n * node.fire('foo', {\r\n * bar: 10\r\n * });\r\n *\r\n * // fire click event that bubbles\r\n * node.fire('click', null, true);\r\n */\r\n fire(eventType, evt = {}, bubble) {\r\n evt.target = evt.target || this;\r\n // bubble\r\n if (bubble) {\r\n this._fireAndBubble(eventType, evt);\r\n }\r\n else {\r\n // no bubble\r\n this._fire(eventType, evt);\r\n }\r\n return this;\r\n }\r\n /**\r\n * get absolute transform of the node which takes into\r\n * account its ancestor transforms\r\n * @method\r\n * @name Konva.Node#getAbsoluteTransform\r\n * @returns {Konva.Transform}\r\n */\r\n getAbsoluteTransform(top) {\r\n // if using an argument, we can't cache the result.\r\n if (top) {\r\n return this._getAbsoluteTransform(top);\r\n }\r\n else {\r\n // if no argument, we can cache the result\r\n return this._getCache(ABSOLUTE_TRANSFORM, this._getAbsoluteTransform);\r\n }\r\n }\r\n _getAbsoluteTransform(top) {\r\n var at;\r\n // we we need position relative to an ancestor, we will iterate for all\r\n if (top) {\r\n at = new Transform();\r\n // start with stage and traverse downwards to self\r\n this._eachAncestorReverse(function (node) {\r\n var transformsEnabled = node.transformsEnabled();\r\n if (transformsEnabled === 'all') {\r\n at.multiply(node.getTransform());\r\n }\r\n else if (transformsEnabled === 'position') {\r\n at.translate(node.x() - node.offsetX(), node.y() - node.offsetY());\r\n }\r\n }, top);\r\n return at;\r\n }\r\n else {\r\n // try to use a cached value\r\n at = this._cache.get(ABSOLUTE_TRANSFORM) || new Transform();\r\n if (this.parent) {\r\n // transform will be cached\r\n this.parent.getAbsoluteTransform().copyInto(at);\r\n }\r\n else {\r\n at.reset();\r\n }\r\n var transformsEnabled = this.transformsEnabled();\r\n if (transformsEnabled === 'all') {\r\n at.multiply(this.getTransform());\r\n }\r\n else if (transformsEnabled === 'position') {\r\n // use \"attrs\" directly, because it is a bit faster\r\n const x = this.attrs.x || 0;\r\n const y = this.attrs.y || 0;\r\n const offsetX = this.attrs.offsetX || 0;\r\n const offsetY = this.attrs.offsetY || 0;\r\n at.translate(x - offsetX, y - offsetY);\r\n }\r\n at.dirty = false;\r\n return at;\r\n }\r\n }\r\n /**\r\n * get absolute scale of the node which takes into\r\n * account its ancestor scales\r\n * @method\r\n * @name Konva.Node#getAbsoluteScale\r\n * @returns {Object}\r\n * @example\r\n * // get absolute scale x\r\n * var scaleX = node.getAbsoluteScale().x;\r\n */\r\n getAbsoluteScale(top) {\r\n // do not cache this calculations,\r\n // because it use cache transform\r\n // this is special logic for caching with some shapes with shadow\r\n var parent = this;\r\n while (parent) {\r\n if (parent._isUnderCache) {\r\n top = parent;\r\n }\r\n parent = parent.getParent();\r\n }\r\n const transform = this.getAbsoluteTransform(top);\r\n const attrs = transform.decompose();\r\n return {\r\n x: attrs.scaleX,\r\n y: attrs.scaleY,\r\n };\r\n }\r\n /**\r\n * get absolute rotation of the node which takes into\r\n * account its ancestor rotations\r\n * @method\r\n * @name Konva.Node#getAbsoluteRotation\r\n * @returns {Number}\r\n * @example\r\n * // get absolute rotation\r\n * var rotation = node.getAbsoluteRotation();\r\n */\r\n getAbsoluteRotation() {\r\n // var parent: Node = this;\r\n // var rotation = 0;\r\n // while (parent) {\r\n // rotation += parent.rotation();\r\n // parent = parent.getParent();\r\n // }\r\n // return rotation;\r\n return this.getAbsoluteTransform().decompose().rotation;\r\n }\r\n /**\r\n * get transform of the node\r\n * @method\r\n * @name Konva.Node#getTransform\r\n * @returns {Konva.Transform}\r\n */\r\n getTransform() {\r\n return this._getCache(TRANSFORM, this._getTransform);\r\n }\r\n _getTransform() {\r\n var _a, _b;\r\n var m = this._cache.get(TRANSFORM) || new Transform();\r\n m.reset();\r\n // I was trying to use attributes directly here\r\n // but it doesn't work for Transformer well\r\n // because it overwrite x,y getters\r\n var x = this.x(), y = this.y(), rotation = Konva$2.getAngle(this.rotation()), scaleX = (_a = this.attrs.scaleX) !== null && _a !== void 0 ? _a : 1, scaleY = (_b = this.attrs.scaleY) !== null && _b !== void 0 ? _b : 1, skewX = this.attrs.skewX || 0, skewY = this.attrs.skewY || 0, offsetX = this.attrs.offsetX || 0, offsetY = this.attrs.offsetY || 0;\r\n if (x !== 0 || y !== 0) {\r\n m.translate(x, y);\r\n }\r\n if (rotation !== 0) {\r\n m.rotate(rotation);\r\n }\r\n if (skewX !== 0 || skewY !== 0) {\r\n m.skew(skewX, skewY);\r\n }\r\n if (scaleX !== 1 || scaleY !== 1) {\r\n m.scale(scaleX, scaleY);\r\n }\r\n if (offsetX !== 0 || offsetY !== 0) {\r\n m.translate(-1 * offsetX, -1 * offsetY);\r\n }\r\n m.dirty = false;\r\n return m;\r\n }\r\n /**\r\n * clone node. Returns a new Node instance with identical attributes. You can also override\r\n * the node properties with an object literal, enabling you to use an existing node as a template\r\n * for another node\r\n * @method\r\n * @name Konva.Node#clone\r\n * @param {Object} obj override attrs\r\n * @returns {Konva.Node}\r\n * @example\r\n * // simple clone\r\n * var clone = node.clone();\r\n *\r\n * // clone a node and override the x position\r\n * var clone = rect.clone({\r\n * x: 5\r\n * });\r\n */\r\n clone(obj) {\r\n // instantiate new node\r\n var attrs = Util.cloneObject(this.attrs), key, allListeners, len, n, listener;\r\n // apply attr overrides\r\n for (key in obj) {\r\n attrs[key] = obj[key];\r\n }\r\n var node = new this.constructor(attrs);\r\n // copy over listeners\r\n for (key in this.eventListeners) {\r\n allListeners = this.eventListeners[key];\r\n len = allListeners.length;\r\n for (n = 0; n < len; n++) {\r\n listener = allListeners[n];\r\n /*\r\n * don't include konva namespaced listeners because\r\n * these are generated by the constructors\r\n */\r\n if (listener.name.indexOf(KONVA) < 0) {\r\n // if listeners array doesn't exist, then create it\r\n if (!node.eventListeners[key]) {\r\n node.eventListeners[key] = [];\r\n }\r\n node.eventListeners[key].push(listener);\r\n }\r\n }\r\n }\r\n return node;\r\n }\r\n _toKonvaCanvas(config) {\r\n config = config || {};\r\n var box = this.getClientRect();\r\n var stage = this.getStage(), x = config.x !== undefined ? config.x : Math.floor(box.x), y = config.y !== undefined ? config.y : Math.floor(box.y), pixelRatio = config.pixelRatio || 1, canvas = new SceneCanvas({\r\n width: config.width || Math.ceil(box.width) || (stage ? stage.width() : 0),\r\n height: config.height ||\r\n Math.ceil(box.height) ||\r\n (stage ? stage.height() : 0),\r\n pixelRatio: pixelRatio,\r\n }), context = canvas.getContext();\r\n if (config.imageSmoothingEnabled === false) {\r\n context._context.imageSmoothingEnabled = false;\r\n }\r\n context.save();\r\n if (x || y) {\r\n context.translate(-1 * x, -1 * y);\r\n }\r\n this.drawScene(canvas);\r\n context.restore();\r\n return canvas;\r\n }\r\n /**\r\n * converts node into an canvas element.\r\n * @method\r\n * @name Konva.Node#toCanvas\r\n * @param {Object} config\r\n * @param {Function} config.callback function executed when the composite has completed\r\n * @param {Number} [config.x] x position of canvas section\r\n * @param {Number} [config.y] y position of canvas section\r\n * @param {Number} [config.width] width of canvas section\r\n * @param {Number} [config.height] height of canvas section\r\n * @param {Number} [config.pixelRatio] pixelRatio of output canvas. Default is 1.\r\n * You can use that property to increase quality of the image, for example for super hight quality exports\r\n * or usage on retina (or similar) displays. pixelRatio will be used to multiply the size of exported image.\r\n * If you export to 500x500 size with pixelRatio = 2, then produced image will have size 1000x1000.\r\n * @param {Boolean} [config.imageSmoothingEnabled] set this to false if you want to disable imageSmoothing\r\n * @example\r\n * var canvas = node.toCanvas();\r\n */\r\n toCanvas(config) {\r\n return this._toKonvaCanvas(config)._canvas;\r\n }\r\n /**\r\n * Creates a composite data URL (base64 string). If MIME type is not\r\n * specified, then \"image/png\" will result. For \"image/jpeg\", specify a quality\r\n * level as quality (range 0.0 - 1.0)\r\n * @method\r\n * @name Konva.Node#toDataURL\r\n * @param {Object} config\r\n * @param {String} [config.mimeType] can be \"image/png\" or \"image/jpeg\".\r\n * \"image/png\" is the default\r\n * @param {Number} [config.x] x position of canvas section\r\n * @param {Number} [config.y] y position of canvas section\r\n * @param {Number} [config.width] width of canvas section\r\n * @param {Number} [config.height] height of canvas section\r\n * @param {Number} [config.quality] jpeg quality. If using an \"image/jpeg\" mimeType,\r\n * you can specify the quality from 0 to 1, where 0 is very poor quality and 1\r\n * is very high quality\r\n * @param {Number} [config.pixelRatio] pixelRatio of output image url. Default is 1.\r\n * You can use that property to increase quality of the image, for example for super hight quality exports\r\n * or usage on retina (or similar) displays. pixelRatio will be used to multiply the size of exported image.\r\n * If you export to 500x500 size with pixelRatio = 2, then produced image will have size 1000x1000.\r\n * @param {Boolean} [config.imageSmoothingEnabled] set this to false if you want to disable imageSmoothing\r\n * @returns {String}\r\n */\r\n toDataURL(config) {\r\n config = config || {};\r\n var mimeType = config.mimeType || null, quality = config.quality || null;\r\n var url = this._toKonvaCanvas(config).toDataURL(mimeType, quality);\r\n if (config.callback) {\r\n config.callback(url);\r\n }\r\n return url;\r\n }\r\n /**\r\n * converts node into an image. Since the toImage\r\n * method is asynchronous, the resulting image can only be retrieved from the config callback\r\n * or the returned Promise. toImage is most commonly used\r\n * to cache complex drawings as an image so that they don't have to constantly be redrawn\r\n * @method\r\n * @name Konva.Node#toImage\r\n * @param {Object} config\r\n * @param {Function} [config.callback] function executed when the composite has completed\r\n * @param {String} [config.mimeType] can be \"image/png\" or \"image/jpeg\".\r\n * \"image/png\" is the default\r\n * @param {Number} [config.x] x position of canvas section\r\n * @param {Number} [config.y] y position of canvas section\r\n * @param {Number} [config.width] width of canvas section\r\n * @param {Number} [config.height] height of canvas section\r\n * @param {Number} [config.quality] jpeg quality. If using an \"image/jpeg\" mimeType,\r\n * you can specify the quality from 0 to 1, where 0 is very poor quality and 1\r\n * is very high quality\r\n * @param {Number} [config.pixelRatio] pixelRatio of output image. Default is 1.\r\n * You can use that property to increase quality of the image, for example for super hight quality exports\r\n * or usage on retina (or similar) displays. pixelRatio will be used to multiply the size of exported image.\r\n * If you export to 500x500 size with pixelRatio = 2, then produced image will have size 1000x1000.\r\n * @param {Boolean} [config.imageSmoothingEnabled] set this to false if you want to disable imageSmoothing\r\n * @return {Promise}\r\n * @example\r\n * var image = node.toImage({\r\n * callback(img) {\r\n * // do stuff with img\r\n * }\r\n * });\r\n */\r\n toImage(config) {\r\n return new Promise((resolve, reject) => {\r\n try {\r\n const callback = config === null || config === void 0 ? void 0 : config.callback;\r\n if (callback)\r\n delete config.callback;\r\n Util._urlToImage(this.toDataURL(config), function (img) {\r\n resolve(img);\r\n callback === null || callback === void 0 ? void 0 : callback(img);\r\n });\r\n }\r\n catch (err) {\r\n reject(err);\r\n }\r\n });\r\n }\r\n /**\r\n * Converts node into a blob. Since the toBlob method is asynchronous,\r\n * the resulting blob can only be retrieved from the config callback\r\n * or the returned Promise.\r\n * @method\r\n * @name Konva.Node#toBlob\r\n * @param {Object} config\r\n * @param {Function} [config.callback] function executed when the composite has completed\r\n * @param {Number} [config.x] x position of canvas section\r\n * @param {Number} [config.y] y position of canvas section\r\n * @param {Number} [config.width] width of canvas section\r\n * @param {Number} [config.height] height of canvas section\r\n * @param {Number} [config.pixelRatio] pixelRatio of output canvas. Default is 1.\r\n * You can use that property to increase quality of the image, for example for super hight quality exports\r\n * or usage on retina (or similar) displays. pixelRatio will be used to multiply the size of exported image.\r\n * If you export to 500x500 size with pixelRatio = 2, then produced image will have size 1000x1000.\r\n * @param {Boolean} [config.imageSmoothingEnabled] set this to false if you want to disable imageSmoothing\r\n * @example\r\n * var blob = await node.toBlob({});\r\n * @returns {Promise}\r\n */\r\n toBlob(config) {\r\n return new Promise((resolve, reject) => {\r\n try {\r\n const callback = config === null || config === void 0 ? void 0 : config.callback;\r\n if (callback)\r\n delete config.callback;\r\n this.toCanvas(config).toBlob((blob) => {\r\n resolve(blob);\r\n callback === null || callback === void 0 ? void 0 : callback(blob);\r\n });\r\n }\r\n catch (err) {\r\n reject(err);\r\n }\r\n });\r\n }\r\n setSize(size) {\r\n this.width(size.width);\r\n this.height(size.height);\r\n return this;\r\n }\r\n getSize() {\r\n return {\r\n width: this.width(),\r\n height: this.height(),\r\n };\r\n }\r\n /**\r\n * get class name, which may return Stage, Layer, Group, or shape class names like Rect, Circle, Text, etc.\r\n * @method\r\n * @name Konva.Node#getClassName\r\n * @returns {String}\r\n */\r\n getClassName() {\r\n return this.className || this.nodeType;\r\n }\r\n /**\r\n * get the node type, which may return Stage, Layer, Group, or Shape\r\n * @method\r\n * @name Konva.Node#getType\r\n * @returns {String}\r\n */\r\n getType() {\r\n return this.nodeType;\r\n }\r\n getDragDistance() {\r\n // compare with undefined because we need to track 0 value\r\n if (this.attrs.dragDistance !== undefined) {\r\n return this.attrs.dragDistance;\r\n }\r\n else if (this.parent) {\r\n return this.parent.getDragDistance();\r\n }\r\n else {\r\n return Konva$2.dragDistance;\r\n }\r\n }\r\n _off(type, name, callback) {\r\n var evtListeners = this.eventListeners[type], i, evtName, handler;\r\n for (i = 0; i < evtListeners.length; i++) {\r\n evtName = evtListeners[i].name;\r\n handler = evtListeners[i].handler;\r\n // the following two conditions must be true in order to remove a handler:\r\n // 1) the current event name cannot be konva unless the event name is konva\r\n // this enables developers to force remove a konva specific listener for whatever reason\r\n // 2) an event name is not specified, or if one is specified, it matches the current event name\r\n if ((evtName !== 'konva' || name === 'konva') &&\r\n (!name || evtName === name) &&\r\n (!callback || callback === handler)) {\r\n evtListeners.splice(i, 1);\r\n if (evtListeners.length === 0) {\r\n delete this.eventListeners[type];\r\n break;\r\n }\r\n i--;\r\n }\r\n }\r\n }\r\n _fireChangeEvent(attr, oldVal, newVal) {\r\n this._fire(attr + CHANGE, {\r\n oldVal: oldVal,\r\n newVal: newVal,\r\n });\r\n }\r\n /**\r\n * add name to node\r\n * @method\r\n * @name Konva.Node#addName\r\n * @param {String} name\r\n * @returns {Konva.Node}\r\n * @example\r\n * node.name('red');\r\n * node.addName('selected');\r\n * node.name(); // return 'red selected'\r\n */\r\n addName(name) {\r\n if (!this.hasName(name)) {\r\n var oldName = this.name();\r\n var newName = oldName ? oldName + ' ' + name : name;\r\n this.name(newName);\r\n }\r\n return this;\r\n }\r\n /**\r\n * check is node has name\r\n * @method\r\n * @name Konva.Node#hasName\r\n * @param {String} name\r\n * @returns {Boolean}\r\n * @example\r\n * node.name('red');\r\n * node.hasName('red'); // return true\r\n * node.hasName('selected'); // return false\r\n * node.hasName(''); // return false\r\n */\r\n hasName(name) {\r\n if (!name) {\r\n return false;\r\n }\r\n const fullName = this.name();\r\n if (!fullName) {\r\n return false;\r\n }\r\n // if name is '' the \"names\" will be [''], so I added extra check above\r\n var names = (fullName || '').split(/\\s/g);\r\n return names.indexOf(name) !== -1;\r\n }\r\n /**\r\n * remove name from node\r\n * @method\r\n * @name Konva.Node#removeName\r\n * @param {String} name\r\n * @returns {Konva.Node}\r\n * @example\r\n * node.name('red selected');\r\n * node.removeName('selected');\r\n * node.hasName('selected'); // return false\r\n * node.name(); // return 'red'\r\n */\r\n removeName(name) {\r\n var names = (this.name() || '').split(/\\s/g);\r\n var index = names.indexOf(name);\r\n if (index !== -1) {\r\n names.splice(index, 1);\r\n this.name(names.join(' '));\r\n }\r\n return this;\r\n }\r\n /**\r\n * set attr\r\n * @method\r\n * @name Konva.Node#setAttr\r\n * @param {String} attr\r\n * @param {*} val\r\n * @returns {Konva.Node}\r\n * @example\r\n * node.setAttr('x', 5);\r\n */\r\n setAttr(attr, val) {\r\n var func = this[SET + Util._capitalize(attr)];\r\n if (Util._isFunction(func)) {\r\n func.call(this, val);\r\n }\r\n else {\r\n // otherwise set directly\r\n this._setAttr(attr, val);\r\n }\r\n return this;\r\n }\r\n _requestDraw() {\r\n if (Konva$2.autoDrawEnabled) {\r\n const drawNode = this.getLayer() || this.getStage();\r\n drawNode === null || drawNode === void 0 ? void 0 : drawNode.batchDraw();\r\n }\r\n }\r\n _setAttr(key, val) {\r\n var oldVal = this.attrs[key];\r\n if (oldVal === val && !Util.isObject(val)) {\r\n return;\r\n }\r\n if (val === undefined || val === null) {\r\n delete this.attrs[key];\r\n }\r\n else {\r\n this.attrs[key] = val;\r\n }\r\n if (this._shouldFireChangeEvents) {\r\n this._fireChangeEvent(key, oldVal, val);\r\n }\r\n this._requestDraw();\r\n }\r\n _setComponentAttr(key, component, val) {\r\n var oldVal;\r\n if (val !== undefined) {\r\n oldVal = this.attrs[key];\r\n if (!oldVal) {\r\n // set value to default value using getAttr\r\n this.attrs[key] = this.getAttr(key);\r\n }\r\n this.attrs[key][component] = val;\r\n this._fireChangeEvent(key, oldVal, val);\r\n }\r\n }\r\n _fireAndBubble(eventType, evt, compareShape) {\r\n if (evt && this.nodeType === SHAPE) {\r\n evt.target = this;\r\n }\r\n var shouldStop = (eventType === MOUSEENTER$1 || eventType === MOUSELEAVE$1) &&\r\n ((compareShape &&\r\n (this === compareShape ||\r\n (this.isAncestorOf && this.isAncestorOf(compareShape)))) ||\r\n (this.nodeType === 'Stage' && !compareShape));\r\n if (!shouldStop) {\r\n this._fire(eventType, evt);\r\n // simulate event bubbling\r\n var stopBubble = (eventType === MOUSEENTER$1 || eventType === MOUSELEAVE$1) &&\r\n compareShape &&\r\n compareShape.isAncestorOf &&\r\n compareShape.isAncestorOf(this) &&\r\n !compareShape.isAncestorOf(this.parent);\r\n if (((evt && !evt.cancelBubble) || !evt) &&\r\n this.parent &&\r\n this.parent.isListening() &&\r\n !stopBubble) {\r\n if (compareShape && compareShape.parent) {\r\n this._fireAndBubble.call(this.parent, eventType, evt, compareShape);\r\n }\r\n else {\r\n this._fireAndBubble.call(this.parent, eventType, evt);\r\n }\r\n }\r\n }\r\n }\r\n _getProtoListeners(eventType) {\r\n let listeners = this._cache.get(ALL_LISTENERS);\r\n // if no cache for listeners, we need to pre calculate it\r\n if (!listeners) {\r\n listeners = {};\r\n let obj = Object.getPrototypeOf(this);\r\n while (obj) {\r\n if (!obj.eventListeners) {\r\n obj = Object.getPrototypeOf(obj);\r\n continue;\r\n }\r\n for (var event in obj.eventListeners) {\r\n const newEvents = obj.eventListeners[event];\r\n const oldEvents = listeners[event] || [];\r\n listeners[event] = newEvents.concat(oldEvents);\r\n }\r\n obj = Object.getPrototypeOf(obj);\r\n }\r\n this._cache.set(ALL_LISTENERS, listeners);\r\n }\r\n return listeners[eventType];\r\n }\r\n _fire(eventType, evt) {\r\n evt = evt || {};\r\n evt.currentTarget = this;\r\n evt.type = eventType;\r\n const topListeners = this._getProtoListeners(eventType);\r\n if (topListeners) {\r\n for (var i = 0; i < topListeners.length; i++) {\r\n topListeners[i].handler.call(this, evt);\r\n }\r\n }\r\n // it is important to iterate over self listeners without cache\r\n // because events can be added/removed while firing\r\n const selfListeners = this.eventListeners[eventType];\r\n if (selfListeners) {\r\n for (var i = 0; i < selfListeners.length; i++) {\r\n selfListeners[i].handler.call(this, evt);\r\n }\r\n }\r\n }\r\n /**\r\n * draw both scene and hit graphs. If the node being drawn is the stage, all of the layers will be cleared and redrawn\r\n * @method\r\n * @name Konva.Node#draw\r\n * @returns {Konva.Node}\r\n */\r\n draw() {\r\n this.drawScene();\r\n this.drawHit();\r\n return this;\r\n }\r\n // drag & drop\r\n _createDragElement(evt) {\r\n var pointerId = evt ? evt.pointerId : undefined;\r\n var stage = this.getStage();\r\n var ap = this.getAbsolutePosition();\r\n var pos = stage._getPointerById(pointerId) ||\r\n stage._changedPointerPositions[0] ||\r\n ap;\r\n DD._dragElements.set(this._id, {\r\n node: this,\r\n startPointerPos: pos,\r\n offset: {\r\n x: pos.x - ap.x,\r\n y: pos.y - ap.y,\r\n },\r\n dragStatus: 'ready',\r\n pointerId,\r\n });\r\n }\r\n /**\r\n * initiate drag and drop.\r\n * @method\r\n * @name Konva.Node#startDrag\r\n */\r\n startDrag(evt, bubbleEvent = true) {\r\n if (!DD._dragElements.has(this._id)) {\r\n this._createDragElement(evt);\r\n }\r\n const elem = DD._dragElements.get(this._id);\r\n elem.dragStatus = 'dragging';\r\n this.fire('dragstart', {\r\n type: 'dragstart',\r\n target: this,\r\n evt: evt && evt.evt,\r\n }, bubbleEvent);\r\n }\r\n _setDragPosition(evt, elem) {\r\n // const pointers = this.getStage().getPointersPositions();\r\n // const pos = pointers.find(p => p.id === this._dragEventId);\r\n const pos = this.getStage()._getPointerById(elem.pointerId);\r\n if (!pos) {\r\n return;\r\n }\r\n var newNodePos = {\r\n x: pos.x - elem.offset.x,\r\n y: pos.y - elem.offset.y,\r\n };\r\n var dbf = this.dragBoundFunc();\r\n if (dbf !== undefined) {\r\n const bounded = dbf.call(this, newNodePos, evt);\r\n if (!bounded) {\r\n Util.warn('dragBoundFunc did not return any value. That is unexpected behavior. You must return new absolute position from dragBoundFunc.');\r\n }\r\n else {\r\n newNodePos = bounded;\r\n }\r\n }\r\n if (!this._lastPos ||\r\n this._lastPos.x !== newNodePos.x ||\r\n this._lastPos.y !== newNodePos.y) {\r\n this.setAbsolutePosition(newNodePos);\r\n this._requestDraw();\r\n }\r\n this._lastPos = newNodePos;\r\n }\r\n /**\r\n * stop drag and drop\r\n * @method\r\n * @name Konva.Node#stopDrag\r\n */\r\n stopDrag(evt) {\r\n const elem = DD._dragElements.get(this._id);\r\n if (elem) {\r\n elem.dragStatus = 'stopped';\r\n }\r\n DD._endDragBefore(evt);\r\n DD._endDragAfter(evt);\r\n }\r\n setDraggable(draggable) {\r\n this._setAttr('draggable', draggable);\r\n this._dragChange();\r\n }\r\n /**\r\n * determine if node is currently in drag and drop mode\r\n * @method\r\n * @name Konva.Node#isDragging\r\n */\r\n isDragging() {\r\n const elem = DD._dragElements.get(this._id);\r\n return elem ? elem.dragStatus === 'dragging' : false;\r\n }\r\n _listenDrag() {\r\n this._dragCleanup();\r\n this.on('mousedown.konva touchstart.konva', function (evt) {\r\n var shouldCheckButton = evt.evt['button'] !== undefined;\r\n var canDrag = !shouldCheckButton || Konva$2.dragButtons.indexOf(evt.evt['button']) >= 0;\r\n if (!canDrag) {\r\n return;\r\n }\r\n if (this.isDragging()) {\r\n return;\r\n }\r\n var hasDraggingChild = false;\r\n DD._dragElements.forEach((elem) => {\r\n if (this.isAncestorOf(elem.node)) {\r\n hasDraggingChild = true;\r\n }\r\n });\r\n // nested drag can be started\r\n // in that case we don't need to start new drag\r\n if (!hasDraggingChild) {\r\n this._createDragElement(evt);\r\n }\r\n });\r\n }\r\n _dragChange() {\r\n if (this.attrs.draggable) {\r\n this._listenDrag();\r\n }\r\n else {\r\n // remove event listeners\r\n this._dragCleanup();\r\n /*\r\n * force drag and drop to end\r\n * if this node is currently in\r\n * drag and drop mode\r\n */\r\n var stage = this.getStage();\r\n if (!stage) {\r\n return;\r\n }\r\n const dragElement = DD._dragElements.get(this._id);\r\n const isDragging = dragElement && dragElement.dragStatus === 'dragging';\r\n const isReady = dragElement && dragElement.dragStatus === 'ready';\r\n if (isDragging) {\r\n this.stopDrag();\r\n }\r\n else if (isReady) {\r\n DD._dragElements.delete(this._id);\r\n }\r\n }\r\n }\r\n _dragCleanup() {\r\n this.off('mousedown.konva');\r\n this.off('touchstart.konva');\r\n }\r\n /**\r\n * determine if node (at least partially) is currently in user-visible area\r\n * @method\r\n * @param {(Number | Object)} margin optional margin in pixels\r\n * @param {Number} margin.x\r\n * @param {Number} margin.y\r\n * @returns {Boolean}\r\n * @name Konva.Node#isClientRectOnScreen\r\n * @example\r\n * // get index\r\n * // default calculations\r\n * var isOnScreen = node.isClientRectOnScreen()\r\n * // increase object size (or screen size) for cases when objects close to the screen still need to be marked as \"visible\"\r\n * var isOnScreen = node.isClientRectOnScreen({ x: stage.width(), y: stage.height() })\r\n */\r\n isClientRectOnScreen(margin = { x: 0, y: 0 }) {\r\n const stage = this.getStage();\r\n if (!stage) {\r\n return false;\r\n }\r\n const screenRect = {\r\n x: -margin.x,\r\n y: -margin.y,\r\n width: stage.width() + 2 * margin.x,\r\n height: stage.height() + 2 * margin.y,\r\n };\r\n return Util.haveIntersection(screenRect, this.getClientRect());\r\n }\r\n /**\r\n * create node with JSON string or an Object. De-serializtion does not generate custom\r\n * shape drawing functions, images, or event handlers (this would make the\r\n * serialized object huge). If your app uses custom shapes, images, and\r\n * event handlers (it probably does), then you need to select the appropriate\r\n * shapes after loading the stage and set these properties via on(), setSceneFunc(),\r\n * and setImage() methods\r\n * @method\r\n * @memberof Konva.Node\r\n * @param {String|Object} json string or object\r\n * @param {Element} [container] optional container dom element used only if you're\r\n * creating a stage node\r\n */\r\n static create(data, container) {\r\n if (Util._isString(data)) {\r\n data = JSON.parse(data);\r\n }\r\n return this._createNode(data, container);\r\n }\r\n static _createNode(obj, container) {\r\n var className = Node.prototype.getClassName.call(obj), children = obj.children, no, len, n;\r\n // if container was passed in, add it to attrs\r\n if (container) {\r\n obj.attrs.container = container;\r\n }\r\n if (!Konva$2[className]) {\r\n Util.warn('Can not find a node with class name \"' +\r\n className +\r\n '\". Fallback to \"Shape\".');\r\n className = 'Shape';\r\n }\r\n const Class = Konva$2[className];\r\n no = new Class(obj.attrs);\r\n if (children) {\r\n len = children.length;\r\n for (n = 0; n < len; n++) {\r\n no.add(Node._createNode(children[n]));\r\n }\r\n }\r\n return no;\r\n }\r\n }\r\n Node.prototype.nodeType = 'Node';\r\n Node.prototype._attrsAffectingSize = [];\r\n // attache events listeners once into prototype\r\n // that way we don't spend too much time on making an new instance\r\n Node.prototype.eventListeners = {};\r\n Node.prototype.on.call(Node.prototype, TRANSFORM_CHANGE_STR$1, function () {\r\n if (this._batchingTransformChange) {\r\n this._needClearTransformCache = true;\r\n return;\r\n }\r\n this._clearCache(TRANSFORM);\r\n this._clearSelfAndDescendantCache(ABSOLUTE_TRANSFORM);\r\n });\r\n Node.prototype.on.call(Node.prototype, 'visibleChange.konva', function () {\r\n this._clearSelfAndDescendantCache(VISIBLE);\r\n });\r\n Node.prototype.on.call(Node.prototype, 'listeningChange.konva', function () {\r\n this._clearSelfAndDescendantCache(LISTENING);\r\n });\r\n Node.prototype.on.call(Node.prototype, 'opacityChange.konva', function () {\r\n this._clearSelfAndDescendantCache(ABSOLUTE_OPACITY);\r\n });\r\n const addGetterSetter = Factory.addGetterSetter;\r\n /**\r\n * get/set zIndex relative to the node's siblings who share the same parent.\r\n * Please remember that zIndex is not absolute (like in CSS). It is relative to parent element only.\r\n * @name Konva.Node#zIndex\r\n * @method\r\n * @param {Number} index\r\n * @returns {Number}\r\n * @example\r\n * // get index\r\n * var index = node.zIndex();\r\n *\r\n * // set index\r\n * node.zIndex(2);\r\n */\r\n addGetterSetter(Node, 'zIndex');\r\n /**\r\n * get/set node absolute position\r\n * @name Konva.Node#absolutePosition\r\n * @method\r\n * @param {Object} pos\r\n * @param {Number} pos.x\r\n * @param {Number} pos.y\r\n * @returns {Object}\r\n * @example\r\n * // get position\r\n * var position = node.absolutePosition();\r\n *\r\n * // set position\r\n * node.absolutePosition({\r\n * x: 5,\r\n * y: 10\r\n * });\r\n */\r\n addGetterSetter(Node, 'absolutePosition');\r\n addGetterSetter(Node, 'position');\r\n /**\r\n * get/set node position relative to parent\r\n * @name Konva.Node#position\r\n * @method\r\n * @param {Object} pos\r\n * @param {Number} pos.x\r\n * @param {Number} pos.y\r\n * @returns {Object}\r\n * @example\r\n * // get position\r\n * var position = node.position();\r\n *\r\n * // set position\r\n * node.position({\r\n * x: 5,\r\n * y: 10\r\n * });\r\n */\r\n addGetterSetter(Node, 'x', 0, getNumberValidator());\r\n /**\r\n * get/set x position\r\n * @name Konva.Node#x\r\n * @method\r\n * @param {Number} x\r\n * @returns {Object}\r\n * @example\r\n * // get x\r\n * var x = node.x();\r\n *\r\n * // set x\r\n * node.x(5);\r\n */\r\n addGetterSetter(Node, 'y', 0, getNumberValidator());\r\n /**\r\n * get/set y position\r\n * @name Konva.Node#y\r\n * @method\r\n * @param {Number} y\r\n * @returns {Integer}\r\n * @example\r\n * // get y\r\n * var y = node.y();\r\n *\r\n * // set y\r\n * node.y(5);\r\n */\r\n addGetterSetter(Node, 'globalCompositeOperation', 'source-over', getStringValidator());\r\n /**\r\n * get/set globalCompositeOperation of a node. globalCompositeOperation DOESN'T affect hit graph of nodes. So they are still trigger to events as they have default \"source-over\" globalCompositeOperation.\r\n * @name Konva.Node#globalCompositeOperation\r\n * @method\r\n * @param {String} type\r\n * @returns {String}\r\n * @example\r\n * // get globalCompositeOperation\r\n * var globalCompositeOperation = shape.globalCompositeOperation();\r\n *\r\n * // set globalCompositeOperation\r\n * shape.globalCompositeOperation('source-in');\r\n */\r\n addGetterSetter(Node, 'opacity', 1, getNumberValidator());\r\n /**\r\n * get/set opacity. Opacity values range from 0 to 1.\r\n * A node with an opacity of 0 is fully transparent, and a node\r\n * with an opacity of 1 is fully opaque\r\n * @name Konva.Node#opacity\r\n * @method\r\n * @param {Object} opacity\r\n * @returns {Number}\r\n * @example\r\n * // get opacity\r\n * var opacity = node.opacity();\r\n *\r\n * // set opacity\r\n * node.opacity(0.5);\r\n */\r\n addGetterSetter(Node, 'name', '', getStringValidator());\r\n /**\r\n * get/set name.\r\n * @name Konva.Node#name\r\n * @method\r\n * @param {String} name\r\n * @returns {String}\r\n * @example\r\n * // get name\r\n * var name = node.name();\r\n *\r\n * // set name\r\n * node.name('foo');\r\n *\r\n * // also node may have multiple names (as css classes)\r\n * node.name('foo bar');\r\n */\r\n addGetterSetter(Node, 'id', '', getStringValidator());\r\n /**\r\n * get/set id. Id is global for whole page.\r\n * @name Konva.Node#id\r\n * @method\r\n * @param {String} id\r\n * @returns {String}\r\n * @example\r\n * // get id\r\n * var name = node.id();\r\n *\r\n * // set id\r\n * node.id('foo');\r\n */\r\n addGetterSetter(Node, 'rotation', 0, getNumberValidator());\r\n /**\r\n * get/set rotation in degrees\r\n * @name Konva.Node#rotation\r\n * @method\r\n * @param {Number} rotation\r\n * @returns {Number}\r\n * @example\r\n * // get rotation in degrees\r\n * var rotation = node.rotation();\r\n *\r\n * // set rotation in degrees\r\n * node.rotation(45);\r\n */\r\n Factory.addComponentsGetterSetter(Node, 'scale', ['x', 'y']);\r\n /**\r\n * get/set scale\r\n * @name Konva.Node#scale\r\n * @param {Object} scale\r\n * @param {Number} scale.x\r\n * @param {Number} scale.y\r\n * @method\r\n * @returns {Object}\r\n * @example\r\n * // get scale\r\n * var scale = node.scale();\r\n *\r\n * // set scale\r\n * shape.scale({\r\n * x: 2,\r\n * y: 3\r\n * });\r\n */\r\n addGetterSetter(Node, 'scaleX', 1, getNumberValidator());\r\n /**\r\n * get/set scale x\r\n * @name Konva.Node#scaleX\r\n * @param {Number} x\r\n * @method\r\n * @returns {Number}\r\n * @example\r\n * // get scale x\r\n * var scaleX = node.scaleX();\r\n *\r\n * // set scale x\r\n * node.scaleX(2);\r\n */\r\n addGetterSetter(Node, 'scaleY', 1, getNumberValidator());\r\n /**\r\n * get/set scale y\r\n * @name Konva.Node#scaleY\r\n * @param {Number} y\r\n * @method\r\n * @returns {Number}\r\n * @example\r\n * // get scale y\r\n * var scaleY = node.scaleY();\r\n *\r\n * // set scale y\r\n * node.scaleY(2);\r\n */\r\n Factory.addComponentsGetterSetter(Node, 'skew', ['x', 'y']);\r\n /**\r\n * get/set skew\r\n * @name Konva.Node#skew\r\n * @param {Object} skew\r\n * @param {Number} skew.x\r\n * @param {Number} skew.y\r\n * @method\r\n * @returns {Object}\r\n * @example\r\n * // get skew\r\n * var skew = node.skew();\r\n *\r\n * // set skew\r\n * node.skew({\r\n * x: 20,\r\n * y: 10\r\n * });\r\n */\r\n addGetterSetter(Node, 'skewX', 0, getNumberValidator());\r\n /**\r\n * get/set skew x\r\n * @name Konva.Node#skewX\r\n * @param {Number} x\r\n * @method\r\n * @returns {Number}\r\n * @example\r\n * // get skew x\r\n * var skewX = node.skewX();\r\n *\r\n * // set skew x\r\n * node.skewX(3);\r\n */\r\n addGetterSetter(Node, 'skewY', 0, getNumberValidator());\r\n /**\r\n * get/set skew y\r\n * @name Konva.Node#skewY\r\n * @param {Number} y\r\n * @method\r\n * @returns {Number}\r\n * @example\r\n * // get skew y\r\n * var skewY = node.skewY();\r\n *\r\n * // set skew y\r\n * node.skewY(3);\r\n */\r\n Factory.addComponentsGetterSetter(Node, 'offset', ['x', 'y']);\r\n /**\r\n * get/set offset. Offsets the default position and rotation point\r\n * @method\r\n * @param {Object} offset\r\n * @param {Number} offset.x\r\n * @param {Number} offset.y\r\n * @returns {Object}\r\n * @example\r\n * // get offset\r\n * var offset = node.offset();\r\n *\r\n * // set offset\r\n * node.offset({\r\n * x: 20,\r\n * y: 10\r\n * });\r\n */\r\n addGetterSetter(Node, 'offsetX', 0, getNumberValidator());\r\n /**\r\n * get/set offset x\r\n * @name Konva.Node#offsetX\r\n * @method\r\n * @param {Number} x\r\n * @returns {Number}\r\n * @example\r\n * // get offset x\r\n * var offsetX = node.offsetX();\r\n *\r\n * // set offset x\r\n * node.offsetX(3);\r\n */\r\n addGetterSetter(Node, 'offsetY', 0, getNumberValidator());\r\n /**\r\n * get/set offset y\r\n * @name Konva.Node#offsetY\r\n * @method\r\n * @param {Number} y\r\n * @returns {Number}\r\n * @example\r\n * // get offset y\r\n * var offsetY = node.offsetY();\r\n *\r\n * // set offset y\r\n * node.offsetY(3);\r\n */\r\n addGetterSetter(Node, 'dragDistance', null, getNumberValidator());\r\n /**\r\n * get/set drag distance\r\n * @name Konva.Node#dragDistance\r\n * @method\r\n * @param {Number} distance\r\n * @returns {Number}\r\n * @example\r\n * // get drag distance\r\n * var dragDistance = node.dragDistance();\r\n *\r\n * // set distance\r\n * // node starts dragging only if pointer moved more then 3 pixels\r\n * node.dragDistance(3);\r\n * // or set globally\r\n * Konva.dragDistance = 3;\r\n */\r\n addGetterSetter(Node, 'width', 0, getNumberValidator());\r\n /**\r\n * get/set width\r\n * @name Konva.Node#width\r\n * @method\r\n * @param {Number} width\r\n * @returns {Number}\r\n * @example\r\n * // get width\r\n * var width = node.width();\r\n *\r\n * // set width\r\n * node.width(100);\r\n */\r\n addGetterSetter(Node, 'height', 0, getNumberValidator());\r\n /**\r\n * get/set height\r\n * @name Konva.Node#height\r\n * @method\r\n * @param {Number} height\r\n * @returns {Number}\r\n * @example\r\n * // get height\r\n * var height = node.height();\r\n *\r\n * // set height\r\n * node.height(100);\r\n */\r\n addGetterSetter(Node, 'listening', true, getBooleanValidator());\r\n /**\r\n * get/set listening attr. If you need to determine if a node is listening or not\r\n * by taking into account its parents, use the isListening() method\r\n * @name Konva.Node#listening\r\n * @method\r\n * @param {Boolean} listening Can be true, or false. The default is true.\r\n * @returns {Boolean}\r\n * @example\r\n * // get listening attr\r\n * var listening = node.listening();\r\n *\r\n * // stop listening for events, remove node and all its children from hit graph\r\n * node.listening(false);\r\n *\r\n * // listen to events according to the parent\r\n * node.listening(true);\r\n */\r\n /**\r\n * get/set preventDefault\r\n * By default all shapes will prevent default behavior\r\n * of a browser on a pointer move or tap.\r\n * that will prevent native scrolling when you are trying to drag&drop a node\r\n * but sometimes you may need to enable default actions\r\n * in that case you can set the property to false\r\n * @name Konva.Node#preventDefault\r\n * @method\r\n * @param {Boolean} preventDefault\r\n * @returns {Boolean}\r\n * @example\r\n * // get preventDefault\r\n * var shouldPrevent = shape.preventDefault();\r\n *\r\n * // set preventDefault\r\n * shape.preventDefault(false);\r\n */\r\n addGetterSetter(Node, 'preventDefault', true, getBooleanValidator());\r\n addGetterSetter(Node, 'filters', null, function (val) {\r\n this._filterUpToDate = false;\r\n return val;\r\n });\r\n /**\r\n * get/set filters. Filters are applied to cached canvases\r\n * @name Konva.Node#filters\r\n * @method\r\n * @param {Array} filters array of filters\r\n * @returns {Array}\r\n * @example\r\n * // get filters\r\n * var filters = node.filters();\r\n *\r\n * // set a single filter\r\n * node.cache();\r\n * node.filters([Konva.Filters.Blur]);\r\n *\r\n * // set multiple filters\r\n * node.cache();\r\n * node.filters([\r\n * Konva.Filters.Blur,\r\n * Konva.Filters.Sepia,\r\n * Konva.Filters.Invert\r\n * ]);\r\n */\r\n addGetterSetter(Node, 'visible', true, getBooleanValidator());\r\n /**\r\n * get/set visible attr. Can be true, or false. The default is true.\r\n * If you need to determine if a node is visible or not\r\n * by taking into account its parents, use the isVisible() method\r\n * @name Konva.Node#visible\r\n * @method\r\n * @param {Boolean} visible\r\n * @returns {Boolean}\r\n * @example\r\n * // get visible attr\r\n * var visible = node.visible();\r\n *\r\n * // make invisible\r\n * node.visible(false);\r\n *\r\n * // make visible (according to the parent)\r\n * node.visible(true);\r\n *\r\n */\r\n addGetterSetter(Node, 'transformsEnabled', 'all', getStringValidator());\r\n /**\r\n * get/set transforms that are enabled. Can be \"all\", \"none\", or \"position\". The default\r\n * is \"all\"\r\n * @name Konva.Node#transformsEnabled\r\n * @method\r\n * @param {String} enabled\r\n * @returns {String}\r\n * @example\r\n * // enable position transform only to improve draw performance\r\n * node.transformsEnabled('position');\r\n *\r\n * // enable all transforms\r\n * node.transformsEnabled('all');\r\n */\r\n /**\r\n * get/set node size\r\n * @name Konva.Node#size\r\n * @method\r\n * @param {Object} size\r\n * @param {Number} size.width\r\n * @param {Number} size.height\r\n * @returns {Object}\r\n * @example\r\n * // get node size\r\n * var size = node.size();\r\n * var width = size.width;\r\n * var height = size.height;\r\n *\r\n * // set size\r\n * node.size({\r\n * width: 100,\r\n * height: 200\r\n * });\r\n */\r\n addGetterSetter(Node, 'size');\r\n /**\r\n * get/set drag bound function. This is used to override the default\r\n * drag and drop position.\r\n * @name Konva.Node#dragBoundFunc\r\n * @method\r\n * @param {Function} dragBoundFunc\r\n * @returns {Function}\r\n * @example\r\n * // get drag bound function\r\n * var dragBoundFunc = node.dragBoundFunc();\r\n *\r\n * // create vertical drag and drop\r\n * node.dragBoundFunc(function(pos){\r\n * // important pos - is absolute position of the node\r\n * // you should return absolute position too\r\n * return {\r\n * x: this.absolutePosition().x,\r\n * y: pos.y\r\n * };\r\n * });\r\n */\r\n addGetterSetter(Node, 'dragBoundFunc');\r\n /**\r\n * get/set draggable flag\r\n * @name Konva.Node#draggable\r\n * @method\r\n * @param {Boolean} draggable\r\n * @returns {Boolean}\r\n * @example\r\n * // get draggable flag\r\n * var draggable = node.draggable();\r\n *\r\n * // enable drag and drop\r\n * node.draggable(true);\r\n *\r\n * // disable drag and drop\r\n * node.draggable(false);\r\n */\r\n addGetterSetter(Node, 'draggable', false, getBooleanValidator());\r\n Factory.backCompat(Node, {\r\n rotateDeg: 'rotate',\r\n setRotationDeg: 'setRotation',\r\n getRotationDeg: 'getRotation',\r\n });\n\n /**\r\n * Container constructor.  Containers are used to contain nodes or other containers\r\n * @constructor\r\n * @memberof Konva\r\n * @augments Konva.Node\r\n * @abstract\r\n * @param {Object} config\r\n * @param {Number} [config.x]\n * @param {Number} [config.y]\n * @param {Number} [config.width]\n * @param {Number} [config.height]\n * @param {Boolean} [config.visible]\n * @param {Boolean} [config.listening] whether or not the node is listening for events\n * @param {String} [config.id] unique id\n * @param {String} [config.name] non-unique name\n * @param {Number} [config.opacity] determines node opacity. Can be any number between 0 and 1\n * @param {Object} [config.scale] set scale\n * @param {Number} [config.scaleX] set scale x\n * @param {Number} [config.scaleY] set scale y\n * @param {Number} [config.rotation] rotation in degrees\n * @param {Object} [config.offset] offset from center point and rotation point\n * @param {Number} [config.offsetX] set offset x\n * @param {Number} [config.offsetY] set offset y\n * @param {Boolean} [config.draggable] makes the node draggable. When stages are draggable, you can drag and drop\n * the entire stage by dragging any portion of the stage\n * @param {Number} [config.dragDistance]\n * @param {Function} [config.dragBoundFunc]\r\n * * @param {Object} [config.clip] set clip\n * @param {Number} [config.clipX] set clip x\n * @param {Number} [config.clipY] set clip y\n * @param {Number} [config.clipWidth] set clip width\n * @param {Number} [config.clipHeight] set clip height\n * @param {Function} [config.clipFunc] set clip func\n\r\n */\r\n class Container extends Node {\r\n constructor() {\r\n super(...arguments);\r\n this.children = [];\r\n }\r\n /**\r\n * returns an array of direct descendant nodes\r\n * @method\r\n * @name Konva.Container#getChildren\r\n * @param {Function} [filterFunc] filter function\r\n * @returns {Array}\r\n * @example\r\n * // get all children\r\n * var children = layer.getChildren();\r\n *\r\n * // get only circles\r\n * var circles = layer.getChildren(function(node){\r\n * return node.getClassName() === 'Circle';\r\n * });\r\n */\r\n getChildren(filterFunc) {\r\n if (!filterFunc) {\r\n return this.children || [];\r\n }\r\n const children = this.children || [];\r\n var results = [];\r\n children.forEach(function (child) {\r\n if (filterFunc(child)) {\r\n results.push(child);\r\n }\r\n });\r\n return results;\r\n }\r\n /**\r\n * determine if node has children\r\n * @method\r\n * @name Konva.Container#hasChildren\r\n * @returns {Boolean}\r\n */\r\n hasChildren() {\r\n return this.getChildren().length > 0;\r\n }\r\n /**\r\n * remove all children. Children will be still in memory.\r\n * If you want to completely destroy all children please use \"destroyChildren\" method instead\r\n * @method\r\n * @name Konva.Container#removeChildren\r\n */\r\n removeChildren() {\r\n this.getChildren().forEach((child) => {\r\n // reset parent to prevent many _setChildrenIndices calls\r\n child.parent = null;\r\n child.index = 0;\r\n child.remove();\r\n });\r\n this.children = [];\r\n // because all children were detached from parent, request draw via container\r\n this._requestDraw();\r\n return this;\r\n }\r\n /**\r\n * destroy all children nodes.\r\n * @method\r\n * @name Konva.Container#destroyChildren\r\n */\r\n destroyChildren() {\r\n this.getChildren().forEach((child) => {\r\n // reset parent to prevent many _setChildrenIndices calls\r\n child.parent = null;\r\n child.index = 0;\r\n child.destroy();\r\n });\r\n this.children = [];\r\n // because all children were detached from parent, request draw via container\r\n this._requestDraw();\r\n return this;\r\n }\r\n /**\r\n * add a child and children into container\r\n * @name Konva.Container#add\r\n * @method\r\n * @param {...Konva.Node} child\r\n * @returns {Container}\r\n * @example\r\n * layer.add(rect);\r\n * layer.add(shape1, shape2, shape3);\r\n * // remember to redraw layer if you changed something\r\n * layer.draw();\r\n */\r\n add(...children) {\r\n if (arguments.length > 1) {\r\n for (var i = 0; i < arguments.length; i++) {\r\n this.add(arguments[i]);\r\n }\r\n return this;\r\n }\r\n var child = children[0];\r\n if (child.getParent()) {\r\n child.moveTo(this);\r\n return this;\r\n }\r\n this._validateAdd(child);\r\n child.index = this.getChildren().length;\r\n child.parent = this;\r\n child._clearCaches();\r\n this.getChildren().push(child);\r\n this._fire('add', {\r\n child: child,\r\n });\r\n this._requestDraw();\r\n // chainable\r\n return this;\r\n }\r\n destroy() {\r\n if (this.hasChildren()) {\r\n this.destroyChildren();\r\n }\r\n super.destroy();\r\n return this;\r\n }\r\n /**\r\n * return an array of nodes that match the selector.\r\n * You can provide a string with '#' for id selections and '.' for name selections.\r\n * Or a function that will return true/false when a node is passed through. See example below.\r\n * With strings you can also select by type or class name. Pass multiple selectors\r\n * separated by a comma.\r\n * @method\r\n * @name Konva.Container#find\r\n * @param {String | Function} selector\r\n * @returns {Array}\r\n * @example\r\n *\r\n * Passing a string as a selector\r\n * // select node with id foo\r\n * var node = stage.find('#foo');\r\n *\r\n * // select nodes with name bar inside layer\r\n * var nodes = layer.find('.bar');\r\n *\r\n * // select all groups inside layer\r\n * var nodes = layer.find('Group');\r\n *\r\n * // select all rectangles inside layer\r\n * var nodes = layer.find('Rect');\r\n *\r\n * // select node with an id of foo or a name of bar inside layer\r\n * var nodes = layer.find('#foo, .bar');\r\n *\r\n * Passing a function as a selector\r\n *\r\n * // get all groups with a function\r\n * var groups = stage.find(node => {\r\n * return node.getType() === 'Group';\r\n * });\r\n *\r\n * // get only Nodes with partial opacity\r\n * var alphaNodes = layer.find(node => {\r\n * return node.getType() === 'Node' && node.getAbsoluteOpacity() < 1;\r\n * });\r\n */\r\n find(selector) {\r\n // protecting _generalFind to prevent user from accidentally adding\r\n // second argument and getting unexpected `findOne` result\r\n return this._generalFind(selector, false);\r\n }\r\n /**\r\n * return a first node from `find` method\r\n * @method\r\n * @name Konva.Container#findOne\r\n * @param {String | Function} selector\r\n * @returns {Konva.Node | Undefined}\r\n * @example\r\n * // select node with id foo\r\n * var node = stage.findOne('#foo');\r\n *\r\n * // select node with name bar inside layer\r\n * var nodes = layer.findOne('.bar');\r\n *\r\n * // select the first node to return true in a function\r\n * var node = stage.findOne(node => {\r\n * return node.getType() === 'Shape'\r\n * })\r\n */\r\n findOne(selector) {\r\n var result = this._generalFind(selector, true);\r\n return result.length > 0 ? result[0] : undefined;\r\n }\r\n _generalFind(selector, findOne) {\r\n var retArr = [];\r\n this._descendants((node) => {\r\n const valid = node._isMatch(selector);\r\n if (valid) {\r\n retArr.push(node);\r\n }\r\n if (valid && findOne) {\r\n return true;\r\n }\r\n return false;\r\n });\r\n return retArr;\r\n }\r\n _descendants(fn) {\r\n let shouldStop = false;\r\n const children = this.getChildren();\r\n for (const child of children) {\r\n shouldStop = fn(child);\r\n if (shouldStop) {\r\n return true;\r\n }\r\n if (!child.hasChildren()) {\r\n continue;\r\n }\r\n shouldStop = child._descendants(fn);\r\n if (shouldStop) {\r\n return true;\r\n }\r\n }\r\n return false;\r\n }\r\n // extenders\r\n toObject() {\r\n var obj = Node.prototype.toObject.call(this);\r\n obj.children = [];\r\n this.getChildren().forEach((child) => {\r\n obj.children.push(child.toObject());\r\n });\r\n return obj;\r\n }\r\n /**\r\n * determine if node is an ancestor\r\n * of descendant\r\n * @method\r\n * @name Konva.Container#isAncestorOf\r\n * @param {Konva.Node} node\r\n */\r\n isAncestorOf(node) {\r\n var parent = node.getParent();\r\n while (parent) {\r\n if (parent._id === this._id) {\r\n return true;\r\n }\r\n parent = parent.getParent();\r\n }\r\n return false;\r\n }\r\n clone(obj) {\r\n // call super method\r\n var node = Node.prototype.clone.call(this, obj);\r\n this.getChildren().forEach(function (no) {\r\n node.add(no.clone());\r\n });\r\n return node;\r\n }\r\n /**\r\n * get all shapes that intersect a point. Note: because this method must clear a temporary\r\n * canvas and redraw every shape inside the container, it should only be used for special situations\r\n * because it performs very poorly. Please use the {@link Konva.Stage#getIntersection} method if at all possible\r\n * because it performs much better\r\n * @method\r\n * @name Konva.Container#getAllIntersections\r\n * @param {Object} pos\r\n * @param {Number} pos.x\r\n * @param {Number} pos.y\r\n * @returns {Array} array of shapes\r\n */\r\n getAllIntersections(pos) {\r\n var arr = [];\r\n this.find('Shape').forEach(function (shape) {\r\n if (shape.isVisible() && shape.intersects(pos)) {\r\n arr.push(shape);\r\n }\r\n });\r\n return arr;\r\n }\r\n _clearSelfAndDescendantCache(attr) {\r\n var _a;\r\n super._clearSelfAndDescendantCache(attr);\r\n // skip clearing if node is cached with canvas\r\n // for performance reasons !!!\r\n if (this.isCached()) {\r\n return;\r\n }\r\n (_a = this.children) === null || _a === void 0 ? void 0 : _a.forEach(function (node) {\r\n node._clearSelfAndDescendantCache(attr);\r\n });\r\n }\r\n _setChildrenIndices() {\r\n var _a;\r\n (_a = this.children) === null || _a === void 0 ? void 0 : _a.forEach(function (child, n) {\r\n child.index = n;\r\n });\r\n this._requestDraw();\r\n }\r\n drawScene(can, top) {\r\n var layer = this.getLayer(), canvas = can || (layer && layer.getCanvas()), context = canvas && canvas.getContext(), cachedCanvas = this._getCanvasCache(), cachedSceneCanvas = cachedCanvas && cachedCanvas.scene;\r\n var caching = canvas && canvas.isCache;\r\n if (!this.isVisible() && !caching) {\r\n return this;\r\n }\r\n if (cachedSceneCanvas) {\r\n context.save();\r\n var m = this.getAbsoluteTransform(top).getMatrix();\r\n context.transform(m[0], m[1], m[2], m[3], m[4], m[5]);\r\n this._drawCachedSceneCanvas(context);\r\n context.restore();\r\n }\r\n else {\r\n this._drawChildren('drawScene', canvas, top);\r\n }\r\n return this;\r\n }\r\n drawHit(can, top) {\r\n if (!this.shouldDrawHit(top)) {\r\n return this;\r\n }\r\n var layer = this.getLayer(), canvas = can || (layer && layer.hitCanvas), context = canvas && canvas.getContext(), cachedCanvas = this._getCanvasCache(), cachedHitCanvas = cachedCanvas && cachedCanvas.hit;\r\n if (cachedHitCanvas) {\r\n context.save();\r\n var m = this.getAbsoluteTransform(top).getMatrix();\r\n context.transform(m[0], m[1], m[2], m[3], m[4], m[5]);\r\n this._drawCachedHitCanvas(context);\r\n context.restore();\r\n }\r\n else {\r\n this._drawChildren('drawHit', canvas, top);\r\n }\r\n return this;\r\n }\r\n _drawChildren(drawMethod, canvas, top) {\r\n var _a;\r\n var context = canvas && canvas.getContext(), clipWidth = this.clipWidth(), clipHeight = this.clipHeight(), clipFunc = this.clipFunc(), hasClip = (clipWidth && clipHeight) || clipFunc;\r\n const selfCache = top === this;\r\n if (hasClip) {\r\n context.save();\r\n var transform = this.getAbsoluteTransform(top);\r\n var m = transform.getMatrix();\r\n context.transform(m[0], m[1], m[2], m[3], m[4], m[5]);\r\n context.beginPath();\r\n if (clipFunc) {\r\n clipFunc.call(this, context, this);\r\n }\r\n else {\r\n var clipX = this.clipX();\r\n var clipY = this.clipY();\r\n context.rect(clipX, clipY, clipWidth, clipHeight);\r\n }\r\n context.clip();\r\n m = transform.copy().invert().getMatrix();\r\n context.transform(m[0], m[1], m[2], m[3], m[4], m[5]);\r\n }\r\n var hasComposition = !selfCache &&\r\n this.globalCompositeOperation() !== 'source-over' &&\r\n drawMethod === 'drawScene';\r\n if (hasComposition) {\r\n context.save();\r\n context._applyGlobalCompositeOperation(this);\r\n }\r\n (_a = this.children) === null || _a === void 0 ? void 0 : _a.forEach(function (child) {\r\n child[drawMethod](canvas, top);\r\n });\r\n if (hasComposition) {\r\n context.restore();\r\n }\r\n if (hasClip) {\r\n context.restore();\r\n }\r\n }\r\n getClientRect(config) {\r\n var _a;\r\n config = config || {};\r\n var skipTransform = config.skipTransform;\r\n var relativeTo = config.relativeTo;\r\n var minX, minY, maxX, maxY;\r\n var selfRect = {\r\n x: Infinity,\r\n y: Infinity,\r\n width: 0,\r\n height: 0,\r\n };\r\n var that = this;\r\n (_a = this.children) === null || _a === void 0 ? void 0 : _a.forEach(function (child) {\r\n // skip invisible children\r\n if (!child.visible()) {\r\n return;\r\n }\r\n var rect = child.getClientRect({\r\n relativeTo: that,\r\n skipShadow: config.skipShadow,\r\n skipStroke: config.skipStroke,\r\n });\r\n // skip invisible children (like empty groups)\r\n if (rect.width === 0 && rect.height === 0) {\r\n return;\r\n }\r\n if (minX === undefined) {\r\n // initial value for first child\r\n minX = rect.x;\r\n minY = rect.y;\r\n maxX = rect.x + rect.width;\r\n maxY = rect.y + rect.height;\r\n }\r\n else {\r\n minX = Math.min(minX, rect.x);\r\n minY = Math.min(minY, rect.y);\r\n maxX = Math.max(maxX, rect.x + rect.width);\r\n maxY = Math.max(maxY, rect.y + rect.height);\r\n }\r\n });\r\n // if child is group we need to make sure it has visible shapes inside\r\n var shapes = this.find('Shape');\r\n var hasVisible = false;\r\n for (var i = 0; i < shapes.length; i++) {\r\n var shape = shapes[i];\r\n if (shape._isVisible(this)) {\r\n hasVisible = true;\r\n break;\r\n }\r\n }\r\n if (hasVisible && minX !== undefined) {\r\n selfRect = {\r\n x: minX,\r\n y: minY,\r\n width: maxX - minX,\r\n height: maxY - minY,\r\n };\r\n }\r\n else {\r\n selfRect = {\r\n x: 0,\r\n y: 0,\r\n width: 0,\r\n height: 0,\r\n };\r\n }\r\n if (!skipTransform) {\r\n return this._transformedRect(selfRect, relativeTo);\r\n }\r\n return selfRect;\r\n }\r\n }\r\n // add getters setters\r\n Factory.addComponentsGetterSetter(Container, 'clip', [\r\n 'x',\r\n 'y',\r\n 'width',\r\n 'height',\r\n ]);\r\n /**\r\n * get/set clip\r\n * @method\r\n * @name Konva.Container#clip\r\n * @param {Object} clip\r\n * @param {Number} clip.x\r\n * @param {Number} clip.y\r\n * @param {Number} clip.width\r\n * @param {Number} clip.height\r\n * @returns {Object}\r\n * @example\r\n * // get clip\r\n * var clip = container.clip();\r\n *\r\n * // set clip\r\n * container.clip({\r\n * x: 20,\r\n * y: 20,\r\n * width: 20,\r\n * height: 20\r\n * });\r\n */\r\n Factory.addGetterSetter(Container, 'clipX', undefined, getNumberValidator());\r\n /**\r\n * get/set clip x\r\n * @name Konva.Container#clipX\r\n * @method\r\n * @param {Number} x\r\n * @returns {Number}\r\n * @example\r\n * // get clip x\r\n * var clipX = container.clipX();\r\n *\r\n * // set clip x\r\n * container.clipX(10);\r\n */\r\n Factory.addGetterSetter(Container, 'clipY', undefined, getNumberValidator());\r\n /**\r\n * get/set clip y\r\n * @name Konva.Container#clipY\r\n * @method\r\n * @param {Number} y\r\n * @returns {Number}\r\n * @example\r\n * // get clip y\r\n * var clipY = container.clipY();\r\n *\r\n * // set clip y\r\n * container.clipY(10);\r\n */\r\n Factory.addGetterSetter(Container, 'clipWidth', undefined, getNumberValidator());\r\n /**\r\n * get/set clip width\r\n * @name Konva.Container#clipWidth\r\n * @method\r\n * @param {Number} width\r\n * @returns {Number}\r\n * @example\r\n * // get clip width\r\n * var clipWidth = container.clipWidth();\r\n *\r\n * // set clip width\r\n * container.clipWidth(100);\r\n */\r\n Factory.addGetterSetter(Container, 'clipHeight', undefined, getNumberValidator());\r\n /**\r\n * get/set clip height\r\n * @name Konva.Container#clipHeight\r\n * @method\r\n * @param {Number} height\r\n * @returns {Number}\r\n * @example\r\n * // get clip height\r\n * var clipHeight = container.clipHeight();\r\n *\r\n * // set clip height\r\n * container.clipHeight(100);\r\n */\r\n Factory.addGetterSetter(Container, 'clipFunc');\r\n /**\r\n * get/set clip function\r\n * @name Konva.Container#clipFunc\r\n * @method\r\n * @param {Function} function\r\n * @returns {Function}\r\n * @example\r\n * // get clip function\r\n * var clipFunction = container.clipFunc();\r\n *\r\n * // set clip height\r\n * container.clipFunc(function(ctx) {\r\n * ctx.rect(0, 0, 100, 100);\r\n * });\r\n */\n\n const Captures = new Map();\r\n // we may use this module for capturing touch events too\r\n // so make sure we don't do something super specific to pointer\r\n const SUPPORT_POINTER_EVENTS = Konva$2._global['PointerEvent'] !== undefined;\r\n function getCapturedShape(pointerId) {\r\n return Captures.get(pointerId);\r\n }\r\n function createEvent(evt) {\r\n return {\r\n evt,\r\n pointerId: evt.pointerId,\r\n };\r\n }\r\n function hasPointerCapture(pointerId, shape) {\r\n return Captures.get(pointerId) === shape;\r\n }\r\n function setPointerCapture(pointerId, shape) {\r\n releaseCapture(pointerId);\r\n const stage = shape.getStage();\r\n if (!stage)\r\n return;\r\n Captures.set(pointerId, shape);\r\n if (SUPPORT_POINTER_EVENTS) {\r\n shape._fire('gotpointercapture', createEvent(new PointerEvent('gotpointercapture')));\r\n }\r\n }\r\n function releaseCapture(pointerId, target) {\r\n const shape = Captures.get(pointerId);\r\n if (!shape)\r\n return;\r\n const stage = shape.getStage();\r\n if (stage && stage.content) ;\r\n Captures.delete(pointerId);\r\n if (SUPPORT_POINTER_EVENTS) {\r\n shape._fire('lostpointercapture', createEvent(new PointerEvent('lostpointercapture')));\r\n }\r\n }\n\n // CONSTANTS\r\n var STAGE = 'Stage', STRING = 'string', PX = 'px', MOUSEOUT = 'mouseout', MOUSELEAVE = 'mouseleave', MOUSEOVER = 'mouseover', MOUSEENTER = 'mouseenter', MOUSEMOVE = 'mousemove', MOUSEDOWN = 'mousedown', MOUSEUP = 'mouseup', POINTERMOVE = 'pointermove', POINTERDOWN = 'pointerdown', POINTERUP = 'pointerup', POINTERCANCEL = 'pointercancel', LOSTPOINTERCAPTURE = 'lostpointercapture', POINTEROUT = 'pointerout', POINTERLEAVE = 'pointerleave', POINTEROVER = 'pointerover', POINTERENTER = 'pointerenter', CONTEXTMENU = 'contextmenu', TOUCHSTART = 'touchstart', TOUCHEND = 'touchend', TOUCHMOVE = 'touchmove', TOUCHCANCEL = 'touchcancel', WHEEL = 'wheel', MAX_LAYERS_NUMBER = 5, EVENTS = [\r\n [MOUSEENTER, '_pointerenter'],\r\n [MOUSEDOWN, '_pointerdown'],\r\n [MOUSEMOVE, '_pointermove'],\r\n [MOUSEUP, '_pointerup'],\r\n [MOUSELEAVE, '_pointerleave'],\r\n [TOUCHSTART, '_pointerdown'],\r\n [TOUCHMOVE, '_pointermove'],\r\n [TOUCHEND, '_pointerup'],\r\n [TOUCHCANCEL, '_pointercancel'],\r\n [MOUSEOVER, '_pointerover'],\r\n [WHEEL, '_wheel'],\r\n [CONTEXTMENU, '_contextmenu'],\r\n [POINTERDOWN, '_pointerdown'],\r\n [POINTERMOVE, '_pointermove'],\r\n [POINTERUP, '_pointerup'],\r\n [POINTERCANCEL, '_pointercancel'],\r\n [LOSTPOINTERCAPTURE, '_lostpointercapture'],\r\n ];\r\n const EVENTS_MAP = {\r\n mouse: {\r\n [POINTEROUT]: MOUSEOUT,\r\n [POINTERLEAVE]: MOUSELEAVE,\r\n [POINTEROVER]: MOUSEOVER,\r\n [POINTERENTER]: MOUSEENTER,\r\n [POINTERMOVE]: MOUSEMOVE,\r\n [POINTERDOWN]: MOUSEDOWN,\r\n [POINTERUP]: MOUSEUP,\r\n [POINTERCANCEL]: 'mousecancel',\r\n pointerclick: 'click',\r\n pointerdblclick: 'dblclick',\r\n },\r\n touch: {\r\n [POINTEROUT]: 'touchout',\r\n [POINTERLEAVE]: 'touchleave',\r\n [POINTEROVER]: 'touchover',\r\n [POINTERENTER]: 'touchenter',\r\n [POINTERMOVE]: TOUCHMOVE,\r\n [POINTERDOWN]: TOUCHSTART,\r\n [POINTERUP]: TOUCHEND,\r\n [POINTERCANCEL]: TOUCHCANCEL,\r\n pointerclick: 'tap',\r\n pointerdblclick: 'dbltap',\r\n },\r\n pointer: {\r\n [POINTEROUT]: POINTEROUT,\r\n [POINTERLEAVE]: POINTERLEAVE,\r\n [POINTEROVER]: POINTEROVER,\r\n [POINTERENTER]: POINTERENTER,\r\n [POINTERMOVE]: POINTERMOVE,\r\n [POINTERDOWN]: POINTERDOWN,\r\n [POINTERUP]: POINTERUP,\r\n [POINTERCANCEL]: POINTERCANCEL,\r\n pointerclick: 'pointerclick',\r\n pointerdblclick: 'pointerdblclick',\r\n },\r\n };\r\n const getEventType = (type) => {\r\n if (type.indexOf('pointer') >= 0) {\r\n return 'pointer';\r\n }\r\n if (type.indexOf('touch') >= 0) {\r\n return 'touch';\r\n }\r\n return 'mouse';\r\n };\r\n const getEventsMap = (eventType) => {\r\n const type = getEventType(eventType);\r\n if (type === 'pointer') {\r\n return Konva$2.pointerEventsEnabled && EVENTS_MAP.pointer;\r\n }\r\n if (type === 'touch') {\r\n return EVENTS_MAP.touch;\r\n }\r\n if (type === 'mouse') {\r\n return EVENTS_MAP.mouse;\r\n }\r\n };\r\n function checkNoClip(attrs = {}) {\r\n if (attrs.clipFunc || attrs.clipWidth || attrs.clipHeight) {\r\n Util.warn('Stage does not support clipping. Please use clip for Layers or Groups.');\r\n }\r\n return attrs;\r\n }\r\n const NO_POINTERS_MESSAGE = `Pointer position is missing and not registered by the stage. Looks like it is outside of the stage container. You can set it manually from event: stage.setPointersPositions(event);`;\r\n const stages = [];\r\n /**\r\n * Stage constructor. A stage is used to contain multiple layers\r\n * @constructor\r\n * @memberof Konva\r\n * @augments Konva.Container\r\n * @param {Object} config\r\n * @param {String|Element} config.container Container selector or DOM element\r\n * @param {Number} [config.x]\n * @param {Number} [config.y]\n * @param {Number} [config.width]\n * @param {Number} [config.height]\n * @param {Boolean} [config.visible]\n * @param {Boolean} [config.listening] whether or not the node is listening for events\n * @param {String} [config.id] unique id\n * @param {String} [config.name] non-unique name\n * @param {Number} [config.opacity] determines node opacity. Can be any number between 0 and 1\n * @param {Object} [config.scale] set scale\n * @param {Number} [config.scaleX] set scale x\n * @param {Number} [config.scaleY] set scale y\n * @param {Number} [config.rotation] rotation in degrees\n * @param {Object} [config.offset] offset from center point and rotation point\n * @param {Number} [config.offsetX] set offset x\n * @param {Number} [config.offsetY] set offset y\n * @param {Boolean} [config.draggable] makes the node draggable. When stages are draggable, you can drag and drop\n * the entire stage by dragging any portion of the stage\n * @param {Number} [config.dragDistance]\n * @param {Function} [config.dragBoundFunc]\r\n * @example\r\n * var stage = new Konva.Stage({\r\n * width: 500,\r\n * height: 800,\r\n * container: 'containerId' // or \"#containerId\" or \".containerClass\"\r\n * });\r\n */\r\n class Stage extends Container {\r\n constructor(config) {\r\n super(checkNoClip(config));\r\n this._pointerPositions = [];\r\n this._changedPointerPositions = [];\r\n this._buildDOM();\r\n this._bindContentEvents();\r\n stages.push(this);\r\n this.on('widthChange.konva heightChange.konva', this._resizeDOM);\r\n this.on('visibleChange.konva', this._checkVisibility);\r\n this.on('clipWidthChange.konva clipHeightChange.konva clipFuncChange.konva', () => {\r\n checkNoClip(this.attrs);\r\n });\r\n this._checkVisibility();\r\n }\r\n _validateAdd(child) {\r\n const isLayer = child.getType() === 'Layer';\r\n const isFastLayer = child.getType() === 'FastLayer';\r\n const valid = isLayer || isFastLayer;\r\n if (!valid) {\r\n Util.throw('You may only add layers to the stage.');\r\n }\r\n }\r\n _checkVisibility() {\r\n if (!this.content) {\r\n return;\r\n }\r\n const style = this.visible() ? '' : 'none';\r\n this.content.style.display = style;\r\n }\r\n /**\r\n * set container dom element which contains the stage wrapper div element\r\n * @method\r\n * @name Konva.Stage#setContainer\r\n * @param {DomElement} container can pass in a dom element or id string\r\n */\r\n setContainer(container) {\r\n if (typeof container === STRING) {\r\n if (container.charAt(0) === '.') {\r\n var className = container.slice(1);\r\n container = document.getElementsByClassName(className)[0];\r\n }\r\n else {\r\n var id;\r\n if (container.charAt(0) !== '#') {\r\n id = container;\r\n }\r\n else {\r\n id = container.slice(1);\r\n }\r\n container = document.getElementById(id);\r\n }\r\n if (!container) {\r\n throw 'Can not find container in document with id ' + id;\r\n }\r\n }\r\n this._setAttr('container', container);\r\n if (this.content) {\r\n if (this.content.parentElement) {\r\n this.content.parentElement.removeChild(this.content);\r\n }\r\n container.appendChild(this.content);\r\n }\r\n return this;\r\n }\r\n shouldDrawHit() {\r\n return true;\r\n }\r\n /**\r\n * clear all layers\r\n * @method\r\n * @name Konva.Stage#clear\r\n */\r\n clear() {\r\n var layers = this.children, len = layers.length, n;\r\n for (n = 0; n < len; n++) {\r\n layers[n].clear();\r\n }\r\n return this;\r\n }\r\n clone(obj) {\r\n if (!obj) {\r\n obj = {};\r\n }\r\n obj.container =\r\n typeof document !== 'undefined' && document.createElement('div');\r\n return Container.prototype.clone.call(this, obj);\r\n }\r\n destroy() {\r\n super.destroy();\r\n var content = this.content;\r\n if (content && Util._isInDocument(content)) {\r\n this.container().removeChild(content);\r\n }\r\n var index = stages.indexOf(this);\r\n if (index > -1) {\r\n stages.splice(index, 1);\r\n }\r\n Util.releaseCanvas(this.bufferCanvas._canvas, this.bufferHitCanvas._canvas);\r\n return this;\r\n }\r\n /**\r\n * returns ABSOLUTE pointer position which can be a touch position or mouse position\r\n * pointer position doesn't include any transforms (such as scale) of the stage\r\n * it is just a plain position of pointer relative to top-left corner of the canvas\r\n * @method\r\n * @name Konva.Stage#getPointerPosition\r\n * @returns {Vector2d|null}\r\n */\r\n getPointerPosition() {\r\n const pos = this._pointerPositions[0] || this._changedPointerPositions[0];\r\n if (!pos) {\r\n Util.warn(NO_POINTERS_MESSAGE);\r\n return null;\r\n }\r\n return {\r\n x: pos.x,\r\n y: pos.y,\r\n };\r\n }\r\n _getPointerById(id) {\r\n return this._pointerPositions.find((p) => p.id === id);\r\n }\r\n getPointersPositions() {\r\n return this._pointerPositions;\r\n }\r\n getStage() {\r\n return this;\r\n }\r\n getContent() {\r\n return this.content;\r\n }\r\n _toKonvaCanvas(config) {\r\n config = config || {};\r\n config.x = config.x || 0;\r\n config.y = config.y || 0;\r\n config.width = config.width || this.width();\r\n config.height = config.height || this.height();\r\n var canvas = new SceneCanvas({\r\n width: config.width,\r\n height: config.height,\r\n pixelRatio: config.pixelRatio || 1,\r\n });\r\n var _context = canvas.getContext()._context;\r\n var layers = this.children;\r\n if (config.x || config.y) {\r\n _context.translate(-1 * config.x, -1 * config.y);\r\n }\r\n layers.forEach(function (layer) {\r\n if (!layer.isVisible()) {\r\n return;\r\n }\r\n var layerCanvas = layer._toKonvaCanvas(config);\r\n _context.drawImage(layerCanvas._canvas, config.x, config.y, layerCanvas.getWidth() / layerCanvas.getPixelRatio(), layerCanvas.getHeight() / layerCanvas.getPixelRatio());\r\n });\r\n return canvas;\r\n }\r\n /**\r\n * get visible intersection shape. This is the preferred\r\n * method for determining if a point intersects a shape or not\r\n * @method\r\n * @name Konva.Stage#getIntersection\r\n * @param {Object} pos\r\n * @param {Number} pos.x\r\n * @param {Number} pos.y\r\n * @returns {Konva.Node}\r\n * @example\r\n * var shape = stage.getIntersection({x: 50, y: 50});\r\n */\r\n getIntersection(pos) {\r\n if (!pos) {\r\n return null;\r\n }\r\n var layers = this.children, len = layers.length, end = len - 1, n;\r\n for (n = end; n >= 0; n--) {\r\n const shape = layers[n].getIntersection(pos);\r\n if (shape) {\r\n return shape;\r\n }\r\n }\r\n return null;\r\n }\r\n _resizeDOM() {\r\n var width = this.width();\r\n var height = this.height();\r\n if (this.content) {\r\n // set content dimensions\r\n this.content.style.width = width + PX;\r\n this.content.style.height = height + PX;\r\n }\r\n this.bufferCanvas.setSize(width, height);\r\n this.bufferHitCanvas.setSize(width, height);\r\n // set layer dimensions\r\n this.children.forEach((layer) => {\r\n layer.setSize({ width, height });\r\n layer.draw();\r\n });\r\n }\r\n add(layer, ...rest) {\r\n if (arguments.length > 1) {\r\n for (var i = 0; i < arguments.length; i++) {\r\n this.add(arguments[i]);\r\n }\r\n return this;\r\n }\r\n super.add(layer);\r\n var length = this.children.length;\r\n if (length > MAX_LAYERS_NUMBER) {\r\n Util.warn('The stage has ' +\r\n length +\r\n ' layers. Recommended maximum number of layers is 3-5. Adding more layers into the stage may drop the performance. Rethink your tree structure, you can use Konva.Group.');\r\n }\r\n layer.setSize({ width: this.width(), height: this.height() });\r\n // draw layer and append canvas to container\r\n layer.draw();\r\n if (Konva$2.isBrowser) {\r\n this.content.appendChild(layer.canvas._canvas);\r\n }\r\n // chainable\r\n return this;\r\n }\r\n getParent() {\r\n return null;\r\n }\r\n getLayer() {\r\n return null;\r\n }\r\n hasPointerCapture(pointerId) {\r\n return hasPointerCapture(pointerId, this);\r\n }\r\n setPointerCapture(pointerId) {\r\n setPointerCapture(pointerId, this);\r\n }\r\n releaseCapture(pointerId) {\r\n releaseCapture(pointerId);\r\n }\r\n /**\r\n * returns an array of layers\r\n * @method\r\n * @name Konva.Stage#getLayers\r\n */\r\n getLayers() {\r\n return this.children;\r\n }\r\n _bindContentEvents() {\r\n if (!Konva$2.isBrowser) {\r\n return;\r\n }\r\n EVENTS.forEach(([event, methodName]) => {\r\n this.content.addEventListener(event, (evt) => {\r\n this[methodName](evt);\r\n }, { passive: false });\r\n });\r\n }\r\n _pointerenter(evt) {\r\n this.setPointersPositions(evt);\r\n const events = getEventsMap(evt.type);\r\n this._fire(events.pointerenter, {\r\n evt: evt,\r\n target: this,\r\n currentTarget: this,\r\n });\r\n }\r\n _pointerover(evt) {\r\n this.setPointersPositions(evt);\r\n const events = getEventsMap(evt.type);\r\n this._fire(events.pointerover, {\r\n evt: evt,\r\n target: this,\r\n currentTarget: this,\r\n });\r\n }\r\n _getTargetShape(evenType) {\r\n let shape = this[evenType + 'targetShape'];\r\n if (shape && !shape.getStage()) {\r\n shape = null;\r\n }\r\n return shape;\r\n }\r\n _pointerleave(evt) {\r\n const events = getEventsMap(evt.type);\r\n const eventType = getEventType(evt.type);\r\n if (!events) {\r\n return;\r\n }\r\n this.setPointersPositions(evt);\r\n var targetShape = this._getTargetShape(eventType);\r\n var eventsEnabled = !DD.isDragging || Konva$2.hitOnDragEnabled;\r\n if (targetShape && eventsEnabled) {\r\n targetShape._fireAndBubble(events.pointerout, { evt: evt });\r\n targetShape._fireAndBubble(events.pointerleave, { evt: evt });\r\n this._fire(events.pointerleave, {\r\n evt: evt,\r\n target: this,\r\n currentTarget: this,\r\n });\r\n this[eventType + 'targetShape'] = null;\r\n }\r\n else if (eventsEnabled) {\r\n this._fire(events.pointerleave, {\r\n evt: evt,\r\n target: this,\r\n currentTarget: this,\r\n });\r\n this._fire(events.pointerout, {\r\n evt: evt,\r\n target: this,\r\n currentTarget: this,\r\n });\r\n }\r\n this.pointerPos = undefined;\r\n this._pointerPositions = [];\r\n }\r\n _pointerdown(evt) {\r\n const events = getEventsMap(evt.type);\r\n const eventType = getEventType(evt.type);\r\n if (!events) {\r\n return;\r\n }\r\n this.setPointersPositions(evt);\r\n var triggeredOnShape = false;\r\n this._changedPointerPositions.forEach((pos) => {\r\n var shape = this.getIntersection(pos);\r\n DD.justDragged = false;\r\n // probably we are staring a click\r\n Konva$2['_' + eventType + 'ListenClick'] = true;\r\n // no shape detected? do nothing\r\n const hasShape = shape && shape.isListening();\r\n if (!hasShape) {\r\n return;\r\n }\r\n if (Konva$2.capturePointerEventsEnabled) {\r\n shape.setPointerCapture(pos.id);\r\n }\r\n // save where we started the click\r\n this[eventType + 'ClickStartShape'] = shape;\r\n shape._fireAndBubble(events.pointerdown, {\r\n evt: evt,\r\n pointerId: pos.id,\r\n });\r\n triggeredOnShape = true;\r\n // TODO: test in iframe\r\n // only call preventDefault if the shape is listening for events\r\n const isTouch = evt.type.indexOf('touch') >= 0;\r\n if (shape.preventDefault() && evt.cancelable && isTouch) {\r\n evt.preventDefault();\r\n }\r\n });\r\n // trigger down on stage if not already\r\n if (!triggeredOnShape) {\r\n this._fire(events.pointerdown, {\r\n evt: evt,\r\n target: this,\r\n currentTarget: this,\r\n pointerId: this._pointerPositions[0].id,\r\n });\r\n }\r\n }\r\n _pointermove(evt) {\r\n const events = getEventsMap(evt.type);\r\n const eventType = getEventType(evt.type);\r\n if (!events) {\r\n return;\r\n }\r\n if (DD.isDragging && DD.node.preventDefault() && evt.cancelable) {\r\n evt.preventDefault();\r\n }\r\n this.setPointersPositions(evt);\r\n var eventsEnabled = !DD.isDragging || Konva$2.hitOnDragEnabled;\r\n if (!eventsEnabled) {\r\n return;\r\n }\r\n var processedShapesIds = {};\r\n let triggeredOnShape = false;\r\n var targetShape = this._getTargetShape(eventType);\r\n this._changedPointerPositions.forEach((pos) => {\r\n const shape = (getCapturedShape(pos.id) ||\r\n this.getIntersection(pos));\r\n const pointerId = pos.id;\r\n const event = { evt: evt, pointerId };\r\n var differentTarget = targetShape !== shape;\r\n if (differentTarget && targetShape) {\r\n targetShape._fireAndBubble(events.pointerout, Object.assign({}, event), shape);\r\n targetShape._fireAndBubble(events.pointerleave, Object.assign({}, event), shape);\r\n }\r\n if (shape) {\r\n if (processedShapesIds[shape._id]) {\r\n return;\r\n }\r\n processedShapesIds[shape._id] = true;\r\n }\r\n if (shape && shape.isListening()) {\r\n triggeredOnShape = true;\r\n if (differentTarget) {\r\n shape._fireAndBubble(events.pointerover, Object.assign({}, event), targetShape);\r\n shape._fireAndBubble(events.pointerenter, Object.assign({}, event), targetShape);\r\n this[eventType + 'targetShape'] = shape;\r\n }\r\n shape._fireAndBubble(events.pointermove, Object.assign({}, event));\r\n }\r\n else {\r\n if (targetShape) {\r\n this._fire(events.pointerover, {\r\n evt: evt,\r\n target: this,\r\n currentTarget: this,\r\n pointerId,\r\n });\r\n this[eventType + 'targetShape'] = null;\r\n }\r\n }\r\n });\r\n if (!triggeredOnShape) {\r\n this._fire(events.pointermove, {\r\n evt: evt,\r\n target: this,\r\n currentTarget: this,\r\n pointerId: this._changedPointerPositions[0].id,\r\n });\r\n }\r\n }\r\n _pointerup(evt) {\r\n const events = getEventsMap(evt.type);\r\n const eventType = getEventType(evt.type);\r\n if (!events) {\r\n return;\r\n }\r\n this.setPointersPositions(evt);\r\n const clickStartShape = this[eventType + 'ClickStartShape'];\r\n const clickEndShape = this[eventType + 'ClickEndShape'];\r\n var processedShapesIds = {};\r\n let triggeredOnShape = false;\r\n this._changedPointerPositions.forEach((pos) => {\r\n const shape = (getCapturedShape(pos.id) ||\r\n this.getIntersection(pos));\r\n if (shape) {\r\n shape.releaseCapture(pos.id);\r\n if (processedShapesIds[shape._id]) {\r\n return;\r\n }\r\n processedShapesIds[shape._id] = true;\r\n }\r\n const pointerId = pos.id;\r\n const event = { evt: evt, pointerId };\r\n let fireDblClick = false;\r\n if (Konva$2['_' + eventType + 'InDblClickWindow']) {\r\n fireDblClick = true;\r\n clearTimeout(this[eventType + 'DblTimeout']);\r\n }\r\n else if (!DD.justDragged) {\r\n // don't set inDblClickWindow after dragging\r\n Konva$2['_' + eventType + 'InDblClickWindow'] = true;\r\n clearTimeout(this[eventType + 'DblTimeout']);\r\n }\r\n this[eventType + 'DblTimeout'] = setTimeout(function () {\r\n Konva$2['_' + eventType + 'InDblClickWindow'] = false;\r\n }, Konva$2.dblClickWindow);\r\n if (shape && shape.isListening()) {\r\n triggeredOnShape = true;\r\n this[eventType + 'ClickEndShape'] = shape;\r\n shape._fireAndBubble(events.pointerup, Object.assign({}, event));\r\n // detect if click or double click occurred\r\n if (Konva$2['_' + eventType + 'ListenClick'] &&\r\n clickStartShape &&\r\n clickStartShape === shape) {\r\n shape._fireAndBubble(events.pointerclick, Object.assign({}, event));\r\n if (fireDblClick && clickEndShape && clickEndShape === shape) {\r\n shape._fireAndBubble(events.pointerdblclick, Object.assign({}, event));\r\n }\r\n }\r\n }\r\n else {\r\n this[eventType + 'ClickEndShape'] = null;\r\n if (Konva$2['_' + eventType + 'ListenClick']) {\r\n this._fire(events.pointerclick, {\r\n evt: evt,\r\n target: this,\r\n currentTarget: this,\r\n pointerId,\r\n });\r\n }\r\n if (fireDblClick) {\r\n this._fire(events.pointerdblclick, {\r\n evt: evt,\r\n target: this,\r\n currentTarget: this,\r\n pointerId,\r\n });\r\n }\r\n }\r\n });\r\n if (!triggeredOnShape) {\r\n this._fire(events.pointerup, {\r\n evt: evt,\r\n target: this,\r\n currentTarget: this,\r\n pointerId: this._changedPointerPositions[0].id,\r\n });\r\n }\r\n Konva$2['_' + eventType + 'ListenClick'] = false;\r\n // always call preventDefault for desktop events because some browsers\r\n // try to drag and drop the canvas element\r\n // TODO: are we sure we need to prevent default at all?\r\n // do not call this function on mobile because it prevent \"click\" event on all parent containers\r\n // but apps may listen to it.\r\n if (evt.cancelable && eventType !== 'touch') {\r\n evt.preventDefault();\r\n }\r\n }\r\n _contextmenu(evt) {\r\n this.setPointersPositions(evt);\r\n var shape = this.getIntersection(this.getPointerPosition());\r\n if (shape && shape.isListening()) {\r\n shape._fireAndBubble(CONTEXTMENU, { evt: evt });\r\n }\r\n else {\r\n this._fire(CONTEXTMENU, {\r\n evt: evt,\r\n target: this,\r\n currentTarget: this,\r\n });\r\n }\r\n }\r\n _wheel(evt) {\r\n this.setPointersPositions(evt);\r\n var shape = this.getIntersection(this.getPointerPosition());\r\n if (shape && shape.isListening()) {\r\n shape._fireAndBubble(WHEEL, { evt: evt });\r\n }\r\n else {\r\n this._fire(WHEEL, {\r\n evt: evt,\r\n target: this,\r\n currentTarget: this,\r\n });\r\n }\r\n }\r\n _pointercancel(evt) {\r\n this.setPointersPositions(evt);\r\n const shape = getCapturedShape(evt.pointerId) ||\r\n this.getIntersection(this.getPointerPosition());\r\n if (shape) {\r\n shape._fireAndBubble(POINTERUP, createEvent(evt));\r\n }\r\n releaseCapture(evt.pointerId);\r\n }\r\n _lostpointercapture(evt) {\r\n releaseCapture(evt.pointerId);\r\n }\r\n /**\r\n * manually register pointers positions (mouse/touch) in the stage.\r\n * So you can use stage.getPointerPosition(). Usually you don't need to use that method\r\n * because all internal events are automatically registered. It may be useful if event\r\n * is triggered outside of the stage, but you still want to use Konva methods to get pointers position.\r\n * @method\r\n * @name Konva.Stage#setPointersPositions\r\n * @param {Object} event Event object\r\n * @example\r\n *\r\n * window.addEventListener('mousemove', (e) => {\r\n * stage.setPointersPositions(e);\r\n * });\r\n */\r\n setPointersPositions(evt) {\r\n var contentPosition = this._getContentPosition(), x = null, y = null;\r\n evt = evt ? evt : window.event;\r\n // touch events\r\n if (evt.touches !== undefined) {\r\n // touchlist has not support for map method\r\n // so we have to iterate\r\n this._pointerPositions = [];\r\n this._changedPointerPositions = [];\r\n Array.prototype.forEach.call(evt.touches, (touch) => {\r\n this._pointerPositions.push({\r\n id: touch.identifier,\r\n x: (touch.clientX - contentPosition.left) / contentPosition.scaleX,\r\n y: (touch.clientY - contentPosition.top) / contentPosition.scaleY,\r\n });\r\n });\r\n Array.prototype.forEach.call(evt.changedTouches || evt.touches, (touch) => {\r\n this._changedPointerPositions.push({\r\n id: touch.identifier,\r\n x: (touch.clientX - contentPosition.left) / contentPosition.scaleX,\r\n y: (touch.clientY - contentPosition.top) / contentPosition.scaleY,\r\n });\r\n });\r\n }\r\n else {\r\n // mouse events\r\n x = (evt.clientX - contentPosition.left) / contentPosition.scaleX;\r\n y = (evt.clientY - contentPosition.top) / contentPosition.scaleY;\r\n this.pointerPos = {\r\n x: x,\r\n y: y,\r\n };\r\n this._pointerPositions = [{ x, y, id: Util._getFirstPointerId(evt) }];\r\n this._changedPointerPositions = [\r\n { x, y, id: Util._getFirstPointerId(evt) },\r\n ];\r\n }\r\n }\r\n _setPointerPosition(evt) {\r\n Util.warn('Method _setPointerPosition is deprecated. Use \"stage.setPointersPositions(event)\" instead.');\r\n this.setPointersPositions(evt);\r\n }\r\n _getContentPosition() {\r\n if (!this.content || !this.content.getBoundingClientRect) {\r\n return {\r\n top: 0,\r\n left: 0,\r\n scaleX: 1,\r\n scaleY: 1,\r\n };\r\n }\r\n var rect = this.content.getBoundingClientRect();\r\n return {\r\n top: rect.top,\r\n left: rect.left,\r\n // sometimes clientWidth can be equals to 0\r\n // i saw it in react-konva test, looks like it is because of hidden testing element\r\n scaleX: rect.width / this.content.clientWidth || 1,\r\n scaleY: rect.height / this.content.clientHeight || 1,\r\n };\r\n }\r\n _buildDOM() {\r\n this.bufferCanvas = new SceneCanvas({\r\n width: this.width(),\r\n height: this.height(),\r\n });\r\n this.bufferHitCanvas = new HitCanvas({\r\n pixelRatio: 1,\r\n width: this.width(),\r\n height: this.height(),\r\n });\r\n if (!Konva$2.isBrowser) {\r\n return;\r\n }\r\n var container = this.container();\r\n if (!container) {\r\n throw 'Stage has no container. A container is required.';\r\n }\r\n // clear content inside container\r\n container.innerHTML = '';\r\n // content\r\n this.content = document.createElement('div');\r\n this.content.style.position = 'relative';\r\n this.content.style.userSelect = 'none';\r\n this.content.className = 'konvajs-content';\r\n this.content.setAttribute('role', 'presentation');\r\n container.appendChild(this.content);\r\n this._resizeDOM();\r\n }\r\n // currently cache function is now working for stage, because stage has no its own canvas element\r\n cache() {\r\n Util.warn('Cache function is not allowed for stage. You may use cache only for layers, groups and shapes.');\r\n return this;\r\n }\r\n clearCache() {\r\n return this;\r\n }\r\n /**\r\n * batch draw\r\n * @method\r\n * @name Konva.Stage#batchDraw\r\n * @return {Konva.Stage} this\r\n */\r\n batchDraw() {\r\n this.getChildren().forEach(function (layer) {\r\n layer.batchDraw();\r\n });\r\n return this;\r\n }\r\n }\r\n Stage.prototype.nodeType = STAGE;\r\n _registerNode(Stage);\r\n /**\r\n * get/set container DOM element\r\n * @method\r\n * @name Konva.Stage#container\r\n * @returns {DomElement} container\r\n * @example\r\n * // get container\r\n * var container = stage.container();\r\n * // set container\r\n * var container = document.createElement('div');\r\n * body.appendChild(container);\r\n * stage.container(container);\r\n */\r\n Factory.addGetterSetter(Stage, 'container');\n\n var HAS_SHADOW = 'hasShadow';\r\n var SHADOW_RGBA = 'shadowRGBA';\r\n var patternImage = 'patternImage';\r\n var linearGradient = 'linearGradient';\r\n var radialGradient = 'radialGradient';\r\n let dummyContext$1;\r\n function getDummyContext$1() {\r\n if (dummyContext$1) {\r\n return dummyContext$1;\r\n }\r\n dummyContext$1 = Util.createCanvasElement().getContext('2d');\r\n return dummyContext$1;\r\n }\r\n const shapes = {};\r\n // TODO: idea - use only \"remove\" (or destroy method)\r\n // how? on add, check that every inner shape has reference in konva store with color\r\n // on remove - clear that reference\r\n // the approach is good. But what if we want to cache the shape before we add it into the stage\r\n // what color to use for hit test?\r\n function _fillFunc$2(context) {\r\n context.fill();\r\n }\r\n function _strokeFunc$2(context) {\r\n context.stroke();\r\n }\r\n function _fillFuncHit(context) {\r\n context.fill();\r\n }\r\n function _strokeFuncHit(context) {\r\n context.stroke();\r\n }\r\n function _clearHasShadowCache() {\r\n this._clearCache(HAS_SHADOW);\r\n }\r\n function _clearGetShadowRGBACache() {\r\n this._clearCache(SHADOW_RGBA);\r\n }\r\n function _clearFillPatternCache() {\r\n this._clearCache(patternImage);\r\n }\r\n function _clearLinearGradientCache() {\r\n this._clearCache(linearGradient);\r\n }\r\n function _clearRadialGradientCache() {\r\n this._clearCache(radialGradient);\r\n }\r\n /**\r\n * Shape constructor. Shapes are primitive objects such as rectangles,\r\n * circles, text, lines, etc.\r\n * @constructor\r\n * @memberof Konva\r\n * @augments Konva.Node\r\n * @param {Object} config\r\n * @param {String} [config.fill] fill color\n * @param {Image} [config.fillPatternImage] fill pattern image\n * @param {Number} [config.fillPatternX]\n * @param {Number} [config.fillPatternY]\n * @param {Object} [config.fillPatternOffset] object with x and y component\n * @param {Number} [config.fillPatternOffsetX] \n * @param {Number} [config.fillPatternOffsetY] \n * @param {Object} [config.fillPatternScale] object with x and y component\n * @param {Number} [config.fillPatternScaleX]\n * @param {Number} [config.fillPatternScaleY]\n * @param {Number} [config.fillPatternRotation]\n * @param {String} [config.fillPatternRepeat] can be \"repeat\", \"repeat-x\", \"repeat-y\", or \"no-repeat\". The default is \"no-repeat\"\n * @param {Object} [config.fillLinearGradientStartPoint] object with x and y component\n * @param {Number} [config.fillLinearGradientStartPointX]\n * @param {Number} [config.fillLinearGradientStartPointY]\n * @param {Object} [config.fillLinearGradientEndPoint] object with x and y component\n * @param {Number} [config.fillLinearGradientEndPointX]\n * @param {Number} [config.fillLinearGradientEndPointY]\n * @param {Array} [config.fillLinearGradientColorStops] array of color stops\n * @param {Object} [config.fillRadialGradientStartPoint] object with x and y component\n * @param {Number} [config.fillRadialGradientStartPointX]\n * @param {Number} [config.fillRadialGradientStartPointY]\n * @param {Object} [config.fillRadialGradientEndPoint] object with x and y component\n * @param {Number} [config.fillRadialGradientEndPointX] \n * @param {Number} [config.fillRadialGradientEndPointY] \n * @param {Number} [config.fillRadialGradientStartRadius]\n * @param {Number} [config.fillRadialGradientEndRadius]\n * @param {Array} [config.fillRadialGradientColorStops] array of color stops\n * @param {Boolean} [config.fillEnabled] flag which enables or disables the fill. The default value is true\n * @param {String} [config.fillPriority] can be color, linear-gradient, radial-graident, or pattern. The default value is color. The fillPriority property makes it really easy to toggle between different fill types. For example, if you want to toggle between a fill color style and a fill pattern style, simply set the fill property and the fillPattern properties, and then use setFillPriority('color') to render the shape with a color fill, or use setFillPriority('pattern') to render the shape with the pattern fill configuration\n * @param {String} [config.stroke] stroke color\n * @param {Number} [config.strokeWidth] stroke width\n * @param {Boolean} [config.fillAfterStrokeEnabled]. Should we draw fill AFTER stroke? Default is false.\n * @param {Number} [config.hitStrokeWidth] size of the stroke on hit canvas. The default is \"auto\" - equals to strokeWidth\n * @param {Boolean} [config.strokeHitEnabled] flag which enables or disables stroke hit region. The default is true\n * @param {Boolean} [config.perfectDrawEnabled] flag which enables or disables using buffer canvas. The default is true\n * @param {Boolean} [config.shadowForStrokeEnabled] flag which enables or disables shadow for stroke. The default is true\n * @param {Boolean} [config.strokeScaleEnabled] flag which enables or disables stroke scale. The default is true\n * @param {Boolean} [config.strokeEnabled] flag which enables or disables the stroke. The default value is true\n * @param {String} [config.lineJoin] can be miter, round, or bevel. The default\n * is miter\n * @param {String} [config.lineCap] can be butt, round, or square. The default\n * is butt\n * @param {String} [config.shadowColor]\n * @param {Number} [config.shadowBlur]\n * @param {Object} [config.shadowOffset] object with x and y component\n * @param {Number} [config.shadowOffsetX]\n * @param {Number} [config.shadowOffsetY]\n * @param {Number} [config.shadowOpacity] shadow opacity. Can be any real number\n * between 0 and 1\n * @param {Boolean} [config.shadowEnabled] flag which enables or disables the shadow. The default value is true\n * @param {Array} [config.dash]\n * @param {Boolean} [config.dashEnabled] flag which enables or disables the dashArray. The default value is true\n\r\n * @param {Number} [config.x]\n * @param {Number} [config.y]\n * @param {Number} [config.width]\n * @param {Number} [config.height]\n * @param {Boolean} [config.visible]\n * @param {Boolean} [config.listening] whether or not the node is listening for events\n * @param {String} [config.id] unique id\n * @param {String} [config.name] non-unique name\n * @param {Number} [config.opacity] determines node opacity. Can be any number between 0 and 1\n * @param {Object} [config.scale] set scale\n * @param {Number} [config.scaleX] set scale x\n * @param {Number} [config.scaleY] set scale y\n * @param {Number} [config.rotation] rotation in degrees\n * @param {Object} [config.offset] offset from center point and rotation point\n * @param {Number} [config.offsetX] set offset x\n * @param {Number} [config.offsetY] set offset y\n * @param {Boolean} [config.draggable] makes the node draggable. When stages are draggable, you can drag and drop\n * the entire stage by dragging any portion of the stage\n * @param {Number} [config.dragDistance]\n * @param {Function} [config.dragBoundFunc]\r\n * @example\r\n * var customShape = new Konva.Shape({\r\n * x: 5,\r\n * y: 10,\r\n * fill: 'red',\r\n * // a Konva.Canvas renderer is passed into the sceneFunc function\r\n * sceneFunc (context, shape) {\r\n * context.beginPath();\r\n * context.moveTo(200, 50);\r\n * context.lineTo(420, 80);\r\n * context.quadraticCurveTo(300, 100, 260, 170);\r\n * context.closePath();\r\n * // Konva specific method\r\n * context.fillStrokeShape(shape);\r\n * }\r\n *});\r\n */\r\n class Shape extends Node {\r\n constructor(config) {\r\n super(config);\r\n // set colorKey\r\n let key;\r\n while (true) {\r\n key = Util.getRandomColor();\r\n if (key && !(key in shapes)) {\r\n break;\r\n }\r\n }\r\n this.colorKey = key;\r\n shapes[key] = this;\r\n }\r\n getContext() {\r\n Util.warn('shape.getContext() method is deprecated. Please do not use it.');\r\n return this.getLayer().getContext();\r\n }\r\n getCanvas() {\r\n Util.warn('shape.getCanvas() method is deprecated. Please do not use it.');\r\n return this.getLayer().getCanvas();\r\n }\r\n getSceneFunc() {\r\n return this.attrs.sceneFunc || this['_sceneFunc'];\r\n }\r\n getHitFunc() {\r\n return this.attrs.hitFunc || this['_hitFunc'];\r\n }\r\n /**\r\n * returns whether or not a shadow will be rendered\r\n * @method\r\n * @name Konva.Shape#hasShadow\r\n * @returns {Boolean}\r\n */\r\n hasShadow() {\r\n return this._getCache(HAS_SHADOW, this._hasShadow);\r\n }\r\n _hasShadow() {\r\n return (this.shadowEnabled() &&\r\n this.shadowOpacity() !== 0 &&\r\n !!(this.shadowColor() ||\r\n this.shadowBlur() ||\r\n this.shadowOffsetX() ||\r\n this.shadowOffsetY()));\r\n }\r\n _getFillPattern() {\r\n return this._getCache(patternImage, this.__getFillPattern);\r\n }\r\n __getFillPattern() {\r\n if (this.fillPatternImage()) {\r\n var ctx = getDummyContext$1();\r\n const pattern = ctx.createPattern(this.fillPatternImage(), this.fillPatternRepeat() || 'repeat');\r\n if (pattern && pattern.setTransform) {\r\n const tr = new Transform();\r\n tr.translate(this.fillPatternX(), this.fillPatternY());\r\n tr.rotate(Konva$2.getAngle(this.fillPatternRotation()));\r\n tr.scale(this.fillPatternScaleX(), this.fillPatternScaleY());\r\n tr.translate(-1 * this.fillPatternOffsetX(), -1 * this.fillPatternOffsetY());\r\n const m = tr.getMatrix();\r\n const matrix = typeof DOMMatrix === 'undefined'\r\n ? {\r\n a: m[0],\r\n b: m[1],\r\n c: m[2],\r\n d: m[3],\r\n e: m[4],\r\n f: m[5], // Vertical translation (moving).\r\n }\r\n : new DOMMatrix(m);\r\n pattern.setTransform(matrix);\r\n }\r\n return pattern;\r\n }\r\n }\r\n _getLinearGradient() {\r\n return this._getCache(linearGradient, this.__getLinearGradient);\r\n }\r\n __getLinearGradient() {\r\n var colorStops = this.fillLinearGradientColorStops();\r\n if (colorStops) {\r\n var ctx = getDummyContext$1();\r\n var start = this.fillLinearGradientStartPoint();\r\n var end = this.fillLinearGradientEndPoint();\r\n var grd = ctx.createLinearGradient(start.x, start.y, end.x, end.y);\r\n // build color stops\r\n for (var n = 0; n < colorStops.length; n += 2) {\r\n grd.addColorStop(colorStops[n], colorStops[n + 1]);\r\n }\r\n return grd;\r\n }\r\n }\r\n _getRadialGradient() {\r\n return this._getCache(radialGradient, this.__getRadialGradient);\r\n }\r\n __getRadialGradient() {\r\n var colorStops = this.fillRadialGradientColorStops();\r\n if (colorStops) {\r\n var ctx = getDummyContext$1();\r\n var start = this.fillRadialGradientStartPoint();\r\n var end = this.fillRadialGradientEndPoint();\r\n var grd = ctx.createRadialGradient(start.x, start.y, this.fillRadialGradientStartRadius(), end.x, end.y, this.fillRadialGradientEndRadius());\r\n // build color stops\r\n for (var n = 0; n < colorStops.length; n += 2) {\r\n grd.addColorStop(colorStops[n], colorStops[n + 1]);\r\n }\r\n return grd;\r\n }\r\n }\r\n getShadowRGBA() {\r\n return this._getCache(SHADOW_RGBA, this._getShadowRGBA);\r\n }\r\n _getShadowRGBA() {\r\n if (!this.hasShadow()) {\r\n return;\r\n }\r\n var rgba = Util.colorToRGBA(this.shadowColor());\r\n if (rgba) {\r\n return ('rgba(' +\r\n rgba.r +\r\n ',' +\r\n rgba.g +\r\n ',' +\r\n rgba.b +\r\n ',' +\r\n rgba.a * (this.shadowOpacity() || 1) +\r\n ')');\r\n }\r\n }\r\n /**\r\n * returns whether or not the shape will be filled\r\n * @method\r\n * @name Konva.Shape#hasFill\r\n * @returns {Boolean}\r\n */\r\n hasFill() {\r\n return this._calculate('hasFill', [\r\n 'fillEnabled',\r\n 'fill',\r\n 'fillPatternImage',\r\n 'fillLinearGradientColorStops',\r\n 'fillRadialGradientColorStops',\r\n ], () => {\r\n return (this.fillEnabled() &&\r\n !!(this.fill() ||\r\n this.fillPatternImage() ||\r\n this.fillLinearGradientColorStops() ||\r\n this.fillRadialGradientColorStops()));\r\n });\r\n }\r\n /**\r\n * returns whether or not the shape will be stroked\r\n * @method\r\n * @name Konva.Shape#hasStroke\r\n * @returns {Boolean}\r\n */\r\n hasStroke() {\r\n return this._calculate('hasStroke', [\r\n 'strokeEnabled',\r\n 'strokeWidth',\r\n 'stroke',\r\n 'strokeLinearGradientColorStops',\r\n ], () => {\r\n return (this.strokeEnabled() &&\r\n this.strokeWidth() &&\r\n !!(this.stroke() || this.strokeLinearGradientColorStops())\r\n // this.getStrokeRadialGradientColorStops()\r\n );\r\n });\r\n // return (\r\n // this.strokeEnabled() &&\r\n // this.strokeWidth() &&\r\n // !!(this.stroke() || this.strokeLinearGradientColorStops())\r\n // // this.getStrokeRadialGradientColorStops()\r\n // );\r\n }\r\n hasHitStroke() {\r\n const width = this.hitStrokeWidth();\r\n // on auto just check by stroke\r\n if (width === 'auto') {\r\n return this.hasStroke();\r\n }\r\n // we should enable hit stroke if stroke is enabled\r\n // and we have some value from width\r\n return this.strokeEnabled() && !!width;\r\n }\r\n /**\r\n * determines if point is in the shape, regardless if other shapes are on top of it. Note: because\r\n * this method clears a temporary canvas and then redraws the shape, it performs very poorly if executed many times\r\n * consecutively. Please use the {@link Konva.Stage#getIntersection} method if at all possible\r\n * because it performs much better\r\n * @method\r\n * @name Konva.Shape#intersects\r\n * @param {Object} point\r\n * @param {Number} point.x\r\n * @param {Number} point.y\r\n * @returns {Boolean}\r\n */\r\n intersects(point) {\r\n var stage = this.getStage(), bufferHitCanvas = stage.bufferHitCanvas, p;\r\n bufferHitCanvas.getContext().clear();\r\n this.drawHit(bufferHitCanvas, null, true);\r\n p = bufferHitCanvas.context.getImageData(Math.round(point.x), Math.round(point.y), 1, 1).data;\r\n return p[3] > 0;\r\n }\r\n destroy() {\r\n Node.prototype.destroy.call(this);\r\n delete shapes[this.colorKey];\r\n delete this.colorKey;\r\n return this;\r\n }\r\n // why do we need buffer canvas?\r\n // it give better result when a shape has\r\n // stroke with fill and with some opacity\r\n _useBufferCanvas(forceFill) {\r\n // image and sprite still has \"fill\" as image\r\n // so they use that method with forced fill\r\n // it probably will be simpler, then copy/paste the code\r\n var _a;\r\n // buffer canvas is available only inside the stage\r\n if (!this.getStage()) {\r\n return false;\r\n }\r\n // force skip buffer canvas\r\n const perfectDrawEnabled = (_a = this.attrs.perfectDrawEnabled) !== null && _a !== void 0 ? _a : true;\r\n if (!perfectDrawEnabled) {\r\n return false;\r\n }\r\n const hasFill = forceFill || this.hasFill();\r\n const hasStroke = this.hasStroke();\r\n const isTransparent = this.getAbsoluteOpacity() !== 1;\r\n if (hasFill && hasStroke && isTransparent) {\r\n return true;\r\n }\r\n const hasShadow = this.hasShadow();\r\n const strokeForShadow = this.shadowForStrokeEnabled();\r\n if (hasFill && hasStroke && hasShadow && strokeForShadow) {\r\n return true;\r\n }\r\n return false;\r\n }\r\n setStrokeHitEnabled(val) {\r\n Util.warn('strokeHitEnabled property is deprecated. Please use hitStrokeWidth instead.');\r\n if (val) {\r\n this.hitStrokeWidth('auto');\r\n }\r\n else {\r\n this.hitStrokeWidth(0);\r\n }\r\n }\r\n getStrokeHitEnabled() {\r\n if (this.hitStrokeWidth() === 0) {\r\n return false;\r\n }\r\n else {\r\n return true;\r\n }\r\n }\r\n /**\r\n * return self rectangle (x, y, width, height) of shape.\r\n * This method are not taken into account transformation and styles.\r\n * @method\r\n * @name Konva.Shape#getSelfRect\r\n * @returns {Object} rect with {x, y, width, height} properties\r\n * @example\r\n *\r\n * rect.getSelfRect(); // return {x:0, y:0, width:rect.width(), height:rect.height()}\r\n * circle.getSelfRect(); // return {x: - circle.width() / 2, y: - circle.height() / 2, width:circle.width(), height:circle.height()}\r\n *\r\n */\r\n getSelfRect() {\r\n var size = this.size();\r\n return {\r\n x: this._centroid ? -size.width / 2 : 0,\r\n y: this._centroid ? -size.height / 2 : 0,\r\n width: size.width,\r\n height: size.height,\r\n };\r\n }\r\n getClientRect(config = {}) {\r\n const skipTransform = config.skipTransform;\r\n const relativeTo = config.relativeTo;\r\n const fillRect = this.getSelfRect();\r\n const applyStroke = !config.skipStroke && this.hasStroke();\r\n const strokeWidth = (applyStroke && this.strokeWidth()) || 0;\r\n const fillAndStrokeWidth = fillRect.width + strokeWidth;\r\n const fillAndStrokeHeight = fillRect.height + strokeWidth;\r\n const applyShadow = !config.skipShadow && this.hasShadow();\r\n const shadowOffsetX = applyShadow ? this.shadowOffsetX() : 0;\r\n const shadowOffsetY = applyShadow ? this.shadowOffsetY() : 0;\r\n const preWidth = fillAndStrokeWidth + Math.abs(shadowOffsetX);\r\n const preHeight = fillAndStrokeHeight + Math.abs(shadowOffsetY);\r\n const blurRadius = (applyShadow && this.shadowBlur()) || 0;\r\n const width = preWidth + blurRadius * 2;\r\n const height = preHeight + blurRadius * 2;\r\n const rect = {\r\n width: width,\r\n height: height,\r\n x: -(strokeWidth / 2 + blurRadius) +\r\n Math.min(shadowOffsetX, 0) +\r\n fillRect.x,\r\n y: -(strokeWidth / 2 + blurRadius) +\r\n Math.min(shadowOffsetY, 0) +\r\n fillRect.y,\r\n };\r\n if (!skipTransform) {\r\n return this._transformedRect(rect, relativeTo);\r\n }\r\n return rect;\r\n }\r\n drawScene(can, top) {\r\n // basically there are 3 drawing modes\r\n // 1 - simple drawing when nothing is cached.\r\n // 2 - when we are caching current\r\n // 3 - when node is cached and we need to draw it into layer\r\n var layer = this.getLayer(), canvas = can || layer.getCanvas(), context = canvas.getContext(), cachedCanvas = this._getCanvasCache(), drawFunc = this.getSceneFunc(), hasShadow = this.hasShadow(), stage, bufferCanvas, bufferContext;\r\n var skipBuffer = canvas.isCache;\r\n var cachingSelf = top === this;\r\n if (!this.isVisible() && !cachingSelf) {\r\n return this;\r\n }\r\n // if node is cached we just need to draw from cache\r\n if (cachedCanvas) {\r\n context.save();\r\n var m = this.getAbsoluteTransform(top).getMatrix();\r\n context.transform(m[0], m[1], m[2], m[3], m[4], m[5]);\r\n this._drawCachedSceneCanvas(context);\r\n context.restore();\r\n return this;\r\n }\r\n if (!drawFunc) {\r\n return this;\r\n }\r\n context.save();\r\n // if buffer canvas is needed\r\n if (this._useBufferCanvas() && !skipBuffer) {\r\n stage = this.getStage();\r\n bufferCanvas = stage.bufferCanvas;\r\n bufferContext = bufferCanvas.getContext();\r\n bufferContext.clear();\r\n bufferContext.save();\r\n bufferContext._applyLineJoin(this);\r\n // layer might be undefined if we are using cache before adding to layer\r\n var o = this.getAbsoluteTransform(top).getMatrix();\r\n bufferContext.transform(o[0], o[1], o[2], o[3], o[4], o[5]);\r\n drawFunc.call(this, bufferContext, this);\r\n bufferContext.restore();\r\n var ratio = bufferCanvas.pixelRatio;\r\n if (hasShadow) {\r\n context._applyShadow(this);\r\n }\r\n context._applyOpacity(this);\r\n context._applyGlobalCompositeOperation(this);\r\n context.drawImage(bufferCanvas._canvas, 0, 0, bufferCanvas.width / ratio, bufferCanvas.height / ratio);\r\n }\r\n else {\r\n context._applyLineJoin(this);\r\n if (!cachingSelf) {\r\n var o = this.getAbsoluteTransform(top).getMatrix();\r\n context.transform(o[0], o[1], o[2], o[3], o[4], o[5]);\r\n context._applyOpacity(this);\r\n context._applyGlobalCompositeOperation(this);\r\n }\r\n if (hasShadow) {\r\n context._applyShadow(this);\r\n }\r\n drawFunc.call(this, context, this);\r\n }\r\n context.restore();\r\n return this;\r\n }\r\n drawHit(can, top, skipDragCheck = false) {\r\n if (!this.shouldDrawHit(top, skipDragCheck)) {\r\n return this;\r\n }\r\n var layer = this.getLayer(), canvas = can || layer.hitCanvas, context = canvas && canvas.getContext(), drawFunc = this.hitFunc() || this.sceneFunc(), cachedCanvas = this._getCanvasCache(), cachedHitCanvas = cachedCanvas && cachedCanvas.hit;\r\n if (!this.colorKey) {\r\n Util.warn('Looks like your canvas has a destroyed shape in it. Do not reuse shape after you destroyed it. If you want to reuse shape you should call remove() instead of destroy()');\r\n }\r\n if (cachedHitCanvas) {\r\n context.save();\r\n var m = this.getAbsoluteTransform(top).getMatrix();\r\n context.transform(m[0], m[1], m[2], m[3], m[4], m[5]);\r\n this._drawCachedHitCanvas(context);\r\n context.restore();\r\n return this;\r\n }\r\n if (!drawFunc) {\r\n return this;\r\n }\r\n context.save();\r\n context._applyLineJoin(this);\r\n const selfCache = this === top;\r\n if (!selfCache) {\r\n var o = this.getAbsoluteTransform(top).getMatrix();\r\n context.transform(o[0], o[1], o[2], o[3], o[4], o[5]);\r\n }\r\n drawFunc.call(this, context, this);\r\n context.restore();\r\n return this;\r\n }\r\n /**\r\n * draw hit graph using the cached scene canvas\r\n * @method\r\n * @name Konva.Shape#drawHitFromCache\r\n * @param {Integer} alphaThreshold alpha channel threshold that determines whether or not\r\n * a pixel should be drawn onto the hit graph. Must be a value between 0 and 255.\r\n * The default is 0\r\n * @returns {Konva.Shape}\r\n * @example\r\n * shape.cache();\r\n * shape.drawHitFromCache();\r\n */\r\n drawHitFromCache(alphaThreshold = 0) {\r\n var cachedCanvas = this._getCanvasCache(), sceneCanvas = this._getCachedSceneCanvas(), hitCanvas = cachedCanvas.hit, hitContext = hitCanvas.getContext(), hitWidth = hitCanvas.getWidth(), hitHeight = hitCanvas.getHeight(), hitImageData, hitData, len, rgbColorKey, i, alpha;\r\n hitContext.clear();\r\n hitContext.drawImage(sceneCanvas._canvas, 0, 0, hitWidth, hitHeight);\r\n try {\r\n hitImageData = hitContext.getImageData(0, 0, hitWidth, hitHeight);\r\n hitData = hitImageData.data;\r\n len = hitData.length;\r\n rgbColorKey = Util._hexToRgb(this.colorKey);\r\n // replace non transparent pixels with color key\r\n for (i = 0; i < len; i += 4) {\r\n alpha = hitData[i + 3];\r\n if (alpha > alphaThreshold) {\r\n hitData[i] = rgbColorKey.r;\r\n hitData[i + 1] = rgbColorKey.g;\r\n hitData[i + 2] = rgbColorKey.b;\r\n hitData[i + 3] = 255;\r\n }\r\n else {\r\n hitData[i + 3] = 0;\r\n }\r\n }\r\n hitContext.putImageData(hitImageData, 0, 0);\r\n }\r\n catch (e) {\r\n Util.error('Unable to draw hit graph from cached scene canvas. ' + e.message);\r\n }\r\n return this;\r\n }\r\n hasPointerCapture(pointerId) {\r\n return hasPointerCapture(pointerId, this);\r\n }\r\n setPointerCapture(pointerId) {\r\n setPointerCapture(pointerId, this);\r\n }\r\n releaseCapture(pointerId) {\r\n releaseCapture(pointerId);\r\n }\r\n }\r\n Shape.prototype._fillFunc = _fillFunc$2;\r\n Shape.prototype._strokeFunc = _strokeFunc$2;\r\n Shape.prototype._fillFuncHit = _fillFuncHit;\r\n Shape.prototype._strokeFuncHit = _strokeFuncHit;\r\n Shape.prototype._centroid = false;\r\n Shape.prototype.nodeType = 'Shape';\r\n _registerNode(Shape);\r\n Shape.prototype.eventListeners = {};\r\n Shape.prototype.on.call(Shape.prototype, 'shadowColorChange.konva shadowBlurChange.konva shadowOffsetChange.konva shadowOpacityChange.konva shadowEnabledChange.konva', _clearHasShadowCache);\r\n Shape.prototype.on.call(Shape.prototype, 'shadowColorChange.konva shadowOpacityChange.konva shadowEnabledChange.konva', _clearGetShadowRGBACache);\r\n Shape.prototype.on.call(Shape.prototype, 'fillPriorityChange.konva fillPatternImageChange.konva fillPatternRepeatChange.konva fillPatternScaleXChange.konva fillPatternScaleYChange.konva fillPatternOffsetXChange.konva fillPatternOffsetYChange.konva fillPatternXChange.konva fillPatternYChange.konva fillPatternRotationChange.konva', _clearFillPatternCache);\r\n Shape.prototype.on.call(Shape.prototype, 'fillPriorityChange.konva fillLinearGradientColorStopsChange.konva fillLinearGradientStartPointXChange.konva fillLinearGradientStartPointYChange.konva fillLinearGradientEndPointXChange.konva fillLinearGradientEndPointYChange.konva', _clearLinearGradientCache);\r\n Shape.prototype.on.call(Shape.prototype, 'fillPriorityChange.konva fillRadialGradientColorStopsChange.konva fillRadialGradientStartPointXChange.konva fillRadialGradientStartPointYChange.konva fillRadialGradientEndPointXChange.konva fillRadialGradientEndPointYChange.konva fillRadialGradientStartRadiusChange.konva fillRadialGradientEndRadiusChange.konva', _clearRadialGradientCache);\r\n // add getters and setters\r\n Factory.addGetterSetter(Shape, 'stroke', undefined, getStringOrGradientValidator());\r\n /**\r\n * get/set stroke color\r\n * @name Konva.Shape#stroke\r\n * @method\r\n * @param {String} color\r\n * @returns {String}\r\n * @example\r\n * // get stroke color\r\n * var stroke = shape.stroke();\r\n *\r\n * // set stroke color with color string\r\n * shape.stroke('green');\r\n *\r\n * // set stroke color with hex\r\n * shape.stroke('#00ff00');\r\n *\r\n * // set stroke color with rgb\r\n * shape.stroke('rgb(0,255,0)');\r\n *\r\n * // set stroke color with rgba and make it 50% opaque\r\n * shape.stroke('rgba(0,255,0,0.5');\r\n */\r\n Factory.addGetterSetter(Shape, 'strokeWidth', 2, getNumberValidator());\r\n /**\r\n * get/set stroke width\r\n * @name Konva.Shape#strokeWidth\r\n * @method\r\n * @param {Number} strokeWidth\r\n * @returns {Number}\r\n * @example\r\n * // get stroke width\r\n * var strokeWidth = shape.strokeWidth();\r\n *\r\n * // set stroke width\r\n * shape.strokeWidth(10);\r\n */\r\n Factory.addGetterSetter(Shape, 'fillAfterStrokeEnabled', false);\r\n /**\r\n * get/set fillAfterStrokeEnabled property. By default Konva is drawing filling first, then stroke on top of the fill.\r\n * In rare situations you may want a different behavior. When you have a stroke first then fill on top of it.\r\n * Especially useful for Text objects.\r\n * Default is false.\r\n * @name Konva.Shape#fillAfterStrokeEnabled\r\n * @method\r\n * @param {Boolean} fillAfterStrokeEnabled\r\n * @returns {Boolean}\r\n * @example\r\n * // get stroke width\r\n * var fillAfterStrokeEnabled = shape.fillAfterStrokeEnabled();\r\n *\r\n * // set stroke width\r\n * shape.fillAfterStrokeEnabled(true);\r\n */\r\n Factory.addGetterSetter(Shape, 'hitStrokeWidth', 'auto', getNumberOrAutoValidator());\r\n /**\r\n * get/set stroke width for hit detection. Default value is \"auto\", it means it will be equals to strokeWidth\r\n * @name Konva.Shape#hitStrokeWidth\r\n * @method\r\n * @param {Number} hitStrokeWidth\r\n * @returns {Number}\r\n * @example\r\n * // get stroke width\r\n * var hitStrokeWidth = shape.hitStrokeWidth();\r\n *\r\n * // set hit stroke width\r\n * shape.hitStrokeWidth(20);\r\n * // set hit stroke width always equals to scene stroke width\r\n * shape.hitStrokeWidth('auto');\r\n */\r\n Factory.addGetterSetter(Shape, 'strokeHitEnabled', true, getBooleanValidator());\r\n /**\r\n * **deprecated, use hitStrokeWidth instead!** get/set strokeHitEnabled property. Useful for performance optimization.\r\n * You may set `shape.strokeHitEnabled(false)`. In this case stroke will be no draw on hit canvas, so hit area\r\n * of shape will be decreased (by lineWidth / 2). Remember that non closed line with `strokeHitEnabled = false`\r\n * will be not drawn on hit canvas, that is mean line will no trigger pointer events (like mouseover)\r\n * Default value is true.\r\n * @name Konva.Shape#strokeHitEnabled\r\n * @method\r\n * @param {Boolean} strokeHitEnabled\r\n * @returns {Boolean}\r\n * @example\r\n * // get strokeHitEnabled\r\n * var strokeHitEnabled = shape.strokeHitEnabled();\r\n *\r\n * // set strokeHitEnabled\r\n * shape.strokeHitEnabled();\r\n */\r\n Factory.addGetterSetter(Shape, 'perfectDrawEnabled', true, getBooleanValidator());\r\n /**\r\n * get/set perfectDrawEnabled. If a shape has fill, stroke and opacity you may set `perfectDrawEnabled` to false to improve performance.\r\n * See http://konvajs.org/docs/performance/Disable_Perfect_Draw.html for more information.\r\n * Default value is true\r\n * @name Konva.Shape#perfectDrawEnabled\r\n * @method\r\n * @param {Boolean} perfectDrawEnabled\r\n * @returns {Boolean}\r\n * @example\r\n * // get perfectDrawEnabled\r\n * var perfectDrawEnabled = shape.perfectDrawEnabled();\r\n *\r\n * // set perfectDrawEnabled\r\n * shape.perfectDrawEnabled();\r\n */\r\n Factory.addGetterSetter(Shape, 'shadowForStrokeEnabled', true, getBooleanValidator());\r\n /**\r\n * get/set shadowForStrokeEnabled. Useful for performance optimization.\r\n * You may set `shape.shadowForStrokeEnabled(false)`. In this case stroke will no effect shadow.\r\n * Remember if you set `shadowForStrokeEnabled = false` for non closed line - that line will have no shadow!.\r\n * Default value is true\r\n * @name Konva.Shape#shadowForStrokeEnabled\r\n * @method\r\n * @param {Boolean} shadowForStrokeEnabled\r\n * @returns {Boolean}\r\n * @example\r\n * // get shadowForStrokeEnabled\r\n * var shadowForStrokeEnabled = shape.shadowForStrokeEnabled();\r\n *\r\n * // set shadowForStrokeEnabled\r\n * shape.shadowForStrokeEnabled();\r\n */\r\n Factory.addGetterSetter(Shape, 'lineJoin');\r\n /**\r\n * get/set line join. Can be miter, round, or bevel. The\r\n * default is miter\r\n * @name Konva.Shape#lineJoin\r\n * @method\r\n * @param {String} lineJoin\r\n * @returns {String}\r\n * @example\r\n * // get line join\r\n * var lineJoin = shape.lineJoin();\r\n *\r\n * // set line join\r\n * shape.lineJoin('round');\r\n */\r\n Factory.addGetterSetter(Shape, 'lineCap');\r\n /**\r\n * get/set line cap. Can be butt, round, or square\r\n * @name Konva.Shape#lineCap\r\n * @method\r\n * @param {String} lineCap\r\n * @returns {String}\r\n * @example\r\n * // get line cap\r\n * var lineCap = shape.lineCap();\r\n *\r\n * // set line cap\r\n * shape.lineCap('round');\r\n */\r\n Factory.addGetterSetter(Shape, 'sceneFunc');\r\n /**\r\n * get/set scene draw function. That function is used to draw the shape on a canvas.\r\n * Also that function will be used to draw hit area of the shape, in case if hitFunc is not defined.\r\n * @name Konva.Shape#sceneFunc\r\n * @method\r\n * @param {Function} drawFunc drawing function\r\n * @returns {Function}\r\n * @example\r\n * // get scene draw function\r\n * var sceneFunc = shape.sceneFunc();\r\n *\r\n * // set scene draw function\r\n * shape.sceneFunc(function(context, shape) {\r\n * context.beginPath();\r\n * context.rect(0, 0, shape.width(), shape.height());\r\n * context.closePath();\r\n * // important Konva method that fill and stroke shape from its properties\r\n * // like stroke and fill\r\n * context.fillStrokeShape(shape);\r\n * });\r\n */\r\n Factory.addGetterSetter(Shape, 'hitFunc');\r\n /**\r\n * get/set hit draw function. That function is used to draw custom hit area of a shape.\r\n * @name Konva.Shape#hitFunc\r\n * @method\r\n * @param {Function} drawFunc drawing function\r\n * @returns {Function}\r\n * @example\r\n * // get hit draw function\r\n * var hitFunc = shape.hitFunc();\r\n *\r\n * // set hit draw function\r\n * shape.hitFunc(function(context) {\r\n * context.beginPath();\r\n * context.rect(0, 0, shape.width(), shape.height());\r\n * context.closePath();\r\n * // important Konva method that fill and stroke shape from its properties\r\n * context.fillStrokeShape(shape);\r\n * });\r\n */\r\n Factory.addGetterSetter(Shape, 'dash');\r\n /**\r\n * get/set dash array for stroke.\r\n * @name Konva.Shape#dash\r\n * @method\r\n * @param {Array} dash\r\n * @returns {Array}\r\n * @example\r\n * // apply dashed stroke that is 10px long and 5 pixels apart\r\n * line.dash([10, 5]);\r\n * // apply dashed stroke that is made up of alternating dashed\r\n * // lines that are 10px long and 20px apart, and dots that have\r\n * // a radius of 5px and are 20px apart\r\n * line.dash([10, 20, 0.001, 20]);\r\n */\r\n Factory.addGetterSetter(Shape, 'dashOffset', 0, getNumberValidator());\r\n /**\r\n * get/set dash offset for stroke.\r\n * @name Konva.Shape#dash\r\n * @method\r\n * @param {Number} dash offset\r\n * @returns {Number}\r\n * @example\r\n * // apply dashed stroke that is 10px long and 5 pixels apart with an offset of 5px\r\n * line.dash([10, 5]);\r\n * line.dashOffset(5);\r\n */\r\n Factory.addGetterSetter(Shape, 'shadowColor', undefined, getStringValidator());\r\n /**\r\n * get/set shadow color\r\n * @name Konva.Shape#shadowColor\r\n * @method\r\n * @param {String} color\r\n * @returns {String}\r\n * @example\r\n * // get shadow color\r\n * var shadow = shape.shadowColor();\r\n *\r\n * // set shadow color with color string\r\n * shape.shadowColor('green');\r\n *\r\n * // set shadow color with hex\r\n * shape.shadowColor('#00ff00');\r\n *\r\n * // set shadow color with rgb\r\n * shape.shadowColor('rgb(0,255,0)');\r\n *\r\n * // set shadow color with rgba and make it 50% opaque\r\n * shape.shadowColor('rgba(0,255,0,0.5');\r\n */\r\n Factory.addGetterSetter(Shape, 'shadowBlur', 0, getNumberValidator());\r\n /**\r\n * get/set shadow blur\r\n * @name Konva.Shape#shadowBlur\r\n * @method\r\n * @param {Number} blur\r\n * @returns {Number}\r\n * @example\r\n * // get shadow blur\r\n * var shadowBlur = shape.shadowBlur();\r\n *\r\n * // set shadow blur\r\n * shape.shadowBlur(10);\r\n */\r\n Factory.addGetterSetter(Shape, 'shadowOpacity', 1, getNumberValidator());\r\n /**\r\n * get/set shadow opacity. must be a value between 0 and 1\r\n * @name Konva.Shape#shadowOpacity\r\n * @method\r\n * @param {Number} opacity\r\n * @returns {Number}\r\n * @example\r\n * // get shadow opacity\r\n * var shadowOpacity = shape.shadowOpacity();\r\n *\r\n * // set shadow opacity\r\n * shape.shadowOpacity(0.5);\r\n */\r\n Factory.addComponentsGetterSetter(Shape, 'shadowOffset', ['x', 'y']);\r\n /**\r\n * get/set shadow offset\r\n * @name Konva.Shape#shadowOffset\r\n * @method\r\n * @param {Object} offset\r\n * @param {Number} offset.x\r\n * @param {Number} offset.y\r\n * @returns {Object}\r\n * @example\r\n * // get shadow offset\r\n * var shadowOffset = shape.shadowOffset();\r\n *\r\n * // set shadow offset\r\n * shape.shadowOffset({\r\n * x: 20,\r\n * y: 10\r\n * });\r\n */\r\n Factory.addGetterSetter(Shape, 'shadowOffsetX', 0, getNumberValidator());\r\n /**\r\n * get/set shadow offset x\r\n * @name Konva.Shape#shadowOffsetX\r\n * @method\r\n * @param {Number} x\r\n * @returns {Number}\r\n * @example\r\n * // get shadow offset x\r\n * var shadowOffsetX = shape.shadowOffsetX();\r\n *\r\n * // set shadow offset x\r\n * shape.shadowOffsetX(5);\r\n */\r\n Factory.addGetterSetter(Shape, 'shadowOffsetY', 0, getNumberValidator());\r\n /**\r\n * get/set shadow offset y\r\n * @name Konva.Shape#shadowOffsetY\r\n * @method\r\n * @param {Number} y\r\n * @returns {Number}\r\n * @example\r\n * // get shadow offset y\r\n * var shadowOffsetY = shape.shadowOffsetY();\r\n *\r\n * // set shadow offset y\r\n * shape.shadowOffsetY(5);\r\n */\r\n Factory.addGetterSetter(Shape, 'fillPatternImage');\r\n /**\r\n * get/set fill pattern image\r\n * @name Konva.Shape#fillPatternImage\r\n * @method\r\n * @param {Image} image object\r\n * @returns {Image}\r\n * @example\r\n * // get fill pattern image\r\n * var fillPatternImage = shape.fillPatternImage();\r\n *\r\n * // set fill pattern image\r\n * var imageObj = new Image();\r\n * imageObj.onload = function() {\r\n * shape.fillPatternImage(imageObj);\r\n * };\r\n * imageObj.src = 'path/to/image/jpg';\r\n */\r\n Factory.addGetterSetter(Shape, 'fill', undefined, getStringOrGradientValidator());\r\n /**\r\n * get/set fill color\r\n * @name Konva.Shape#fill\r\n * @method\r\n * @param {String} color\r\n * @returns {String}\r\n * @example\r\n * // get fill color\r\n * var fill = shape.fill();\r\n *\r\n * // set fill color with color string\r\n * shape.fill('green');\r\n *\r\n * // set fill color with hex\r\n * shape.fill('#00ff00');\r\n *\r\n * // set fill color with rgb\r\n * shape.fill('rgb(0,255,0)');\r\n *\r\n * // set fill color with rgba and make it 50% opaque\r\n * shape.fill('rgba(0,255,0,0.5');\r\n *\r\n * // shape without fill\r\n * shape.fill(null);\r\n */\r\n Factory.addGetterSetter(Shape, 'fillPatternX', 0, getNumberValidator());\r\n /**\r\n * get/set fill pattern x\r\n * @name Konva.Shape#fillPatternX\r\n * @method\r\n * @param {Number} x\r\n * @returns {Number}\r\n * @example\r\n * // get fill pattern x\r\n * var fillPatternX = shape.fillPatternX();\r\n * // set fill pattern x\r\n * shape.fillPatternX(20);\r\n */\r\n Factory.addGetterSetter(Shape, 'fillPatternY', 0, getNumberValidator());\r\n /**\r\n * get/set fill pattern y\r\n * @name Konva.Shape#fillPatternY\r\n * @method\r\n * @param {Number} y\r\n * @returns {Number}\r\n * @example\r\n * // get fill pattern y\r\n * var fillPatternY = shape.fillPatternY();\r\n * // set fill pattern y\r\n * shape.fillPatternY(20);\r\n */\r\n Factory.addGetterSetter(Shape, 'fillLinearGradientColorStops');\r\n /**\r\n * get/set fill linear gradient color stops\r\n * @name Konva.Shape#fillLinearGradientColorStops\r\n * @method\r\n * @param {Array} colorStops\r\n * @returns {Array} colorStops\r\n * @example\r\n * // get fill linear gradient color stops\r\n * var colorStops = shape.fillLinearGradientColorStops();\r\n *\r\n * // create a linear gradient that starts with red, changes to blue\r\n * // halfway through, and then changes to green\r\n * shape.fillLinearGradientColorStops(0, 'red', 0.5, 'blue', 1, 'green');\r\n */\r\n Factory.addGetterSetter(Shape, 'strokeLinearGradientColorStops');\r\n /**\r\n * get/set stroke linear gradient color stops\r\n * @name Konva.Shape#strokeLinearGradientColorStops\r\n * @method\r\n * @param {Array} colorStops\r\n * @returns {Array} colorStops\r\n * @example\r\n * // get stroke linear gradient color stops\r\n * var colorStops = shape.strokeLinearGradientColorStops();\r\n *\r\n * // create a linear gradient that starts with red, changes to blue\r\n * // halfway through, and then changes to green\r\n * shape.strokeLinearGradientColorStops([0, 'red', 0.5, 'blue', 1, 'green']);\r\n */\r\n Factory.addGetterSetter(Shape, 'fillRadialGradientStartRadius', 0);\r\n /**\r\n * get/set fill radial gradient start radius\r\n * @name Konva.Shape#fillRadialGradientStartRadius\r\n * @method\r\n * @param {Number} radius\r\n * @returns {Number}\r\n * @example\r\n * // get radial gradient start radius\r\n * var startRadius = shape.fillRadialGradientStartRadius();\r\n *\r\n * // set radial gradient start radius\r\n * shape.fillRadialGradientStartRadius(0);\r\n */\r\n Factory.addGetterSetter(Shape, 'fillRadialGradientEndRadius', 0);\r\n /**\r\n * get/set fill radial gradient end radius\r\n * @name Konva.Shape#fillRadialGradientEndRadius\r\n * @method\r\n * @param {Number} radius\r\n * @returns {Number}\r\n * @example\r\n * // get radial gradient end radius\r\n * var endRadius = shape.fillRadialGradientEndRadius();\r\n *\r\n * // set radial gradient end radius\r\n * shape.fillRadialGradientEndRadius(100);\r\n */\r\n Factory.addGetterSetter(Shape, 'fillRadialGradientColorStops');\r\n /**\r\n * get/set fill radial gradient color stops\r\n * @name Konva.Shape#fillRadialGradientColorStops\r\n * @method\r\n * @param {Number} colorStops\r\n * @returns {Array}\r\n * @example\r\n * // get fill radial gradient color stops\r\n * var colorStops = shape.fillRadialGradientColorStops();\r\n *\r\n * // create a radial gradient that starts with red, changes to blue\r\n * // halfway through, and then changes to green\r\n * shape.fillRadialGradientColorStops(0, 'red', 0.5, 'blue', 1, 'green');\r\n */\r\n Factory.addGetterSetter(Shape, 'fillPatternRepeat', 'repeat');\r\n /**\r\n * get/set fill pattern repeat. Can be 'repeat', 'repeat-x', 'repeat-y', or 'no-repeat'. The default is 'repeat'\r\n * @name Konva.Shape#fillPatternRepeat\r\n * @method\r\n * @param {String} repeat\r\n * @returns {String}\r\n * @example\r\n * // get fill pattern repeat\r\n * var repeat = shape.fillPatternRepeat();\r\n *\r\n * // repeat pattern in x direction only\r\n * shape.fillPatternRepeat('repeat-x');\r\n *\r\n * // do not repeat the pattern\r\n * shape.fillPatternRepeat('no-repeat');\r\n */\r\n Factory.addGetterSetter(Shape, 'fillEnabled', true);\r\n /**\r\n * get/set fill enabled flag\r\n * @name Konva.Shape#fillEnabled\r\n * @method\r\n * @param {Boolean} enabled\r\n * @returns {Boolean}\r\n * @example\r\n * // get fill enabled flag\r\n * var fillEnabled = shape.fillEnabled();\r\n *\r\n * // disable fill\r\n * shape.fillEnabled(false);\r\n *\r\n * // enable fill\r\n * shape.fillEnabled(true);\r\n */\r\n Factory.addGetterSetter(Shape, 'strokeEnabled', true);\r\n /**\r\n * get/set stroke enabled flag\r\n * @name Konva.Shape#strokeEnabled\r\n * @method\r\n * @param {Boolean} enabled\r\n * @returns {Boolean}\r\n * @example\r\n * // get stroke enabled flag\r\n * var strokeEnabled = shape.strokeEnabled();\r\n *\r\n * // disable stroke\r\n * shape.strokeEnabled(false);\r\n *\r\n * // enable stroke\r\n * shape.strokeEnabled(true);\r\n */\r\n Factory.addGetterSetter(Shape, 'shadowEnabled', true);\r\n /**\r\n * get/set shadow enabled flag\r\n * @name Konva.Shape#shadowEnabled\r\n * @method\r\n * @param {Boolean} enabled\r\n * @returns {Boolean}\r\n * @example\r\n * // get shadow enabled flag\r\n * var shadowEnabled = shape.shadowEnabled();\r\n *\r\n * // disable shadow\r\n * shape.shadowEnabled(false);\r\n *\r\n * // enable shadow\r\n * shape.shadowEnabled(true);\r\n */\r\n Factory.addGetterSetter(Shape, 'dashEnabled', true);\r\n /**\r\n * get/set dash enabled flag\r\n * @name Konva.Shape#dashEnabled\r\n * @method\r\n * @param {Boolean} enabled\r\n * @returns {Boolean}\r\n * @example\r\n * // get dash enabled flag\r\n * var dashEnabled = shape.dashEnabled();\r\n *\r\n * // disable dash\r\n * shape.dashEnabled(false);\r\n *\r\n * // enable dash\r\n * shape.dashEnabled(true);\r\n */\r\n Factory.addGetterSetter(Shape, 'strokeScaleEnabled', true);\r\n /**\r\n * get/set strokeScale enabled flag\r\n * @name Konva.Shape#strokeScaleEnabled\r\n * @method\r\n * @param {Boolean} enabled\r\n * @returns {Boolean}\r\n * @example\r\n * // get stroke scale enabled flag\r\n * var strokeScaleEnabled = shape.strokeScaleEnabled();\r\n *\r\n * // disable stroke scale\r\n * shape.strokeScaleEnabled(false);\r\n *\r\n * // enable stroke scale\r\n * shape.strokeScaleEnabled(true);\r\n */\r\n Factory.addGetterSetter(Shape, 'fillPriority', 'color');\r\n /**\r\n * get/set fill priority. can be color, pattern, linear-gradient, or radial-gradient. The default is color.\r\n * This is handy if you want to toggle between different fill types.\r\n * @name Konva.Shape#fillPriority\r\n * @method\r\n * @param {String} priority\r\n * @returns {String}\r\n * @example\r\n * // get fill priority\r\n * var fillPriority = shape.fillPriority();\r\n *\r\n * // set fill priority\r\n * shape.fillPriority('linear-gradient');\r\n */\r\n Factory.addComponentsGetterSetter(Shape, 'fillPatternOffset', ['x', 'y']);\r\n /**\r\n * get/set fill pattern offset\r\n * @name Konva.Shape#fillPatternOffset\r\n * @method\r\n * @param {Object} offset\r\n * @param {Number} offset.x\r\n * @param {Number} offset.y\r\n * @returns {Object}\r\n * @example\r\n * // get fill pattern offset\r\n * var patternOffset = shape.fillPatternOffset();\r\n *\r\n * // set fill pattern offset\r\n * shape.fillPatternOffset({\r\n * x: 20,\r\n * y: 10\r\n * });\r\n */\r\n Factory.addGetterSetter(Shape, 'fillPatternOffsetX', 0, getNumberValidator());\r\n /**\r\n * get/set fill pattern offset x\r\n * @name Konva.Shape#fillPatternOffsetX\r\n * @method\r\n * @param {Number} x\r\n * @returns {Number}\r\n * @example\r\n * // get fill pattern offset x\r\n * var patternOffsetX = shape.fillPatternOffsetX();\r\n *\r\n * // set fill pattern offset x\r\n * shape.fillPatternOffsetX(20);\r\n */\r\n Factory.addGetterSetter(Shape, 'fillPatternOffsetY', 0, getNumberValidator());\r\n /**\r\n * get/set fill pattern offset y\r\n * @name Konva.Shape#fillPatternOffsetY\r\n * @method\r\n * @param {Number} y\r\n * @returns {Number}\r\n * @example\r\n * // get fill pattern offset y\r\n * var patternOffsetY = shape.fillPatternOffsetY();\r\n *\r\n * // set fill pattern offset y\r\n * shape.fillPatternOffsetY(10);\r\n */\r\n Factory.addComponentsGetterSetter(Shape, 'fillPatternScale', ['x', 'y']);\r\n /**\r\n * get/set fill pattern scale\r\n * @name Konva.Shape#fillPatternScale\r\n * @method\r\n * @param {Object} scale\r\n * @param {Number} scale.x\r\n * @param {Number} scale.y\r\n * @returns {Object}\r\n * @example\r\n * // get fill pattern scale\r\n * var patternScale = shape.fillPatternScale();\r\n *\r\n * // set fill pattern scale\r\n * shape.fillPatternScale({\r\n * x: 2,\r\n * y: 2\r\n * });\r\n */\r\n Factory.addGetterSetter(Shape, 'fillPatternScaleX', 1, getNumberValidator());\r\n /**\r\n * get/set fill pattern scale x\r\n * @name Konva.Shape#fillPatternScaleX\r\n * @method\r\n * @param {Number} x\r\n * @returns {Number}\r\n * @example\r\n * // get fill pattern scale x\r\n * var patternScaleX = shape.fillPatternScaleX();\r\n *\r\n * // set fill pattern scale x\r\n * shape.fillPatternScaleX(2);\r\n */\r\n Factory.addGetterSetter(Shape, 'fillPatternScaleY', 1, getNumberValidator());\r\n /**\r\n * get/set fill pattern scale y\r\n * @name Konva.Shape#fillPatternScaleY\r\n * @method\r\n * @param {Number} y\r\n * @returns {Number}\r\n * @example\r\n * // get fill pattern scale y\r\n * var patternScaleY = shape.fillPatternScaleY();\r\n *\r\n * // set fill pattern scale y\r\n * shape.fillPatternScaleY(2);\r\n */\r\n Factory.addComponentsGetterSetter(Shape, 'fillLinearGradientStartPoint', [\r\n 'x',\r\n 'y',\r\n ]);\r\n /**\r\n * get/set fill linear gradient start point\r\n * @name Konva.Shape#fillLinearGradientStartPoint\r\n * @method\r\n * @param {Object} startPoint\r\n * @param {Number} startPoint.x\r\n * @param {Number} startPoint.y\r\n * @returns {Object}\r\n * @example\r\n * // get fill linear gradient start point\r\n * var startPoint = shape.fillLinearGradientStartPoint();\r\n *\r\n * // set fill linear gradient start point\r\n * shape.fillLinearGradientStartPoint({\r\n * x: 20,\r\n * y: 10\r\n * });\r\n */\r\n Factory.addComponentsGetterSetter(Shape, 'strokeLinearGradientStartPoint', [\r\n 'x',\r\n 'y',\r\n ]);\r\n /**\r\n * get/set stroke linear gradient start point\r\n * @name Konva.Shape#strokeLinearGradientStartPoint\r\n * @method\r\n * @param {Object} startPoint\r\n * @param {Number} startPoint.x\r\n * @param {Number} startPoint.y\r\n * @returns {Object}\r\n * @example\r\n * // get stroke linear gradient start point\r\n * var startPoint = shape.strokeLinearGradientStartPoint();\r\n *\r\n * // set stroke linear gradient start point\r\n * shape.strokeLinearGradientStartPoint({\r\n * x: 20,\r\n * y: 10\r\n * });\r\n */\r\n Factory.addGetterSetter(Shape, 'fillLinearGradientStartPointX', 0);\r\n /**\r\n * get/set fill linear gradient start point x\r\n * @name Konva.Shape#fillLinearGradientStartPointX\r\n * @method\r\n * @param {Number} x\r\n * @returns {Number}\r\n * @example\r\n * // get fill linear gradient start point x\r\n * var startPointX = shape.fillLinearGradientStartPointX();\r\n *\r\n * // set fill linear gradient start point x\r\n * shape.fillLinearGradientStartPointX(20);\r\n */\r\n Factory.addGetterSetter(Shape, 'strokeLinearGradientStartPointX', 0);\r\n /**\r\n * get/set stroke linear gradient start point x\r\n * @name Konva.Shape#linearLinearGradientStartPointX\r\n * @method\r\n * @param {Number} x\r\n * @returns {Number}\r\n * @example\r\n * // get stroke linear gradient start point x\r\n * var startPointX = shape.strokeLinearGradientStartPointX();\r\n *\r\n * // set stroke linear gradient start point x\r\n * shape.strokeLinearGradientStartPointX(20);\r\n */\r\n Factory.addGetterSetter(Shape, 'fillLinearGradientStartPointY', 0);\r\n /**\r\n * get/set fill linear gradient start point y\r\n * @name Konva.Shape#fillLinearGradientStartPointY\r\n * @method\r\n * @param {Number} y\r\n * @returns {Number}\r\n * @example\r\n * // get fill linear gradient start point y\r\n * var startPointY = shape.fillLinearGradientStartPointY();\r\n *\r\n * // set fill linear gradient start point y\r\n * shape.fillLinearGradientStartPointY(20);\r\n */\r\n Factory.addGetterSetter(Shape, 'strokeLinearGradientStartPointY', 0);\r\n /**\r\n * get/set stroke linear gradient start point y\r\n * @name Konva.Shape#strokeLinearGradientStartPointY\r\n * @method\r\n * @param {Number} y\r\n * @returns {Number}\r\n * @example\r\n * // get stroke linear gradient start point y\r\n * var startPointY = shape.strokeLinearGradientStartPointY();\r\n *\r\n * // set stroke linear gradient start point y\r\n * shape.strokeLinearGradientStartPointY(20);\r\n */\r\n Factory.addComponentsGetterSetter(Shape, 'fillLinearGradientEndPoint', [\r\n 'x',\r\n 'y',\r\n ]);\r\n /**\r\n * get/set fill linear gradient end point\r\n * @name Konva.Shape#fillLinearGradientEndPoint\r\n * @method\r\n * @param {Object} endPoint\r\n * @param {Number} endPoint.x\r\n * @param {Number} endPoint.y\r\n * @returns {Object}\r\n * @example\r\n * // get fill linear gradient end point\r\n * var endPoint = shape.fillLinearGradientEndPoint();\r\n *\r\n * // set fill linear gradient end point\r\n * shape.fillLinearGradientEndPoint({\r\n * x: 20,\r\n * y: 10\r\n * });\r\n */\r\n Factory.addComponentsGetterSetter(Shape, 'strokeLinearGradientEndPoint', [\r\n 'x',\r\n 'y',\r\n ]);\r\n /**\r\n * get/set stroke linear gradient end point\r\n * @name Konva.Shape#strokeLinearGradientEndPoint\r\n * @method\r\n * @param {Object} endPoint\r\n * @param {Number} endPoint.x\r\n * @param {Number} endPoint.y\r\n * @returns {Object}\r\n * @example\r\n * // get stroke linear gradient end point\r\n * var endPoint = shape.strokeLinearGradientEndPoint();\r\n *\r\n * // set stroke linear gradient end point\r\n * shape.strokeLinearGradientEndPoint({\r\n * x: 20,\r\n * y: 10\r\n * });\r\n */\r\n Factory.addGetterSetter(Shape, 'fillLinearGradientEndPointX', 0);\r\n /**\r\n * get/set fill linear gradient end point x\r\n * @name Konva.Shape#fillLinearGradientEndPointX\r\n * @method\r\n * @param {Number} x\r\n * @returns {Number}\r\n * @example\r\n * // get fill linear gradient end point x\r\n * var endPointX = shape.fillLinearGradientEndPointX();\r\n *\r\n * // set fill linear gradient end point x\r\n * shape.fillLinearGradientEndPointX(20);\r\n */\r\n Factory.addGetterSetter(Shape, 'strokeLinearGradientEndPointX', 0);\r\n /**\r\n * get/set fill linear gradient end point x\r\n * @name Konva.Shape#strokeLinearGradientEndPointX\r\n * @method\r\n * @param {Number} x\r\n * @returns {Number}\r\n * @example\r\n * // get stroke linear gradient end point x\r\n * var endPointX = shape.strokeLinearGradientEndPointX();\r\n *\r\n * // set stroke linear gradient end point x\r\n * shape.strokeLinearGradientEndPointX(20);\r\n */\r\n Factory.addGetterSetter(Shape, 'fillLinearGradientEndPointY', 0);\r\n /**\r\n * get/set fill linear gradient end point y\r\n * @name Konva.Shape#fillLinearGradientEndPointY\r\n * @method\r\n * @param {Number} y\r\n * @returns {Number}\r\n * @example\r\n * // get fill linear gradient end point y\r\n * var endPointY = shape.fillLinearGradientEndPointY();\r\n *\r\n * // set fill linear gradient end point y\r\n * shape.fillLinearGradientEndPointY(20);\r\n */\r\n Factory.addGetterSetter(Shape, 'strokeLinearGradientEndPointY', 0);\r\n /**\r\n * get/set stroke linear gradient end point y\r\n * @name Konva.Shape#strokeLinearGradientEndPointY\r\n * @method\r\n * @param {Number} y\r\n * @returns {Number}\r\n * @example\r\n * // get stroke linear gradient end point y\r\n * var endPointY = shape.strokeLinearGradientEndPointY();\r\n *\r\n * // set stroke linear gradient end point y\r\n * shape.strokeLinearGradientEndPointY(20);\r\n */\r\n Factory.addComponentsGetterSetter(Shape, 'fillRadialGradientStartPoint', [\r\n 'x',\r\n 'y',\r\n ]);\r\n /**\r\n * get/set fill radial gradient start point\r\n * @name Konva.Shape#fillRadialGradientStartPoint\r\n * @method\r\n * @param {Object} startPoint\r\n * @param {Number} startPoint.x\r\n * @param {Number} startPoint.y\r\n * @returns {Object}\r\n * @example\r\n * // get fill radial gradient start point\r\n * var startPoint = shape.fillRadialGradientStartPoint();\r\n *\r\n * // set fill radial gradient start point\r\n * shape.fillRadialGradientStartPoint({\r\n * x: 20,\r\n * y: 10\r\n * });\r\n */\r\n Factory.addGetterSetter(Shape, 'fillRadialGradientStartPointX', 0);\r\n /**\r\n * get/set fill radial gradient start point x\r\n * @name Konva.Shape#fillRadialGradientStartPointX\r\n * @method\r\n * @param {Number} x\r\n * @returns {Number}\r\n * @example\r\n * // get fill radial gradient start point x\r\n * var startPointX = shape.fillRadialGradientStartPointX();\r\n *\r\n * // set fill radial gradient start point x\r\n * shape.fillRadialGradientStartPointX(20);\r\n */\r\n Factory.addGetterSetter(Shape, 'fillRadialGradientStartPointY', 0);\r\n /**\r\n * get/set fill radial gradient start point y\r\n * @name Konva.Shape#fillRadialGradientStartPointY\r\n * @method\r\n * @param {Number} y\r\n * @returns {Number}\r\n * @example\r\n * // get fill radial gradient start point y\r\n * var startPointY = shape.fillRadialGradientStartPointY();\r\n *\r\n * // set fill radial gradient start point y\r\n * shape.fillRadialGradientStartPointY(20);\r\n */\r\n Factory.addComponentsGetterSetter(Shape, 'fillRadialGradientEndPoint', [\r\n 'x',\r\n 'y',\r\n ]);\r\n /**\r\n * get/set fill radial gradient end point\r\n * @name Konva.Shape#fillRadialGradientEndPoint\r\n * @method\r\n * @param {Object} endPoint\r\n * @param {Number} endPoint.x\r\n * @param {Number} endPoint.y\r\n * @returns {Object}\r\n * @example\r\n * // get fill radial gradient end point\r\n * var endPoint = shape.fillRadialGradientEndPoint();\r\n *\r\n * // set fill radial gradient end point\r\n * shape.fillRadialGradientEndPoint({\r\n * x: 20,\r\n * y: 10\r\n * });\r\n */\r\n Factory.addGetterSetter(Shape, 'fillRadialGradientEndPointX', 0);\r\n /**\r\n * get/set fill radial gradient end point x\r\n * @name Konva.Shape#fillRadialGradientEndPointX\r\n * @method\r\n * @param {Number} x\r\n * @returns {Number}\r\n * @example\r\n * // get fill radial gradient end point x\r\n * var endPointX = shape.fillRadialGradientEndPointX();\r\n *\r\n * // set fill radial gradient end point x\r\n * shape.fillRadialGradientEndPointX(20);\r\n */\r\n Factory.addGetterSetter(Shape, 'fillRadialGradientEndPointY', 0);\r\n /**\r\n * get/set fill radial gradient end point y\r\n * @name Konva.Shape#fillRadialGradientEndPointY\r\n * @method\r\n * @param {Number} y\r\n * @returns {Number}\r\n * @example\r\n * // get fill radial gradient end point y\r\n * var endPointY = shape.fillRadialGradientEndPointY();\r\n *\r\n * // set fill radial gradient end point y\r\n * shape.fillRadialGradientEndPointY(20);\r\n */\r\n Factory.addGetterSetter(Shape, 'fillPatternRotation', 0);\r\n /**\r\n * get/set fill pattern rotation in degrees\r\n * @name Konva.Shape#fillPatternRotation\r\n * @method\r\n * @param {Number} rotation\r\n * @returns {Konva.Shape}\r\n * @example\r\n * // get fill pattern rotation\r\n * var patternRotation = shape.fillPatternRotation();\r\n *\r\n * // set fill pattern rotation\r\n * shape.fillPatternRotation(20);\r\n */\r\n Factory.backCompat(Shape, {\r\n dashArray: 'dash',\r\n getDashArray: 'getDash',\r\n setDashArray: 'getDash',\r\n drawFunc: 'sceneFunc',\r\n getDrawFunc: 'getSceneFunc',\r\n setDrawFunc: 'setSceneFunc',\r\n drawHitFunc: 'hitFunc',\r\n getDrawHitFunc: 'getHitFunc',\r\n setDrawHitFunc: 'setHitFunc',\r\n });\n\n // constants\r\n var HASH = '#', BEFORE_DRAW = 'beforeDraw', DRAW = 'draw', \r\n /*\r\n * 2 - 3 - 4\r\n * | |\r\n * 1 - 0 5\r\n * |\r\n * 8 - 7 - 6\r\n */\r\n INTERSECTION_OFFSETS = [\r\n { x: 0, y: 0 },\r\n { x: -1, y: -1 },\r\n { x: 1, y: -1 },\r\n { x: 1, y: 1 },\r\n { x: -1, y: 1 }, // 8\r\n ], INTERSECTION_OFFSETS_LEN = INTERSECTION_OFFSETS.length;\r\n /**\r\n * Layer constructor. Layers are tied to their own canvas element and are used\r\n * to contain groups or shapes.\r\n * @constructor\r\n * @memberof Konva\r\n * @augments Konva.Container\r\n * @param {Object} config\r\n * @param {Boolean} [config.clearBeforeDraw] set this property to false if you don't want\r\n * to clear the canvas before each layer draw. The default value is true.\r\n * @param {Number} [config.x]\n * @param {Number} [config.y]\n * @param {Number} [config.width]\n * @param {Number} [config.height]\n * @param {Boolean} [config.visible]\n * @param {Boolean} [config.listening] whether or not the node is listening for events\n * @param {String} [config.id] unique id\n * @param {String} [config.name] non-unique name\n * @param {Number} [config.opacity] determines node opacity. Can be any number between 0 and 1\n * @param {Object} [config.scale] set scale\n * @param {Number} [config.scaleX] set scale x\n * @param {Number} [config.scaleY] set scale y\n * @param {Number} [config.rotation] rotation in degrees\n * @param {Object} [config.offset] offset from center point and rotation point\n * @param {Number} [config.offsetX] set offset x\n * @param {Number} [config.offsetY] set offset y\n * @param {Boolean} [config.draggable] makes the node draggable. When stages are draggable, you can drag and drop\n * the entire stage by dragging any portion of the stage\n * @param {Number} [config.dragDistance]\n * @param {Function} [config.dragBoundFunc]\r\n * * @param {Object} [config.clip] set clip\n * @param {Number} [config.clipX] set clip x\n * @param {Number} [config.clipY] set clip y\n * @param {Number} [config.clipWidth] set clip width\n * @param {Number} [config.clipHeight] set clip height\n * @param {Function} [config.clipFunc] set clip func\n\r\n * @example\r\n * var layer = new Konva.Layer();\r\n * stage.add(layer);\r\n * // now you can add shapes, groups into the layer\r\n */\r\n class Layer extends Container {\r\n constructor(config) {\r\n super(config);\r\n this.canvas = new SceneCanvas();\r\n this.hitCanvas = new HitCanvas({\r\n pixelRatio: 1,\r\n });\r\n this._waitingForDraw = false;\r\n this.on('visibleChange.konva', this._checkVisibility);\r\n this._checkVisibility();\r\n this.on('imageSmoothingEnabledChange.konva', this._setSmoothEnabled);\r\n this._setSmoothEnabled();\r\n }\r\n // for nodejs?\r\n createPNGStream() {\r\n const c = this.canvas._canvas;\r\n return c.createPNGStream();\r\n }\r\n /**\r\n * get layer canvas wrapper\r\n * @method\r\n * @name Konva.Layer#getCanvas\r\n */\r\n getCanvas() {\r\n return this.canvas;\r\n }\r\n /**\r\n * get native canvas element\r\n * @method\r\n * @name Konva.Layer#getNativeCanvasElement\r\n */\r\n getNativeCanvasElement() {\r\n return this.canvas._canvas;\r\n }\r\n /**\r\n * get layer hit canvas\r\n * @method\r\n * @name Konva.Layer#getHitCanvas\r\n */\r\n getHitCanvas() {\r\n return this.hitCanvas;\r\n }\r\n /**\r\n * get layer canvas context\r\n * @method\r\n * @name Konva.Layer#getContext\r\n */\r\n getContext() {\r\n return this.getCanvas().getContext();\r\n }\r\n // TODO: deprecate this method\r\n clear(bounds) {\r\n this.getContext().clear(bounds);\r\n this.getHitCanvas().getContext().clear(bounds);\r\n return this;\r\n }\r\n // extend Node.prototype.setZIndex\r\n setZIndex(index) {\r\n super.setZIndex(index);\r\n var stage = this.getStage();\r\n if (stage && stage.content) {\r\n stage.content.removeChild(this.getNativeCanvasElement());\r\n if (index < stage.children.length - 1) {\r\n stage.content.insertBefore(this.getNativeCanvasElement(), stage.children[index + 1].getCanvas()._canvas);\r\n }\r\n else {\r\n stage.content.appendChild(this.getNativeCanvasElement());\r\n }\r\n }\r\n return this;\r\n }\r\n moveToTop() {\r\n Node.prototype.moveToTop.call(this);\r\n var stage = this.getStage();\r\n if (stage && stage.content) {\r\n stage.content.removeChild(this.getNativeCanvasElement());\r\n stage.content.appendChild(this.getNativeCanvasElement());\r\n }\r\n return true;\r\n }\r\n moveUp() {\r\n var moved = Node.prototype.moveUp.call(this);\r\n if (!moved) {\r\n return false;\r\n }\r\n var stage = this.getStage();\r\n if (!stage || !stage.content) {\r\n return false;\r\n }\r\n stage.content.removeChild(this.getNativeCanvasElement());\r\n if (this.index < stage.children.length - 1) {\r\n stage.content.insertBefore(this.getNativeCanvasElement(), stage.children[this.index + 1].getCanvas()._canvas);\r\n }\r\n else {\r\n stage.content.appendChild(this.getNativeCanvasElement());\r\n }\r\n return true;\r\n }\r\n // extend Node.prototype.moveDown\r\n moveDown() {\r\n if (Node.prototype.moveDown.call(this)) {\r\n var stage = this.getStage();\r\n if (stage) {\r\n var children = stage.children;\r\n if (stage.content) {\r\n stage.content.removeChild(this.getNativeCanvasElement());\r\n stage.content.insertBefore(this.getNativeCanvasElement(), children[this.index + 1].getCanvas()._canvas);\r\n }\r\n }\r\n return true;\r\n }\r\n return false;\r\n }\r\n // extend Node.prototype.moveToBottom\r\n moveToBottom() {\r\n if (Node.prototype.moveToBottom.call(this)) {\r\n var stage = this.getStage();\r\n if (stage) {\r\n var children = stage.children;\r\n if (stage.content) {\r\n stage.content.removeChild(this.getNativeCanvasElement());\r\n stage.content.insertBefore(this.getNativeCanvasElement(), children[1].getCanvas()._canvas);\r\n }\r\n }\r\n return true;\r\n }\r\n return false;\r\n }\r\n getLayer() {\r\n return this;\r\n }\r\n remove() {\r\n var _canvas = this.getNativeCanvasElement();\r\n Node.prototype.remove.call(this);\r\n if (_canvas && _canvas.parentNode && Util._isInDocument(_canvas)) {\r\n _canvas.parentNode.removeChild(_canvas);\r\n }\r\n return this;\r\n }\r\n getStage() {\r\n return this.parent;\r\n }\r\n setSize({ width, height }) {\r\n this.canvas.setSize(width, height);\r\n this.hitCanvas.setSize(width, height);\r\n this._setSmoothEnabled();\r\n return this;\r\n }\r\n _validateAdd(child) {\r\n var type = child.getType();\r\n if (type !== 'Group' && type !== 'Shape') {\r\n Util.throw('You may only add groups and shapes to a layer.');\r\n }\r\n }\r\n _toKonvaCanvas(config) {\r\n config = config || {};\r\n config.width = config.width || this.getWidth();\r\n config.height = config.height || this.getHeight();\r\n config.x = config.x !== undefined ? config.x : this.x();\r\n config.y = config.y !== undefined ? config.y : this.y();\r\n return Node.prototype._toKonvaCanvas.call(this, config);\r\n }\r\n _checkVisibility() {\r\n const visible = this.visible();\r\n if (visible) {\r\n this.canvas._canvas.style.display = 'block';\r\n }\r\n else {\r\n this.canvas._canvas.style.display = 'none';\r\n }\r\n }\r\n _setSmoothEnabled() {\r\n this.getContext()._context.imageSmoothingEnabled =\r\n this.imageSmoothingEnabled();\r\n }\r\n /**\r\n * get/set width of layer. getter return width of stage. setter doing nothing.\r\n * if you want change width use `stage.width(value);`\r\n * @name Konva.Layer#width\r\n * @method\r\n * @returns {Number}\r\n * @example\r\n * var width = layer.width();\r\n */\r\n getWidth() {\r\n if (this.parent) {\r\n return this.parent.width();\r\n }\r\n }\r\n setWidth() {\r\n Util.warn('Can not change width of layer. Use \"stage.width(value)\" function instead.');\r\n }\r\n /**\r\n * get/set height of layer.getter return height of stage. setter doing nothing.\r\n * if you want change height use `stage.height(value);`\r\n * @name Konva.Layer#height\r\n * @method\r\n * @returns {Number}\r\n * @example\r\n * var height = layer.height();\r\n */\r\n getHeight() {\r\n if (this.parent) {\r\n return this.parent.height();\r\n }\r\n }\r\n setHeight() {\r\n Util.warn('Can not change height of layer. Use \"stage.height(value)\" function instead.');\r\n }\r\n /**\r\n * batch draw. this function will not do immediate draw\r\n * but it will schedule drawing to next tick (requestAnimFrame)\r\n * @method\r\n * @name Konva.Layer#batchDraw\r\n * @return {Konva.Layer} this\r\n */\r\n batchDraw() {\r\n if (!this._waitingForDraw) {\r\n this._waitingForDraw = true;\r\n Util.requestAnimFrame(() => {\r\n this.draw();\r\n this._waitingForDraw = false;\r\n });\r\n }\r\n return this;\r\n }\r\n /**\r\n * get visible intersection shape. This is the preferred\r\n * method for determining if a point intersects a shape or not\r\n * also you may pass optional selector parameter to return ancestor of intersected shape\r\n * @method\r\n * @name Konva.Layer#getIntersection\r\n * @param {Object} pos\r\n * @param {Number} pos.x\r\n * @param {Number} pos.y\r\n * @returns {Konva.Node}\r\n * @example\r\n * var shape = layer.getIntersection({x: 50, y: 50});\r\n */\r\n getIntersection(pos) {\r\n if (!this.isListening() || !this.isVisible()) {\r\n return null;\r\n }\r\n // in some cases antialiased area may be bigger than 1px\r\n // it is possible if we will cache node, then scale it a lot\r\n var spiralSearchDistance = 1;\r\n var continueSearch = false;\r\n while (true) {\r\n for (let i = 0; i < INTERSECTION_OFFSETS_LEN; i++) {\r\n const intersectionOffset = INTERSECTION_OFFSETS[i];\r\n const obj = this._getIntersection({\r\n x: pos.x + intersectionOffset.x * spiralSearchDistance,\r\n y: pos.y + intersectionOffset.y * spiralSearchDistance,\r\n });\r\n const shape = obj.shape;\r\n if (shape) {\r\n return shape;\r\n }\r\n // we should continue search if we found antialiased pixel\r\n // that means our node somewhere very close\r\n continueSearch = !!obj.antialiased;\r\n // stop search if found empty pixel\r\n if (!obj.antialiased) {\r\n break;\r\n }\r\n }\r\n // if no shape, and no antialiased pixel, we should end searching\r\n if (continueSearch) {\r\n spiralSearchDistance += 1;\r\n }\r\n else {\r\n return null;\r\n }\r\n }\r\n }\r\n _getIntersection(pos) {\r\n const ratio = this.hitCanvas.pixelRatio;\r\n const p = this.hitCanvas.context.getImageData(Math.round(pos.x * ratio), Math.round(pos.y * ratio), 1, 1).data;\r\n const p3 = p[3];\r\n // fully opaque pixel\r\n if (p3 === 255) {\r\n const colorKey = Util._rgbToHex(p[0], p[1], p[2]);\r\n const shape = shapes[HASH + colorKey];\r\n if (shape) {\r\n return {\r\n shape: shape,\r\n };\r\n }\r\n return {\r\n antialiased: true,\r\n };\r\n }\r\n else if (p3 > 0) {\r\n // antialiased pixel\r\n return {\r\n antialiased: true,\r\n };\r\n }\r\n // empty pixel\r\n return {};\r\n }\r\n drawScene(can, top) {\r\n var layer = this.getLayer(), canvas = can || (layer && layer.getCanvas());\r\n this._fire(BEFORE_DRAW, {\r\n node: this,\r\n });\r\n if (this.clearBeforeDraw()) {\r\n canvas.getContext().clear();\r\n }\r\n Container.prototype.drawScene.call(this, canvas, top);\r\n this._fire(DRAW, {\r\n node: this,\r\n });\r\n return this;\r\n }\r\n drawHit(can, top) {\r\n var layer = this.getLayer(), canvas = can || (layer && layer.hitCanvas);\r\n if (layer && layer.clearBeforeDraw()) {\r\n layer.getHitCanvas().getContext().clear();\r\n }\r\n Container.prototype.drawHit.call(this, canvas, top);\r\n return this;\r\n }\r\n /**\r\n * enable hit graph. **DEPRECATED!** Use `layer.listening(true)` instead.\r\n * @name Konva.Layer#enableHitGraph\r\n * @method\r\n * @returns {Layer}\r\n */\r\n enableHitGraph() {\r\n this.hitGraphEnabled(true);\r\n return this;\r\n }\r\n /**\r\n * disable hit graph. **DEPRECATED!** Use `layer.listening(false)` instead.\r\n * @name Konva.Layer#disableHitGraph\r\n * @method\r\n * @returns {Layer}\r\n */\r\n disableHitGraph() {\r\n this.hitGraphEnabled(false);\r\n return this;\r\n }\r\n setHitGraphEnabled(val) {\r\n Util.warn('hitGraphEnabled method is deprecated. Please use layer.listening() instead.');\r\n this.listening(val);\r\n }\r\n getHitGraphEnabled(val) {\r\n Util.warn('hitGraphEnabled method is deprecated. Please use layer.listening() instead.');\r\n return this.listening();\r\n }\r\n /**\r\n * Show or hide hit canvas over the stage. May be useful for debugging custom hitFunc\r\n * @name Konva.Layer#toggleHitCanvas\r\n * @method\r\n */\r\n toggleHitCanvas() {\r\n if (!this.parent || !this.parent['content']) {\r\n return;\r\n }\r\n var parent = this.parent;\r\n var added = !!this.hitCanvas._canvas.parentNode;\r\n if (added) {\r\n parent.content.removeChild(this.hitCanvas._canvas);\r\n }\r\n else {\r\n parent.content.appendChild(this.hitCanvas._canvas);\r\n }\r\n }\r\n destroy() {\r\n Util.releaseCanvas(this.getNativeCanvasElement(), this.getHitCanvas()._canvas);\r\n return super.destroy();\r\n }\r\n }\r\n Layer.prototype.nodeType = 'Layer';\r\n _registerNode(Layer);\r\n /**\r\n * get/set imageSmoothingEnabled flag\r\n * For more info see https://developer.mozilla.org/en-US/docs/Web/API/CanvasRenderingContext2D/imageSmoothingEnabled\r\n * @name Konva.Layer#imageSmoothingEnabled\r\n * @method\r\n * @param {Boolean} imageSmoothingEnabled\r\n * @returns {Boolean}\r\n * @example\r\n * // get imageSmoothingEnabled flag\r\n * var imageSmoothingEnabled = layer.imageSmoothingEnabled();\r\n *\r\n * layer.imageSmoothingEnabled(false);\r\n *\r\n * layer.imageSmoothingEnabled(true);\r\n */\r\n Factory.addGetterSetter(Layer, 'imageSmoothingEnabled', true);\r\n /**\r\n * get/set clearBeforeDraw flag which determines if the layer is cleared or not\r\n * before drawing\r\n * @name Konva.Layer#clearBeforeDraw\r\n * @method\r\n * @param {Boolean} clearBeforeDraw\r\n * @returns {Boolean}\r\n * @example\r\n * // get clearBeforeDraw flag\r\n * var clearBeforeDraw = layer.clearBeforeDraw();\r\n *\r\n * // disable clear before draw\r\n * layer.clearBeforeDraw(false);\r\n *\r\n * // enable clear before draw\r\n * layer.clearBeforeDraw(true);\r\n */\r\n Factory.addGetterSetter(Layer, 'clearBeforeDraw', true);\r\n Factory.addGetterSetter(Layer, 'hitGraphEnabled', true, getBooleanValidator());\r\n /**\r\n * get/set hitGraphEnabled flag. **DEPRECATED!** Use `layer.listening(false)` instead.\r\n * Disabling the hit graph will greatly increase\r\n * draw performance because the hit graph will not be redrawn each time the layer is\r\n * drawn. This, however, also disables mouse/touch event detection\r\n * @name Konva.Layer#hitGraphEnabled\r\n * @method\r\n * @param {Boolean} enabled\r\n * @returns {Boolean}\r\n * @example\r\n * // get hitGraphEnabled flag\r\n * var hitGraphEnabled = layer.hitGraphEnabled();\r\n *\r\n * // disable hit graph\r\n * layer.hitGraphEnabled(false);\r\n *\r\n * // enable hit graph\r\n * layer.hitGraphEnabled(true);\r\n */\n\n /**\r\n * FastLayer constructor. **DEPRECATED!** Please use `Konva.Layer({ listening: false})` instead. Layers are tied to their own canvas element and are used\r\n * to contain shapes only. If you don't need node nesting, mouse and touch interactions,\r\n * or event pub/sub, you should use FastLayer instead of Layer to create your layers.\r\n * It renders about 2x faster than normal layers.\r\n *\r\n * @constructor\r\n * @memberof Konva\r\n * @augments Konva.Layer\r\n * * @param {Object} [config.clip] set clip\n * @param {Number} [config.clipX] set clip x\n * @param {Number} [config.clipY] set clip y\n * @param {Number} [config.clipWidth] set clip width\n * @param {Number} [config.clipHeight] set clip height\n * @param {Function} [config.clipFunc] set clip func\n\r\n * @example\r\n * var layer = new Konva.FastLayer();\r\n */\r\n class FastLayer extends Layer {\r\n constructor(attrs) {\r\n super(attrs);\r\n this.listening(false);\r\n Util.warn('Konva.Fast layer is deprecated. Please use \"new Konva.Layer({ listening: false })\" instead.');\r\n }\r\n }\r\n FastLayer.prototype.nodeType = 'FastLayer';\r\n _registerNode(FastLayer);\n\n /**\r\n * Group constructor. Groups are used to contain shapes or other groups.\r\n * @constructor\r\n * @memberof Konva\r\n * @augments Konva.Container\r\n * @param {Object} config\r\n * @param {Number} [config.x]\n * @param {Number} [config.y]\n * @param {Number} [config.width]\n * @param {Number} [config.height]\n * @param {Boolean} [config.visible]\n * @param {Boolean} [config.listening] whether or not the node is listening for events\n * @param {String} [config.id] unique id\n * @param {String} [config.name] non-unique name\n * @param {Number} [config.opacity] determines node opacity. Can be any number between 0 and 1\n * @param {Object} [config.scale] set scale\n * @param {Number} [config.scaleX] set scale x\n * @param {Number} [config.scaleY] set scale y\n * @param {Number} [config.rotation] rotation in degrees\n * @param {Object} [config.offset] offset from center point and rotation point\n * @param {Number} [config.offsetX] set offset x\n * @param {Number} [config.offsetY] set offset y\n * @param {Boolean} [config.draggable] makes the node draggable. When stages are draggable, you can drag and drop\n * the entire stage by dragging any portion of the stage\n * @param {Number} [config.dragDistance]\n * @param {Function} [config.dragBoundFunc]\r\n * * @param {Object} [config.clip] set clip\n * @param {Number} [config.clipX] set clip x\n * @param {Number} [config.clipY] set clip y\n * @param {Number} [config.clipWidth] set clip width\n * @param {Number} [config.clipHeight] set clip height\n * @param {Function} [config.clipFunc] set clip func\n\r\n * @example\r\n * var group = new Konva.Group();\r\n */\r\n class Group extends Container {\r\n _validateAdd(child) {\r\n var type = child.getType();\r\n if (type !== 'Group' && type !== 'Shape') {\r\n Util.throw('You may only add groups and shapes to groups.');\r\n }\r\n }\r\n }\r\n Group.prototype.nodeType = 'Group';\r\n _registerNode(Group);\n\n var now = (function () {\r\n if (glob.performance && glob.performance.now) {\r\n return function () {\r\n return glob.performance.now();\r\n };\r\n }\r\n return function () {\r\n return new Date().getTime();\r\n };\r\n })();\r\n /**\r\n * Animation constructor.\r\n * @constructor\r\n * @memberof Konva\r\n * @param {AnimationFn} func function executed on each animation frame. The function is passed a frame object, which contains\r\n * timeDiff, lastTime, time, and frameRate properties. The timeDiff property is the number of milliseconds that have passed\r\n * since the last animation frame. The time property is the time in milliseconds that elapsed from the moment the animation started\r\n * to the current animation frame. The lastTime property is a `time` value from the previous frame. The frameRate property is the current frame rate in frames / second.\r\n * Return false from function, if you don't need to redraw layer/layers on some frames.\r\n * @param {Konva.Layer|Array} [layers] layer(s) to be redrawn on each animation frame. Can be a layer, an array of layers, or null.\r\n * Not specifying a node will result in no redraw.\r\n * @example\r\n * // move a node to the right at 50 pixels / second\r\n * var velocity = 50;\r\n *\r\n * var anim = new Konva.Animation(function(frame) {\r\n * var dist = velocity * (frame.timeDiff / 1000);\r\n * node.move({x: dist, y: 0});\r\n * }, layer);\r\n *\r\n * anim.start();\r\n */\r\n class Animation {\r\n constructor(func, layers) {\r\n this.id = Animation.animIdCounter++;\r\n this.frame = {\r\n time: 0,\r\n timeDiff: 0,\r\n lastTime: now(),\r\n frameRate: 0,\r\n };\r\n this.func = func;\r\n this.setLayers(layers);\r\n }\r\n /**\r\n * set layers to be redrawn on each animation frame\r\n * @method\r\n * @name Konva.Animation#setLayers\r\n * @param {Konva.Layer|Array} [layers] layer(s) to be redrawn. Can be a layer, an array of layers, or null. Not specifying a node will result in no redraw.\r\n * @return {Konva.Animation} this\r\n */\r\n setLayers(layers) {\r\n var lays = [];\r\n // if passing in no layers\r\n if (!layers) {\r\n lays = [];\r\n }\r\n else if (layers.length > 0) {\r\n // if passing in an array of Layers\r\n // NOTE: layers could be an array. for simplicity, I'm just inspecting\r\n // the length property to check for both cases\r\n lays = layers;\r\n }\r\n else {\r\n // if passing in a Layer\r\n lays = [layers];\r\n }\r\n this.layers = lays;\r\n return this;\r\n }\r\n /**\r\n * get layers\r\n * @method\r\n * @name Konva.Animation#getLayers\r\n * @return {Array} Array of Konva.Layer\r\n */\r\n getLayers() {\r\n return this.layers;\r\n }\r\n /**\r\n * add layer. Returns true if the layer was added, and false if it was not\r\n * @method\r\n * @name Konva.Animation#addLayer\r\n * @param {Konva.Layer} layer to add\r\n * @return {Bool} true if layer is added to animation, otherwise false\r\n */\r\n addLayer(layer) {\r\n var layers = this.layers, len = layers.length, n;\r\n // don't add the layer if it already exists\r\n for (n = 0; n < len; n++) {\r\n if (layers[n]._id === layer._id) {\r\n return false;\r\n }\r\n }\r\n this.layers.push(layer);\r\n return true;\r\n }\r\n /**\r\n * determine if animation is running or not. returns true or false\r\n * @method\r\n * @name Konva.Animation#isRunning\r\n * @return {Bool} is animation running?\r\n */\r\n isRunning() {\r\n var a = Animation, animations = a.animations, len = animations.length, n;\r\n for (n = 0; n < len; n++) {\r\n if (animations[n].id === this.id) {\r\n return true;\r\n }\r\n }\r\n return false;\r\n }\r\n /**\r\n * start animation\r\n * @method\r\n * @name Konva.Animation#start\r\n * @return {Konva.Animation} this\r\n */\r\n start() {\r\n this.stop();\r\n this.frame.timeDiff = 0;\r\n this.frame.lastTime = now();\r\n Animation._addAnimation(this);\r\n return this;\r\n }\r\n /**\r\n * stop animation\r\n * @method\r\n * @name Konva.Animation#stop\r\n * @return {Konva.Animation} this\r\n */\r\n stop() {\r\n Animation._removeAnimation(this);\r\n return this;\r\n }\r\n _updateFrameObject(time) {\r\n this.frame.timeDiff = time - this.frame.lastTime;\r\n this.frame.lastTime = time;\r\n this.frame.time += this.frame.timeDiff;\r\n this.frame.frameRate = 1000 / this.frame.timeDiff;\r\n }\r\n static _addAnimation(anim) {\r\n this.animations.push(anim);\r\n this._handleAnimation();\r\n }\r\n static _removeAnimation(anim) {\r\n var id = anim.id, animations = this.animations, len = animations.length, n;\r\n for (n = 0; n < len; n++) {\r\n if (animations[n].id === id) {\r\n this.animations.splice(n, 1);\r\n break;\r\n }\r\n }\r\n }\r\n static _runFrames() {\r\n var layerHash = {}, animations = this.animations, anim, layers, func, n, i, layersLen, layer, key, needRedraw;\r\n /*\r\n * loop through all animations and execute animation\r\n * function. if the animation object has specified node,\r\n * we can add the node to the nodes hash to eliminate\r\n * drawing the same node multiple times. The node property\r\n * can be the stage itself or a layer\r\n */\r\n /*\r\n * WARNING: don't cache animations.length because it could change while\r\n * the for loop is running, causing a JS error\r\n */\r\n for (n = 0; n < animations.length; n++) {\r\n anim = animations[n];\r\n layers = anim.layers;\r\n func = anim.func;\r\n anim._updateFrameObject(now());\r\n layersLen = layers.length;\r\n // if animation object has a function, execute it\r\n if (func) {\r\n // allow anim bypassing drawing\r\n needRedraw = func.call(anim, anim.frame) !== false;\r\n }\r\n else {\r\n needRedraw = true;\r\n }\r\n if (!needRedraw) {\r\n continue;\r\n }\r\n for (i = 0; i < layersLen; i++) {\r\n layer = layers[i];\r\n if (layer._id !== undefined) {\r\n layerHash[layer._id] = layer;\r\n }\r\n }\r\n }\r\n for (key in layerHash) {\r\n if (!layerHash.hasOwnProperty(key)) {\r\n continue;\r\n }\r\n layerHash[key].batchDraw();\r\n }\r\n }\r\n static _animationLoop() {\r\n var Anim = Animation;\r\n if (Anim.animations.length) {\r\n Anim._runFrames();\r\n Util.requestAnimFrame(Anim._animationLoop);\r\n }\r\n else {\r\n Anim.animRunning = false;\r\n }\r\n }\r\n static _handleAnimation() {\r\n if (!this.animRunning) {\r\n this.animRunning = true;\r\n Util.requestAnimFrame(this._animationLoop);\r\n }\r\n }\r\n }\r\n Animation.animations = [];\r\n Animation.animIdCounter = 0;\r\n Animation.animRunning = false;\n\n var blacklist = {\r\n node: 1,\r\n duration: 1,\r\n easing: 1,\r\n onFinish: 1,\r\n yoyo: 1,\r\n }, PAUSED = 1, PLAYING = 2, REVERSING = 3, idCounter = 0, colorAttrs = ['fill', 'stroke', 'shadowColor'];\r\n class TweenEngine {\r\n constructor(prop, propFunc, func, begin, finish, duration, yoyo) {\r\n this.prop = prop;\r\n this.propFunc = propFunc;\r\n this.begin = begin;\r\n this._pos = begin;\r\n this.duration = duration;\r\n this._change = 0;\r\n this.prevPos = 0;\r\n this.yoyo = yoyo;\r\n this._time = 0;\r\n this._position = 0;\r\n this._startTime = 0;\r\n this._finish = 0;\r\n this.func = func;\r\n this._change = finish - this.begin;\r\n this.pause();\r\n }\r\n fire(str) {\r\n var handler = this[str];\r\n if (handler) {\r\n handler();\r\n }\r\n }\r\n setTime(t) {\r\n if (t > this.duration) {\r\n if (this.yoyo) {\r\n this._time = this.duration;\r\n this.reverse();\r\n }\r\n else {\r\n this.finish();\r\n }\r\n }\r\n else if (t < 0) {\r\n if (this.yoyo) {\r\n this._time = 0;\r\n this.play();\r\n }\r\n else {\r\n this.reset();\r\n }\r\n }\r\n else {\r\n this._time = t;\r\n this.update();\r\n }\r\n }\r\n getTime() {\r\n return this._time;\r\n }\r\n setPosition(p) {\r\n this.prevPos = this._pos;\r\n this.propFunc(p);\r\n this._pos = p;\r\n }\r\n getPosition(t) {\r\n if (t === undefined) {\r\n t = this._time;\r\n }\r\n return this.func(t, this.begin, this._change, this.duration);\r\n }\r\n play() {\r\n this.state = PLAYING;\r\n this._startTime = this.getTimer() - this._time;\r\n this.onEnterFrame();\r\n this.fire('onPlay');\r\n }\r\n reverse() {\r\n this.state = REVERSING;\r\n this._time = this.duration - this._time;\r\n this._startTime = this.getTimer() - this._time;\r\n this.onEnterFrame();\r\n this.fire('onReverse');\r\n }\r\n seek(t) {\r\n this.pause();\r\n this._time = t;\r\n this.update();\r\n this.fire('onSeek');\r\n }\r\n reset() {\r\n this.pause();\r\n this._time = 0;\r\n this.update();\r\n this.fire('onReset');\r\n }\r\n finish() {\r\n this.pause();\r\n this._time = this.duration;\r\n this.update();\r\n this.fire('onFinish');\r\n }\r\n update() {\r\n this.setPosition(this.getPosition(this._time));\r\n this.fire('onUpdate');\r\n }\r\n onEnterFrame() {\r\n var t = this.getTimer() - this._startTime;\r\n if (this.state === PLAYING) {\r\n this.setTime(t);\r\n }\r\n else if (this.state === REVERSING) {\r\n this.setTime(this.duration - t);\r\n }\r\n }\r\n pause() {\r\n this.state = PAUSED;\r\n this.fire('onPause');\r\n }\r\n getTimer() {\r\n return new Date().getTime();\r\n }\r\n }\r\n /**\r\n * Tween constructor. Tweens enable you to animate a node between the current state and a new state.\r\n * You can play, pause, reverse, seek, reset, and finish tweens. By default, tweens are animated using\r\n * a linear easing. For more tweening options, check out {@link Konva.Easings}\r\n * @constructor\r\n * @memberof Konva\r\n * @example\r\n * // instantiate new tween which fully rotates a node in 1 second\r\n * var tween = new Konva.Tween({\r\n * // list of tween specific properties\r\n * node: node,\r\n * duration: 1,\r\n * easing: Konva.Easings.EaseInOut,\r\n * onUpdate: () => console.log('node attrs updated')\r\n * onFinish: () => console.log('finished'),\r\n * // set new values for any attributes of a passed node\r\n * rotation: 360,\r\n * fill: 'red'\r\n * });\r\n *\r\n * // play tween\r\n * tween.play();\r\n *\r\n * // pause tween\r\n * tween.pause();\r\n */\r\n class Tween {\r\n constructor(config) {\r\n var that = this, node = config.node, nodeId = node._id, duration, easing = config.easing || Easings.Linear, yoyo = !!config.yoyo, key;\r\n if (typeof config.duration === 'undefined') {\r\n duration = 0.3;\r\n }\r\n else if (config.duration === 0) {\r\n // zero is bad value for duration\r\n duration = 0.001;\r\n }\r\n else {\r\n duration = config.duration;\r\n }\r\n this.node = node;\r\n this._id = idCounter++;\r\n var layers = node.getLayer() ||\r\n (node instanceof Konva$2['Stage'] ? node.getLayers() : null);\r\n if (!layers) {\r\n Util.error('Tween constructor have `node` that is not in a layer. Please add node into layer first.');\r\n }\r\n this.anim = new Animation(function () {\r\n that.tween.onEnterFrame();\r\n }, layers);\r\n this.tween = new TweenEngine(key, function (i) {\r\n that._tweenFunc(i);\r\n }, easing, 0, 1, duration * 1000, yoyo);\r\n this._addListeners();\r\n // init attrs map\r\n if (!Tween.attrs[nodeId]) {\r\n Tween.attrs[nodeId] = {};\r\n }\r\n if (!Tween.attrs[nodeId][this._id]) {\r\n Tween.attrs[nodeId][this._id] = {};\r\n }\r\n // init tweens map\r\n if (!Tween.tweens[nodeId]) {\r\n Tween.tweens[nodeId] = {};\r\n }\r\n for (key in config) {\r\n if (blacklist[key] === undefined) {\r\n this._addAttr(key, config[key]);\r\n }\r\n }\r\n this.reset();\r\n // callbacks\r\n this.onFinish = config.onFinish;\r\n this.onReset = config.onReset;\r\n this.onUpdate = config.onUpdate;\r\n }\r\n _addAttr(key, end) {\r\n var node = this.node, nodeId = node._id, start, diff, tweenId, n, len, trueEnd, trueStart, endRGBA;\r\n // remove conflict from tween map if it exists\r\n tweenId = Tween.tweens[nodeId][key];\r\n if (tweenId) {\r\n delete Tween.attrs[nodeId][tweenId][key];\r\n }\r\n // add to tween map\r\n start = node.getAttr(key);\r\n if (Util._isArray(end)) {\r\n diff = [];\r\n len = Math.max(end.length, start.length);\r\n if (key === 'points' && end.length !== start.length) {\r\n // before tweening points we need to make sure that start.length === end.length\r\n // Util._prepareArrayForTween thinking that end.length > start.length\r\n if (end.length > start.length) {\r\n // so in this case we will increase number of starting points\r\n trueStart = start;\r\n start = Util._prepareArrayForTween(start, end, node.closed());\r\n }\r\n else {\r\n // in this case we will increase number of eding points\r\n trueEnd = end;\r\n end = Util._prepareArrayForTween(end, start, node.closed());\r\n }\r\n }\r\n if (key.indexOf('fill') === 0) {\r\n for (n = 0; n < len; n++) {\r\n if (n % 2 === 0) {\r\n diff.push(end[n] - start[n]);\r\n }\r\n else {\r\n var startRGBA = Util.colorToRGBA(start[n]);\r\n endRGBA = Util.colorToRGBA(end[n]);\r\n start[n] = startRGBA;\r\n diff.push({\r\n r: endRGBA.r - startRGBA.r,\r\n g: endRGBA.g - startRGBA.g,\r\n b: endRGBA.b - startRGBA.b,\r\n a: endRGBA.a - startRGBA.a,\r\n });\r\n }\r\n }\r\n }\r\n else {\r\n for (n = 0; n < len; n++) {\r\n diff.push(end[n] - start[n]);\r\n }\r\n }\r\n }\r\n else if (colorAttrs.indexOf(key) !== -1) {\r\n start = Util.colorToRGBA(start);\r\n endRGBA = Util.colorToRGBA(end);\r\n diff = {\r\n r: endRGBA.r - start.r,\r\n g: endRGBA.g - start.g,\r\n b: endRGBA.b - start.b,\r\n a: endRGBA.a - start.a,\r\n };\r\n }\r\n else {\r\n diff = end - start;\r\n }\r\n Tween.attrs[nodeId][this._id][key] = {\r\n start: start,\r\n diff: diff,\r\n end: end,\r\n trueEnd: trueEnd,\r\n trueStart: trueStart,\r\n };\r\n Tween.tweens[nodeId][key] = this._id;\r\n }\r\n _tweenFunc(i) {\r\n var node = this.node, attrs = Tween.attrs[node._id][this._id], key, attr, start, diff, newVal, n, len, end;\r\n for (key in attrs) {\r\n attr = attrs[key];\r\n start = attr.start;\r\n diff = attr.diff;\r\n end = attr.end;\r\n if (Util._isArray(start)) {\r\n newVal = [];\r\n len = Math.max(start.length, end.length);\r\n if (key.indexOf('fill') === 0) {\r\n for (n = 0; n < len; n++) {\r\n if (n % 2 === 0) {\r\n newVal.push((start[n] || 0) + diff[n] * i);\r\n }\r\n else {\r\n newVal.push('rgba(' +\r\n Math.round(start[n].r + diff[n].r * i) +\r\n ',' +\r\n Math.round(start[n].g + diff[n].g * i) +\r\n ',' +\r\n Math.round(start[n].b + diff[n].b * i) +\r\n ',' +\r\n (start[n].a + diff[n].a * i) +\r\n ')');\r\n }\r\n }\r\n }\r\n else {\r\n for (n = 0; n < len; n++) {\r\n newVal.push((start[n] || 0) + diff[n] * i);\r\n }\r\n }\r\n }\r\n else if (colorAttrs.indexOf(key) !== -1) {\r\n newVal =\r\n 'rgba(' +\r\n Math.round(start.r + diff.r * i) +\r\n ',' +\r\n Math.round(start.g + diff.g * i) +\r\n ',' +\r\n Math.round(start.b + diff.b * i) +\r\n ',' +\r\n (start.a + diff.a * i) +\r\n ')';\r\n }\r\n else {\r\n newVal = start + diff * i;\r\n }\r\n node.setAttr(key, newVal);\r\n }\r\n }\r\n _addListeners() {\r\n // start listeners\r\n this.tween.onPlay = () => {\r\n this.anim.start();\r\n };\r\n this.tween.onReverse = () => {\r\n this.anim.start();\r\n };\r\n // stop listeners\r\n this.tween.onPause = () => {\r\n this.anim.stop();\r\n };\r\n this.tween.onFinish = () => {\r\n var node = this.node;\r\n // after tweening points of line we need to set original end\r\n var attrs = Tween.attrs[node._id][this._id];\r\n if (attrs.points && attrs.points.trueEnd) {\r\n node.setAttr('points', attrs.points.trueEnd);\r\n }\r\n if (this.onFinish) {\r\n this.onFinish.call(this);\r\n }\r\n };\r\n this.tween.onReset = () => {\r\n var node = this.node;\r\n // after tweening points of line we need to set original start\r\n var attrs = Tween.attrs[node._id][this._id];\r\n if (attrs.points && attrs.points.trueStart) {\r\n node.points(attrs.points.trueStart);\r\n }\r\n if (this.onReset) {\r\n this.onReset();\r\n }\r\n };\r\n this.tween.onUpdate = () => {\r\n if (this.onUpdate) {\r\n this.onUpdate.call(this);\r\n }\r\n };\r\n }\r\n /**\r\n * play\r\n * @method\r\n * @name Konva.Tween#play\r\n * @returns {Tween}\r\n */\r\n play() {\r\n this.tween.play();\r\n return this;\r\n }\r\n /**\r\n * reverse\r\n * @method\r\n * @name Konva.Tween#reverse\r\n * @returns {Tween}\r\n */\r\n reverse() {\r\n this.tween.reverse();\r\n return this;\r\n }\r\n /**\r\n * reset\r\n * @method\r\n * @name Konva.Tween#reset\r\n * @returns {Tween}\r\n */\r\n reset() {\r\n this.tween.reset();\r\n return this;\r\n }\r\n /**\r\n * seek\r\n * @method\r\n * @name Konva.Tween#seek(\r\n * @param {Integer} t time in seconds between 0 and the duration\r\n * @returns {Tween}\r\n */\r\n seek(t) {\r\n this.tween.seek(t * 1000);\r\n return this;\r\n }\r\n /**\r\n * pause\r\n * @method\r\n * @name Konva.Tween#pause\r\n * @returns {Tween}\r\n */\r\n pause() {\r\n this.tween.pause();\r\n return this;\r\n }\r\n /**\r\n * finish\r\n * @method\r\n * @name Konva.Tween#finish\r\n * @returns {Tween}\r\n */\r\n finish() {\r\n this.tween.finish();\r\n return this;\r\n }\r\n /**\r\n * destroy\r\n * @method\r\n * @name Konva.Tween#destroy\r\n */\r\n destroy() {\r\n var nodeId = this.node._id, thisId = this._id, attrs = Tween.tweens[nodeId], key;\r\n this.pause();\r\n for (key in attrs) {\r\n delete Tween.tweens[nodeId][key];\r\n }\r\n delete Tween.attrs[nodeId][thisId];\r\n }\r\n }\r\n Tween.attrs = {};\r\n Tween.tweens = {};\r\n /**\r\n * Tween node properties. Shorter usage of {@link Konva.Tween} object.\r\n *\r\n * @method Konva.Node#to\r\n * @param {Object} [params] tween params\r\n * @example\r\n *\r\n * circle.to({\r\n * x : 50,\r\n * duration : 0.5,\r\n * onUpdate: () => console.log('props updated'),\r\n * onFinish: () => console.log('finished'),\r\n * });\r\n */\r\n Node.prototype.to = function (params) {\r\n var onFinish = params.onFinish;\r\n params.node = this;\r\n params.onFinish = function () {\r\n this.destroy();\r\n if (onFinish) {\r\n onFinish();\r\n }\r\n };\r\n var tween = new Tween(params);\r\n tween.play();\r\n };\r\n /*\r\n * These eases were ported from an Adobe Flash tweening library to JavaScript\r\n * by Xaric\r\n */\r\n /**\r\n * @namespace Easings\r\n * @memberof Konva\r\n */\r\n const Easings = {\r\n /**\r\n * back ease in\r\n * @function\r\n * @memberof Konva.Easings\r\n */\r\n BackEaseIn(t, b, c, d) {\r\n var s = 1.70158;\r\n return c * (t /= d) * t * ((s + 1) * t - s) + b;\r\n },\r\n /**\r\n * back ease out\r\n * @function\r\n * @memberof Konva.Easings\r\n */\r\n BackEaseOut(t, b, c, d) {\r\n var s = 1.70158;\r\n return c * ((t = t / d - 1) * t * ((s + 1) * t + s) + 1) + b;\r\n },\r\n /**\r\n * back ease in out\r\n * @function\r\n * @memberof Konva.Easings\r\n */\r\n BackEaseInOut(t, b, c, d) {\r\n var s = 1.70158;\r\n if ((t /= d / 2) < 1) {\r\n return (c / 2) * (t * t * (((s *= 1.525) + 1) * t - s)) + b;\r\n }\r\n return (c / 2) * ((t -= 2) * t * (((s *= 1.525) + 1) * t + s) + 2) + b;\r\n },\r\n /**\r\n * elastic ease in\r\n * @function\r\n * @memberof Konva.Easings\r\n */\r\n ElasticEaseIn(t, b, c, d, a, p) {\r\n // added s = 0\r\n var s = 0;\r\n if (t === 0) {\r\n return b;\r\n }\r\n if ((t /= d) === 1) {\r\n return b + c;\r\n }\r\n if (!p) {\r\n p = d * 0.3;\r\n }\r\n if (!a || a < Math.abs(c)) {\r\n a = c;\r\n s = p / 4;\r\n }\r\n else {\r\n s = (p / (2 * Math.PI)) * Math.asin(c / a);\r\n }\r\n return (-(a *\r\n Math.pow(2, 10 * (t -= 1)) *\r\n Math.sin(((t * d - s) * (2 * Math.PI)) / p)) + b);\r\n },\r\n /**\r\n * elastic ease out\r\n * @function\r\n * @memberof Konva.Easings\r\n */\r\n ElasticEaseOut(t, b, c, d, a, p) {\r\n // added s = 0\r\n var s = 0;\r\n if (t === 0) {\r\n return b;\r\n }\r\n if ((t /= d) === 1) {\r\n return b + c;\r\n }\r\n if (!p) {\r\n p = d * 0.3;\r\n }\r\n if (!a || a < Math.abs(c)) {\r\n a = c;\r\n s = p / 4;\r\n }\r\n else {\r\n s = (p / (2 * Math.PI)) * Math.asin(c / a);\r\n }\r\n return (a * Math.pow(2, -10 * t) * Math.sin(((t * d - s) * (2 * Math.PI)) / p) +\r\n c +\r\n b);\r\n },\r\n /**\r\n * elastic ease in out\r\n * @function\r\n * @memberof Konva.Easings\r\n */\r\n ElasticEaseInOut(t, b, c, d, a, p) {\r\n // added s = 0\r\n var s = 0;\r\n if (t === 0) {\r\n return b;\r\n }\r\n if ((t /= d / 2) === 2) {\r\n return b + c;\r\n }\r\n if (!p) {\r\n p = d * (0.3 * 1.5);\r\n }\r\n if (!a || a < Math.abs(c)) {\r\n a = c;\r\n s = p / 4;\r\n }\r\n else {\r\n s = (p / (2 * Math.PI)) * Math.asin(c / a);\r\n }\r\n if (t < 1) {\r\n return (-0.5 *\r\n (a *\r\n Math.pow(2, 10 * (t -= 1)) *\r\n Math.sin(((t * d - s) * (2 * Math.PI)) / p)) +\r\n b);\r\n }\r\n return (a *\r\n Math.pow(2, -10 * (t -= 1)) *\r\n Math.sin(((t * d - s) * (2 * Math.PI)) / p) *\r\n 0.5 +\r\n c +\r\n b);\r\n },\r\n /**\r\n * bounce ease out\r\n * @function\r\n * @memberof Konva.Easings\r\n */\r\n BounceEaseOut(t, b, c, d) {\r\n if ((t /= d) < 1 / 2.75) {\r\n return c * (7.5625 * t * t) + b;\r\n }\r\n else if (t < 2 / 2.75) {\r\n return c * (7.5625 * (t -= 1.5 / 2.75) * t + 0.75) + b;\r\n }\r\n else if (t < 2.5 / 2.75) {\r\n return c * (7.5625 * (t -= 2.25 / 2.75) * t + 0.9375) + b;\r\n }\r\n else {\r\n return c * (7.5625 * (t -= 2.625 / 2.75) * t + 0.984375) + b;\r\n }\r\n },\r\n /**\r\n * bounce ease in\r\n * @function\r\n * @memberof Konva.Easings\r\n */\r\n BounceEaseIn(t, b, c, d) {\r\n return c - Easings.BounceEaseOut(d - t, 0, c, d) + b;\r\n },\r\n /**\r\n * bounce ease in out\r\n * @function\r\n * @memberof Konva.Easings\r\n */\r\n BounceEaseInOut(t, b, c, d) {\r\n if (t < d / 2) {\r\n return Easings.BounceEaseIn(t * 2, 0, c, d) * 0.5 + b;\r\n }\r\n else {\r\n return Easings.BounceEaseOut(t * 2 - d, 0, c, d) * 0.5 + c * 0.5 + b;\r\n }\r\n },\r\n /**\r\n * ease in\r\n * @function\r\n * @memberof Konva.Easings\r\n */\r\n EaseIn(t, b, c, d) {\r\n return c * (t /= d) * t + b;\r\n },\r\n /**\r\n * ease out\r\n * @function\r\n * @memberof Konva.Easings\r\n */\r\n EaseOut(t, b, c, d) {\r\n return -c * (t /= d) * (t - 2) + b;\r\n },\r\n /**\r\n * ease in out\r\n * @function\r\n * @memberof Konva.Easings\r\n */\r\n EaseInOut(t, b, c, d) {\r\n if ((t /= d / 2) < 1) {\r\n return (c / 2) * t * t + b;\r\n }\r\n return (-c / 2) * (--t * (t - 2) - 1) + b;\r\n },\r\n /**\r\n * strong ease in\r\n * @function\r\n * @memberof Konva.Easings\r\n */\r\n StrongEaseIn(t, b, c, d) {\r\n return c * (t /= d) * t * t * t * t + b;\r\n },\r\n /**\r\n * strong ease out\r\n * @function\r\n * @memberof Konva.Easings\r\n */\r\n StrongEaseOut(t, b, c, d) {\r\n return c * ((t = t / d - 1) * t * t * t * t + 1) + b;\r\n },\r\n /**\r\n * strong ease in out\r\n * @function\r\n * @memberof Konva.Easings\r\n */\r\n StrongEaseInOut(t, b, c, d) {\r\n if ((t /= d / 2) < 1) {\r\n return (c / 2) * t * t * t * t * t + b;\r\n }\r\n return (c / 2) * ((t -= 2) * t * t * t * t + 2) + b;\r\n },\r\n /**\r\n * linear\r\n * @function\r\n * @memberof Konva.Easings\r\n */\r\n Linear(t, b, c, d) {\r\n return (c * t) / d + b;\r\n },\r\n };\n\n // what is core parts of Konva?\r\n const Konva$1 = Util._assign(Konva$2, {\r\n Util,\r\n Transform,\r\n Node,\r\n Container,\r\n Stage,\r\n stages,\r\n Layer,\r\n FastLayer,\r\n Group,\r\n DD,\r\n Shape,\r\n shapes,\r\n Animation,\r\n Tween,\r\n Easings,\r\n Context,\r\n Canvas,\r\n });\n\n /**\r\n * Arc constructor\r\n * @constructor\r\n * @memberof Konva\r\n * @augments Konva.Shape\r\n * @param {Object} config\r\n * @param {Number} config.angle in degrees\r\n * @param {Number} config.innerRadius\r\n * @param {Number} config.outerRadius\r\n * @param {Boolean} [config.clockwise]\r\n * @param {String} [config.fill] fill color\n * @param {Image} [config.fillPatternImage] fill pattern image\n * @param {Number} [config.fillPatternX]\n * @param {Number} [config.fillPatternY]\n * @param {Object} [config.fillPatternOffset] object with x and y component\n * @param {Number} [config.fillPatternOffsetX] \n * @param {Number} [config.fillPatternOffsetY] \n * @param {Object} [config.fillPatternScale] object with x and y component\n * @param {Number} [config.fillPatternScaleX]\n * @param {Number} [config.fillPatternScaleY]\n * @param {Number} [config.fillPatternRotation]\n * @param {String} [config.fillPatternRepeat] can be \"repeat\", \"repeat-x\", \"repeat-y\", or \"no-repeat\". The default is \"no-repeat\"\n * @param {Object} [config.fillLinearGradientStartPoint] object with x and y component\n * @param {Number} [config.fillLinearGradientStartPointX]\n * @param {Number} [config.fillLinearGradientStartPointY]\n * @param {Object} [config.fillLinearGradientEndPoint] object with x and y component\n * @param {Number} [config.fillLinearGradientEndPointX]\n * @param {Number} [config.fillLinearGradientEndPointY]\n * @param {Array} [config.fillLinearGradientColorStops] array of color stops\n * @param {Object} [config.fillRadialGradientStartPoint] object with x and y component\n * @param {Number} [config.fillRadialGradientStartPointX]\n * @param {Number} [config.fillRadialGradientStartPointY]\n * @param {Object} [config.fillRadialGradientEndPoint] object with x and y component\n * @param {Number} [config.fillRadialGradientEndPointX] \n * @param {Number} [config.fillRadialGradientEndPointY] \n * @param {Number} [config.fillRadialGradientStartRadius]\n * @param {Number} [config.fillRadialGradientEndRadius]\n * @param {Array} [config.fillRadialGradientColorStops] array of color stops\n * @param {Boolean} [config.fillEnabled] flag which enables or disables the fill. The default value is true\n * @param {String} [config.fillPriority] can be color, linear-gradient, radial-graident, or pattern. The default value is color. The fillPriority property makes it really easy to toggle between different fill types. For example, if you want to toggle between a fill color style and a fill pattern style, simply set the fill property and the fillPattern properties, and then use setFillPriority('color') to render the shape with a color fill, or use setFillPriority('pattern') to render the shape with the pattern fill configuration\n * @param {String} [config.stroke] stroke color\n * @param {Number} [config.strokeWidth] stroke width\n * @param {Boolean} [config.fillAfterStrokeEnabled]. Should we draw fill AFTER stroke? Default is false.\n * @param {Number} [config.hitStrokeWidth] size of the stroke on hit canvas. The default is \"auto\" - equals to strokeWidth\n * @param {Boolean} [config.strokeHitEnabled] flag which enables or disables stroke hit region. The default is true\n * @param {Boolean} [config.perfectDrawEnabled] flag which enables or disables using buffer canvas. The default is true\n * @param {Boolean} [config.shadowForStrokeEnabled] flag which enables or disables shadow for stroke. The default is true\n * @param {Boolean} [config.strokeScaleEnabled] flag which enables or disables stroke scale. The default is true\n * @param {Boolean} [config.strokeEnabled] flag which enables or disables the stroke. The default value is true\n * @param {String} [config.lineJoin] can be miter, round, or bevel. The default\n * is miter\n * @param {String} [config.lineCap] can be butt, round, or square. The default\n * is butt\n * @param {String} [config.shadowColor]\n * @param {Number} [config.shadowBlur]\n * @param {Object} [config.shadowOffset] object with x and y component\n * @param {Number} [config.shadowOffsetX]\n * @param {Number} [config.shadowOffsetY]\n * @param {Number} [config.shadowOpacity] shadow opacity. Can be any real number\n * between 0 and 1\n * @param {Boolean} [config.shadowEnabled] flag which enables or disables the shadow. The default value is true\n * @param {Array} [config.dash]\n * @param {Boolean} [config.dashEnabled] flag which enables or disables the dashArray. The default value is true\n\r\n * @param {Number} [config.x]\n * @param {Number} [config.y]\n * @param {Number} [config.width]\n * @param {Number} [config.height]\n * @param {Boolean} [config.visible]\n * @param {Boolean} [config.listening] whether or not the node is listening for events\n * @param {String} [config.id] unique id\n * @param {String} [config.name] non-unique name\n * @param {Number} [config.opacity] determines node opacity. Can be any number between 0 and 1\n * @param {Object} [config.scale] set scale\n * @param {Number} [config.scaleX] set scale x\n * @param {Number} [config.scaleY] set scale y\n * @param {Number} [config.rotation] rotation in degrees\n * @param {Object} [config.offset] offset from center point and rotation point\n * @param {Number} [config.offsetX] set offset x\n * @param {Number} [config.offsetY] set offset y\n * @param {Boolean} [config.draggable] makes the node draggable. When stages are draggable, you can drag and drop\n * the entire stage by dragging any portion of the stage\n * @param {Number} [config.dragDistance]\n * @param {Function} [config.dragBoundFunc]\r\n * @example\r\n * // draw a Arc that's pointing downwards\r\n * var arc = new Konva.Arc({\r\n * innerRadius: 40,\r\n * outerRadius: 80,\r\n * fill: 'red',\r\n * stroke: 'black'\r\n * strokeWidth: 5,\r\n * angle: 60,\r\n * rotationDeg: -120\r\n * });\r\n */\r\n class Arc extends Shape {\r\n _sceneFunc(context) {\r\n var angle = Konva$2.getAngle(this.angle()), clockwise = this.clockwise();\r\n context.beginPath();\r\n context.arc(0, 0, this.outerRadius(), 0, angle, clockwise);\r\n context.arc(0, 0, this.innerRadius(), angle, 0, !clockwise);\r\n context.closePath();\r\n context.fillStrokeShape(this);\r\n }\r\n getWidth() {\r\n return this.outerRadius() * 2;\r\n }\r\n getHeight() {\r\n return this.outerRadius() * 2;\r\n }\r\n setWidth(width) {\r\n this.outerRadius(width / 2);\r\n }\r\n setHeight(height) {\r\n this.outerRadius(height / 2);\r\n }\r\n getSelfRect() {\r\n const innerRadius = this.innerRadius();\r\n const outerRadius = this.outerRadius();\r\n const clockwise = this.clockwise();\r\n const angle = Konva$2.getAngle(clockwise ? 360 - this.angle() : this.angle());\r\n const boundLeftRatio = Math.cos(Math.min(angle, Math.PI));\r\n const boundRightRatio = 1;\r\n const boundTopRatio = Math.sin(Math.min(Math.max(Math.PI, angle), (3 * Math.PI) / 2));\r\n const boundBottomRatio = Math.sin(Math.min(angle, Math.PI / 2));\r\n const boundLeft = boundLeftRatio * (boundLeftRatio > 0 ? innerRadius : outerRadius);\r\n const boundRight = boundRightRatio * (outerRadius );\r\n const boundTop = boundTopRatio * (boundTopRatio > 0 ? innerRadius : outerRadius);\r\n const boundBottom = boundBottomRatio * (boundBottomRatio > 0 ? outerRadius : innerRadius);\r\n return {\r\n x: boundLeft,\r\n y: clockwise ? -1 * boundBottom : boundTop,\r\n width: boundRight - boundLeft,\r\n height: boundBottom - boundTop,\r\n };\r\n }\r\n }\r\n Arc.prototype._centroid = true;\r\n Arc.prototype.className = 'Arc';\r\n Arc.prototype._attrsAffectingSize = ['innerRadius', 'outerRadius'];\r\n _registerNode(Arc);\r\n // add getters setters\r\n Factory.addGetterSetter(Arc, 'innerRadius', 0, getNumberValidator());\r\n /**\r\n * get/set innerRadius\r\n * @name Konva.Arc#innerRadius\r\n * @method\r\n * @param {Number} innerRadius\r\n * @returns {Number}\r\n * @example\r\n * // get inner radius\r\n * var innerRadius = arc.innerRadius();\r\n *\r\n * // set inner radius\r\n * arc.innerRadius(20);\r\n */\r\n Factory.addGetterSetter(Arc, 'outerRadius', 0, getNumberValidator());\r\n /**\r\n * get/set outerRadius\r\n * @name Konva.Arc#outerRadius\r\n * @method\r\n * @param {Number} outerRadius\r\n * @returns {Number}\r\n * @example\r\n * // get outer radius\r\n * var outerRadius = arc.outerRadius();\r\n *\r\n * // set outer radius\r\n * arc.outerRadius(20);\r\n */\r\n Factory.addGetterSetter(Arc, 'angle', 0, getNumberValidator());\r\n /**\r\n * get/set angle in degrees\r\n * @name Konva.Arc#angle\r\n * @method\r\n * @param {Number} angle\r\n * @returns {Number}\r\n * @example\r\n * // get angle\r\n * var angle = arc.angle();\r\n *\r\n * // set angle\r\n * arc.angle(20);\r\n */\r\n Factory.addGetterSetter(Arc, 'clockwise', false, getBooleanValidator());\r\n /**\r\n * get/set clockwise flag\r\n * @name Konva.Arc#clockwise\r\n * @method\r\n * @param {Boolean} clockwise\r\n * @returns {Boolean}\r\n * @example\r\n * // get clockwise flag\r\n * var clockwise = arc.clockwise();\r\n *\r\n * // draw arc counter-clockwise\r\n * arc.clockwise(false);\r\n *\r\n * // draw arc clockwise\r\n * arc.clockwise(true);\r\n */\n\n function getControlPoints(x0, y0, x1, y1, x2, y2, t) {\r\n var d01 = Math.sqrt(Math.pow(x1 - x0, 2) + Math.pow(y1 - y0, 2)), d12 = Math.sqrt(Math.pow(x2 - x1, 2) + Math.pow(y2 - y1, 2)), fa = (t * d01) / (d01 + d12), fb = (t * d12) / (d01 + d12), p1x = x1 - fa * (x2 - x0), p1y = y1 - fa * (y2 - y0), p2x = x1 + fb * (x2 - x0), p2y = y1 + fb * (y2 - y0);\r\n return [p1x, p1y, p2x, p2y];\r\n }\r\n function expandPoints(p, tension) {\r\n var len = p.length, allPoints = [], n, cp;\r\n for (n = 2; n < len - 2; n += 2) {\r\n cp = getControlPoints(p[n - 2], p[n - 1], p[n], p[n + 1], p[n + 2], p[n + 3], tension);\r\n if (isNaN(cp[0])) {\r\n continue;\r\n }\r\n allPoints.push(cp[0]);\r\n allPoints.push(cp[1]);\r\n allPoints.push(p[n]);\r\n allPoints.push(p[n + 1]);\r\n allPoints.push(cp[2]);\r\n allPoints.push(cp[3]);\r\n }\r\n return allPoints;\r\n }\r\n /**\r\n * Line constructor.  Lines are defined by an array of points and\r\n * a tension\r\n * @constructor\r\n * @memberof Konva\r\n * @augments Konva.Shape\r\n * @param {Object} config\r\n * @param {Array} config.points Flat array of points coordinates. You should define them as [x1, y1, x2, y2, x3, y3].\r\n * @param {Number} [config.tension] Higher values will result in a more curvy line. A value of 0 will result in no interpolation.\r\n * The default is 0\r\n * @param {Boolean} [config.closed] defines whether or not the line shape is closed, creating a polygon or blob\r\n * @param {Boolean} [config.bezier] if no tension is provided but bezier=true, we draw the line as a bezier using the passed points\r\n * @param {String} [config.fill] fill color\n * @param {Image} [config.fillPatternImage] fill pattern image\n * @param {Number} [config.fillPatternX]\n * @param {Number} [config.fillPatternY]\n * @param {Object} [config.fillPatternOffset] object with x and y component\n * @param {Number} [config.fillPatternOffsetX] \n * @param {Number} [config.fillPatternOffsetY] \n * @param {Object} [config.fillPatternScale] object with x and y component\n * @param {Number} [config.fillPatternScaleX]\n * @param {Number} [config.fillPatternScaleY]\n * @param {Number} [config.fillPatternRotation]\n * @param {String} [config.fillPatternRepeat] can be \"repeat\", \"repeat-x\", \"repeat-y\", or \"no-repeat\". The default is \"no-repeat\"\n * @param {Object} [config.fillLinearGradientStartPoint] object with x and y component\n * @param {Number} [config.fillLinearGradientStartPointX]\n * @param {Number} [config.fillLinearGradientStartPointY]\n * @param {Object} [config.fillLinearGradientEndPoint] object with x and y component\n * @param {Number} [config.fillLinearGradientEndPointX]\n * @param {Number} [config.fillLinearGradientEndPointY]\n * @param {Array} [config.fillLinearGradientColorStops] array of color stops\n * @param {Object} [config.fillRadialGradientStartPoint] object with x and y component\n * @param {Number} [config.fillRadialGradientStartPointX]\n * @param {Number} [config.fillRadialGradientStartPointY]\n * @param {Object} [config.fillRadialGradientEndPoint] object with x and y component\n * @param {Number} [config.fillRadialGradientEndPointX] \n * @param {Number} [config.fillRadialGradientEndPointY] \n * @param {Number} [config.fillRadialGradientStartRadius]\n * @param {Number} [config.fillRadialGradientEndRadius]\n * @param {Array} [config.fillRadialGradientColorStops] array of color stops\n * @param {Boolean} [config.fillEnabled] flag which enables or disables the fill. The default value is true\n * @param {String} [config.fillPriority] can be color, linear-gradient, radial-graident, or pattern. The default value is color. The fillPriority property makes it really easy to toggle between different fill types. For example, if you want to toggle between a fill color style and a fill pattern style, simply set the fill property and the fillPattern properties, and then use setFillPriority('color') to render the shape with a color fill, or use setFillPriority('pattern') to render the shape with the pattern fill configuration\n * @param {String} [config.stroke] stroke color\n * @param {Number} [config.strokeWidth] stroke width\n * @param {Boolean} [config.fillAfterStrokeEnabled]. Should we draw fill AFTER stroke? Default is false.\n * @param {Number} [config.hitStrokeWidth] size of the stroke on hit canvas. The default is \"auto\" - equals to strokeWidth\n * @param {Boolean} [config.strokeHitEnabled] flag which enables or disables stroke hit region. The default is true\n * @param {Boolean} [config.perfectDrawEnabled] flag which enables or disables using buffer canvas. The default is true\n * @param {Boolean} [config.shadowForStrokeEnabled] flag which enables or disables shadow for stroke. The default is true\n * @param {Boolean} [config.strokeScaleEnabled] flag which enables or disables stroke scale. The default is true\n * @param {Boolean} [config.strokeEnabled] flag which enables or disables the stroke. The default value is true\n * @param {String} [config.lineJoin] can be miter, round, or bevel. The default\n * is miter\n * @param {String} [config.lineCap] can be butt, round, or square. The default\n * is butt\n * @param {String} [config.shadowColor]\n * @param {Number} [config.shadowBlur]\n * @param {Object} [config.shadowOffset] object with x and y component\n * @param {Number} [config.shadowOffsetX]\n * @param {Number} [config.shadowOffsetY]\n * @param {Number} [config.shadowOpacity] shadow opacity. Can be any real number\n * between 0 and 1\n * @param {Boolean} [config.shadowEnabled] flag which enables or disables the shadow. The default value is true\n * @param {Array} [config.dash]\n * @param {Boolean} [config.dashEnabled] flag which enables or disables the dashArray. The default value is true\n\r\n * @param {Number} [config.x]\n * @param {Number} [config.y]\n * @param {Number} [config.width]\n * @param {Number} [config.height]\n * @param {Boolean} [config.visible]\n * @param {Boolean} [config.listening] whether or not the node is listening for events\n * @param {String} [config.id] unique id\n * @param {String} [config.name] non-unique name\n * @param {Number} [config.opacity] determines node opacity. Can be any number between 0 and 1\n * @param {Object} [config.scale] set scale\n * @param {Number} [config.scaleX] set scale x\n * @param {Number} [config.scaleY] set scale y\n * @param {Number} [config.rotation] rotation in degrees\n * @param {Object} [config.offset] offset from center point and rotation point\n * @param {Number} [config.offsetX] set offset x\n * @param {Number} [config.offsetY] set offset y\n * @param {Boolean} [config.draggable] makes the node draggable. When stages are draggable, you can drag and drop\n * the entire stage by dragging any portion of the stage\n * @param {Number} [config.dragDistance]\n * @param {Function} [config.dragBoundFunc]\r\n * @example\r\n * var line = new Konva.Line({\r\n * x: 100,\r\n * y: 50,\r\n * points: [73, 70, 340, 23, 450, 60, 500, 20],\r\n * stroke: 'red',\r\n * tension: 1\r\n * });\r\n */\r\n class Line extends Shape {\r\n constructor(config) {\r\n super(config);\r\n this.on('pointsChange.konva tensionChange.konva closedChange.konva bezierChange.konva', function () {\r\n this._clearCache('tensionPoints');\r\n });\r\n }\r\n _sceneFunc(context) {\r\n var points = this.points(), length = points.length, tension = this.tension(), closed = this.closed(), bezier = this.bezier(), tp, len, n;\r\n if (!length) {\r\n return;\r\n }\r\n context.beginPath();\r\n context.moveTo(points[0], points[1]);\r\n // tension\r\n if (tension !== 0 && length > 4) {\r\n tp = this.getTensionPoints();\r\n len = tp.length;\r\n n = closed ? 0 : 4;\r\n if (!closed) {\r\n context.quadraticCurveTo(tp[0], tp[1], tp[2], tp[3]);\r\n }\r\n while (n < len - 2) {\r\n context.bezierCurveTo(tp[n++], tp[n++], tp[n++], tp[n++], tp[n++], tp[n++]);\r\n }\r\n if (!closed) {\r\n context.quadraticCurveTo(tp[len - 2], tp[len - 1], points[length - 2], points[length - 1]);\r\n }\r\n }\r\n else if (bezier) {\r\n // no tension but bezier\r\n n = 2;\r\n while (n < length) {\r\n context.bezierCurveTo(points[n++], points[n++], points[n++], points[n++], points[n++], points[n++]);\r\n }\r\n }\r\n else {\r\n // no tension\r\n for (n = 2; n < length; n += 2) {\r\n context.lineTo(points[n], points[n + 1]);\r\n }\r\n }\r\n // closed e.g. polygons and blobs\r\n if (closed) {\r\n context.closePath();\r\n context.fillStrokeShape(this);\r\n }\r\n else {\r\n // open e.g. lines and splines\r\n context.strokeShape(this);\r\n }\r\n }\r\n getTensionPoints() {\r\n return this._getCache('tensionPoints', this._getTensionPoints);\r\n }\r\n _getTensionPoints() {\r\n if (this.closed()) {\r\n return this._getTensionPointsClosed();\r\n }\r\n else {\r\n return expandPoints(this.points(), this.tension());\r\n }\r\n }\r\n _getTensionPointsClosed() {\r\n var p = this.points(), len = p.length, tension = this.tension(), firstControlPoints = getControlPoints(p[len - 2], p[len - 1], p[0], p[1], p[2], p[3], tension), lastControlPoints = getControlPoints(p[len - 4], p[len - 3], p[len - 2], p[len - 1], p[0], p[1], tension), middle = expandPoints(p, tension), tp = [firstControlPoints[2], firstControlPoints[3]]\r\n .concat(middle)\r\n .concat([\r\n lastControlPoints[0],\r\n lastControlPoints[1],\r\n p[len - 2],\r\n p[len - 1],\r\n lastControlPoints[2],\r\n lastControlPoints[3],\r\n firstControlPoints[0],\r\n firstControlPoints[1],\r\n p[0],\r\n p[1],\r\n ]);\r\n return tp;\r\n }\r\n getWidth() {\r\n return this.getSelfRect().width;\r\n }\r\n getHeight() {\r\n return this.getSelfRect().height;\r\n }\r\n // overload size detection\r\n getSelfRect() {\r\n var points = this.points();\r\n if (points.length < 4) {\r\n return {\r\n x: points[0] || 0,\r\n y: points[1] || 0,\r\n width: 0,\r\n height: 0,\r\n };\r\n }\r\n if (this.tension() !== 0) {\r\n points = [\r\n points[0],\r\n points[1],\r\n ...this._getTensionPoints(),\r\n points[points.length - 2],\r\n points[points.length - 1],\r\n ];\r\n }\r\n else {\r\n points = this.points();\r\n }\r\n var minX = points[0];\r\n var maxX = points[0];\r\n var minY = points[1];\r\n var maxY = points[1];\r\n var x, y;\r\n for (var i = 0; i < points.length / 2; i++) {\r\n x = points[i * 2];\r\n y = points[i * 2 + 1];\r\n minX = Math.min(minX, x);\r\n maxX = Math.max(maxX, x);\r\n minY = Math.min(minY, y);\r\n maxY = Math.max(maxY, y);\r\n }\r\n return {\r\n x: minX,\r\n y: minY,\r\n width: maxX - minX,\r\n height: maxY - minY,\r\n };\r\n }\r\n }\r\n Line.prototype.className = 'Line';\r\n Line.prototype._attrsAffectingSize = ['points', 'bezier', 'tension'];\r\n _registerNode(Line);\r\n // add getters setters\r\n Factory.addGetterSetter(Line, 'closed', false);\r\n /**\r\n * get/set closed flag. The default is false\r\n * @name Konva.Line#closed\r\n * @method\r\n * @param {Boolean} closed\r\n * @returns {Boolean}\r\n * @example\r\n * // get closed flag\r\n * var closed = line.closed();\r\n *\r\n * // close the shape\r\n * line.closed(true);\r\n *\r\n * // open the shape\r\n * line.closed(false);\r\n */\r\n Factory.addGetterSetter(Line, 'bezier', false);\r\n /**\r\n * get/set bezier flag. The default is false\r\n * @name Konva.Line#bezier\r\n * @method\r\n * @param {Boolean} bezier\r\n * @returns {Boolean}\r\n * @example\r\n * // get whether the line is a bezier\r\n * var isBezier = line.bezier();\r\n *\r\n * // set whether the line is a bezier\r\n * line.bezier(true);\r\n */\r\n Factory.addGetterSetter(Line, 'tension', 0, getNumberValidator());\r\n /**\r\n * get/set tension\r\n * @name Konva.Line#tension\r\n * @method\r\n * @param {Number} tension Higher values will result in a more curvy line. A value of 0 will result in no interpolation. The default is 0\r\n * @returns {Number}\r\n * @example\r\n * // get tension\r\n * var tension = line.tension();\r\n *\r\n * // set tension\r\n * line.tension(3);\r\n */\r\n Factory.addGetterSetter(Line, 'points', [], getNumberArrayValidator());\r\n /**\r\n * get/set points array. Points is a flat array [x1, y1, x2, y2]. It is flat for performance reasons.\r\n * @name Konva.Line#points\r\n * @method\r\n * @param {Array} points\r\n * @returns {Array}\r\n * @example\r\n * // get points\r\n * var points = line.points();\r\n *\r\n * // set points\r\n * line.points([10, 20, 30, 40, 50, 60]);\r\n *\r\n * // push a new point\r\n * line.points(line.points().concat([70, 80]));\r\n */\n\n /**\r\n * Path constructor.\r\n * @author Jason Follas\r\n * @constructor\r\n * @memberof Konva\r\n * @augments Konva.Shape\r\n * @param {Object} config\r\n * @param {String} config.data SVG data string\r\n * @param {String} [config.fill] fill color\n * @param {Image} [config.fillPatternImage] fill pattern image\n * @param {Number} [config.fillPatternX]\n * @param {Number} [config.fillPatternY]\n * @param {Object} [config.fillPatternOffset] object with x and y component\n * @param {Number} [config.fillPatternOffsetX] \n * @param {Number} [config.fillPatternOffsetY] \n * @param {Object} [config.fillPatternScale] object with x and y component\n * @param {Number} [config.fillPatternScaleX]\n * @param {Number} [config.fillPatternScaleY]\n * @param {Number} [config.fillPatternRotation]\n * @param {String} [config.fillPatternRepeat] can be \"repeat\", \"repeat-x\", \"repeat-y\", or \"no-repeat\". The default is \"no-repeat\"\n * @param {Object} [config.fillLinearGradientStartPoint] object with x and y component\n * @param {Number} [config.fillLinearGradientStartPointX]\n * @param {Number} [config.fillLinearGradientStartPointY]\n * @param {Object} [config.fillLinearGradientEndPoint] object with x and y component\n * @param {Number} [config.fillLinearGradientEndPointX]\n * @param {Number} [config.fillLinearGradientEndPointY]\n * @param {Array} [config.fillLinearGradientColorStops] array of color stops\n * @param {Object} [config.fillRadialGradientStartPoint] object with x and y component\n * @param {Number} [config.fillRadialGradientStartPointX]\n * @param {Number} [config.fillRadialGradientStartPointY]\n * @param {Object} [config.fillRadialGradientEndPoint] object with x and y component\n * @param {Number} [config.fillRadialGradientEndPointX] \n * @param {Number} [config.fillRadialGradientEndPointY] \n * @param {Number} [config.fillRadialGradientStartRadius]\n * @param {Number} [config.fillRadialGradientEndRadius]\n * @param {Array} [config.fillRadialGradientColorStops] array of color stops\n * @param {Boolean} [config.fillEnabled] flag which enables or disables the fill. The default value is true\n * @param {String} [config.fillPriority] can be color, linear-gradient, radial-graident, or pattern. The default value is color. The fillPriority property makes it really easy to toggle between different fill types. For example, if you want to toggle between a fill color style and a fill pattern style, simply set the fill property and the fillPattern properties, and then use setFillPriority('color') to render the shape with a color fill, or use setFillPriority('pattern') to render the shape with the pattern fill configuration\n * @param {String} [config.stroke] stroke color\n * @param {Number} [config.strokeWidth] stroke width\n * @param {Boolean} [config.fillAfterStrokeEnabled]. Should we draw fill AFTER stroke? Default is false.\n * @param {Number} [config.hitStrokeWidth] size of the stroke on hit canvas. The default is \"auto\" - equals to strokeWidth\n * @param {Boolean} [config.strokeHitEnabled] flag which enables or disables stroke hit region. The default is true\n * @param {Boolean} [config.perfectDrawEnabled] flag which enables or disables using buffer canvas. The default is true\n * @param {Boolean} [config.shadowForStrokeEnabled] flag which enables or disables shadow for stroke. The default is true\n * @param {Boolean} [config.strokeScaleEnabled] flag which enables or disables stroke scale. The default is true\n * @param {Boolean} [config.strokeEnabled] flag which enables or disables the stroke. The default value is true\n * @param {String} [config.lineJoin] can be miter, round, or bevel. The default\n * is miter\n * @param {String} [config.lineCap] can be butt, round, or square. The default\n * is butt\n * @param {String} [config.shadowColor]\n * @param {Number} [config.shadowBlur]\n * @param {Object} [config.shadowOffset] object with x and y component\n * @param {Number} [config.shadowOffsetX]\n * @param {Number} [config.shadowOffsetY]\n * @param {Number} [config.shadowOpacity] shadow opacity. Can be any real number\n * between 0 and 1\n * @param {Boolean} [config.shadowEnabled] flag which enables or disables the shadow. The default value is true\n * @param {Array} [config.dash]\n * @param {Boolean} [config.dashEnabled] flag which enables or disables the dashArray. The default value is true\n\r\n * @param {Number} [config.x]\n * @param {Number} [config.y]\n * @param {Number} [config.width]\n * @param {Number} [config.height]\n * @param {Boolean} [config.visible]\n * @param {Boolean} [config.listening] whether or not the node is listening for events\n * @param {String} [config.id] unique id\n * @param {String} [config.name] non-unique name\n * @param {Number} [config.opacity] determines node opacity. Can be any number between 0 and 1\n * @param {Object} [config.scale] set scale\n * @param {Number} [config.scaleX] set scale x\n * @param {Number} [config.scaleY] set scale y\n * @param {Number} [config.rotation] rotation in degrees\n * @param {Object} [config.offset] offset from center point and rotation point\n * @param {Number} [config.offsetX] set offset x\n * @param {Number} [config.offsetY] set offset y\n * @param {Boolean} [config.draggable] makes the node draggable. When stages are draggable, you can drag and drop\n * the entire stage by dragging any portion of the stage\n * @param {Number} [config.dragDistance]\n * @param {Function} [config.dragBoundFunc]\r\n * @example\r\n * var path = new Konva.Path({\r\n * x: 240,\r\n * y: 40,\r\n * data: 'M12.582,9.551C3.251,16.237,0.921,29.021,7.08,38.564l-2.36,1.689l4.893,2.262l4.893,2.262l-0.568-5.36l-0.567-5.359l-2.365,1.694c-4.657-7.375-2.83-17.185,4.352-22.33c7.451-5.338,17.817-3.625,23.156,3.824c5.337,7.449,3.625,17.813-3.821,23.152l2.857,3.988c9.617-6.893,11.827-20.277,4.935-29.896C35.591,4.87,22.204,2.658,12.582,9.551z',\r\n * fill: 'green',\r\n * scaleX: 2,\r\n * scaleY: 2\r\n * });\r\n */\r\n class Path extends Shape {\r\n constructor(config) {\r\n super(config);\r\n this.dataArray = [];\r\n this.pathLength = 0;\r\n this.dataArray = Path.parsePathData(this.data());\r\n this.pathLength = 0;\r\n for (var i = 0; i < this.dataArray.length; ++i) {\r\n this.pathLength += this.dataArray[i].pathLength;\r\n }\r\n this.on('dataChange.konva', function () {\r\n this.dataArray = Path.parsePathData(this.data());\r\n this.pathLength = 0;\r\n for (var i = 0; i < this.dataArray.length; ++i) {\r\n this.pathLength += this.dataArray[i].pathLength;\r\n }\r\n });\r\n }\r\n _sceneFunc(context) {\r\n var ca = this.dataArray;\r\n // context position\r\n context.beginPath();\r\n var isClosed = false;\r\n for (var n = 0; n < ca.length; n++) {\r\n var c = ca[n].command;\r\n var p = ca[n].points;\r\n switch (c) {\r\n case 'L':\r\n context.lineTo(p[0], p[1]);\r\n break;\r\n case 'M':\r\n context.moveTo(p[0], p[1]);\r\n break;\r\n case 'C':\r\n context.bezierCurveTo(p[0], p[1], p[2], p[3], p[4], p[5]);\r\n break;\r\n case 'Q':\r\n context.quadraticCurveTo(p[0], p[1], p[2], p[3]);\r\n break;\r\n case 'A':\r\n var cx = p[0], cy = p[1], rx = p[2], ry = p[3], theta = p[4], dTheta = p[5], psi = p[6], fs = p[7];\r\n var r = rx > ry ? rx : ry;\r\n var scaleX = rx > ry ? 1 : rx / ry;\r\n var scaleY = rx > ry ? ry / rx : 1;\r\n context.translate(cx, cy);\r\n context.rotate(psi);\r\n context.scale(scaleX, scaleY);\r\n context.arc(0, 0, r, theta, theta + dTheta, 1 - fs);\r\n context.scale(1 / scaleX, 1 / scaleY);\r\n context.rotate(-psi);\r\n context.translate(-cx, -cy);\r\n break;\r\n case 'z':\r\n isClosed = true;\r\n context.closePath();\r\n break;\r\n }\r\n }\r\n if (!isClosed && !this.hasFill()) {\r\n context.strokeShape(this);\r\n }\r\n else {\r\n context.fillStrokeShape(this);\r\n }\r\n }\r\n getSelfRect() {\r\n var points = [];\r\n this.dataArray.forEach(function (data) {\r\n if (data.command === 'A') {\r\n // Approximates by breaking curve into line segments\r\n var start = data.points[4];\r\n // 4 = theta\r\n var dTheta = data.points[5];\r\n // 5 = dTheta\r\n var end = data.points[4] + dTheta;\r\n var inc = Math.PI / 180.0;\r\n // 1 degree resolution\r\n if (Math.abs(start - end) < inc) {\r\n inc = Math.abs(start - end);\r\n }\r\n if (dTheta < 0) {\r\n // clockwise\r\n for (let t = start - inc; t > end; t -= inc) {\r\n const point = Path.getPointOnEllipticalArc(data.points[0], data.points[1], data.points[2], data.points[3], t, 0);\r\n points.push(point.x, point.y);\r\n }\r\n }\r\n else {\r\n // counter-clockwise\r\n for (let t = start + inc; t < end; t += inc) {\r\n const point = Path.getPointOnEllipticalArc(data.points[0], data.points[1], data.points[2], data.points[3], t, 0);\r\n points.push(point.x, point.y);\r\n }\r\n }\r\n }\r\n else if (data.command === 'C') {\r\n // Approximates by breaking curve into 100 line segments\r\n for (let t = 0.0; t <= 1; t += 0.01) {\r\n const point = Path.getPointOnCubicBezier(t, data.start.x, data.start.y, data.points[0], data.points[1], data.points[2], data.points[3], data.points[4], data.points[5]);\r\n points.push(point.x, point.y);\r\n }\r\n }\r\n else {\r\n // TODO: how can we calculate bezier curves better?\r\n points = points.concat(data.points);\r\n }\r\n });\r\n var minX = points[0];\r\n var maxX = points[0];\r\n var minY = points[1];\r\n var maxY = points[1];\r\n var x, y;\r\n for (var i = 0; i < points.length / 2; i++) {\r\n x = points[i * 2];\r\n y = points[i * 2 + 1];\r\n // skip bad values\r\n if (!isNaN(x)) {\r\n minX = Math.min(minX, x);\r\n maxX = Math.max(maxX, x);\r\n }\r\n if (!isNaN(y)) {\r\n minY = Math.min(minY, y);\r\n maxY = Math.max(maxY, y);\r\n }\r\n }\r\n return {\r\n x: minX,\r\n y: minY,\r\n width: maxX - minX,\r\n height: maxY - minY,\r\n };\r\n }\r\n /**\r\n * Return length of the path.\r\n * @method\r\n * @name Konva.Path#getLength\r\n * @returns {Number} length\r\n * @example\r\n * var length = path.getLength();\r\n */\r\n getLength() {\r\n return this.pathLength;\r\n }\r\n /**\r\n * Get point on path at specific length of the path\r\n * @method\r\n * @name Konva.Path#getPointAtLength\r\n * @param {Number} length length\r\n * @returns {Object} point {x,y} point\r\n * @example\r\n * var point = path.getPointAtLength(10);\r\n */\r\n getPointAtLength(length) {\r\n var point, i = 0, ii = this.dataArray.length;\r\n if (!ii) {\r\n return null;\r\n }\r\n while (i < ii && length > this.dataArray[i].pathLength) {\r\n length -= this.dataArray[i].pathLength;\r\n ++i;\r\n }\r\n if (i === ii) {\r\n point = this.dataArray[i - 1].points.slice(-2);\r\n return {\r\n x: point[0],\r\n y: point[1],\r\n };\r\n }\r\n if (length < 0.01) {\r\n point = this.dataArray[i].points.slice(0, 2);\r\n return {\r\n x: point[0],\r\n y: point[1],\r\n };\r\n }\r\n var cp = this.dataArray[i];\r\n var p = cp.points;\r\n switch (cp.command) {\r\n case 'L':\r\n return Path.getPointOnLine(length, cp.start.x, cp.start.y, p[0], p[1]);\r\n case 'C':\r\n return Path.getPointOnCubicBezier(length / cp.pathLength, cp.start.x, cp.start.y, p[0], p[1], p[2], p[3], p[4], p[5]);\r\n case 'Q':\r\n return Path.getPointOnQuadraticBezier(length / cp.pathLength, cp.start.x, cp.start.y, p[0], p[1], p[2], p[3]);\r\n case 'A':\r\n var cx = p[0], cy = p[1], rx = p[2], ry = p[3], theta = p[4], dTheta = p[5], psi = p[6];\r\n theta += (dTheta * length) / cp.pathLength;\r\n return Path.getPointOnEllipticalArc(cx, cy, rx, ry, theta, psi);\r\n }\r\n return null;\r\n }\r\n static getLineLength(x1, y1, x2, y2) {\r\n return Math.sqrt((x2 - x1) * (x2 - x1) + (y2 - y1) * (y2 - y1));\r\n }\r\n static getPointOnLine(dist, P1x, P1y, P2x, P2y, fromX, fromY) {\r\n if (fromX === undefined) {\r\n fromX = P1x;\r\n }\r\n if (fromY === undefined) {\r\n fromY = P1y;\r\n }\r\n var m = (P2y - P1y) / (P2x - P1x + 0.00000001);\r\n var run = Math.sqrt((dist * dist) / (1 + m * m));\r\n if (P2x < P1x) {\r\n run *= -1;\r\n }\r\n var rise = m * run;\r\n var pt;\r\n if (P2x === P1x) {\r\n // vertical line\r\n pt = {\r\n x: fromX,\r\n y: fromY + rise,\r\n };\r\n }\r\n else if ((fromY - P1y) / (fromX - P1x + 0.00000001) === m) {\r\n pt = {\r\n x: fromX + run,\r\n y: fromY + rise,\r\n };\r\n }\r\n else {\r\n var ix, iy;\r\n var len = this.getLineLength(P1x, P1y, P2x, P2y);\r\n // if (len < 0.00000001) {\r\n // return {\r\n // x: P1x,\r\n // y: P1y,\r\n // };\r\n // }\r\n var u = (fromX - P1x) * (P2x - P1x) + (fromY - P1y) * (P2y - P1y);\r\n u = u / (len * len);\r\n ix = P1x + u * (P2x - P1x);\r\n iy = P1y + u * (P2y - P1y);\r\n var pRise = this.getLineLength(fromX, fromY, ix, iy);\r\n var pRun = Math.sqrt(dist * dist - pRise * pRise);\r\n run = Math.sqrt((pRun * pRun) / (1 + m * m));\r\n if (P2x < P1x) {\r\n run *= -1;\r\n }\r\n rise = m * run;\r\n pt = {\r\n x: ix + run,\r\n y: iy + rise,\r\n };\r\n }\r\n return pt;\r\n }\r\n static getPointOnCubicBezier(pct, P1x, P1y, P2x, P2y, P3x, P3y, P4x, P4y) {\r\n function CB1(t) {\r\n return t * t * t;\r\n }\r\n function CB2(t) {\r\n return 3 * t * t * (1 - t);\r\n }\r\n function CB3(t) {\r\n return 3 * t * (1 - t) * (1 - t);\r\n }\r\n function CB4(t) {\r\n return (1 - t) * (1 - t) * (1 - t);\r\n }\r\n var x = P4x * CB1(pct) + P3x * CB2(pct) + P2x * CB3(pct) + P1x * CB4(pct);\r\n var y = P4y * CB1(pct) + P3y * CB2(pct) + P2y * CB3(pct) + P1y * CB4(pct);\r\n return {\r\n x: x,\r\n y: y,\r\n };\r\n }\r\n static getPointOnQuadraticBezier(pct, P1x, P1y, P2x, P2y, P3x, P3y) {\r\n function QB1(t) {\r\n return t * t;\r\n }\r\n function QB2(t) {\r\n return 2 * t * (1 - t);\r\n }\r\n function QB3(t) {\r\n return (1 - t) * (1 - t);\r\n }\r\n var x = P3x * QB1(pct) + P2x * QB2(pct) + P1x * QB3(pct);\r\n var y = P3y * QB1(pct) + P2y * QB2(pct) + P1y * QB3(pct);\r\n return {\r\n x: x,\r\n y: y,\r\n };\r\n }\r\n static getPointOnEllipticalArc(cx, cy, rx, ry, theta, psi) {\r\n var cosPsi = Math.cos(psi), sinPsi = Math.sin(psi);\r\n var pt = {\r\n x: rx * Math.cos(theta),\r\n y: ry * Math.sin(theta),\r\n };\r\n return {\r\n x: cx + (pt.x * cosPsi - pt.y * sinPsi),\r\n y: cy + (pt.x * sinPsi + pt.y * cosPsi),\r\n };\r\n }\r\n /*\r\n * get parsed data array from the data\r\n * string. V, v, H, h, and l data are converted to\r\n * L data for the purpose of high performance Path\r\n * rendering\r\n */\r\n static parsePathData(data) {\r\n // Path Data Segment must begin with a moveTo\r\n //m (x y)+ Relative moveTo (subsequent points are treated as lineTo)\r\n //M (x y)+ Absolute moveTo (subsequent points are treated as lineTo)\r\n //l (x y)+ Relative lineTo\r\n //L (x y)+ Absolute LineTo\r\n //h (x)+ Relative horizontal lineTo\r\n //H (x)+ Absolute horizontal lineTo\r\n //v (y)+ Relative vertical lineTo\r\n //V (y)+ Absolute vertical lineTo\r\n //z (closepath)\r\n //Z (closepath)\r\n //c (x1 y1 x2 y2 x y)+ Relative Bezier curve\r\n //C (x1 y1 x2 y2 x y)+ Absolute Bezier curve\r\n //q (x1 y1 x y)+ Relative Quadratic Bezier\r\n //Q (x1 y1 x y)+ Absolute Quadratic Bezier\r\n //t (x y)+ Shorthand/Smooth Relative Quadratic Bezier\r\n //T (x y)+ Shorthand/Smooth Absolute Quadratic Bezier\r\n //s (x2 y2 x y)+ Shorthand/Smooth Relative Bezier curve\r\n //S (x2 y2 x y)+ Shorthand/Smooth Absolute Bezier curve\r\n //a (rx ry x-axis-rotation large-arc-flag sweep-flag x y)+ Relative Elliptical Arc\r\n //A (rx ry x-axis-rotation large-arc-flag sweep-flag x y)+ Absolute Elliptical Arc\r\n // return early if data is not defined\r\n if (!data) {\r\n return [];\r\n }\r\n // command string\r\n var cs = data;\r\n // command chars\r\n var cc = [\r\n 'm',\r\n 'M',\r\n 'l',\r\n 'L',\r\n 'v',\r\n 'V',\r\n 'h',\r\n 'H',\r\n 'z',\r\n 'Z',\r\n 'c',\r\n 'C',\r\n 'q',\r\n 'Q',\r\n 't',\r\n 'T',\r\n 's',\r\n 'S',\r\n 'a',\r\n 'A',\r\n ];\r\n // convert white spaces to commas\r\n cs = cs.replace(new RegExp(' ', 'g'), ',');\r\n // create pipes so that we can split the data\r\n for (var n = 0; n < cc.length; n++) {\r\n cs = cs.replace(new RegExp(cc[n], 'g'), '|' + cc[n]);\r\n }\r\n // create array\r\n var arr = cs.split('|');\r\n var ca = [];\r\n var coords = [];\r\n // init context point\r\n var cpx = 0;\r\n var cpy = 0;\r\n var re = /([-+]?((\\d+\\.\\d+)|((\\d+)|(\\.\\d+)))(?:e[-+]?\\d+)?)/gi;\r\n var match;\r\n for (n = 1; n < arr.length; n++) {\r\n var str = arr[n];\r\n var c = str.charAt(0);\r\n str = str.slice(1);\r\n coords.length = 0;\r\n while ((match = re.exec(str))) {\r\n coords.push(match[0]);\r\n }\r\n // while ((match = re.exec(str))) {\r\n // coords.push(match[0]);\r\n // }\r\n var p = [];\r\n for (var j = 0, jlen = coords.length; j < jlen; j++) {\r\n // extra case for merged flags\r\n if (coords[j] === '00') {\r\n p.push(0, 0);\r\n continue;\r\n }\r\n var parsed = parseFloat(coords[j]);\r\n if (!isNaN(parsed)) {\r\n p.push(parsed);\r\n }\r\n else {\r\n p.push(0);\r\n }\r\n }\r\n while (p.length > 0) {\r\n if (isNaN(p[0])) {\r\n // case for a trailing comma before next command\r\n break;\r\n }\r\n var cmd = null;\r\n var points = [];\r\n var startX = cpx, startY = cpy;\r\n // Move var from within the switch to up here (jshint)\r\n var prevCmd, ctlPtx, ctlPty; // Ss, Tt\r\n var rx, ry, psi, fa, fs, x1, y1; // Aa\r\n // convert l, H, h, V, and v to L\r\n switch (c) {\r\n // Note: Keep the lineTo's above the moveTo's in this switch\r\n case 'l':\r\n cpx += p.shift();\r\n cpy += p.shift();\r\n cmd = 'L';\r\n points.push(cpx, cpy);\r\n break;\r\n case 'L':\r\n cpx = p.shift();\r\n cpy = p.shift();\r\n points.push(cpx, cpy);\r\n break;\r\n // Note: lineTo handlers need to be above this point\r\n case 'm':\r\n var dx = p.shift();\r\n var dy = p.shift();\r\n cpx += dx;\r\n cpy += dy;\r\n cmd = 'M';\r\n // After closing the path move the current position\r\n // to the the first point of the path (if any).\r\n if (ca.length > 2 && ca[ca.length - 1].command === 'z') {\r\n for (var idx = ca.length - 2; idx >= 0; idx--) {\r\n if (ca[idx].command === 'M') {\r\n cpx = ca[idx].points[0] + dx;\r\n cpy = ca[idx].points[1] + dy;\r\n break;\r\n }\r\n }\r\n }\r\n points.push(cpx, cpy);\r\n c = 'l';\r\n // subsequent points are treated as relative lineTo\r\n break;\r\n case 'M':\r\n cpx = p.shift();\r\n cpy = p.shift();\r\n cmd = 'M';\r\n points.push(cpx, cpy);\r\n c = 'L';\r\n // subsequent points are treated as absolute lineTo\r\n break;\r\n case 'h':\r\n cpx += p.shift();\r\n cmd = 'L';\r\n points.push(cpx, cpy);\r\n break;\r\n case 'H':\r\n cpx = p.shift();\r\n cmd = 'L';\r\n points.push(cpx, cpy);\r\n break;\r\n case 'v':\r\n cpy += p.shift();\r\n cmd = 'L';\r\n points.push(cpx, cpy);\r\n break;\r\n case 'V':\r\n cpy = p.shift();\r\n cmd = 'L';\r\n points.push(cpx, cpy);\r\n break;\r\n case 'C':\r\n points.push(p.shift(), p.shift(), p.shift(), p.shift());\r\n cpx = p.shift();\r\n cpy = p.shift();\r\n points.push(cpx, cpy);\r\n break;\r\n case 'c':\r\n points.push(cpx + p.shift(), cpy + p.shift(), cpx + p.shift(), cpy + p.shift());\r\n cpx += p.shift();\r\n cpy += p.shift();\r\n cmd = 'C';\r\n points.push(cpx, cpy);\r\n break;\r\n case 'S':\r\n ctlPtx = cpx;\r\n ctlPty = cpy;\r\n prevCmd = ca[ca.length - 1];\r\n if (prevCmd.command === 'C') {\r\n ctlPtx = cpx + (cpx - prevCmd.points[2]);\r\n ctlPty = cpy + (cpy - prevCmd.points[3]);\r\n }\r\n points.push(ctlPtx, ctlPty, p.shift(), p.shift());\r\n cpx = p.shift();\r\n cpy = p.shift();\r\n cmd = 'C';\r\n points.push(cpx, cpy);\r\n break;\r\n case 's':\r\n ctlPtx = cpx;\r\n ctlPty = cpy;\r\n prevCmd = ca[ca.length - 1];\r\n if (prevCmd.command === 'C') {\r\n ctlPtx = cpx + (cpx - prevCmd.points[2]);\r\n ctlPty = cpy + (cpy - prevCmd.points[3]);\r\n }\r\n points.push(ctlPtx, ctlPty, cpx + p.shift(), cpy + p.shift());\r\n cpx += p.shift();\r\n cpy += p.shift();\r\n cmd = 'C';\r\n points.push(cpx, cpy);\r\n break;\r\n case 'Q':\r\n points.push(p.shift(), p.shift());\r\n cpx = p.shift();\r\n cpy = p.shift();\r\n points.push(cpx, cpy);\r\n break;\r\n case 'q':\r\n points.push(cpx + p.shift(), cpy + p.shift());\r\n cpx += p.shift();\r\n cpy += p.shift();\r\n cmd = 'Q';\r\n points.push(cpx, cpy);\r\n break;\r\n case 'T':\r\n ctlPtx = cpx;\r\n ctlPty = cpy;\r\n prevCmd = ca[ca.length - 1];\r\n if (prevCmd.command === 'Q') {\r\n ctlPtx = cpx + (cpx - prevCmd.points[0]);\r\n ctlPty = cpy + (cpy - prevCmd.points[1]);\r\n }\r\n cpx = p.shift();\r\n cpy = p.shift();\r\n cmd = 'Q';\r\n points.push(ctlPtx, ctlPty, cpx, cpy);\r\n break;\r\n case 't':\r\n ctlPtx = cpx;\r\n ctlPty = cpy;\r\n prevCmd = ca[ca.length - 1];\r\n if (prevCmd.command === 'Q') {\r\n ctlPtx = cpx + (cpx - prevCmd.points[0]);\r\n ctlPty = cpy + (cpy - prevCmd.points[1]);\r\n }\r\n cpx += p.shift();\r\n cpy += p.shift();\r\n cmd = 'Q';\r\n points.push(ctlPtx, ctlPty, cpx, cpy);\r\n break;\r\n case 'A':\r\n rx = p.shift();\r\n ry = p.shift();\r\n psi = p.shift();\r\n fa = p.shift();\r\n fs = p.shift();\r\n x1 = cpx;\r\n y1 = cpy;\r\n cpx = p.shift();\r\n cpy = p.shift();\r\n cmd = 'A';\r\n points = this.convertEndpointToCenterParameterization(x1, y1, cpx, cpy, fa, fs, rx, ry, psi);\r\n break;\r\n case 'a':\r\n rx = p.shift();\r\n ry = p.shift();\r\n psi = p.shift();\r\n fa = p.shift();\r\n fs = p.shift();\r\n x1 = cpx;\r\n y1 = cpy;\r\n cpx += p.shift();\r\n cpy += p.shift();\r\n cmd = 'A';\r\n points = this.convertEndpointToCenterParameterization(x1, y1, cpx, cpy, fa, fs, rx, ry, psi);\r\n break;\r\n }\r\n ca.push({\r\n command: cmd || c,\r\n points: points,\r\n start: {\r\n x: startX,\r\n y: startY,\r\n },\r\n pathLength: this.calcLength(startX, startY, cmd || c, points),\r\n });\r\n }\r\n if (c === 'z' || c === 'Z') {\r\n ca.push({\r\n command: 'z',\r\n points: [],\r\n start: undefined,\r\n pathLength: 0,\r\n });\r\n }\r\n }\r\n return ca;\r\n }\r\n static calcLength(x, y, cmd, points) {\r\n var len, p1, p2, t;\r\n var path = Path;\r\n switch (cmd) {\r\n case 'L':\r\n return path.getLineLength(x, y, points[0], points[1]);\r\n case 'C':\r\n // Approximates by breaking curve into 100 line segments\r\n len = 0.0;\r\n p1 = path.getPointOnCubicBezier(0, x, y, points[0], points[1], points[2], points[3], points[4], points[5]);\r\n for (t = 0.01; t <= 1; t += 0.01) {\r\n p2 = path.getPointOnCubicBezier(t, x, y, points[0], points[1], points[2], points[3], points[4], points[5]);\r\n len += path.getLineLength(p1.x, p1.y, p2.x, p2.y);\r\n p1 = p2;\r\n }\r\n return len;\r\n case 'Q':\r\n // Approximates by breaking curve into 100 line segments\r\n len = 0.0;\r\n p1 = path.getPointOnQuadraticBezier(0, x, y, points[0], points[1], points[2], points[3]);\r\n for (t = 0.01; t <= 1; t += 0.01) {\r\n p2 = path.getPointOnQuadraticBezier(t, x, y, points[0], points[1], points[2], points[3]);\r\n len += path.getLineLength(p1.x, p1.y, p2.x, p2.y);\r\n p1 = p2;\r\n }\r\n return len;\r\n case 'A':\r\n // Approximates by breaking curve into line segments\r\n len = 0.0;\r\n var start = points[4];\r\n // 4 = theta\r\n var dTheta = points[5];\r\n // 5 = dTheta\r\n var end = points[4] + dTheta;\r\n var inc = Math.PI / 180.0;\r\n // 1 degree resolution\r\n if (Math.abs(start - end) < inc) {\r\n inc = Math.abs(start - end);\r\n }\r\n // Note: for purpose of calculating arc length, not going to worry about rotating X-axis by angle psi\r\n p1 = path.getPointOnEllipticalArc(points[0], points[1], points[2], points[3], start, 0);\r\n if (dTheta < 0) {\r\n // clockwise\r\n for (t = start - inc; t > end; t -= inc) {\r\n p2 = path.getPointOnEllipticalArc(points[0], points[1], points[2], points[3], t, 0);\r\n len += path.getLineLength(p1.x, p1.y, p2.x, p2.y);\r\n p1 = p2;\r\n }\r\n }\r\n else {\r\n // counter-clockwise\r\n for (t = start + inc; t < end; t += inc) {\r\n p2 = path.getPointOnEllipticalArc(points[0], points[1], points[2], points[3], t, 0);\r\n len += path.getLineLength(p1.x, p1.y, p2.x, p2.y);\r\n p1 = p2;\r\n }\r\n }\r\n p2 = path.getPointOnEllipticalArc(points[0], points[1], points[2], points[3], end, 0);\r\n len += path.getLineLength(p1.x, p1.y, p2.x, p2.y);\r\n return len;\r\n }\r\n return 0;\r\n }\r\n static convertEndpointToCenterParameterization(x1, y1, x2, y2, fa, fs, rx, ry, psiDeg) {\r\n // Derived from: http://www.w3.org/TR/SVG/implnote.html#ArcImplementationNotes\r\n var psi = psiDeg * (Math.PI / 180.0);\r\n var xp = (Math.cos(psi) * (x1 - x2)) / 2.0 + (Math.sin(psi) * (y1 - y2)) / 2.0;\r\n var yp = (-1 * Math.sin(psi) * (x1 - x2)) / 2.0 +\r\n (Math.cos(psi) * (y1 - y2)) / 2.0;\r\n var lambda = (xp * xp) / (rx * rx) + (yp * yp) / (ry * ry);\r\n if (lambda > 1) {\r\n rx *= Math.sqrt(lambda);\r\n ry *= Math.sqrt(lambda);\r\n }\r\n var f = Math.sqrt((rx * rx * (ry * ry) - rx * rx * (yp * yp) - ry * ry * (xp * xp)) /\r\n (rx * rx * (yp * yp) + ry * ry * (xp * xp)));\r\n if (fa === fs) {\r\n f *= -1;\r\n }\r\n if (isNaN(f)) {\r\n f = 0;\r\n }\r\n var cxp = (f * rx * yp) / ry;\r\n var cyp = (f * -ry * xp) / rx;\r\n var cx = (x1 + x2) / 2.0 + Math.cos(psi) * cxp - Math.sin(psi) * cyp;\r\n var cy = (y1 + y2) / 2.0 + Math.sin(psi) * cxp + Math.cos(psi) * cyp;\r\n var vMag = function (v) {\r\n return Math.sqrt(v[0] * v[0] + v[1] * v[1]);\r\n };\r\n var vRatio = function (u, v) {\r\n return (u[0] * v[0] + u[1] * v[1]) / (vMag(u) * vMag(v));\r\n };\r\n var vAngle = function (u, v) {\r\n return (u[0] * v[1] < u[1] * v[0] ? -1 : 1) * Math.acos(vRatio(u, v));\r\n };\r\n var theta = vAngle([1, 0], [(xp - cxp) / rx, (yp - cyp) / ry]);\r\n var u = [(xp - cxp) / rx, (yp - cyp) / ry];\r\n var v = [(-1 * xp - cxp) / rx, (-1 * yp - cyp) / ry];\r\n var dTheta = vAngle(u, v);\r\n if (vRatio(u, v) <= -1) {\r\n dTheta = Math.PI;\r\n }\r\n if (vRatio(u, v) >= 1) {\r\n dTheta = 0;\r\n }\r\n if (fs === 0 && dTheta > 0) {\r\n dTheta = dTheta - 2 * Math.PI;\r\n }\r\n if (fs === 1 && dTheta < 0) {\r\n dTheta = dTheta + 2 * Math.PI;\r\n }\r\n return [cx, cy, rx, ry, theta, dTheta, psi, fs];\r\n }\r\n }\r\n Path.prototype.className = 'Path';\r\n Path.prototype._attrsAffectingSize = ['data'];\r\n _registerNode(Path);\r\n /**\r\n * get/set SVG path data string. This method\r\n * also automatically parses the data string\r\n * into a data array. Currently supported SVG data:\r\n * M, m, L, l, H, h, V, v, Q, q, T, t, C, c, S, s, A, a, Z, z\r\n * @name Konva.Path#data\r\n * @method\r\n * @param {String} data svg path string\r\n * @returns {String}\r\n * @example\r\n * // get data\r\n * var data = path.data();\r\n *\r\n * // set data\r\n * path.data('M200,100h100v50z');\r\n */\r\n Factory.addGetterSetter(Path, 'data');\n\n /**\r\n * Arrow constructor\r\n * @constructor\r\n * @memberof Konva\r\n * @augments Konva.Line\r\n * @param {Object} config\r\n * @param {Array} config.points Flat array of points coordinates. You should define them as [x1, y1, x2, y2, x3, y3].\r\n * @param {Number} [config.tension] Higher values will result in a more curvy line. A value of 0 will result in no interpolation.\r\n * The default is 0\r\n * @param {Number} config.pointerLength Arrow pointer length. Default value is 10.\r\n * @param {Number} config.pointerWidth Arrow pointer width. Default value is 10.\r\n * @param {Boolean} config.pointerAtBeginning Do we need to draw pointer on beginning position?. Default false.\r\n * @param {Boolean} config.pointerAtEnding Do we need to draw pointer on ending position?. Default true.\r\n * @param {String} [config.fill] fill color\n * @param {Image} [config.fillPatternImage] fill pattern image\n * @param {Number} [config.fillPatternX]\n * @param {Number} [config.fillPatternY]\n * @param {Object} [config.fillPatternOffset] object with x and y component\n * @param {Number} [config.fillPatternOffsetX] \n * @param {Number} [config.fillPatternOffsetY] \n * @param {Object} [config.fillPatternScale] object with x and y component\n * @param {Number} [config.fillPatternScaleX]\n * @param {Number} [config.fillPatternScaleY]\n * @param {Number} [config.fillPatternRotation]\n * @param {String} [config.fillPatternRepeat] can be \"repeat\", \"repeat-x\", \"repeat-y\", or \"no-repeat\". The default is \"no-repeat\"\n * @param {Object} [config.fillLinearGradientStartPoint] object with x and y component\n * @param {Number} [config.fillLinearGradientStartPointX]\n * @param {Number} [config.fillLinearGradientStartPointY]\n * @param {Object} [config.fillLinearGradientEndPoint] object with x and y component\n * @param {Number} [config.fillLinearGradientEndPointX]\n * @param {Number} [config.fillLinearGradientEndPointY]\n * @param {Array} [config.fillLinearGradientColorStops] array of color stops\n * @param {Object} [config.fillRadialGradientStartPoint] object with x and y component\n * @param {Number} [config.fillRadialGradientStartPointX]\n * @param {Number} [config.fillRadialGradientStartPointY]\n * @param {Object} [config.fillRadialGradientEndPoint] object with x and y component\n * @param {Number} [config.fillRadialGradientEndPointX] \n * @param {Number} [config.fillRadialGradientEndPointY] \n * @param {Number} [config.fillRadialGradientStartRadius]\n * @param {Number} [config.fillRadialGradientEndRadius]\n * @param {Array} [config.fillRadialGradientColorStops] array of color stops\n * @param {Boolean} [config.fillEnabled] flag which enables or disables the fill. The default value is true\n * @param {String} [config.fillPriority] can be color, linear-gradient, radial-graident, or pattern. The default value is color. The fillPriority property makes it really easy to toggle between different fill types. For example, if you want to toggle between a fill color style and a fill pattern style, simply set the fill property and the fillPattern properties, and then use setFillPriority('color') to render the shape with a color fill, or use setFillPriority('pattern') to render the shape with the pattern fill configuration\n * @param {String} [config.stroke] stroke color\n * @param {Number} [config.strokeWidth] stroke width\n * @param {Boolean} [config.fillAfterStrokeEnabled]. Should we draw fill AFTER stroke? Default is false.\n * @param {Number} [config.hitStrokeWidth] size of the stroke on hit canvas. The default is \"auto\" - equals to strokeWidth\n * @param {Boolean} [config.strokeHitEnabled] flag which enables or disables stroke hit region. The default is true\n * @param {Boolean} [config.perfectDrawEnabled] flag which enables or disables using buffer canvas. The default is true\n * @param {Boolean} [config.shadowForStrokeEnabled] flag which enables or disables shadow for stroke. The default is true\n * @param {Boolean} [config.strokeScaleEnabled] flag which enables or disables stroke scale. The default is true\n * @param {Boolean} [config.strokeEnabled] flag which enables or disables the stroke. The default value is true\n * @param {String} [config.lineJoin] can be miter, round, or bevel. The default\n * is miter\n * @param {String} [config.lineCap] can be butt, round, or square. The default\n * is butt\n * @param {String} [config.shadowColor]\n * @param {Number} [config.shadowBlur]\n * @param {Object} [config.shadowOffset] object with x and y component\n * @param {Number} [config.shadowOffsetX]\n * @param {Number} [config.shadowOffsetY]\n * @param {Number} [config.shadowOpacity] shadow opacity. Can be any real number\n * between 0 and 1\n * @param {Boolean} [config.shadowEnabled] flag which enables or disables the shadow. The default value is true\n * @param {Array} [config.dash]\n * @param {Boolean} [config.dashEnabled] flag which enables or disables the dashArray. The default value is true\n\r\n * @param {Number} [config.x]\n * @param {Number} [config.y]\n * @param {Number} [config.width]\n * @param {Number} [config.height]\n * @param {Boolean} [config.visible]\n * @param {Boolean} [config.listening] whether or not the node is listening for events\n * @param {String} [config.id] unique id\n * @param {String} [config.name] non-unique name\n * @param {Number} [config.opacity] determines node opacity. Can be any number between 0 and 1\n * @param {Object} [config.scale] set scale\n * @param {Number} [config.scaleX] set scale x\n * @param {Number} [config.scaleY] set scale y\n * @param {Number} [config.rotation] rotation in degrees\n * @param {Object} [config.offset] offset from center point and rotation point\n * @param {Number} [config.offsetX] set offset x\n * @param {Number} [config.offsetY] set offset y\n * @param {Boolean} [config.draggable] makes the node draggable. When stages are draggable, you can drag and drop\n * the entire stage by dragging any portion of the stage\n * @param {Number} [config.dragDistance]\n * @param {Function} [config.dragBoundFunc]\r\n * @example\r\n * var line = new Konva.Line({\r\n * points: [73, 70, 340, 23, 450, 60, 500, 20],\r\n * stroke: 'red',\r\n * tension: 1,\r\n * pointerLength : 10,\r\n * pointerWidth : 12\r\n * });\r\n */\r\n class Arrow extends Line {\r\n _sceneFunc(ctx) {\r\n super._sceneFunc(ctx);\r\n var PI2 = Math.PI * 2;\r\n var points = this.points();\r\n var tp = points;\r\n var fromTension = this.tension() !== 0 && points.length > 4;\r\n if (fromTension) {\r\n tp = this.getTensionPoints();\r\n }\r\n var length = this.pointerLength();\r\n var n = points.length;\r\n var dx, dy;\r\n if (fromTension) {\r\n const lp = [\r\n tp[tp.length - 4],\r\n tp[tp.length - 3],\r\n tp[tp.length - 2],\r\n tp[tp.length - 1],\r\n points[n - 2],\r\n points[n - 1],\r\n ];\r\n const lastLength = Path.calcLength(tp[tp.length - 4], tp[tp.length - 3], 'C', lp);\r\n const previous = Path.getPointOnQuadraticBezier(Math.min(1, 1 - length / lastLength), lp[0], lp[1], lp[2], lp[3], lp[4], lp[5]);\r\n dx = points[n - 2] - previous.x;\r\n dy = points[n - 1] - previous.y;\r\n }\r\n else {\r\n dx = points[n - 2] - points[n - 4];\r\n dy = points[n - 1] - points[n - 3];\r\n }\r\n var radians = (Math.atan2(dy, dx) + PI2) % PI2;\r\n var width = this.pointerWidth();\r\n if (this.pointerAtEnding()) {\r\n ctx.save();\r\n ctx.beginPath();\r\n ctx.translate(points[n - 2], points[n - 1]);\r\n ctx.rotate(radians);\r\n ctx.moveTo(0, 0);\r\n ctx.lineTo(-length, width / 2);\r\n ctx.lineTo(-length, -width / 2);\r\n ctx.closePath();\r\n ctx.restore();\r\n this.__fillStroke(ctx);\r\n }\r\n if (this.pointerAtBeginning()) {\r\n ctx.save();\r\n ctx.beginPath();\r\n ctx.translate(points[0], points[1]);\r\n if (fromTension) {\r\n dx = (tp[0] + tp[2]) / 2 - points[0];\r\n dy = (tp[1] + tp[3]) / 2 - points[1];\r\n }\r\n else {\r\n dx = points[2] - points[0];\r\n dy = points[3] - points[1];\r\n }\r\n ctx.rotate((Math.atan2(-dy, -dx) + PI2) % PI2);\r\n ctx.moveTo(0, 0);\r\n ctx.lineTo(-length, width / 2);\r\n ctx.lineTo(-length, -width / 2);\r\n ctx.closePath();\r\n ctx.restore();\r\n this.__fillStroke(ctx);\r\n }\r\n }\r\n __fillStroke(ctx) {\r\n // here is a tricky part\r\n // we need to disable dash for arrow pointers\r\n var isDashEnabled = this.dashEnabled();\r\n if (isDashEnabled) {\r\n // manually disable dash for head\r\n // it is better not to use setter here,\r\n // because it will trigger attr change event\r\n this.attrs.dashEnabled = false;\r\n ctx.setLineDash([]);\r\n }\r\n ctx.fillStrokeShape(this);\r\n // restore old value\r\n if (isDashEnabled) {\r\n this.attrs.dashEnabled = true;\r\n }\r\n }\r\n getSelfRect() {\r\n const lineRect = super.getSelfRect();\r\n const offset = this.pointerWidth() / 2;\r\n return {\r\n x: lineRect.x - offset,\r\n y: lineRect.y - offset,\r\n width: lineRect.width + offset * 2,\r\n height: lineRect.height + offset * 2,\r\n };\r\n }\r\n }\r\n Arrow.prototype.className = 'Arrow';\r\n _registerNode(Arrow);\r\n /**\r\n * get/set pointerLength\r\n * @name Konva.Arrow#pointerLength\r\n * @method\r\n * @param {Number} Length of pointer of arrow. The default is 10.\r\n * @returns {Number}\r\n * @example\r\n * // get length\r\n * var pointerLength = line.pointerLength();\r\n *\r\n * // set length\r\n * line.pointerLength(15);\r\n */\r\n Factory.addGetterSetter(Arrow, 'pointerLength', 10, getNumberValidator());\r\n /**\r\n * get/set pointerWidth\r\n * @name Konva.Arrow#pointerWidth\r\n * @method\r\n * @param {Number} Width of pointer of arrow.\r\n * The default is 10.\r\n * @returns {Number}\r\n * @example\r\n * // get width\r\n * var pointerWidth = line.pointerWidth();\r\n *\r\n * // set width\r\n * line.pointerWidth(15);\r\n */\r\n Factory.addGetterSetter(Arrow, 'pointerWidth', 10, getNumberValidator());\r\n /**\r\n * get/set pointerAtBeginning\r\n * @name Konva.Arrow#pointerAtBeginning\r\n * @method\r\n * @param {Number} Should pointer displayed at beginning of arrow. The default is false.\r\n * @returns {Boolean}\r\n * @example\r\n * // get value\r\n * var pointerAtBeginning = line.pointerAtBeginning();\r\n *\r\n * // set value\r\n * line.pointerAtBeginning(true);\r\n */\r\n Factory.addGetterSetter(Arrow, 'pointerAtBeginning', false);\r\n /**\r\n * get/set pointerAtEnding\r\n * @name Konva.Arrow#pointerAtEnding\r\n * @method\r\n * @param {Number} Should pointer displayed at ending of arrow. The default is true.\r\n * @returns {Boolean}\r\n * @example\r\n * // get value\r\n * var pointerAtEnding = line.pointerAtEnding();\r\n *\r\n * // set value\r\n * line.pointerAtEnding(false);\r\n */\r\n Factory.addGetterSetter(Arrow, 'pointerAtEnding', true);\n\n /**\r\n * Circle constructor\r\n * @constructor\r\n * @memberof Konva\r\n * @augments Konva.Shape\r\n * @param {Object} config\r\n * @param {Number} config.radius\r\n * @param {String} [config.fill] fill color\n * @param {Image} [config.fillPatternImage] fill pattern image\n * @param {Number} [config.fillPatternX]\n * @param {Number} [config.fillPatternY]\n * @param {Object} [config.fillPatternOffset] object with x and y component\n * @param {Number} [config.fillPatternOffsetX] \n * @param {Number} [config.fillPatternOffsetY] \n * @param {Object} [config.fillPatternScale] object with x and y component\n * @param {Number} [config.fillPatternScaleX]\n * @param {Number} [config.fillPatternScaleY]\n * @param {Number} [config.fillPatternRotation]\n * @param {String} [config.fillPatternRepeat] can be \"repeat\", \"repeat-x\", \"repeat-y\", or \"no-repeat\". The default is \"no-repeat\"\n * @param {Object} [config.fillLinearGradientStartPoint] object with x and y component\n * @param {Number} [config.fillLinearGradientStartPointX]\n * @param {Number} [config.fillLinearGradientStartPointY]\n * @param {Object} [config.fillLinearGradientEndPoint] object with x and y component\n * @param {Number} [config.fillLinearGradientEndPointX]\n * @param {Number} [config.fillLinearGradientEndPointY]\n * @param {Array} [config.fillLinearGradientColorStops] array of color stops\n * @param {Object} [config.fillRadialGradientStartPoint] object with x and y component\n * @param {Number} [config.fillRadialGradientStartPointX]\n * @param {Number} [config.fillRadialGradientStartPointY]\n * @param {Object} [config.fillRadialGradientEndPoint] object with x and y component\n * @param {Number} [config.fillRadialGradientEndPointX] \n * @param {Number} [config.fillRadialGradientEndPointY] \n * @param {Number} [config.fillRadialGradientStartRadius]\n * @param {Number} [config.fillRadialGradientEndRadius]\n * @param {Array} [config.fillRadialGradientColorStops] array of color stops\n * @param {Boolean} [config.fillEnabled] flag which enables or disables the fill. The default value is true\n * @param {String} [config.fillPriority] can be color, linear-gradient, radial-graident, or pattern. The default value is color. The fillPriority property makes it really easy to toggle between different fill types. For example, if you want to toggle between a fill color style and a fill pattern style, simply set the fill property and the fillPattern properties, and then use setFillPriority('color') to render the shape with a color fill, or use setFillPriority('pattern') to render the shape with the pattern fill configuration\n * @param {String} [config.stroke] stroke color\n * @param {Number} [config.strokeWidth] stroke width\n * @param {Boolean} [config.fillAfterStrokeEnabled]. Should we draw fill AFTER stroke? Default is false.\n * @param {Number} [config.hitStrokeWidth] size of the stroke on hit canvas. The default is \"auto\" - equals to strokeWidth\n * @param {Boolean} [config.strokeHitEnabled] flag which enables or disables stroke hit region. The default is true\n * @param {Boolean} [config.perfectDrawEnabled] flag which enables or disables using buffer canvas. The default is true\n * @param {Boolean} [config.shadowForStrokeEnabled] flag which enables or disables shadow for stroke. The default is true\n * @param {Boolean} [config.strokeScaleEnabled] flag which enables or disables stroke scale. The default is true\n * @param {Boolean} [config.strokeEnabled] flag which enables or disables the stroke. The default value is true\n * @param {String} [config.lineJoin] can be miter, round, or bevel. The default\n * is miter\n * @param {String} [config.lineCap] can be butt, round, or square. The default\n * is butt\n * @param {String} [config.shadowColor]\n * @param {Number} [config.shadowBlur]\n * @param {Object} [config.shadowOffset] object with x and y component\n * @param {Number} [config.shadowOffsetX]\n * @param {Number} [config.shadowOffsetY]\n * @param {Number} [config.shadowOpacity] shadow opacity. Can be any real number\n * between 0 and 1\n * @param {Boolean} [config.shadowEnabled] flag which enables or disables the shadow. The default value is true\n * @param {Array} [config.dash]\n * @param {Boolean} [config.dashEnabled] flag which enables or disables the dashArray. The default value is true\n\r\n * @param {Number} [config.x]\n * @param {Number} [config.y]\n * @param {Number} [config.width]\n * @param {Number} [config.height]\n * @param {Boolean} [config.visible]\n * @param {Boolean} [config.listening] whether or not the node is listening for events\n * @param {String} [config.id] unique id\n * @param {String} [config.name] non-unique name\n * @param {Number} [config.opacity] determines node opacity. Can be any number between 0 and 1\n * @param {Object} [config.scale] set scale\n * @param {Number} [config.scaleX] set scale x\n * @param {Number} [config.scaleY] set scale y\n * @param {Number} [config.rotation] rotation in degrees\n * @param {Object} [config.offset] offset from center point and rotation point\n * @param {Number} [config.offsetX] set offset x\n * @param {Number} [config.offsetY] set offset y\n * @param {Boolean} [config.draggable] makes the node draggable. When stages are draggable, you can drag and drop\n * the entire stage by dragging any portion of the stage\n * @param {Number} [config.dragDistance]\n * @param {Function} [config.dragBoundFunc]\r\n * @example\r\n * // create circle\r\n * var circle = new Konva.Circle({\r\n * radius: 40,\r\n * fill: 'red',\r\n * stroke: 'black',\r\n * strokeWidth: 5\r\n * });\r\n */\r\n class Circle extends Shape {\r\n _sceneFunc(context) {\r\n context.beginPath();\r\n context.arc(0, 0, this.attrs.radius || 0, 0, Math.PI * 2, false);\r\n context.closePath();\r\n context.fillStrokeShape(this);\r\n }\r\n getWidth() {\r\n return this.radius() * 2;\r\n }\r\n getHeight() {\r\n return this.radius() * 2;\r\n }\r\n setWidth(width) {\r\n if (this.radius() !== width / 2) {\r\n this.radius(width / 2);\r\n }\r\n }\r\n setHeight(height) {\r\n if (this.radius() !== height / 2) {\r\n this.radius(height / 2);\r\n }\r\n }\r\n }\r\n Circle.prototype._centroid = true;\r\n Circle.prototype.className = 'Circle';\r\n Circle.prototype._attrsAffectingSize = ['radius'];\r\n _registerNode(Circle);\r\n /**\r\n * get/set radius\r\n * @name Konva.Circle#radius\r\n * @method\r\n * @param {Number} radius\r\n * @returns {Number}\r\n * @example\r\n * // get radius\r\n * var radius = circle.radius();\r\n *\r\n * // set radius\r\n * circle.radius(10);\r\n */\r\n Factory.addGetterSetter(Circle, 'radius', 0, getNumberValidator());\n\n /**\r\n * Ellipse constructor\r\n * @constructor\r\n * @memberof Konva\r\n * @augments Konva.Shape\r\n * @param {Object} config\r\n * @param {Object} config.radius defines x and y radius\r\n * @param {String} [config.fill] fill color\n * @param {Image} [config.fillPatternImage] fill pattern image\n * @param {Number} [config.fillPatternX]\n * @param {Number} [config.fillPatternY]\n * @param {Object} [config.fillPatternOffset] object with x and y component\n * @param {Number} [config.fillPatternOffsetX] \n * @param {Number} [config.fillPatternOffsetY] \n * @param {Object} [config.fillPatternScale] object with x and y component\n * @param {Number} [config.fillPatternScaleX]\n * @param {Number} [config.fillPatternScaleY]\n * @param {Number} [config.fillPatternRotation]\n * @param {String} [config.fillPatternRepeat] can be \"repeat\", \"repeat-x\", \"repeat-y\", or \"no-repeat\". The default is \"no-repeat\"\n * @param {Object} [config.fillLinearGradientStartPoint] object with x and y component\n * @param {Number} [config.fillLinearGradientStartPointX]\n * @param {Number} [config.fillLinearGradientStartPointY]\n * @param {Object} [config.fillLinearGradientEndPoint] object with x and y component\n * @param {Number} [config.fillLinearGradientEndPointX]\n * @param {Number} [config.fillLinearGradientEndPointY]\n * @param {Array} [config.fillLinearGradientColorStops] array of color stops\n * @param {Object} [config.fillRadialGradientStartPoint] object with x and y component\n * @param {Number} [config.fillRadialGradientStartPointX]\n * @param {Number} [config.fillRadialGradientStartPointY]\n * @param {Object} [config.fillRadialGradientEndPoint] object with x and y component\n * @param {Number} [config.fillRadialGradientEndPointX] \n * @param {Number} [config.fillRadialGradientEndPointY] \n * @param {Number} [config.fillRadialGradientStartRadius]\n * @param {Number} [config.fillRadialGradientEndRadius]\n * @param {Array} [config.fillRadialGradientColorStops] array of color stops\n * @param {Boolean} [config.fillEnabled] flag which enables or disables the fill. The default value is true\n * @param {String} [config.fillPriority] can be color, linear-gradient, radial-graident, or pattern. The default value is color. The fillPriority property makes it really easy to toggle between different fill types. For example, if you want to toggle between a fill color style and a fill pattern style, simply set the fill property and the fillPattern properties, and then use setFillPriority('color') to render the shape with a color fill, or use setFillPriority('pattern') to render the shape with the pattern fill configuration\n * @param {String} [config.stroke] stroke color\n * @param {Number} [config.strokeWidth] stroke width\n * @param {Boolean} [config.fillAfterStrokeEnabled]. Should we draw fill AFTER stroke? Default is false.\n * @param {Number} [config.hitStrokeWidth] size of the stroke on hit canvas. The default is \"auto\" - equals to strokeWidth\n * @param {Boolean} [config.strokeHitEnabled] flag which enables or disables stroke hit region. The default is true\n * @param {Boolean} [config.perfectDrawEnabled] flag which enables or disables using buffer canvas. The default is true\n * @param {Boolean} [config.shadowForStrokeEnabled] flag which enables or disables shadow for stroke. The default is true\n * @param {Boolean} [config.strokeScaleEnabled] flag which enables or disables stroke scale. The default is true\n * @param {Boolean} [config.strokeEnabled] flag which enables or disables the stroke. The default value is true\n * @param {String} [config.lineJoin] can be miter, round, or bevel. The default\n * is miter\n * @param {String} [config.lineCap] can be butt, round, or square. The default\n * is butt\n * @param {String} [config.shadowColor]\n * @param {Number} [config.shadowBlur]\n * @param {Object} [config.shadowOffset] object with x and y component\n * @param {Number} [config.shadowOffsetX]\n * @param {Number} [config.shadowOffsetY]\n * @param {Number} [config.shadowOpacity] shadow opacity. Can be any real number\n * between 0 and 1\n * @param {Boolean} [config.shadowEnabled] flag which enables or disables the shadow. The default value is true\n * @param {Array} [config.dash]\n * @param {Boolean} [config.dashEnabled] flag which enables or disables the dashArray. The default value is true\n\r\n * @param {Number} [config.x]\n * @param {Number} [config.y]\n * @param {Number} [config.width]\n * @param {Number} [config.height]\n * @param {Boolean} [config.visible]\n * @param {Boolean} [config.listening] whether or not the node is listening for events\n * @param {String} [config.id] unique id\n * @param {String} [config.name] non-unique name\n * @param {Number} [config.opacity] determines node opacity. Can be any number between 0 and 1\n * @param {Object} [config.scale] set scale\n * @param {Number} [config.scaleX] set scale x\n * @param {Number} [config.scaleY] set scale y\n * @param {Number} [config.rotation] rotation in degrees\n * @param {Object} [config.offset] offset from center point and rotation point\n * @param {Number} [config.offsetX] set offset x\n * @param {Number} [config.offsetY] set offset y\n * @param {Boolean} [config.draggable] makes the node draggable. When stages are draggable, you can drag and drop\n * the entire stage by dragging any portion of the stage\n * @param {Number} [config.dragDistance]\n * @param {Function} [config.dragBoundFunc]\r\n * @example\r\n * var ellipse = new Konva.Ellipse({\r\n * radius : {\r\n * x : 50,\r\n * y : 50\r\n * },\r\n * fill: 'red'\r\n * });\r\n */\r\n class Ellipse extends Shape {\r\n _sceneFunc(context) {\r\n var rx = this.radiusX(), ry = this.radiusY();\r\n context.beginPath();\r\n context.save();\r\n if (rx !== ry) {\r\n context.scale(1, ry / rx);\r\n }\r\n context.arc(0, 0, rx, 0, Math.PI * 2, false);\r\n context.restore();\r\n context.closePath();\r\n context.fillStrokeShape(this);\r\n }\r\n getWidth() {\r\n return this.radiusX() * 2;\r\n }\r\n getHeight() {\r\n return this.radiusY() * 2;\r\n }\r\n setWidth(width) {\r\n this.radiusX(width / 2);\r\n }\r\n setHeight(height) {\r\n this.radiusY(height / 2);\r\n }\r\n }\r\n Ellipse.prototype.className = 'Ellipse';\r\n Ellipse.prototype._centroid = true;\r\n Ellipse.prototype._attrsAffectingSize = ['radiusX', 'radiusY'];\r\n _registerNode(Ellipse);\r\n // add getters setters\r\n Factory.addComponentsGetterSetter(Ellipse, 'radius', ['x', 'y']);\r\n /**\r\n * get/set radius\r\n * @name Konva.Ellipse#radius\r\n * @method\r\n * @param {Object} radius\r\n * @param {Number} radius.x\r\n * @param {Number} radius.y\r\n * @returns {Object}\r\n * @example\r\n * // get radius\r\n * var radius = ellipse.radius();\r\n *\r\n * // set radius\r\n * ellipse.radius({\r\n * x: 200,\r\n * y: 100\r\n * });\r\n */\r\n Factory.addGetterSetter(Ellipse, 'radiusX', 0, getNumberValidator());\r\n /**\r\n * get/set radius x\r\n * @name Konva.Ellipse#radiusX\r\n * @method\r\n * @param {Number} x\r\n * @returns {Number}\r\n * @example\r\n * // get radius x\r\n * var radiusX = ellipse.radiusX();\r\n *\r\n * // set radius x\r\n * ellipse.radiusX(200);\r\n */\r\n Factory.addGetterSetter(Ellipse, 'radiusY', 0, getNumberValidator());\r\n /**\r\n * get/set radius y\r\n * @name Konva.Ellipse#radiusY\r\n * @method\r\n * @param {Number} y\r\n * @returns {Number}\r\n * @example\r\n * // get radius y\r\n * var radiusY = ellipse.radiusY();\r\n *\r\n * // set radius y\r\n * ellipse.radiusY(200);\r\n */\n\n /**\r\n * Image constructor\r\n * @constructor\r\n * @memberof Konva\r\n * @augments Konva.Shape\r\n * @param {Object} config\r\n * @param {Image} config.image\r\n * @param {Object} [config.crop]\r\n * @param {String} [config.fill] fill color\n * @param {Image} [config.fillPatternImage] fill pattern image\n * @param {Number} [config.fillPatternX]\n * @param {Number} [config.fillPatternY]\n * @param {Object} [config.fillPatternOffset] object with x and y component\n * @param {Number} [config.fillPatternOffsetX] \n * @param {Number} [config.fillPatternOffsetY] \n * @param {Object} [config.fillPatternScale] object with x and y component\n * @param {Number} [config.fillPatternScaleX]\n * @param {Number} [config.fillPatternScaleY]\n * @param {Number} [config.fillPatternRotation]\n * @param {String} [config.fillPatternRepeat] can be \"repeat\", \"repeat-x\", \"repeat-y\", or \"no-repeat\". The default is \"no-repeat\"\n * @param {Object} [config.fillLinearGradientStartPoint] object with x and y component\n * @param {Number} [config.fillLinearGradientStartPointX]\n * @param {Number} [config.fillLinearGradientStartPointY]\n * @param {Object} [config.fillLinearGradientEndPoint] object with x and y component\n * @param {Number} [config.fillLinearGradientEndPointX]\n * @param {Number} [config.fillLinearGradientEndPointY]\n * @param {Array} [config.fillLinearGradientColorStops] array of color stops\n * @param {Object} [config.fillRadialGradientStartPoint] object with x and y component\n * @param {Number} [config.fillRadialGradientStartPointX]\n * @param {Number} [config.fillRadialGradientStartPointY]\n * @param {Object} [config.fillRadialGradientEndPoint] object with x and y component\n * @param {Number} [config.fillRadialGradientEndPointX] \n * @param {Number} [config.fillRadialGradientEndPointY] \n * @param {Number} [config.fillRadialGradientStartRadius]\n * @param {Number} [config.fillRadialGradientEndRadius]\n * @param {Array} [config.fillRadialGradientColorStops] array of color stops\n * @param {Boolean} [config.fillEnabled] flag which enables or disables the fill. The default value is true\n * @param {String} [config.fillPriority] can be color, linear-gradient, radial-graident, or pattern. The default value is color. The fillPriority property makes it really easy to toggle between different fill types. For example, if you want to toggle between a fill color style and a fill pattern style, simply set the fill property and the fillPattern properties, and then use setFillPriority('color') to render the shape with a color fill, or use setFillPriority('pattern') to render the shape with the pattern fill configuration\n * @param {String} [config.stroke] stroke color\n * @param {Number} [config.strokeWidth] stroke width\n * @param {Boolean} [config.fillAfterStrokeEnabled]. Should we draw fill AFTER stroke? Default is false.\n * @param {Number} [config.hitStrokeWidth] size of the stroke on hit canvas. The default is \"auto\" - equals to strokeWidth\n * @param {Boolean} [config.strokeHitEnabled] flag which enables or disables stroke hit region. The default is true\n * @param {Boolean} [config.perfectDrawEnabled] flag which enables or disables using buffer canvas. The default is true\n * @param {Boolean} [config.shadowForStrokeEnabled] flag which enables or disables shadow for stroke. The default is true\n * @param {Boolean} [config.strokeScaleEnabled] flag which enables or disables stroke scale. The default is true\n * @param {Boolean} [config.strokeEnabled] flag which enables or disables the stroke. The default value is true\n * @param {String} [config.lineJoin] can be miter, round, or bevel. The default\n * is miter\n * @param {String} [config.lineCap] can be butt, round, or square. The default\n * is butt\n * @param {String} [config.shadowColor]\n * @param {Number} [config.shadowBlur]\n * @param {Object} [config.shadowOffset] object with x and y component\n * @param {Number} [config.shadowOffsetX]\n * @param {Number} [config.shadowOffsetY]\n * @param {Number} [config.shadowOpacity] shadow opacity. Can be any real number\n * between 0 and 1\n * @param {Boolean} [config.shadowEnabled] flag which enables or disables the shadow. The default value is true\n * @param {Array} [config.dash]\n * @param {Boolean} [config.dashEnabled] flag which enables or disables the dashArray. The default value is true\n\r\n * @param {Number} [config.x]\n * @param {Number} [config.y]\n * @param {Number} [config.width]\n * @param {Number} [config.height]\n * @param {Boolean} [config.visible]\n * @param {Boolean} [config.listening] whether or not the node is listening for events\n * @param {String} [config.id] unique id\n * @param {String} [config.name] non-unique name\n * @param {Number} [config.opacity] determines node opacity. Can be any number between 0 and 1\n * @param {Object} [config.scale] set scale\n * @param {Number} [config.scaleX] set scale x\n * @param {Number} [config.scaleY] set scale y\n * @param {Number} [config.rotation] rotation in degrees\n * @param {Object} [config.offset] offset from center point and rotation point\n * @param {Number} [config.offsetX] set offset x\n * @param {Number} [config.offsetY] set offset y\n * @param {Boolean} [config.draggable] makes the node draggable. When stages are draggable, you can drag and drop\n * the entire stage by dragging any portion of the stage\n * @param {Number} [config.dragDistance]\n * @param {Function} [config.dragBoundFunc]\r\n * @example\r\n * var imageObj = new Image();\r\n * imageObj.onload = function() {\r\n * var image = new Konva.Image({\r\n * x: 200,\r\n * y: 50,\r\n * image: imageObj,\r\n * width: 100,\r\n * height: 100\r\n * });\r\n * };\r\n * imageObj.src = '/path/to/image.jpg'\r\n */\r\n class Image extends Shape {\r\n constructor(attrs) {\r\n super(attrs);\r\n this.on('imageChange.konva', () => {\r\n this._setImageLoad();\r\n });\r\n this._setImageLoad();\r\n }\r\n _setImageLoad() {\r\n const image = this.image();\r\n // check is image is already loaded\r\n if (image && image.complete) {\r\n return;\r\n }\r\n // check is video is already loaded\r\n if (image && image.readyState === 4) {\r\n return;\r\n }\r\n if (image && image['addEventListener']) {\r\n image['addEventListener']('load', () => {\r\n this._requestDraw();\r\n });\r\n }\r\n }\r\n _useBufferCanvas() {\r\n return super._useBufferCanvas(true);\r\n }\r\n _sceneFunc(context) {\r\n const width = this.getWidth();\r\n const height = this.getHeight();\r\n const image = this.attrs.image;\r\n let params;\r\n if (image) {\r\n const cropWidth = this.attrs.cropWidth;\r\n const cropHeight = this.attrs.cropHeight;\r\n if (cropWidth && cropHeight) {\r\n params = [\r\n image,\r\n this.cropX(),\r\n this.cropY(),\r\n cropWidth,\r\n cropHeight,\r\n 0,\r\n 0,\r\n width,\r\n height,\r\n ];\r\n }\r\n else {\r\n params = [image, 0, 0, width, height];\r\n }\r\n }\r\n if (this.hasFill() || this.hasStroke()) {\r\n context.beginPath();\r\n context.rect(0, 0, width, height);\r\n context.closePath();\r\n context.fillStrokeShape(this);\r\n }\r\n if (image) {\r\n context.drawImage.apply(context, params);\r\n }\r\n }\r\n _hitFunc(context) {\r\n var width = this.width(), height = this.height();\r\n context.beginPath();\r\n context.rect(0, 0, width, height);\r\n context.closePath();\r\n context.fillStrokeShape(this);\r\n }\r\n getWidth() {\r\n var _a, _b;\r\n return (_a = this.attrs.width) !== null && _a !== void 0 ? _a : (_b = this.image()) === null || _b === void 0 ? void 0 : _b.width;\r\n }\r\n getHeight() {\r\n var _a, _b;\r\n return (_a = this.attrs.height) !== null && _a !== void 0 ? _a : (_b = this.image()) === null || _b === void 0 ? void 0 : _b.height;\r\n }\r\n /**\r\n * load image from given url and create `Konva.Image` instance\r\n * @method\r\n * @memberof Konva.Image\r\n * @param {String} url image source\r\n * @param {Function} callback with Konva.Image instance as first argument\r\n * @param {Function} onError optional error handler\r\n * @example\r\n * Konva.Image.fromURL(imageURL, function(image){\r\n * // image is Konva.Image instance\r\n * layer.add(image);\r\n * layer.draw();\r\n * });\r\n */\r\n static fromURL(url, callback, onError = null) {\r\n var img = Util.createImageElement();\r\n img.onload = function () {\r\n var image = new Image({\r\n image: img,\r\n });\r\n callback(image);\r\n };\r\n img.onerror = onError;\r\n img.crossOrigin = 'Anonymous';\r\n img.src = url;\r\n }\r\n }\r\n Image.prototype.className = 'Image';\r\n _registerNode(Image);\r\n /**\r\n * get/set image source. It can be image, canvas or video element\r\n * @name Konva.Image#image\r\n * @method\r\n * @param {Object} image source\r\n * @returns {Object}\r\n * @example\r\n * // get value\r\n * var image = shape.image();\r\n *\r\n * // set value\r\n * shape.image(img);\r\n */\r\n Factory.addGetterSetter(Image, 'image');\r\n Factory.addComponentsGetterSetter(Image, 'crop', ['x', 'y', 'width', 'height']);\r\n /**\r\n * get/set crop\r\n * @method\r\n * @name Konva.Image#crop\r\n * @param {Object} crop\r\n * @param {Number} crop.x\r\n * @param {Number} crop.y\r\n * @param {Number} crop.width\r\n * @param {Number} crop.height\r\n * @returns {Object}\r\n * @example\r\n * // get crop\r\n * var crop = image.crop();\r\n *\r\n * // set crop\r\n * image.crop({\r\n * x: 20,\r\n * y: 20,\r\n * width: 20,\r\n * height: 20\r\n * });\r\n */\r\n Factory.addGetterSetter(Image, 'cropX', 0, getNumberValidator());\r\n /**\r\n * get/set crop x\r\n * @method\r\n * @name Konva.Image#cropX\r\n * @param {Number} x\r\n * @returns {Number}\r\n * @example\r\n * // get crop x\r\n * var cropX = image.cropX();\r\n *\r\n * // set crop x\r\n * image.cropX(20);\r\n */\r\n Factory.addGetterSetter(Image, 'cropY', 0, getNumberValidator());\r\n /**\r\n * get/set crop y\r\n * @name Konva.Image#cropY\r\n * @method\r\n * @param {Number} y\r\n * @returns {Number}\r\n * @example\r\n * // get crop y\r\n * var cropY = image.cropY();\r\n *\r\n * // set crop y\r\n * image.cropY(20);\r\n */\r\n Factory.addGetterSetter(Image, 'cropWidth', 0, getNumberValidator());\r\n /**\r\n * get/set crop width\r\n * @name Konva.Image#cropWidth\r\n * @method\r\n * @param {Number} width\r\n * @returns {Number}\r\n * @example\r\n * // get crop width\r\n * var cropWidth = image.cropWidth();\r\n *\r\n * // set crop width\r\n * image.cropWidth(20);\r\n */\r\n Factory.addGetterSetter(Image, 'cropHeight', 0, getNumberValidator());\r\n /**\r\n * get/set crop height\r\n * @name Konva.Image#cropHeight\r\n * @method\r\n * @param {Number} height\r\n * @returns {Number}\r\n * @example\r\n * // get crop height\r\n * var cropHeight = image.cropHeight();\r\n *\r\n * // set crop height\r\n * image.cropHeight(20);\r\n */\n\n // constants\r\n var ATTR_CHANGE_LIST$2 = [\r\n 'fontFamily',\r\n 'fontSize',\r\n 'fontStyle',\r\n 'padding',\r\n 'lineHeight',\r\n 'text',\r\n 'width',\r\n 'height',\r\n 'pointerDirection',\r\n 'pointerWidth',\r\n 'pointerHeight',\r\n ], CHANGE_KONVA$1 = 'Change.konva', NONE$1 = 'none', UP = 'up', RIGHT$1 = 'right', DOWN = 'down', LEFT$1 = 'left', \r\n // cached variables\r\n attrChangeListLen$1 = ATTR_CHANGE_LIST$2.length;\r\n /**\r\n * Label constructor.  Labels are groups that contain a Text and Tag shape\r\n * @constructor\r\n * @memberof Konva\r\n * @param {Object} config\r\n * @param {Number} [config.x]\n * @param {Number} [config.y]\n * @param {Number} [config.width]\n * @param {Number} [config.height]\n * @param {Boolean} [config.visible]\n * @param {Boolean} [config.listening] whether or not the node is listening for events\n * @param {String} [config.id] unique id\n * @param {String} [config.name] non-unique name\n * @param {Number} [config.opacity] determines node opacity. Can be any number between 0 and 1\n * @param {Object} [config.scale] set scale\n * @param {Number} [config.scaleX] set scale x\n * @param {Number} [config.scaleY] set scale y\n * @param {Number} [config.rotation] rotation in degrees\n * @param {Object} [config.offset] offset from center point and rotation point\n * @param {Number} [config.offsetX] set offset x\n * @param {Number} [config.offsetY] set offset y\n * @param {Boolean} [config.draggable] makes the node draggable. When stages are draggable, you can drag and drop\n * the entire stage by dragging any portion of the stage\n * @param {Number} [config.dragDistance]\n * @param {Function} [config.dragBoundFunc]\r\n * @example\r\n * // create label\r\n * var label = new Konva.Label({\r\n * x: 100,\r\n * y: 100,\r\n * draggable: true\r\n * });\r\n *\r\n * // add a tag to the label\r\n * label.add(new Konva.Tag({\r\n * fill: '#bbb',\r\n * stroke: '#333',\r\n * shadowColor: 'black',\r\n * shadowBlur: 10,\r\n * shadowOffset: [10, 10],\r\n * shadowOpacity: 0.2,\r\n * lineJoin: 'round',\r\n * pointerDirection: 'up',\r\n * pointerWidth: 20,\r\n * pointerHeight: 20,\r\n * cornerRadius: 5\r\n * }));\r\n *\r\n * // add text to the label\r\n * label.add(new Konva.Text({\r\n * text: 'Hello World!',\r\n * fontSize: 50,\r\n * lineHeight: 1.2,\r\n * padding: 10,\r\n * fill: 'green'\r\n * }));\r\n */\r\n class Label extends Group {\r\n constructor(config) {\r\n super(config);\r\n this.on('add.konva', function (evt) {\r\n this._addListeners(evt.child);\r\n this._sync();\r\n });\r\n }\r\n /**\r\n * get Text shape for the label. You need to access the Text shape in order to update\r\n * the text properties\r\n * @name Konva.Label#getText\r\n * @method\r\n * @example\r\n * label.getText().fill('red')\r\n */\r\n getText() {\r\n return this.find('Text')[0];\r\n }\r\n /**\r\n * get Tag shape for the label. You need to access the Tag shape in order to update\r\n * the pointer properties and the corner radius\r\n * @name Konva.Label#getTag\r\n * @method\r\n */\r\n getTag() {\r\n return this.find('Tag')[0];\r\n }\r\n _addListeners(text) {\r\n var that = this, n;\r\n var func = function () {\r\n that._sync();\r\n };\r\n // update text data for certain attr changes\r\n for (n = 0; n < attrChangeListLen$1; n++) {\r\n text.on(ATTR_CHANGE_LIST$2[n] + CHANGE_KONVA$1, func);\r\n }\r\n }\r\n getWidth() {\r\n return this.getText().width();\r\n }\r\n getHeight() {\r\n return this.getText().height();\r\n }\r\n _sync() {\r\n var text = this.getText(), tag = this.getTag(), width, height, pointerDirection, pointerWidth, x, y, pointerHeight;\r\n if (text && tag) {\r\n width = text.width();\r\n height = text.height();\r\n pointerDirection = tag.pointerDirection();\r\n pointerWidth = tag.pointerWidth();\r\n pointerHeight = tag.pointerHeight();\r\n x = 0;\r\n y = 0;\r\n switch (pointerDirection) {\r\n case UP:\r\n x = width / 2;\r\n y = -1 * pointerHeight;\r\n break;\r\n case RIGHT$1:\r\n x = width + pointerWidth;\r\n y = height / 2;\r\n break;\r\n case DOWN:\r\n x = width / 2;\r\n y = height + pointerHeight;\r\n break;\r\n case LEFT$1:\r\n x = -1 * pointerWidth;\r\n y = height / 2;\r\n break;\r\n }\r\n tag.setAttrs({\r\n x: -1 * x,\r\n y: -1 * y,\r\n width: width,\r\n height: height,\r\n });\r\n text.setAttrs({\r\n x: -1 * x,\r\n y: -1 * y,\r\n });\r\n }\r\n }\r\n }\r\n Label.prototype.className = 'Label';\r\n _registerNode(Label);\r\n /**\r\n * Tag constructor.  A Tag can be configured\r\n * to have a pointer element that points up, right, down, or left\r\n * @constructor\r\n * @memberof Konva\r\n * @param {Object} config\r\n * @param {String} [config.pointerDirection] can be up, right, down, left, or none; the default\r\n * is none. When a pointer is present, the positioning of the label is relative to the tip of the pointer.\r\n * @param {Number} [config.pointerWidth]\r\n * @param {Number} [config.pointerHeight]\r\n * @param {Number} [config.cornerRadius]\r\n */\r\n class Tag extends Shape {\r\n _sceneFunc(context) {\r\n var width = this.width(), height = this.height(), pointerDirection = this.pointerDirection(), pointerWidth = this.pointerWidth(), pointerHeight = this.pointerHeight(), cornerRadius = this.cornerRadius();\r\n let topLeft = 0;\r\n let topRight = 0;\r\n let bottomLeft = 0;\r\n let bottomRight = 0;\r\n if (typeof cornerRadius === 'number') {\r\n topLeft =\r\n topRight =\r\n bottomLeft =\r\n bottomRight =\r\n Math.min(cornerRadius, width / 2, height / 2);\r\n }\r\n else {\r\n topLeft = Math.min(cornerRadius[0] || 0, width / 2, height / 2);\r\n topRight = Math.min(cornerRadius[1] || 0, width / 2, height / 2);\r\n bottomRight = Math.min(cornerRadius[2] || 0, width / 2, height / 2);\r\n bottomLeft = Math.min(cornerRadius[3] || 0, width / 2, height / 2);\r\n }\r\n context.beginPath();\r\n context.moveTo(topLeft, 0);\r\n if (pointerDirection === UP) {\r\n context.lineTo((width - pointerWidth) / 2, 0);\r\n context.lineTo(width / 2, -1 * pointerHeight);\r\n context.lineTo((width + pointerWidth) / 2, 0);\r\n }\r\n context.lineTo(width - topRight, 0);\r\n context.arc(width - topRight, topRight, topRight, (Math.PI * 3) / 2, 0, false);\r\n if (pointerDirection === RIGHT$1) {\r\n context.lineTo(width, (height - pointerHeight) / 2);\r\n context.lineTo(width + pointerWidth, height / 2);\r\n context.lineTo(width, (height + pointerHeight) / 2);\r\n }\r\n context.lineTo(width, height - bottomRight);\r\n context.arc(width - bottomRight, height - bottomRight, bottomRight, 0, Math.PI / 2, false);\r\n if (pointerDirection === DOWN) {\r\n context.lineTo((width + pointerWidth) / 2, height);\r\n context.lineTo(width / 2, height + pointerHeight);\r\n context.lineTo((width - pointerWidth) / 2, height);\r\n }\r\n context.lineTo(bottomLeft, height);\r\n context.arc(bottomLeft, height - bottomLeft, bottomLeft, Math.PI / 2, Math.PI, false);\r\n if (pointerDirection === LEFT$1) {\r\n context.lineTo(0, (height + pointerHeight) / 2);\r\n context.lineTo(-1 * pointerWidth, height / 2);\r\n context.lineTo(0, (height - pointerHeight) / 2);\r\n }\r\n context.lineTo(0, topLeft);\r\n context.arc(topLeft, topLeft, topLeft, Math.PI, (Math.PI * 3) / 2, false);\r\n context.closePath();\r\n context.fillStrokeShape(this);\r\n }\r\n getSelfRect() {\r\n var x = 0, y = 0, pointerWidth = this.pointerWidth(), pointerHeight = this.pointerHeight(), direction = this.pointerDirection(), width = this.width(), height = this.height();\r\n if (direction === UP) {\r\n y -= pointerHeight;\r\n height += pointerHeight;\r\n }\r\n else if (direction === DOWN) {\r\n height += pointerHeight;\r\n }\r\n else if (direction === LEFT$1) {\r\n // ARGH!!! I have no idea why should I used magic 1.5!!!!!!!!!\r\n x -= pointerWidth * 1.5;\r\n width += pointerWidth;\r\n }\r\n else if (direction === RIGHT$1) {\r\n width += pointerWidth * 1.5;\r\n }\r\n return {\r\n x: x,\r\n y: y,\r\n width: width,\r\n height: height,\r\n };\r\n }\r\n }\r\n Tag.prototype.className = 'Tag';\r\n _registerNode(Tag);\r\n /**\r\n * get/set pointer direction\r\n * @name Konva.Tag#pointerDirection\r\n * @method\r\n * @param {String} pointerDirection can be up, right, down, left, or none. The default is none.\r\n * @returns {String}\r\n * @example\r\n * tag.pointerDirection('right');\r\n */\r\n Factory.addGetterSetter(Tag, 'pointerDirection', NONE$1);\r\n /**\r\n * get/set pointer width\r\n * @name Konva.Tag#pointerWidth\r\n * @method\r\n * @param {Number} pointerWidth\r\n * @returns {Number}\r\n * @example\r\n * tag.pointerWidth(20);\r\n */\r\n Factory.addGetterSetter(Tag, 'pointerWidth', 0, getNumberValidator());\r\n /**\r\n * get/set pointer height\r\n * @method\r\n * @name Konva.Tag#pointerHeight\r\n * @param {Number} pointerHeight\r\n * @returns {Number}\r\n * @example\r\n * tag.pointerHeight(20);\r\n */\r\n Factory.addGetterSetter(Tag, 'pointerHeight', 0, getNumberValidator());\r\n /**\r\n * get/set cornerRadius\r\n * @name Konva.Tag#cornerRadius\r\n * @method\r\n * @param {Number} cornerRadius\r\n * @returns {Number}\r\n * @example\r\n * tag.cornerRadius(20);\r\n *\r\n * // set different corner radius values\r\n * // top-left, top-right, bottom-right, bottom-left\r\n * tag.cornerRadius([0, 10, 20, 30]);\r\n */\r\n Factory.addGetterSetter(Tag, 'cornerRadius', 0, getNumberOrArrayOfNumbersValidator(4));\n\n /**\r\n * Rect constructor\r\n * @constructor\r\n * @memberof Konva\r\n * @augments Konva.Shape\r\n * @param {Object} config\r\n * @param {Number} [config.cornerRadius]\r\n * @param {String} [config.fill] fill color\n * @param {Image} [config.fillPatternImage] fill pattern image\n * @param {Number} [config.fillPatternX]\n * @param {Number} [config.fillPatternY]\n * @param {Object} [config.fillPatternOffset] object with x and y component\n * @param {Number} [config.fillPatternOffsetX] \n * @param {Number} [config.fillPatternOffsetY] \n * @param {Object} [config.fillPatternScale] object with x and y component\n * @param {Number} [config.fillPatternScaleX]\n * @param {Number} [config.fillPatternScaleY]\n * @param {Number} [config.fillPatternRotation]\n * @param {String} [config.fillPatternRepeat] can be \"repeat\", \"repeat-x\", \"repeat-y\", or \"no-repeat\". The default is \"no-repeat\"\n * @param {Object} [config.fillLinearGradientStartPoint] object with x and y component\n * @param {Number} [config.fillLinearGradientStartPointX]\n * @param {Number} [config.fillLinearGradientStartPointY]\n * @param {Object} [config.fillLinearGradientEndPoint] object with x and y component\n * @param {Number} [config.fillLinearGradientEndPointX]\n * @param {Number} [config.fillLinearGradientEndPointY]\n * @param {Array} [config.fillLinearGradientColorStops] array of color stops\n * @param {Object} [config.fillRadialGradientStartPoint] object with x and y component\n * @param {Number} [config.fillRadialGradientStartPointX]\n * @param {Number} [config.fillRadialGradientStartPointY]\n * @param {Object} [config.fillRadialGradientEndPoint] object with x and y component\n * @param {Number} [config.fillRadialGradientEndPointX] \n * @param {Number} [config.fillRadialGradientEndPointY] \n * @param {Number} [config.fillRadialGradientStartRadius]\n * @param {Number} [config.fillRadialGradientEndRadius]\n * @param {Array} [config.fillRadialGradientColorStops] array of color stops\n * @param {Boolean} [config.fillEnabled] flag which enables or disables the fill. The default value is true\n * @param {String} [config.fillPriority] can be color, linear-gradient, radial-graident, or pattern. The default value is color. The fillPriority property makes it really easy to toggle between different fill types. For example, if you want to toggle between a fill color style and a fill pattern style, simply set the fill property and the fillPattern properties, and then use setFillPriority('color') to render the shape with a color fill, or use setFillPriority('pattern') to render the shape with the pattern fill configuration\n * @param {String} [config.stroke] stroke color\n * @param {Number} [config.strokeWidth] stroke width\n * @param {Boolean} [config.fillAfterStrokeEnabled]. Should we draw fill AFTER stroke? Default is false.\n * @param {Number} [config.hitStrokeWidth] size of the stroke on hit canvas. The default is \"auto\" - equals to strokeWidth\n * @param {Boolean} [config.strokeHitEnabled] flag which enables or disables stroke hit region. The default is true\n * @param {Boolean} [config.perfectDrawEnabled] flag which enables or disables using buffer canvas. The default is true\n * @param {Boolean} [config.shadowForStrokeEnabled] flag which enables or disables shadow for stroke. The default is true\n * @param {Boolean} [config.strokeScaleEnabled] flag which enables or disables stroke scale. The default is true\n * @param {Boolean} [config.strokeEnabled] flag which enables or disables the stroke. The default value is true\n * @param {String} [config.lineJoin] can be miter, round, or bevel. The default\n * is miter\n * @param {String} [config.lineCap] can be butt, round, or square. The default\n * is butt\n * @param {String} [config.shadowColor]\n * @param {Number} [config.shadowBlur]\n * @param {Object} [config.shadowOffset] object with x and y component\n * @param {Number} [config.shadowOffsetX]\n * @param {Number} [config.shadowOffsetY]\n * @param {Number} [config.shadowOpacity] shadow opacity. Can be any real number\n * between 0 and 1\n * @param {Boolean} [config.shadowEnabled] flag which enables or disables the shadow. The default value is true\n * @param {Array} [config.dash]\n * @param {Boolean} [config.dashEnabled] flag which enables or disables the dashArray. The default value is true\n\r\n * @param {Number} [config.x]\n * @param {Number} [config.y]\n * @param {Number} [config.width]\n * @param {Number} [config.height]\n * @param {Boolean} [config.visible]\n * @param {Boolean} [config.listening] whether or not the node is listening for events\n * @param {String} [config.id] unique id\n * @param {String} [config.name] non-unique name\n * @param {Number} [config.opacity] determines node opacity. Can be any number between 0 and 1\n * @param {Object} [config.scale] set scale\n * @param {Number} [config.scaleX] set scale x\n * @param {Number} [config.scaleY] set scale y\n * @param {Number} [config.rotation] rotation in degrees\n * @param {Object} [config.offset] offset from center point and rotation point\n * @param {Number} [config.offsetX] set offset x\n * @param {Number} [config.offsetY] set offset y\n * @param {Boolean} [config.draggable] makes the node draggable. When stages are draggable, you can drag and drop\n * the entire stage by dragging any portion of the stage\n * @param {Number} [config.dragDistance]\n * @param {Function} [config.dragBoundFunc]\r\n * @example\r\n * var rect = new Konva.Rect({\r\n * width: 100,\r\n * height: 50,\r\n * fill: 'red',\r\n * stroke: 'black',\r\n * strokeWidth: 5\r\n * });\r\n */\r\n class Rect extends Shape {\r\n _sceneFunc(context) {\r\n var cornerRadius = this.cornerRadius(), width = this.width(), height = this.height();\r\n context.beginPath();\r\n if (!cornerRadius) {\r\n // simple rect - don't bother doing all that complicated maths stuff.\r\n context.rect(0, 0, width, height);\r\n }\r\n else {\r\n let topLeft = 0;\r\n let topRight = 0;\r\n let bottomLeft = 0;\r\n let bottomRight = 0;\r\n if (typeof cornerRadius === 'number') {\r\n topLeft = topRight = bottomLeft = bottomRight = Math.min(cornerRadius, width / 2, height / 2);\r\n }\r\n else {\r\n topLeft = Math.min(cornerRadius[0] || 0, width / 2, height / 2);\r\n topRight = Math.min(cornerRadius[1] || 0, width / 2, height / 2);\r\n bottomRight = Math.min(cornerRadius[2] || 0, width / 2, height / 2);\r\n bottomLeft = Math.min(cornerRadius[3] || 0, width / 2, height / 2);\r\n }\r\n context.moveTo(topLeft, 0);\r\n context.lineTo(width - topRight, 0);\r\n context.arc(width - topRight, topRight, topRight, (Math.PI * 3) / 2, 0, false);\r\n context.lineTo(width, height - bottomRight);\r\n context.arc(width - bottomRight, height - bottomRight, bottomRight, 0, Math.PI / 2, false);\r\n context.lineTo(bottomLeft, height);\r\n context.arc(bottomLeft, height - bottomLeft, bottomLeft, Math.PI / 2, Math.PI, false);\r\n context.lineTo(0, topLeft);\r\n context.arc(topLeft, topLeft, topLeft, Math.PI, (Math.PI * 3) / 2, false);\r\n }\r\n context.closePath();\r\n context.fillStrokeShape(this);\r\n }\r\n }\r\n Rect.prototype.className = 'Rect';\r\n _registerNode(Rect);\r\n /**\r\n * get/set corner radius\r\n * @method\r\n * @name Konva.Rect#cornerRadius\r\n * @param {Number} cornerRadius\r\n * @returns {Number}\r\n * @example\r\n * // get corner radius\r\n * var cornerRadius = rect.cornerRadius();\r\n *\r\n * // set corner radius\r\n * rect.cornerRadius(10);\r\n *\r\n * // set different corner radius values\r\n * // top-left, top-right, bottom-right, bottom-left\r\n * rect.cornerRadius([0, 10, 20, 30]);\r\n */\r\n Factory.addGetterSetter(Rect, 'cornerRadius', 0, getNumberOrArrayOfNumbersValidator(4));\n\n /**\r\n * RegularPolygon constructor. Examples include triangles, squares, pentagons, hexagons, etc.\r\n * @constructor\r\n * @memberof Konva\r\n * @augments Konva.Shape\r\n * @param {Object} config\r\n * @param {Number} config.sides\r\n * @param {Number} config.radius\r\n * @param {String} [config.fill] fill color\n * @param {Image} [config.fillPatternImage] fill pattern image\n * @param {Number} [config.fillPatternX]\n * @param {Number} [config.fillPatternY]\n * @param {Object} [config.fillPatternOffset] object with x and y component\n * @param {Number} [config.fillPatternOffsetX] \n * @param {Number} [config.fillPatternOffsetY] \n * @param {Object} [config.fillPatternScale] object with x and y component\n * @param {Number} [config.fillPatternScaleX]\n * @param {Number} [config.fillPatternScaleY]\n * @param {Number} [config.fillPatternRotation]\n * @param {String} [config.fillPatternRepeat] can be \"repeat\", \"repeat-x\", \"repeat-y\", or \"no-repeat\". The default is \"no-repeat\"\n * @param {Object} [config.fillLinearGradientStartPoint] object with x and y component\n * @param {Number} [config.fillLinearGradientStartPointX]\n * @param {Number} [config.fillLinearGradientStartPointY]\n * @param {Object} [config.fillLinearGradientEndPoint] object with x and y component\n * @param {Number} [config.fillLinearGradientEndPointX]\n * @param {Number} [config.fillLinearGradientEndPointY]\n * @param {Array} [config.fillLinearGradientColorStops] array of color stops\n * @param {Object} [config.fillRadialGradientStartPoint] object with x and y component\n * @param {Number} [config.fillRadialGradientStartPointX]\n * @param {Number} [config.fillRadialGradientStartPointY]\n * @param {Object} [config.fillRadialGradientEndPoint] object with x and y component\n * @param {Number} [config.fillRadialGradientEndPointX] \n * @param {Number} [config.fillRadialGradientEndPointY] \n * @param {Number} [config.fillRadialGradientStartRadius]\n * @param {Number} [config.fillRadialGradientEndRadius]\n * @param {Array} [config.fillRadialGradientColorStops] array of color stops\n * @param {Boolean} [config.fillEnabled] flag which enables or disables the fill. The default value is true\n * @param {String} [config.fillPriority] can be color, linear-gradient, radial-graident, or pattern. The default value is color. The fillPriority property makes it really easy to toggle between different fill types. For example, if you want to toggle between a fill color style and a fill pattern style, simply set the fill property and the fillPattern properties, and then use setFillPriority('color') to render the shape with a color fill, or use setFillPriority('pattern') to render the shape with the pattern fill configuration\n * @param {String} [config.stroke] stroke color\n * @param {Number} [config.strokeWidth] stroke width\n * @param {Boolean} [config.fillAfterStrokeEnabled]. Should we draw fill AFTER stroke? Default is false.\n * @param {Number} [config.hitStrokeWidth] size of the stroke on hit canvas. The default is \"auto\" - equals to strokeWidth\n * @param {Boolean} [config.strokeHitEnabled] flag which enables or disables stroke hit region. The default is true\n * @param {Boolean} [config.perfectDrawEnabled] flag which enables or disables using buffer canvas. The default is true\n * @param {Boolean} [config.shadowForStrokeEnabled] flag which enables or disables shadow for stroke. The default is true\n * @param {Boolean} [config.strokeScaleEnabled] flag which enables or disables stroke scale. The default is true\n * @param {Boolean} [config.strokeEnabled] flag which enables or disables the stroke. The default value is true\n * @param {String} [config.lineJoin] can be miter, round, or bevel. The default\n * is miter\n * @param {String} [config.lineCap] can be butt, round, or square. The default\n * is butt\n * @param {String} [config.shadowColor]\n * @param {Number} [config.shadowBlur]\n * @param {Object} [config.shadowOffset] object with x and y component\n * @param {Number} [config.shadowOffsetX]\n * @param {Number} [config.shadowOffsetY]\n * @param {Number} [config.shadowOpacity] shadow opacity. Can be any real number\n * between 0 and 1\n * @param {Boolean} [config.shadowEnabled] flag which enables or disables the shadow. The default value is true\n * @param {Array} [config.dash]\n * @param {Boolean} [config.dashEnabled] flag which enables or disables the dashArray. The default value is true\n\r\n * @param {Number} [config.x]\n * @param {Number} [config.y]\n * @param {Number} [config.width]\n * @param {Number} [config.height]\n * @param {Boolean} [config.visible]\n * @param {Boolean} [config.listening] whether or not the node is listening for events\n * @param {String} [config.id] unique id\n * @param {String} [config.name] non-unique name\n * @param {Number} [config.opacity] determines node opacity. Can be any number between 0 and 1\n * @param {Object} [config.scale] set scale\n * @param {Number} [config.scaleX] set scale x\n * @param {Number} [config.scaleY] set scale y\n * @param {Number} [config.rotation] rotation in degrees\n * @param {Object} [config.offset] offset from center point and rotation point\n * @param {Number} [config.offsetX] set offset x\n * @param {Number} [config.offsetY] set offset y\n * @param {Boolean} [config.draggable] makes the node draggable. When stages are draggable, you can drag and drop\n * the entire stage by dragging any portion of the stage\n * @param {Number} [config.dragDistance]\n * @param {Function} [config.dragBoundFunc]\r\n * @example\r\n * var hexagon = new Konva.RegularPolygon({\r\n * x: 100,\r\n * y: 200,\r\n * sides: 6,\r\n * radius: 70,\r\n * fill: 'red',\r\n * stroke: 'black',\r\n * strokeWidth: 4\r\n * });\r\n */\r\n class RegularPolygon extends Shape {\r\n _sceneFunc(context) {\r\n const points = this._getPoints();\r\n context.beginPath();\r\n context.moveTo(points[0].x, points[0].y);\r\n for (var n = 1; n < points.length; n++) {\r\n context.lineTo(points[n].x, points[n].y);\r\n }\r\n context.closePath();\r\n context.fillStrokeShape(this);\r\n }\r\n _getPoints() {\r\n const sides = this.attrs.sides;\r\n const radius = this.attrs.radius || 0;\r\n const points = [];\r\n for (var n = 0; n < sides; n++) {\r\n points.push({\r\n x: radius * Math.sin((n * 2 * Math.PI) / sides),\r\n y: -1 * radius * Math.cos((n * 2 * Math.PI) / sides),\r\n });\r\n }\r\n return points;\r\n }\r\n getSelfRect() {\r\n const points = this._getPoints();\r\n var minX = points[0].x;\r\n var maxX = points[0].y;\r\n var minY = points[0].x;\r\n var maxY = points[0].y;\r\n points.forEach((point) => {\r\n minX = Math.min(minX, point.x);\r\n maxX = Math.max(maxX, point.x);\r\n minY = Math.min(minY, point.y);\r\n maxY = Math.max(maxY, point.y);\r\n });\r\n return {\r\n x: minX,\r\n y: minY,\r\n width: maxX - minX,\r\n height: maxY - minY,\r\n };\r\n }\r\n getWidth() {\r\n return this.radius() * 2;\r\n }\r\n getHeight() {\r\n return this.radius() * 2;\r\n }\r\n setWidth(width) {\r\n this.radius(width / 2);\r\n }\r\n setHeight(height) {\r\n this.radius(height / 2);\r\n }\r\n }\r\n RegularPolygon.prototype.className = 'RegularPolygon';\r\n RegularPolygon.prototype._centroid = true;\r\n RegularPolygon.prototype._attrsAffectingSize = ['radius'];\r\n _registerNode(RegularPolygon);\r\n /**\r\n * get/set radius\r\n * @method\r\n * @name Konva.RegularPolygon#radius\r\n * @param {Number} radius\r\n * @returns {Number}\r\n * @example\r\n * // get radius\r\n * var radius = shape.radius();\r\n *\r\n * // set radius\r\n * shape.radius(10);\r\n */\r\n Factory.addGetterSetter(RegularPolygon, 'radius', 0, getNumberValidator());\r\n /**\r\n * get/set sides\r\n * @method\r\n * @name Konva.RegularPolygon#sides\r\n * @param {Number} sides\r\n * @returns {Number}\r\n * @example\r\n * // get sides\r\n * var sides = shape.sides();\r\n *\r\n * // set sides\r\n * shape.sides(10);\r\n */\r\n Factory.addGetterSetter(RegularPolygon, 'sides', 0, getNumberValidator());\n\n var PIx2 = Math.PI * 2;\r\n /**\r\n * Ring constructor\r\n * @constructor\r\n * @augments Konva.Shape\r\n * @memberof Konva\r\n * @param {Object} config\r\n * @param {Number} config.innerRadius\r\n * @param {Number} config.outerRadius\r\n * @param {String} [config.fill] fill color\n * @param {Image} [config.fillPatternImage] fill pattern image\n * @param {Number} [config.fillPatternX]\n * @param {Number} [config.fillPatternY]\n * @param {Object} [config.fillPatternOffset] object with x and y component\n * @param {Number} [config.fillPatternOffsetX] \n * @param {Number} [config.fillPatternOffsetY] \n * @param {Object} [config.fillPatternScale] object with x and y component\n * @param {Number} [config.fillPatternScaleX]\n * @param {Number} [config.fillPatternScaleY]\n * @param {Number} [config.fillPatternRotation]\n * @param {String} [config.fillPatternRepeat] can be \"repeat\", \"repeat-x\", \"repeat-y\", or \"no-repeat\". The default is \"no-repeat\"\n * @param {Object} [config.fillLinearGradientStartPoint] object with x and y component\n * @param {Number} [config.fillLinearGradientStartPointX]\n * @param {Number} [config.fillLinearGradientStartPointY]\n * @param {Object} [config.fillLinearGradientEndPoint] object with x and y component\n * @param {Number} [config.fillLinearGradientEndPointX]\n * @param {Number} [config.fillLinearGradientEndPointY]\n * @param {Array} [config.fillLinearGradientColorStops] array of color stops\n * @param {Object} [config.fillRadialGradientStartPoint] object with x and y component\n * @param {Number} [config.fillRadialGradientStartPointX]\n * @param {Number} [config.fillRadialGradientStartPointY]\n * @param {Object} [config.fillRadialGradientEndPoint] object with x and y component\n * @param {Number} [config.fillRadialGradientEndPointX] \n * @param {Number} [config.fillRadialGradientEndPointY] \n * @param {Number} [config.fillRadialGradientStartRadius]\n * @param {Number} [config.fillRadialGradientEndRadius]\n * @param {Array} [config.fillRadialGradientColorStops] array of color stops\n * @param {Boolean} [config.fillEnabled] flag which enables or disables the fill. The default value is true\n * @param {String} [config.fillPriority] can be color, linear-gradient, radial-graident, or pattern. The default value is color. The fillPriority property makes it really easy to toggle between different fill types. For example, if you want to toggle between a fill color style and a fill pattern style, simply set the fill property and the fillPattern properties, and then use setFillPriority('color') to render the shape with a color fill, or use setFillPriority('pattern') to render the shape with the pattern fill configuration\n * @param {String} [config.stroke] stroke color\n * @param {Number} [config.strokeWidth] stroke width\n * @param {Boolean} [config.fillAfterStrokeEnabled]. Should we draw fill AFTER stroke? Default is false.\n * @param {Number} [config.hitStrokeWidth] size of the stroke on hit canvas. The default is \"auto\" - equals to strokeWidth\n * @param {Boolean} [config.strokeHitEnabled] flag which enables or disables stroke hit region. The default is true\n * @param {Boolean} [config.perfectDrawEnabled] flag which enables or disables using buffer canvas. The default is true\n * @param {Boolean} [config.shadowForStrokeEnabled] flag which enables or disables shadow for stroke. The default is true\n * @param {Boolean} [config.strokeScaleEnabled] flag which enables or disables stroke scale. The default is true\n * @param {Boolean} [config.strokeEnabled] flag which enables or disables the stroke. The default value is true\n * @param {String} [config.lineJoin] can be miter, round, or bevel. The default\n * is miter\n * @param {String} [config.lineCap] can be butt, round, or square. The default\n * is butt\n * @param {String} [config.shadowColor]\n * @param {Number} [config.shadowBlur]\n * @param {Object} [config.shadowOffset] object with x and y component\n * @param {Number} [config.shadowOffsetX]\n * @param {Number} [config.shadowOffsetY]\n * @param {Number} [config.shadowOpacity] shadow opacity. Can be any real number\n * between 0 and 1\n * @param {Boolean} [config.shadowEnabled] flag which enables or disables the shadow. The default value is true\n * @param {Array} [config.dash]\n * @param {Boolean} [config.dashEnabled] flag which enables or disables the dashArray. The default value is true\n\r\n * @param {Number} [config.x]\n * @param {Number} [config.y]\n * @param {Number} [config.width]\n * @param {Number} [config.height]\n * @param {Boolean} [config.visible]\n * @param {Boolean} [config.listening] whether or not the node is listening for events\n * @param {String} [config.id] unique id\n * @param {String} [config.name] non-unique name\n * @param {Number} [config.opacity] determines node opacity. Can be any number between 0 and 1\n * @param {Object} [config.scale] set scale\n * @param {Number} [config.scaleX] set scale x\n * @param {Number} [config.scaleY] set scale y\n * @param {Number} [config.rotation] rotation in degrees\n * @param {Object} [config.offset] offset from center point and rotation point\n * @param {Number} [config.offsetX] set offset x\n * @param {Number} [config.offsetY] set offset y\n * @param {Boolean} [config.draggable] makes the node draggable. When stages are draggable, you can drag and drop\n * the entire stage by dragging any portion of the stage\n * @param {Number} [config.dragDistance]\n * @param {Function} [config.dragBoundFunc]\r\n * @example\r\n * var ring = new Konva.Ring({\r\n * innerRadius: 40,\r\n * outerRadius: 80,\r\n * fill: 'red',\r\n * stroke: 'black',\r\n * strokeWidth: 5\r\n * });\r\n */\r\n class Ring extends Shape {\r\n _sceneFunc(context) {\r\n context.beginPath();\r\n context.arc(0, 0, this.innerRadius(), 0, PIx2, false);\r\n context.moveTo(this.outerRadius(), 0);\r\n context.arc(0, 0, this.outerRadius(), PIx2, 0, true);\r\n context.closePath();\r\n context.fillStrokeShape(this);\r\n }\r\n getWidth() {\r\n return this.outerRadius() * 2;\r\n }\r\n getHeight() {\r\n return this.outerRadius() * 2;\r\n }\r\n setWidth(width) {\r\n this.outerRadius(width / 2);\r\n }\r\n setHeight(height) {\r\n this.outerRadius(height / 2);\r\n }\r\n }\r\n Ring.prototype.className = 'Ring';\r\n Ring.prototype._centroid = true;\r\n Ring.prototype._attrsAffectingSize = ['innerRadius', 'outerRadius'];\r\n _registerNode(Ring);\r\n /**\r\n * get/set innerRadius\r\n * @method\r\n * @name Konva.Ring#innerRadius\r\n * @param {Number} innerRadius\r\n * @returns {Number}\r\n * @example\r\n * // get inner radius\r\n * var innerRadius = ring.innerRadius();\r\n *\r\n * // set inner radius\r\n * ring.innerRadius(20);\r\n */\r\n Factory.addGetterSetter(Ring, 'innerRadius', 0, getNumberValidator());\r\n /**\r\n * get/set outerRadius\r\n * @name Konva.Ring#outerRadius\r\n * @method\r\n * @param {Number} outerRadius\r\n * @returns {Number}\r\n * @example\r\n * // get outer radius\r\n * var outerRadius = ring.outerRadius();\r\n *\r\n * // set outer radius\r\n * ring.outerRadius(20);\r\n */\r\n Factory.addGetterSetter(Ring, 'outerRadius', 0, getNumberValidator());\n\n /**\r\n * Sprite constructor\r\n * @constructor\r\n * @memberof Konva\r\n * @augments Konva.Shape\r\n * @param {Object} config\r\n * @param {String} config.animation animation key\r\n * @param {Object} config.animations animation map\r\n * @param {Integer} [config.frameIndex] animation frame index\r\n * @param {Image} config.image image object\r\n * @param {Integer} [config.frameRate] animation frame rate\r\n * @param {String} [config.fill] fill color\n * @param {Image} [config.fillPatternImage] fill pattern image\n * @param {Number} [config.fillPatternX]\n * @param {Number} [config.fillPatternY]\n * @param {Object} [config.fillPatternOffset] object with x and y component\n * @param {Number} [config.fillPatternOffsetX] \n * @param {Number} [config.fillPatternOffsetY] \n * @param {Object} [config.fillPatternScale] object with x and y component\n * @param {Number} [config.fillPatternScaleX]\n * @param {Number} [config.fillPatternScaleY]\n * @param {Number} [config.fillPatternRotation]\n * @param {String} [config.fillPatternRepeat] can be \"repeat\", \"repeat-x\", \"repeat-y\", or \"no-repeat\". The default is \"no-repeat\"\n * @param {Object} [config.fillLinearGradientStartPoint] object with x and y component\n * @param {Number} [config.fillLinearGradientStartPointX]\n * @param {Number} [config.fillLinearGradientStartPointY]\n * @param {Object} [config.fillLinearGradientEndPoint] object with x and y component\n * @param {Number} [config.fillLinearGradientEndPointX]\n * @param {Number} [config.fillLinearGradientEndPointY]\n * @param {Array} [config.fillLinearGradientColorStops] array of color stops\n * @param {Object} [config.fillRadialGradientStartPoint] object with x and y component\n * @param {Number} [config.fillRadialGradientStartPointX]\n * @param {Number} [config.fillRadialGradientStartPointY]\n * @param {Object} [config.fillRadialGradientEndPoint] object with x and y component\n * @param {Number} [config.fillRadialGradientEndPointX] \n * @param {Number} [config.fillRadialGradientEndPointY] \n * @param {Number} [config.fillRadialGradientStartRadius]\n * @param {Number} [config.fillRadialGradientEndRadius]\n * @param {Array} [config.fillRadialGradientColorStops] array of color stops\n * @param {Boolean} [config.fillEnabled] flag which enables or disables the fill. The default value is true\n * @param {String} [config.fillPriority] can be color, linear-gradient, radial-graident, or pattern. The default value is color. The fillPriority property makes it really easy to toggle between different fill types. For example, if you want to toggle between a fill color style and a fill pattern style, simply set the fill property and the fillPattern properties, and then use setFillPriority('color') to render the shape with a color fill, or use setFillPriority('pattern') to render the shape with the pattern fill configuration\n * @param {String} [config.stroke] stroke color\n * @param {Number} [config.strokeWidth] stroke width\n * @param {Boolean} [config.fillAfterStrokeEnabled]. Should we draw fill AFTER stroke? Default is false.\n * @param {Number} [config.hitStrokeWidth] size of the stroke on hit canvas. The default is \"auto\" - equals to strokeWidth\n * @param {Boolean} [config.strokeHitEnabled] flag which enables or disables stroke hit region. The default is true\n * @param {Boolean} [config.perfectDrawEnabled] flag which enables or disables using buffer canvas. The default is true\n * @param {Boolean} [config.shadowForStrokeEnabled] flag which enables or disables shadow for stroke. The default is true\n * @param {Boolean} [config.strokeScaleEnabled] flag which enables or disables stroke scale. The default is true\n * @param {Boolean} [config.strokeEnabled] flag which enables or disables the stroke. The default value is true\n * @param {String} [config.lineJoin] can be miter, round, or bevel. The default\n * is miter\n * @param {String} [config.lineCap] can be butt, round, or square. The default\n * is butt\n * @param {String} [config.shadowColor]\n * @param {Number} [config.shadowBlur]\n * @param {Object} [config.shadowOffset] object with x and y component\n * @param {Number} [config.shadowOffsetX]\n * @param {Number} [config.shadowOffsetY]\n * @param {Number} [config.shadowOpacity] shadow opacity. Can be any real number\n * between 0 and 1\n * @param {Boolean} [config.shadowEnabled] flag which enables or disables the shadow. The default value is true\n * @param {Array} [config.dash]\n * @param {Boolean} [config.dashEnabled] flag which enables or disables the dashArray. The default value is true\n\r\n * @param {Number} [config.x]\n * @param {Number} [config.y]\n * @param {Number} [config.width]\n * @param {Number} [config.height]\n * @param {Boolean} [config.visible]\n * @param {Boolean} [config.listening] whether or not the node is listening for events\n * @param {String} [config.id] unique id\n * @param {String} [config.name] non-unique name\n * @param {Number} [config.opacity] determines node opacity. Can be any number between 0 and 1\n * @param {Object} [config.scale] set scale\n * @param {Number} [config.scaleX] set scale x\n * @param {Number} [config.scaleY] set scale y\n * @param {Number} [config.rotation] rotation in degrees\n * @param {Object} [config.offset] offset from center point and rotation point\n * @param {Number} [config.offsetX] set offset x\n * @param {Number} [config.offsetY] set offset y\n * @param {Boolean} [config.draggable] makes the node draggable. When stages are draggable, you can drag and drop\n * the entire stage by dragging any portion of the stage\n * @param {Number} [config.dragDistance]\n * @param {Function} [config.dragBoundFunc]\r\n * @example\r\n * var imageObj = new Image();\r\n * imageObj.onload = function() {\r\n * var sprite = new Konva.Sprite({\r\n * x: 200,\r\n * y: 100,\r\n * image: imageObj,\r\n * animation: 'standing',\r\n * animations: {\r\n * standing: [\r\n * // x, y, width, height (6 frames)\r\n * 0, 0, 49, 109,\r\n * 52, 0, 49, 109,\r\n * 105, 0, 49, 109,\r\n * 158, 0, 49, 109,\r\n * 210, 0, 49, 109,\r\n * 262, 0, 49, 109\r\n * ],\r\n * kicking: [\r\n * // x, y, width, height (6 frames)\r\n * 0, 109, 45, 98,\r\n * 45, 109, 45, 98,\r\n * 95, 109, 63, 98,\r\n * 156, 109, 70, 98,\r\n * 229, 109, 60, 98,\r\n * 287, 109, 41, 98\r\n * ]\r\n * },\r\n * frameRate: 7,\r\n * frameIndex: 0\r\n * });\r\n * };\r\n * imageObj.src = '/path/to/image.jpg'\r\n */\r\n class Sprite extends Shape {\r\n constructor(config) {\r\n super(config);\r\n this._updated = true;\r\n this.anim = new Animation(() => {\r\n // if we don't need to redraw layer we should return false\r\n var updated = this._updated;\r\n this._updated = false;\r\n return updated;\r\n });\r\n this.on('animationChange.konva', function () {\r\n // reset index when animation changes\r\n this.frameIndex(0);\r\n });\r\n this.on('frameIndexChange.konva', function () {\r\n this._updated = true;\r\n });\r\n // smooth change for frameRate\r\n this.on('frameRateChange.konva', function () {\r\n if (!this.anim.isRunning()) {\r\n return;\r\n }\r\n clearInterval(this.interval);\r\n this._setInterval();\r\n });\r\n }\r\n _sceneFunc(context) {\r\n var anim = this.animation(), index = this.frameIndex(), ix4 = index * 4, set = this.animations()[anim], offsets = this.frameOffsets(), x = set[ix4 + 0], y = set[ix4 + 1], width = set[ix4 + 2], height = set[ix4 + 3], image = this.image();\r\n if (this.hasFill() || this.hasStroke()) {\r\n context.beginPath();\r\n context.rect(0, 0, width, height);\r\n context.closePath();\r\n context.fillStrokeShape(this);\r\n }\r\n if (image) {\r\n if (offsets) {\r\n var offset = offsets[anim], ix2 = index * 2;\r\n context.drawImage(image, x, y, width, height, offset[ix2 + 0], offset[ix2 + 1], width, height);\r\n }\r\n else {\r\n context.drawImage(image, x, y, width, height, 0, 0, width, height);\r\n }\r\n }\r\n }\r\n _hitFunc(context) {\r\n var anim = this.animation(), index = this.frameIndex(), ix4 = index * 4, set = this.animations()[anim], offsets = this.frameOffsets(), width = set[ix4 + 2], height = set[ix4 + 3];\r\n context.beginPath();\r\n if (offsets) {\r\n var offset = offsets[anim];\r\n var ix2 = index * 2;\r\n context.rect(offset[ix2 + 0], offset[ix2 + 1], width, height);\r\n }\r\n else {\r\n context.rect(0, 0, width, height);\r\n }\r\n context.closePath();\r\n context.fillShape(this);\r\n }\r\n _useBufferCanvas() {\r\n return super._useBufferCanvas(true);\r\n }\r\n _setInterval() {\r\n var that = this;\r\n this.interval = setInterval(function () {\r\n that._updateIndex();\r\n }, 1000 / this.frameRate());\r\n }\r\n /**\r\n * start sprite animation\r\n * @method\r\n * @name Konva.Sprite#start\r\n */\r\n start() {\r\n if (this.isRunning()) {\r\n return;\r\n }\r\n var layer = this.getLayer();\r\n /*\r\n * animation object has no executable function because\r\n * the updates are done with a fixed FPS with the setInterval\r\n * below. The anim object only needs the layer reference for\r\n * redraw\r\n */\r\n this.anim.setLayers(layer);\r\n this._setInterval();\r\n this.anim.start();\r\n }\r\n /**\r\n * stop sprite animation\r\n * @method\r\n * @name Konva.Sprite#stop\r\n */\r\n stop() {\r\n this.anim.stop();\r\n clearInterval(this.interval);\r\n }\r\n /**\r\n * determine if animation of sprite is running or not. returns true or false\r\n * @method\r\n * @name Konva.Sprite#isRunning\r\n * @returns {Boolean}\r\n */\r\n isRunning() {\r\n return this.anim.isRunning();\r\n }\r\n _updateIndex() {\r\n var index = this.frameIndex(), animation = this.animation(), animations = this.animations(), anim = animations[animation], len = anim.length / 4;\r\n if (index < len - 1) {\r\n this.frameIndex(index + 1);\r\n }\r\n else {\r\n this.frameIndex(0);\r\n }\r\n }\r\n }\r\n Sprite.prototype.className = 'Sprite';\r\n _registerNode(Sprite);\r\n // add getters setters\r\n Factory.addGetterSetter(Sprite, 'animation');\r\n /**\r\n * get/set animation key\r\n * @name Konva.Sprite#animation\r\n * @method\r\n * @param {String} anim animation key\r\n * @returns {String}\r\n * @example\r\n * // get animation key\r\n * var animation = sprite.animation();\r\n *\r\n * // set animation key\r\n * sprite.animation('kicking');\r\n */\r\n Factory.addGetterSetter(Sprite, 'animations');\r\n /**\r\n * get/set animations map\r\n * @name Konva.Sprite#animations\r\n * @method\r\n * @param {Object} animations\r\n * @returns {Object}\r\n * @example\r\n * // get animations map\r\n * var animations = sprite.animations();\r\n *\r\n * // set animations map\r\n * sprite.animations({\r\n * standing: [\r\n * // x, y, width, height (6 frames)\r\n * 0, 0, 49, 109,\r\n * 52, 0, 49, 109,\r\n * 105, 0, 49, 109,\r\n * 158, 0, 49, 109,\r\n * 210, 0, 49, 109,\r\n * 262, 0, 49, 109\r\n * ],\r\n * kicking: [\r\n * // x, y, width, height (6 frames)\r\n * 0, 109, 45, 98,\r\n * 45, 109, 45, 98,\r\n * 95, 109, 63, 98,\r\n * 156, 109, 70, 98,\r\n * 229, 109, 60, 98,\r\n * 287, 109, 41, 98\r\n * ]\r\n * });\r\n */\r\n Factory.addGetterSetter(Sprite, 'frameOffsets');\r\n /**\r\n * get/set offsets map\r\n * @name Konva.Sprite#offsets\r\n * @method\r\n * @param {Object} offsets\r\n * @returns {Object}\r\n * @example\r\n * // get offsets map\r\n * var offsets = sprite.offsets();\r\n *\r\n * // set offsets map\r\n * sprite.offsets({\r\n * standing: [\r\n * // x, y (6 frames)\r\n * 0, 0,\r\n * 0, 0,\r\n * 5, 0,\r\n * 0, 0,\r\n * 0, 3,\r\n * 2, 0\r\n * ],\r\n * kicking: [\r\n * // x, y (6 frames)\r\n * 0, 5,\r\n * 5, 0,\r\n * 10, 0,\r\n * 0, 0,\r\n * 2, 1,\r\n * 0, 0\r\n * ]\r\n * });\r\n */\r\n Factory.addGetterSetter(Sprite, 'image');\r\n /**\r\n * get/set image\r\n * @name Konva.Sprite#image\r\n * @method\r\n * @param {Image} image\r\n * @returns {Image}\r\n * @example\r\n * // get image\r\n * var image = sprite.image();\r\n *\r\n * // set image\r\n * sprite.image(imageObj);\r\n */\r\n Factory.addGetterSetter(Sprite, 'frameIndex', 0, getNumberValidator());\r\n /**\r\n * set/set animation frame index\r\n * @name Konva.Sprite#frameIndex\r\n * @method\r\n * @param {Integer} frameIndex\r\n * @returns {Integer}\r\n * @example\r\n * // get animation frame index\r\n * var frameIndex = sprite.frameIndex();\r\n *\r\n * // set animation frame index\r\n * sprite.frameIndex(3);\r\n */\r\n Factory.addGetterSetter(Sprite, 'frameRate', 17, getNumberValidator());\r\n /**\r\n * get/set frame rate in frames per second. Increase this number to make the sprite\r\n * animation run faster, and decrease the number to make the sprite animation run slower\r\n * The default is 17 frames per second\r\n * @name Konva.Sprite#frameRate\r\n * @method\r\n * @param {Integer} frameRate\r\n * @returns {Integer}\r\n * @example\r\n * // get frame rate\r\n * var frameRate = sprite.frameRate();\r\n *\r\n * // set frame rate to 2 frames per second\r\n * sprite.frameRate(2);\r\n */\r\n Factory.backCompat(Sprite, {\r\n index: 'frameIndex',\r\n getIndex: 'getFrameIndex',\r\n setIndex: 'setFrameIndex',\r\n });\n\n /**\r\n * Star constructor\r\n * @constructor\r\n * @memberof Konva\r\n * @augments Konva.Shape\r\n * @param {Object} config\r\n * @param {Integer} config.numPoints\r\n * @param {Number} config.innerRadius\r\n * @param {Number} config.outerRadius\r\n * @param {String} [config.fill] fill color\n * @param {Image} [config.fillPatternImage] fill pattern image\n * @param {Number} [config.fillPatternX]\n * @param {Number} [config.fillPatternY]\n * @param {Object} [config.fillPatternOffset] object with x and y component\n * @param {Number} [config.fillPatternOffsetX] \n * @param {Number} [config.fillPatternOffsetY] \n * @param {Object} [config.fillPatternScale] object with x and y component\n * @param {Number} [config.fillPatternScaleX]\n * @param {Number} [config.fillPatternScaleY]\n * @param {Number} [config.fillPatternRotation]\n * @param {String} [config.fillPatternRepeat] can be \"repeat\", \"repeat-x\", \"repeat-y\", or \"no-repeat\". The default is \"no-repeat\"\n * @param {Object} [config.fillLinearGradientStartPoint] object with x and y component\n * @param {Number} [config.fillLinearGradientStartPointX]\n * @param {Number} [config.fillLinearGradientStartPointY]\n * @param {Object} [config.fillLinearGradientEndPoint] object with x and y component\n * @param {Number} [config.fillLinearGradientEndPointX]\n * @param {Number} [config.fillLinearGradientEndPointY]\n * @param {Array} [config.fillLinearGradientColorStops] array of color stops\n * @param {Object} [config.fillRadialGradientStartPoint] object with x and y component\n * @param {Number} [config.fillRadialGradientStartPointX]\n * @param {Number} [config.fillRadialGradientStartPointY]\n * @param {Object} [config.fillRadialGradientEndPoint] object with x and y component\n * @param {Number} [config.fillRadialGradientEndPointX] \n * @param {Number} [config.fillRadialGradientEndPointY] \n * @param {Number} [config.fillRadialGradientStartRadius]\n * @param {Number} [config.fillRadialGradientEndRadius]\n * @param {Array} [config.fillRadialGradientColorStops] array of color stops\n * @param {Boolean} [config.fillEnabled] flag which enables or disables the fill. The default value is true\n * @param {String} [config.fillPriority] can be color, linear-gradient, radial-graident, or pattern. The default value is color. The fillPriority property makes it really easy to toggle between different fill types. For example, if you want to toggle between a fill color style and a fill pattern style, simply set the fill property and the fillPattern properties, and then use setFillPriority('color') to render the shape with a color fill, or use setFillPriority('pattern') to render the shape with the pattern fill configuration\n * @param {String} [config.stroke] stroke color\n * @param {Number} [config.strokeWidth] stroke width\n * @param {Boolean} [config.fillAfterStrokeEnabled]. Should we draw fill AFTER stroke? Default is false.\n * @param {Number} [config.hitStrokeWidth] size of the stroke on hit canvas. The default is \"auto\" - equals to strokeWidth\n * @param {Boolean} [config.strokeHitEnabled] flag which enables or disables stroke hit region. The default is true\n * @param {Boolean} [config.perfectDrawEnabled] flag which enables or disables using buffer canvas. The default is true\n * @param {Boolean} [config.shadowForStrokeEnabled] flag which enables or disables shadow for stroke. The default is true\n * @param {Boolean} [config.strokeScaleEnabled] flag which enables or disables stroke scale. The default is true\n * @param {Boolean} [config.strokeEnabled] flag which enables or disables the stroke. The default value is true\n * @param {String} [config.lineJoin] can be miter, round, or bevel. The default\n * is miter\n * @param {String} [config.lineCap] can be butt, round, or square. The default\n * is butt\n * @param {String} [config.shadowColor]\n * @param {Number} [config.shadowBlur]\n * @param {Object} [config.shadowOffset] object with x and y component\n * @param {Number} [config.shadowOffsetX]\n * @param {Number} [config.shadowOffsetY]\n * @param {Number} [config.shadowOpacity] shadow opacity. Can be any real number\n * between 0 and 1\n * @param {Boolean} [config.shadowEnabled] flag which enables or disables the shadow. The default value is true\n * @param {Array} [config.dash]\n * @param {Boolean} [config.dashEnabled] flag which enables or disables the dashArray. The default value is true\n\r\n * @param {Number} [config.x]\n * @param {Number} [config.y]\n * @param {Number} [config.width]\n * @param {Number} [config.height]\n * @param {Boolean} [config.visible]\n * @param {Boolean} [config.listening] whether or not the node is listening for events\n * @param {String} [config.id] unique id\n * @param {String} [config.name] non-unique name\n * @param {Number} [config.opacity] determines node opacity. Can be any number between 0 and 1\n * @param {Object} [config.scale] set scale\n * @param {Number} [config.scaleX] set scale x\n * @param {Number} [config.scaleY] set scale y\n * @param {Number} [config.rotation] rotation in degrees\n * @param {Object} [config.offset] offset from center point and rotation point\n * @param {Number} [config.offsetX] set offset x\n * @param {Number} [config.offsetY] set offset y\n * @param {Boolean} [config.draggable] makes the node draggable. When stages are draggable, you can drag and drop\n * the entire stage by dragging any portion of the stage\n * @param {Number} [config.dragDistance]\n * @param {Function} [config.dragBoundFunc]\r\n * @example\r\n * var star = new Konva.Star({\r\n * x: 100,\r\n * y: 200,\r\n * numPoints: 5,\r\n * innerRadius: 70,\r\n * outerRadius: 70,\r\n * fill: 'red',\r\n * stroke: 'black',\r\n * strokeWidth: 4\r\n * });\r\n */\r\n class Star extends Shape {\r\n _sceneFunc(context) {\r\n var innerRadius = this.innerRadius(), outerRadius = this.outerRadius(), numPoints = this.numPoints();\r\n context.beginPath();\r\n context.moveTo(0, 0 - outerRadius);\r\n for (var n = 1; n < numPoints * 2; n++) {\r\n var radius = n % 2 === 0 ? outerRadius : innerRadius;\r\n var x = radius * Math.sin((n * Math.PI) / numPoints);\r\n var y = -1 * radius * Math.cos((n * Math.PI) / numPoints);\r\n context.lineTo(x, y);\r\n }\r\n context.closePath();\r\n context.fillStrokeShape(this);\r\n }\r\n getWidth() {\r\n return this.outerRadius() * 2;\r\n }\r\n getHeight() {\r\n return this.outerRadius() * 2;\r\n }\r\n setWidth(width) {\r\n this.outerRadius(width / 2);\r\n }\r\n setHeight(height) {\r\n this.outerRadius(height / 2);\r\n }\r\n }\r\n Star.prototype.className = 'Star';\r\n Star.prototype._centroid = true;\r\n Star.prototype._attrsAffectingSize = ['innerRadius', 'outerRadius'];\r\n _registerNode(Star);\r\n /**\r\n * get/set number of points\r\n * @name Konva.Star#numPoints\r\n * @method\r\n * @param {Number} numPoints\r\n * @returns {Number}\r\n * @example\r\n * // get inner radius\r\n * var numPoints = star.numPoints();\r\n *\r\n * // set inner radius\r\n * star.numPoints(20);\r\n */\r\n Factory.addGetterSetter(Star, 'numPoints', 5, getNumberValidator());\r\n /**\r\n * get/set innerRadius\r\n * @name Konva.Star#innerRadius\r\n * @method\r\n * @param {Number} innerRadius\r\n * @returns {Number}\r\n * @example\r\n * // get inner radius\r\n * var innerRadius = star.innerRadius();\r\n *\r\n * // set inner radius\r\n * star.innerRadius(20);\r\n */\r\n Factory.addGetterSetter(Star, 'innerRadius', 0, getNumberValidator());\r\n /**\r\n * get/set outerRadius\r\n * @name Konva.Star#outerRadius\r\n * @method\r\n * @param {Number} outerRadius\r\n * @returns {Number}\r\n * @example\r\n * // get inner radius\r\n * var outerRadius = star.outerRadius();\r\n *\r\n * // set inner radius\r\n * star.outerRadius(20);\r\n */\r\n Factory.addGetterSetter(Star, 'outerRadius', 0, getNumberValidator());\n\n function stringToArray(string) {\r\n // we need to use `Array.from` because it can split unicode string correctly\r\n // we also can use some regexp magic from lodash:\r\n // https://github.com/lodash/lodash/blob/fb1f99d9d90ad177560d771bc5953a435b2dc119/lodash.toarray/index.js#L256\r\n // but I decided it is too much code for that small fix\r\n return Array.from(string);\r\n }\r\n // constants\r\n var AUTO = 'auto', \r\n //CANVAS = 'canvas',\r\n CENTER = 'center', JUSTIFY = 'justify', CHANGE_KONVA = 'Change.konva', CONTEXT_2D = '2d', DASH = '-', LEFT = 'left', TEXT = 'text', TEXT_UPPER = 'Text', TOP = 'top', BOTTOM = 'bottom', MIDDLE = 'middle', NORMAL$1 = 'normal', PX_SPACE = 'px ', SPACE = ' ', RIGHT = 'right', WORD = 'word', CHAR = 'char', NONE = 'none', ELLIPSIS = '…', ATTR_CHANGE_LIST$1 = [\r\n 'fontFamily',\r\n 'fontSize',\r\n 'fontStyle',\r\n 'fontVariant',\r\n 'padding',\r\n 'align',\r\n 'verticalAlign',\r\n 'lineHeight',\r\n 'text',\r\n 'width',\r\n 'height',\r\n 'wrap',\r\n 'ellipsis',\r\n 'letterSpacing',\r\n ], \r\n // cached variables\r\n attrChangeListLen = ATTR_CHANGE_LIST$1.length;\r\n function normalizeFontFamily(fontFamily) {\r\n return fontFamily\r\n .split(',')\r\n .map((family) => {\r\n family = family.trim();\r\n const hasSpace = family.indexOf(' ') >= 0;\r\n const hasQuotes = family.indexOf('\"') >= 0 || family.indexOf(\"'\") >= 0;\r\n if (hasSpace && !hasQuotes) {\r\n family = `\"${family}\"`;\r\n }\r\n return family;\r\n })\r\n .join(', ');\r\n }\r\n var dummyContext;\r\n function getDummyContext() {\r\n if (dummyContext) {\r\n return dummyContext;\r\n }\r\n dummyContext = Util.createCanvasElement().getContext(CONTEXT_2D);\r\n return dummyContext;\r\n }\r\n function _fillFunc$1(context) {\r\n context.fillText(this._partialText, this._partialTextX, this._partialTextY);\r\n }\r\n function _strokeFunc$1(context) {\r\n context.strokeText(this._partialText, this._partialTextX, this._partialTextY);\r\n }\r\n function checkDefaultFill(config) {\r\n config = config || {};\r\n // set default color to black\r\n if (!config.fillLinearGradientColorStops &&\r\n !config.fillRadialGradientColorStops &&\r\n !config.fillPatternImage) {\r\n config.fill = config.fill || 'black';\r\n }\r\n return config;\r\n }\r\n /**\r\n * Text constructor\r\n * @constructor\r\n * @memberof Konva\r\n * @augments Konva.Shape\r\n * @param {Object} config\r\n * @param {String} [config.fontFamily] default is Arial\r\n * @param {Number} [config.fontSize] in pixels. Default is 12\r\n * @param {String} [config.fontStyle] can be 'normal', 'bold', 'italic' or even 'italic bold'. Default is 'normal'\r\n * @param {String} [config.fontVariant] can be normal or small-caps. Default is normal\r\n * @param {String} [config.textDecoration] can be line-through, underline or empty string. Default is empty string.\r\n * @param {String} config.text\r\n * @param {String} [config.align] can be left, center, or right\r\n * @param {String} [config.verticalAlign] can be top, middle or bottom\r\n * @param {Number} [config.padding]\r\n * @param {Number} [config.lineHeight] default is 1\r\n * @param {String} [config.wrap] can be \"word\", \"char\", or \"none\". Default is word\r\n * @param {Boolean} [config.ellipsis] can be true or false. Default is false. if Konva.Text config is set to wrap=\"none\" and ellipsis=true, then it will add \"...\" to the end\r\n * @param {String} [config.fill] fill color\n * @param {Image} [config.fillPatternImage] fill pattern image\n * @param {Number} [config.fillPatternX]\n * @param {Number} [config.fillPatternY]\n * @param {Object} [config.fillPatternOffset] object with x and y component\n * @param {Number} [config.fillPatternOffsetX] \n * @param {Number} [config.fillPatternOffsetY] \n * @param {Object} [config.fillPatternScale] object with x and y component\n * @param {Number} [config.fillPatternScaleX]\n * @param {Number} [config.fillPatternScaleY]\n * @param {Number} [config.fillPatternRotation]\n * @param {String} [config.fillPatternRepeat] can be \"repeat\", \"repeat-x\", \"repeat-y\", or \"no-repeat\". The default is \"no-repeat\"\n * @param {Object} [config.fillLinearGradientStartPoint] object with x and y component\n * @param {Number} [config.fillLinearGradientStartPointX]\n * @param {Number} [config.fillLinearGradientStartPointY]\n * @param {Object} [config.fillLinearGradientEndPoint] object with x and y component\n * @param {Number} [config.fillLinearGradientEndPointX]\n * @param {Number} [config.fillLinearGradientEndPointY]\n * @param {Array} [config.fillLinearGradientColorStops] array of color stops\n * @param {Object} [config.fillRadialGradientStartPoint] object with x and y component\n * @param {Number} [config.fillRadialGradientStartPointX]\n * @param {Number} [config.fillRadialGradientStartPointY]\n * @param {Object} [config.fillRadialGradientEndPoint] object with x and y component\n * @param {Number} [config.fillRadialGradientEndPointX] \n * @param {Number} [config.fillRadialGradientEndPointY] \n * @param {Number} [config.fillRadialGradientStartRadius]\n * @param {Number} [config.fillRadialGradientEndRadius]\n * @param {Array} [config.fillRadialGradientColorStops] array of color stops\n * @param {Boolean} [config.fillEnabled] flag which enables or disables the fill. The default value is true\n * @param {String} [config.fillPriority] can be color, linear-gradient, radial-graident, or pattern. The default value is color. The fillPriority property makes it really easy to toggle between different fill types. For example, if you want to toggle between a fill color style and a fill pattern style, simply set the fill property and the fillPattern properties, and then use setFillPriority('color') to render the shape with a color fill, or use setFillPriority('pattern') to render the shape with the pattern fill configuration\n * @param {String} [config.stroke] stroke color\n * @param {Number} [config.strokeWidth] stroke width\n * @param {Boolean} [config.fillAfterStrokeEnabled]. Should we draw fill AFTER stroke? Default is false.\n * @param {Number} [config.hitStrokeWidth] size of the stroke on hit canvas. The default is \"auto\" - equals to strokeWidth\n * @param {Boolean} [config.strokeHitEnabled] flag which enables or disables stroke hit region. The default is true\n * @param {Boolean} [config.perfectDrawEnabled] flag which enables or disables using buffer canvas. The default is true\n * @param {Boolean} [config.shadowForStrokeEnabled] flag which enables or disables shadow for stroke. The default is true\n * @param {Boolean} [config.strokeScaleEnabled] flag which enables or disables stroke scale. The default is true\n * @param {Boolean} [config.strokeEnabled] flag which enables or disables the stroke. The default value is true\n * @param {String} [config.lineJoin] can be miter, round, or bevel. The default\n * is miter\n * @param {String} [config.lineCap] can be butt, round, or square. The default\n * is butt\n * @param {String} [config.shadowColor]\n * @param {Number} [config.shadowBlur]\n * @param {Object} [config.shadowOffset] object with x and y component\n * @param {Number} [config.shadowOffsetX]\n * @param {Number} [config.shadowOffsetY]\n * @param {Number} [config.shadowOpacity] shadow opacity. Can be any real number\n * between 0 and 1\n * @param {Boolean} [config.shadowEnabled] flag which enables or disables the shadow. The default value is true\n * @param {Array} [config.dash]\n * @param {Boolean} [config.dashEnabled] flag which enables or disables the dashArray. The default value is true\n\r\n * @param {Number} [config.x]\n * @param {Number} [config.y]\n * @param {Number} [config.width]\n * @param {Number} [config.height]\n * @param {Boolean} [config.visible]\n * @param {Boolean} [config.listening] whether or not the node is listening for events\n * @param {String} [config.id] unique id\n * @param {String} [config.name] non-unique name\n * @param {Number} [config.opacity] determines node opacity. Can be any number between 0 and 1\n * @param {Object} [config.scale] set scale\n * @param {Number} [config.scaleX] set scale x\n * @param {Number} [config.scaleY] set scale y\n * @param {Number} [config.rotation] rotation in degrees\n * @param {Object} [config.offset] offset from center point and rotation point\n * @param {Number} [config.offsetX] set offset x\n * @param {Number} [config.offsetY] set offset y\n * @param {Boolean} [config.draggable] makes the node draggable. When stages are draggable, you can drag and drop\n * the entire stage by dragging any portion of the stage\n * @param {Number} [config.dragDistance]\n * @param {Function} [config.dragBoundFunc]\r\n * @example\r\n * var text = new Konva.Text({\r\n * x: 10,\r\n * y: 15,\r\n * text: 'Simple Text',\r\n * fontSize: 30,\r\n * fontFamily: 'Calibri',\r\n * fill: 'green'\r\n * });\r\n */\r\n class Text extends Shape {\r\n constructor(config) {\r\n super(checkDefaultFill(config));\r\n this._partialTextX = 0;\r\n this._partialTextY = 0;\r\n // update text data for certain attr changes\r\n for (var n = 0; n < attrChangeListLen; n++) {\r\n this.on(ATTR_CHANGE_LIST$1[n] + CHANGE_KONVA, this._setTextData);\r\n }\r\n this._setTextData();\r\n }\r\n _sceneFunc(context) {\r\n var textArr = this.textArr, textArrLen = textArr.length;\r\n if (!this.text()) {\r\n return;\r\n }\r\n var padding = this.padding(), fontSize = this.fontSize(), lineHeightPx = this.lineHeight() * fontSize, verticalAlign = this.verticalAlign(), alignY = 0, align = this.align(), totalWidth = this.getWidth(), letterSpacing = this.letterSpacing(), fill = this.fill(), textDecoration = this.textDecoration(), shouldUnderline = textDecoration.indexOf('underline') !== -1, shouldLineThrough = textDecoration.indexOf('line-through') !== -1, n;\r\n var translateY = 0;\r\n var translateY = lineHeightPx / 2;\r\n var lineTranslateX = 0;\r\n var lineTranslateY = 0;\r\n context.setAttr('font', this._getContextFont());\r\n context.setAttr('textBaseline', MIDDLE);\r\n context.setAttr('textAlign', LEFT);\r\n // handle vertical alignment\r\n if (verticalAlign === MIDDLE) {\r\n alignY = (this.getHeight() - textArrLen * lineHeightPx - padding * 2) / 2;\r\n }\r\n else if (verticalAlign === BOTTOM) {\r\n alignY = this.getHeight() - textArrLen * lineHeightPx - padding * 2;\r\n }\r\n context.translate(padding, alignY + padding);\r\n // draw text lines\r\n for (n = 0; n < textArrLen; n++) {\r\n var lineTranslateX = 0;\r\n var lineTranslateY = 0;\r\n var obj = textArr[n], text = obj.text, width = obj.width, lastLine = obj.lastInParagraph, spacesNumber, oneWord, lineWidth;\r\n // horizontal alignment\r\n context.save();\r\n if (align === RIGHT) {\r\n lineTranslateX += totalWidth - width - padding * 2;\r\n }\r\n else if (align === CENTER) {\r\n lineTranslateX += (totalWidth - width - padding * 2) / 2;\r\n }\r\n if (shouldUnderline) {\r\n context.save();\r\n context.beginPath();\r\n context.moveTo(lineTranslateX, translateY + lineTranslateY + Math.round(fontSize / 2));\r\n spacesNumber = text.split(' ').length - 1;\r\n oneWord = spacesNumber === 0;\r\n lineWidth =\r\n align === JUSTIFY && lastLine && !oneWord\r\n ? totalWidth - padding * 2\r\n : width;\r\n context.lineTo(lineTranslateX + Math.round(lineWidth), translateY + lineTranslateY + Math.round(fontSize / 2));\r\n // I have no idea what is real ratio\r\n // just /15 looks good enough\r\n context.lineWidth = fontSize / 15;\r\n context.strokeStyle = fill;\r\n context.stroke();\r\n context.restore();\r\n }\r\n if (shouldLineThrough) {\r\n context.save();\r\n context.beginPath();\r\n context.moveTo(lineTranslateX, translateY + lineTranslateY);\r\n spacesNumber = text.split(' ').length - 1;\r\n oneWord = spacesNumber === 0;\r\n lineWidth =\r\n align === JUSTIFY && lastLine && !oneWord\r\n ? totalWidth - padding * 2\r\n : width;\r\n context.lineTo(lineTranslateX + Math.round(lineWidth), translateY + lineTranslateY);\r\n context.lineWidth = fontSize / 15;\r\n context.strokeStyle = fill;\r\n context.stroke();\r\n context.restore();\r\n }\r\n if (letterSpacing !== 0 || align === JUSTIFY) {\r\n // var words = text.split(' ');\r\n spacesNumber = text.split(' ').length - 1;\r\n var array = stringToArray(text);\r\n for (var li = 0; li < array.length; li++) {\r\n var letter = array[li];\r\n // skip justify for the last line\r\n if (letter === ' ' && !lastLine && align === JUSTIFY) {\r\n lineTranslateX += (totalWidth - padding * 2 - width) / spacesNumber;\r\n // context.translate(\r\n // Math.floor((totalWidth - padding * 2 - width) / spacesNumber),\r\n // 0\r\n // );\r\n }\r\n this._partialTextX = lineTranslateX;\r\n this._partialTextY = translateY + lineTranslateY;\r\n this._partialText = letter;\r\n context.fillStrokeShape(this);\r\n lineTranslateX += this.measureSize(letter).width + letterSpacing;\r\n }\r\n }\r\n else {\r\n this._partialTextX = lineTranslateX;\r\n this._partialTextY = translateY + lineTranslateY;\r\n this._partialText = text;\r\n context.fillStrokeShape(this);\r\n }\r\n context.restore();\r\n if (textArrLen > 1) {\r\n translateY += lineHeightPx;\r\n }\r\n }\r\n }\r\n _hitFunc(context) {\r\n var width = this.getWidth(), height = this.getHeight();\r\n context.beginPath();\r\n context.rect(0, 0, width, height);\r\n context.closePath();\r\n context.fillStrokeShape(this);\r\n }\r\n setText(text) {\r\n var str = Util._isString(text)\r\n ? text\r\n : text === null || text === undefined\r\n ? ''\r\n : text + '';\r\n this._setAttr(TEXT, str);\r\n return this;\r\n }\r\n getWidth() {\r\n var isAuto = this.attrs.width === AUTO || this.attrs.width === undefined;\r\n return isAuto ? this.getTextWidth() + this.padding() * 2 : this.attrs.width;\r\n }\r\n getHeight() {\r\n var isAuto = this.attrs.height === AUTO || this.attrs.height === undefined;\r\n return isAuto\r\n ? this.fontSize() * this.textArr.length * this.lineHeight() +\r\n this.padding() * 2\r\n : this.attrs.height;\r\n }\r\n /**\r\n * get pure text width without padding\r\n * @method\r\n * @name Konva.Text#getTextWidth\r\n * @returns {Number}\r\n */\r\n getTextWidth() {\r\n return this.textWidth;\r\n }\r\n getTextHeight() {\r\n Util.warn('text.getTextHeight() method is deprecated. Use text.height() - for full height and text.fontSize() - for one line height.');\r\n return this.textHeight;\r\n }\r\n /**\r\n * measure string with the font of current text shape.\r\n * That method can't handle multiline text.\r\n * @method\r\n * @name Konva.Text#measureSize\r\n * @param {String} [text] text to measure\r\n * @returns {Object} { width , height} of measured text\r\n */\r\n measureSize(text) {\r\n var _context = getDummyContext(), fontSize = this.fontSize(), metrics;\r\n _context.save();\r\n _context.font = this._getContextFont();\r\n metrics = _context.measureText(text);\r\n _context.restore();\r\n return {\r\n width: metrics.width,\r\n height: fontSize,\r\n };\r\n }\r\n _getContextFont() {\r\n return (this.fontStyle() +\r\n SPACE +\r\n this.fontVariant() +\r\n SPACE +\r\n (this.fontSize() + PX_SPACE) +\r\n // wrap font family into \" so font families with spaces works ok\r\n normalizeFontFamily(this.fontFamily()));\r\n }\r\n _addTextLine(line) {\r\n if (this.align() === JUSTIFY) {\r\n line = line.trim();\r\n }\r\n var width = this._getTextWidth(line);\r\n return this.textArr.push({\r\n text: line,\r\n width: width,\r\n lastInParagraph: false,\r\n });\r\n }\r\n _getTextWidth(text) {\r\n var letterSpacing = this.letterSpacing();\r\n var length = text.length;\r\n return (getDummyContext().measureText(text).width +\r\n (length ? letterSpacing * (length - 1) : 0));\r\n }\r\n _setTextData() {\r\n var lines = this.text().split('\\n'), fontSize = +this.fontSize(), textWidth = 0, lineHeightPx = this.lineHeight() * fontSize, width = this.attrs.width, height = this.attrs.height, fixedWidth = width !== AUTO && width !== undefined, fixedHeight = height !== AUTO && height !== undefined, padding = this.padding(), maxWidth = width - padding * 2, maxHeightPx = height - padding * 2, currentHeightPx = 0, wrap = this.wrap(), \r\n // align = this.align(),\r\n shouldWrap = wrap !== NONE, wrapAtWord = wrap !== CHAR && shouldWrap, shouldAddEllipsis = this.ellipsis();\r\n this.textArr = [];\r\n getDummyContext().font = this._getContextFont();\r\n var additionalWidth = shouldAddEllipsis ? this._getTextWidth(ELLIPSIS) : 0;\r\n for (var i = 0, max = lines.length; i < max; ++i) {\r\n var line = lines[i];\r\n var lineWidth = this._getTextWidth(line);\r\n if (fixedWidth && lineWidth > maxWidth) {\r\n /*\r\n * if width is fixed and line does not fit entirely\r\n * break the line into multiple fitting lines\r\n */\r\n while (line.length > 0) {\r\n /*\r\n * use binary search to find the longest substring that\r\n * that would fit in the specified width\r\n */\r\n var low = 0, high = line.length, match = '', matchWidth = 0;\r\n while (low < high) {\r\n var mid = (low + high) >>> 1, substr = line.slice(0, mid + 1), substrWidth = this._getTextWidth(substr) + additionalWidth;\r\n if (substrWidth <= maxWidth) {\r\n low = mid + 1;\r\n match = substr;\r\n matchWidth = substrWidth;\r\n }\r\n else {\r\n high = mid;\r\n }\r\n }\r\n /*\r\n * 'low' is now the index of the substring end\r\n * 'match' is the substring\r\n * 'matchWidth' is the substring width in px\r\n */\r\n if (match) {\r\n // a fitting substring was found\r\n if (wrapAtWord) {\r\n // try to find a space or dash where wrapping could be done\r\n var wrapIndex;\r\n var nextChar = line[match.length];\r\n var nextIsSpaceOrDash = nextChar === SPACE || nextChar === DASH;\r\n if (nextIsSpaceOrDash && matchWidth <= maxWidth) {\r\n wrapIndex = match.length;\r\n }\r\n else {\r\n wrapIndex =\r\n Math.max(match.lastIndexOf(SPACE), match.lastIndexOf(DASH)) +\r\n 1;\r\n }\r\n if (wrapIndex > 0) {\r\n // re-cut the substring found at the space/dash position\r\n low = wrapIndex;\r\n match = match.slice(0, low);\r\n matchWidth = this._getTextWidth(match);\r\n }\r\n }\r\n // if (align === 'right') {\r\n match = match.trimRight();\r\n // }\r\n this._addTextLine(match);\r\n textWidth = Math.max(textWidth, matchWidth);\r\n currentHeightPx += lineHeightPx;\r\n var shouldHandleEllipsis = this._shouldHandleEllipsis(currentHeightPx);\r\n if (shouldHandleEllipsis) {\r\n this._tryToAddEllipsisToLastLine();\r\n /*\r\n * stop wrapping if wrapping is disabled or if adding\r\n * one more line would overflow the fixed height\r\n */\r\n break;\r\n }\r\n line = line.slice(low);\r\n line = line.trimLeft();\r\n if (line.length > 0) {\r\n // Check if the remaining text would fit on one line\r\n lineWidth = this._getTextWidth(line);\r\n if (lineWidth <= maxWidth) {\r\n // if it does, add the line and break out of the loop\r\n this._addTextLine(line);\r\n currentHeightPx += lineHeightPx;\r\n textWidth = Math.max(textWidth, lineWidth);\r\n break;\r\n }\r\n }\r\n }\r\n else {\r\n // not even one character could fit in the element, abort\r\n break;\r\n }\r\n }\r\n }\r\n else {\r\n // element width is automatically adjusted to max line width\r\n this._addTextLine(line);\r\n currentHeightPx += lineHeightPx;\r\n textWidth = Math.max(textWidth, lineWidth);\r\n if (this._shouldHandleEllipsis(currentHeightPx) && i < max - 1) {\r\n this._tryToAddEllipsisToLastLine();\r\n }\r\n }\r\n // if element height is fixed, abort if adding one more line would overflow\r\n if (fixedHeight && currentHeightPx + lineHeightPx > maxHeightPx) {\r\n break;\r\n }\r\n if (this.textArr[this.textArr.length - 1]) {\r\n this.textArr[this.textArr.length - 1].lastInParagraph = true;\r\n }\r\n }\r\n this.textHeight = fontSize;\r\n // var maxTextWidth = 0;\r\n // for(var j = 0; j < this.textArr.length; j++) {\r\n // maxTextWidth = Math.max(maxTextWidth, this.textArr[j].width);\r\n // }\r\n this.textWidth = textWidth;\r\n }\r\n /**\r\n * whether to handle ellipsis, there are two cases:\r\n * 1. the current line is the last line\r\n * 2. wrap is NONE\r\n * @param {Number} currentHeightPx\r\n * @returns\r\n */\r\n _shouldHandleEllipsis(currentHeightPx) {\r\n var fontSize = +this.fontSize(), lineHeightPx = this.lineHeight() * fontSize, height = this.attrs.height, fixedHeight = height !== AUTO && height !== undefined, padding = this.padding(), maxHeightPx = height - padding * 2, wrap = this.wrap(), shouldWrap = wrap !== NONE;\r\n return (!shouldWrap ||\r\n (fixedHeight && currentHeightPx + lineHeightPx > maxHeightPx));\r\n }\r\n _tryToAddEllipsisToLastLine() {\r\n var width = this.attrs.width, fixedWidth = width !== AUTO && width !== undefined, padding = this.padding(), maxWidth = width - padding * 2, shouldAddEllipsis = this.ellipsis();\r\n var lastLine = this.textArr[this.textArr.length - 1];\r\n if (!lastLine || !shouldAddEllipsis) {\r\n return;\r\n }\r\n if (fixedWidth) {\r\n var haveSpace = this._getTextWidth(lastLine.text + ELLIPSIS) < maxWidth;\r\n if (!haveSpace) {\r\n lastLine.text = lastLine.text.slice(0, lastLine.text.length - 3);\r\n }\r\n }\r\n this.textArr.splice(this.textArr.length - 1, 1);\r\n this._addTextLine(lastLine.text + ELLIPSIS);\r\n }\r\n // for text we can't disable stroke scaling\r\n // if we do, the result will be unexpected\r\n getStrokeScaleEnabled() {\r\n return true;\r\n }\r\n }\r\n Text.prototype._fillFunc = _fillFunc$1;\r\n Text.prototype._strokeFunc = _strokeFunc$1;\r\n Text.prototype.className = TEXT_UPPER;\r\n Text.prototype._attrsAffectingSize = [\r\n 'text',\r\n 'fontSize',\r\n 'padding',\r\n 'wrap',\r\n 'lineHeight',\r\n 'letterSpacing',\r\n ];\r\n _registerNode(Text);\r\n /**\r\n * get/set width of text area, which includes padding.\r\n * @name Konva.Text#width\r\n * @method\r\n * @param {Number} width\r\n * @returns {Number}\r\n * @example\r\n * // get width\r\n * var width = text.width();\r\n *\r\n * // set width\r\n * text.width(20);\r\n *\r\n * // set to auto\r\n * text.width('auto');\r\n * text.width() // will return calculated width, and not \"auto\"\r\n */\r\n Factory.overWriteSetter(Text, 'width', getNumberOrAutoValidator());\r\n /**\r\n * get/set the height of the text area, which takes into account multi-line text, line heights, and padding.\r\n * @name Konva.Text#height\r\n * @method\r\n * @param {Number} height\r\n * @returns {Number}\r\n * @example\r\n * // get height\r\n * var height = text.height();\r\n *\r\n * // set height\r\n * text.height(20);\r\n *\r\n * // set to auto\r\n * text.height('auto');\r\n * text.height() // will return calculated height, and not \"auto\"\r\n */\r\n Factory.overWriteSetter(Text, 'height', getNumberOrAutoValidator());\r\n /**\r\n * get/set font family\r\n * @name Konva.Text#fontFamily\r\n * @method\r\n * @param {String} fontFamily\r\n * @returns {String}\r\n * @example\r\n * // get font family\r\n * var fontFamily = text.fontFamily();\r\n *\r\n * // set font family\r\n * text.fontFamily('Arial');\r\n */\r\n Factory.addGetterSetter(Text, 'fontFamily', 'Arial');\r\n /**\r\n * get/set font size in pixels\r\n * @name Konva.Text#fontSize\r\n * @method\r\n * @param {Number} fontSize\r\n * @returns {Number}\r\n * @example\r\n * // get font size\r\n * var fontSize = text.fontSize();\r\n *\r\n * // set font size to 22px\r\n * text.fontSize(22);\r\n */\r\n Factory.addGetterSetter(Text, 'fontSize', 12, getNumberValidator());\r\n /**\r\n * get/set font style. Can be 'normal', 'italic', or 'bold' or even 'italic bold'. 'normal' is the default.\r\n * @name Konva.Text#fontStyle\r\n * @method\r\n * @param {String} fontStyle\r\n * @returns {String}\r\n * @example\r\n * // get font style\r\n * var fontStyle = text.fontStyle();\r\n *\r\n * // set font style\r\n * text.fontStyle('bold');\r\n */\r\n Factory.addGetterSetter(Text, 'fontStyle', NORMAL$1);\r\n /**\r\n * get/set font variant. Can be 'normal' or 'small-caps'. 'normal' is the default.\r\n * @name Konva.Text#fontVariant\r\n * @method\r\n * @param {String} fontVariant\r\n * @returns {String}\r\n * @example\r\n * // get font variant\r\n * var fontVariant = text.fontVariant();\r\n *\r\n * // set font variant\r\n * text.fontVariant('small-caps');\r\n */\r\n Factory.addGetterSetter(Text, 'fontVariant', NORMAL$1);\r\n /**\r\n * get/set padding\r\n * @name Konva.Text#padding\r\n * @method\r\n * @param {Number} padding\r\n * @returns {Number}\r\n * @example\r\n * // get padding\r\n * var padding = text.padding();\r\n *\r\n * // set padding to 10 pixels\r\n * text.padding(10);\r\n */\r\n Factory.addGetterSetter(Text, 'padding', 0, getNumberValidator());\r\n /**\r\n * get/set horizontal align of text. Can be 'left', 'center', 'right' or 'justify'\r\n * @name Konva.Text#align\r\n * @method\r\n * @param {String} align\r\n * @returns {String}\r\n * @example\r\n * // get text align\r\n * var align = text.align();\r\n *\r\n * // center text\r\n * text.align('center');\r\n *\r\n * // align text to right\r\n * text.align('right');\r\n */\r\n Factory.addGetterSetter(Text, 'align', LEFT);\r\n /**\r\n * get/set vertical align of text. Can be 'top', 'middle', 'bottom'.\r\n * @name Konva.Text#verticalAlign\r\n * @method\r\n * @param {String} verticalAlign\r\n * @returns {String}\r\n * @example\r\n * // get text vertical align\r\n * var verticalAlign = text.verticalAlign();\r\n *\r\n * // center text\r\n * text.verticalAlign('middle');\r\n */\r\n Factory.addGetterSetter(Text, 'verticalAlign', TOP);\r\n /**\r\n * get/set line height. The default is 1.\r\n * @name Konva.Text#lineHeight\r\n * @method\r\n * @param {Number} lineHeight\r\n * @returns {Number}\r\n * @example\r\n * // get line height\r\n * var lineHeight = text.lineHeight();\r\n *\r\n * // set the line height\r\n * text.lineHeight(2);\r\n */\r\n Factory.addGetterSetter(Text, 'lineHeight', 1, getNumberValidator());\r\n /**\r\n * get/set wrap. Can be \"word\", \"char\", or \"none\". Default is \"word\".\r\n * In \"word\" wrapping any word still can be wrapped if it can't be placed in the required width\r\n * without breaks.\r\n * @name Konva.Text#wrap\r\n * @method\r\n * @param {String} wrap\r\n * @returns {String}\r\n * @example\r\n * // get wrap\r\n * var wrap = text.wrap();\r\n *\r\n * // set wrap\r\n * text.wrap('word');\r\n */\r\n Factory.addGetterSetter(Text, 'wrap', WORD);\r\n /**\r\n * get/set ellipsis. Can be true or false. Default is false. If ellipses is true,\r\n * Konva will add \"...\" at the end of the text if it doesn't have enough space to write characters.\r\n * That is possible only when you limit both width and height of the text\r\n * @name Konva.Text#ellipsis\r\n * @method\r\n * @param {Boolean} ellipsis\r\n * @returns {Boolean}\r\n * @example\r\n * // get ellipsis param, returns true or false\r\n * var ellipsis = text.ellipsis();\r\n *\r\n * // set ellipsis\r\n * text.ellipsis(true);\r\n */\r\n Factory.addGetterSetter(Text, 'ellipsis', false, getBooleanValidator());\r\n /**\r\n * set letter spacing property. Default value is 0.\r\n * @name Konva.Text#letterSpacing\r\n * @method\r\n * @param {Number} letterSpacing\r\n */\r\n Factory.addGetterSetter(Text, 'letterSpacing', 0, getNumberValidator());\r\n /**\r\n * get/set text\r\n * @name Konva.Text#text\r\n * @method\r\n * @param {String} text\r\n * @returns {String}\r\n * @example\r\n * // get text\r\n * var text = text.text();\r\n *\r\n * // set text\r\n * text.text('Hello world!');\r\n */\r\n Factory.addGetterSetter(Text, 'text', '', getStringValidator());\r\n /**\r\n * get/set text decoration of a text. Possible values are 'underline', 'line-through' or combination of these values separated by space\r\n * @name Konva.Text#textDecoration\r\n * @method\r\n * @param {String} textDecoration\r\n * @returns {String}\r\n * @example\r\n * // get text decoration\r\n * var textDecoration = text.textDecoration();\r\n *\r\n * // underline text\r\n * text.textDecoration('underline');\r\n *\r\n * // strike text\r\n * text.textDecoration('line-through');\r\n *\r\n * // underline and strike text\r\n * text.textDecoration('underline line-through');\r\n */\r\n Factory.addGetterSetter(Text, 'textDecoration', '');\n\n var EMPTY_STRING = '', NORMAL = 'normal';\r\n function _fillFunc(context) {\r\n context.fillText(this.partialText, 0, 0);\r\n }\r\n function _strokeFunc(context) {\r\n context.strokeText(this.partialText, 0, 0);\r\n }\r\n /**\r\n * Path constructor.\r\n * @author Jason Follas\r\n * @constructor\r\n * @memberof Konva\r\n * @augments Konva.Shape\r\n * @param {Object} config\r\n * @param {String} [config.fontFamily] default is Arial\r\n * @param {Number} [config.fontSize] default is 12\r\n * @param {String} [config.fontStyle] can be normal, bold, or italic. Default is normal\r\n * @param {String} [config.fontVariant] can be normal or small-caps. Default is normal\r\n * @param {String} [config.textBaseline] Can be 'top', 'bottom', 'middle', 'alphabetic', 'hanging'. Default is middle\r\n * @param {String} config.text\r\n * @param {String} config.data SVG data string\r\n * @param {Function} config.kerningFunc a getter for kerning values for the specified characters\r\n * @param {String} [config.fill] fill color\n * @param {Image} [config.fillPatternImage] fill pattern image\n * @param {Number} [config.fillPatternX]\n * @param {Number} [config.fillPatternY]\n * @param {Object} [config.fillPatternOffset] object with x and y component\n * @param {Number} [config.fillPatternOffsetX] \n * @param {Number} [config.fillPatternOffsetY] \n * @param {Object} [config.fillPatternScale] object with x and y component\n * @param {Number} [config.fillPatternScaleX]\n * @param {Number} [config.fillPatternScaleY]\n * @param {Number} [config.fillPatternRotation]\n * @param {String} [config.fillPatternRepeat] can be \"repeat\", \"repeat-x\", \"repeat-y\", or \"no-repeat\". The default is \"no-repeat\"\n * @param {Object} [config.fillLinearGradientStartPoint] object with x and y component\n * @param {Number} [config.fillLinearGradientStartPointX]\n * @param {Number} [config.fillLinearGradientStartPointY]\n * @param {Object} [config.fillLinearGradientEndPoint] object with x and y component\n * @param {Number} [config.fillLinearGradientEndPointX]\n * @param {Number} [config.fillLinearGradientEndPointY]\n * @param {Array} [config.fillLinearGradientColorStops] array of color stops\n * @param {Object} [config.fillRadialGradientStartPoint] object with x and y component\n * @param {Number} [config.fillRadialGradientStartPointX]\n * @param {Number} [config.fillRadialGradientStartPointY]\n * @param {Object} [config.fillRadialGradientEndPoint] object with x and y component\n * @param {Number} [config.fillRadialGradientEndPointX] \n * @param {Number} [config.fillRadialGradientEndPointY] \n * @param {Number} [config.fillRadialGradientStartRadius]\n * @param {Number} [config.fillRadialGradientEndRadius]\n * @param {Array} [config.fillRadialGradientColorStops] array of color stops\n * @param {Boolean} [config.fillEnabled] flag which enables or disables the fill. The default value is true\n * @param {String} [config.fillPriority] can be color, linear-gradient, radial-graident, or pattern. The default value is color. The fillPriority property makes it really easy to toggle between different fill types. For example, if you want to toggle between a fill color style and a fill pattern style, simply set the fill property and the fillPattern properties, and then use setFillPriority('color') to render the shape with a color fill, or use setFillPriority('pattern') to render the shape with the pattern fill configuration\n * @param {String} [config.stroke] stroke color\n * @param {Number} [config.strokeWidth] stroke width\n * @param {Boolean} [config.fillAfterStrokeEnabled]. Should we draw fill AFTER stroke? Default is false.\n * @param {Number} [config.hitStrokeWidth] size of the stroke on hit canvas. The default is \"auto\" - equals to strokeWidth\n * @param {Boolean} [config.strokeHitEnabled] flag which enables or disables stroke hit region. The default is true\n * @param {Boolean} [config.perfectDrawEnabled] flag which enables or disables using buffer canvas. The default is true\n * @param {Boolean} [config.shadowForStrokeEnabled] flag which enables or disables shadow for stroke. The default is true\n * @param {Boolean} [config.strokeScaleEnabled] flag which enables or disables stroke scale. The default is true\n * @param {Boolean} [config.strokeEnabled] flag which enables or disables the stroke. The default value is true\n * @param {String} [config.lineJoin] can be miter, round, or bevel. The default\n * is miter\n * @param {String} [config.lineCap] can be butt, round, or square. The default\n * is butt\n * @param {String} [config.shadowColor]\n * @param {Number} [config.shadowBlur]\n * @param {Object} [config.shadowOffset] object with x and y component\n * @param {Number} [config.shadowOffsetX]\n * @param {Number} [config.shadowOffsetY]\n * @param {Number} [config.shadowOpacity] shadow opacity. Can be any real number\n * between 0 and 1\n * @param {Boolean} [config.shadowEnabled] flag which enables or disables the shadow. The default value is true\n * @param {Array} [config.dash]\n * @param {Boolean} [config.dashEnabled] flag which enables or disables the dashArray. The default value is true\n\r\n * @param {Number} [config.x]\n * @param {Number} [config.y]\n * @param {Number} [config.width]\n * @param {Number} [config.height]\n * @param {Boolean} [config.visible]\n * @param {Boolean} [config.listening] whether or not the node is listening for events\n * @param {String} [config.id] unique id\n * @param {String} [config.name] non-unique name\n * @param {Number} [config.opacity] determines node opacity. Can be any number between 0 and 1\n * @param {Object} [config.scale] set scale\n * @param {Number} [config.scaleX] set scale x\n * @param {Number} [config.scaleY] set scale y\n * @param {Number} [config.rotation] rotation in degrees\n * @param {Object} [config.offset] offset from center point and rotation point\n * @param {Number} [config.offsetX] set offset x\n * @param {Number} [config.offsetY] set offset y\n * @param {Boolean} [config.draggable] makes the node draggable. When stages are draggable, you can drag and drop\n * the entire stage by dragging any portion of the stage\n * @param {Number} [config.dragDistance]\n * @param {Function} [config.dragBoundFunc]\r\n * @example\r\n * var kerningPairs = {\r\n * 'A': {\r\n * ' ': -0.05517578125,\r\n * 'T': -0.07421875,\r\n * 'V': -0.07421875\r\n * }\r\n * 'V': {\r\n * ',': -0.091796875,\r\n * \":\": -0.037109375,\r\n * \";\": -0.037109375,\r\n * \"A\": -0.07421875\r\n * }\r\n * }\r\n * var textpath = new Konva.TextPath({\r\n * x: 100,\r\n * y: 50,\r\n * fill: '#333',\r\n * fontSize: '24',\r\n * fontFamily: 'Arial',\r\n * text: 'All the world\\'s a stage, and all the men and women merely players.',\r\n * data: 'M10,10 C0,0 10,150 100,100 S300,150 400,50',\r\n * kerningFunc(leftChar, rightChar) {\r\n * return kerningPairs.hasOwnProperty(leftChar) ? pairs[leftChar][rightChar] || 0 : 0\r\n * }\r\n * });\r\n */\r\n class TextPath extends Shape {\r\n constructor(config) {\r\n // call super constructor\r\n super(config);\r\n this.dummyCanvas = Util.createCanvasElement();\r\n this.dataArray = [];\r\n this.dataArray = Path.parsePathData(this.attrs.data);\r\n this.on('dataChange.konva', function () {\r\n this.dataArray = Path.parsePathData(this.attrs.data);\r\n this._setTextData();\r\n });\r\n // update text data for certain attr changes\r\n this.on('textChange.konva alignChange.konva letterSpacingChange.konva kerningFuncChange.konva fontSizeChange.konva fontFamilyChange.konva', this._setTextData);\r\n this._setTextData();\r\n }\r\n _sceneFunc(context) {\r\n context.setAttr('font', this._getContextFont());\r\n context.setAttr('textBaseline', this.textBaseline());\r\n context.setAttr('textAlign', 'left');\r\n context.save();\r\n var textDecoration = this.textDecoration();\r\n var fill = this.fill();\r\n var fontSize = this.fontSize();\r\n var glyphInfo = this.glyphInfo;\r\n if (textDecoration === 'underline') {\r\n context.beginPath();\r\n }\r\n for (var i = 0; i < glyphInfo.length; i++) {\r\n context.save();\r\n var p0 = glyphInfo[i].p0;\r\n context.translate(p0.x, p0.y);\r\n context.rotate(glyphInfo[i].rotation);\r\n this.partialText = glyphInfo[i].text;\r\n context.fillStrokeShape(this);\r\n if (textDecoration === 'underline') {\r\n if (i === 0) {\r\n context.moveTo(0, fontSize / 2 + 1);\r\n }\r\n context.lineTo(fontSize, fontSize / 2 + 1);\r\n }\r\n context.restore();\r\n //// To assist with debugging visually, uncomment following\r\n //\r\n // if (i % 2) context.strokeStyle = 'cyan';\r\n // else context.strokeStyle = 'green';\r\n // var p1 = glyphInfo[i].p1;\r\n // context.moveTo(p0.x, p0.y);\r\n // context.lineTo(p1.x, p1.y);\r\n // context.stroke();\r\n }\r\n if (textDecoration === 'underline') {\r\n context.strokeStyle = fill;\r\n context.lineWidth = fontSize / 20;\r\n context.stroke();\r\n }\r\n context.restore();\r\n }\r\n _hitFunc(context) {\r\n context.beginPath();\r\n var glyphInfo = this.glyphInfo;\r\n if (glyphInfo.length >= 1) {\r\n var p0 = glyphInfo[0].p0;\r\n context.moveTo(p0.x, p0.y);\r\n }\r\n for (var i = 0; i < glyphInfo.length; i++) {\r\n var p1 = glyphInfo[i].p1;\r\n context.lineTo(p1.x, p1.y);\r\n }\r\n context.setAttr('lineWidth', this.fontSize());\r\n context.setAttr('strokeStyle', this.colorKey);\r\n context.stroke();\r\n }\r\n /**\r\n * get text width in pixels\r\n * @method\r\n * @name Konva.TextPath#getTextWidth\r\n */\r\n getTextWidth() {\r\n return this.textWidth;\r\n }\r\n getTextHeight() {\r\n Util.warn('text.getTextHeight() method is deprecated. Use text.height() - for full height and text.fontSize() - for one line height.');\r\n return this.textHeight;\r\n }\r\n setText(text) {\r\n return Text.prototype.setText.call(this, text);\r\n }\r\n _getContextFont() {\r\n return Text.prototype._getContextFont.call(this);\r\n }\r\n _getTextSize(text) {\r\n var dummyCanvas = this.dummyCanvas;\r\n var _context = dummyCanvas.getContext('2d');\r\n _context.save();\r\n _context.font = this._getContextFont();\r\n var metrics = _context.measureText(text);\r\n _context.restore();\r\n return {\r\n width: metrics.width,\r\n height: parseInt(this.attrs.fontSize, 10),\r\n };\r\n }\r\n _setTextData() {\r\n var that = this;\r\n var size = this._getTextSize(this.attrs.text);\r\n var letterSpacing = this.letterSpacing();\r\n var align = this.align();\r\n var kerningFunc = this.kerningFunc();\r\n this.textWidth = size.width;\r\n this.textHeight = size.height;\r\n var textFullWidth = Math.max(this.textWidth + ((this.attrs.text || '').length - 1) * letterSpacing, 0);\r\n this.glyphInfo = [];\r\n var fullPathWidth = 0;\r\n for (var l = 0; l < that.dataArray.length; l++) {\r\n if (that.dataArray[l].pathLength > 0) {\r\n fullPathWidth += that.dataArray[l].pathLength;\r\n }\r\n }\r\n var offset = 0;\r\n if (align === 'center') {\r\n offset = Math.max(0, fullPathWidth / 2 - textFullWidth / 2);\r\n }\r\n if (align === 'right') {\r\n offset = Math.max(0, fullPathWidth - textFullWidth);\r\n }\r\n var charArr = stringToArray(this.text());\r\n var spacesNumber = this.text().split(' ').length - 1;\r\n var p0, p1, pathCmd;\r\n var pIndex = -1;\r\n var currentT = 0;\r\n // var sumLength = 0;\r\n // for(var j = 0; j < that.dataArray.length; j++) {\r\n // if(that.dataArray[j].pathLength > 0) {\r\n //\r\n // if (sumLength + that.dataArray[j].pathLength > offset) {}\r\n // fullPathWidth += that.dataArray[j].pathLength;\r\n // }\r\n // }\r\n var getNextPathSegment = function () {\r\n currentT = 0;\r\n var pathData = that.dataArray;\r\n for (var j = pIndex + 1; j < pathData.length; j++) {\r\n if (pathData[j].pathLength > 0) {\r\n pIndex = j;\r\n return pathData[j];\r\n }\r\n else if (pathData[j].command === 'M') {\r\n p0 = {\r\n x: pathData[j].points[0],\r\n y: pathData[j].points[1],\r\n };\r\n }\r\n }\r\n return {};\r\n };\r\n var findSegmentToFitCharacter = function (c) {\r\n var glyphWidth = that._getTextSize(c).width + letterSpacing;\r\n if (c === ' ' && align === 'justify') {\r\n glyphWidth += (fullPathWidth - textFullWidth) / spacesNumber;\r\n }\r\n var currLen = 0;\r\n var attempts = 0;\r\n p1 = undefined;\r\n while (Math.abs(glyphWidth - currLen) / glyphWidth > 0.01 &&\r\n attempts < 20) {\r\n attempts++;\r\n var cumulativePathLength = currLen;\r\n while (pathCmd === undefined) {\r\n pathCmd = getNextPathSegment();\r\n if (pathCmd &&\r\n cumulativePathLength + pathCmd.pathLength < glyphWidth) {\r\n cumulativePathLength += pathCmd.pathLength;\r\n pathCmd = undefined;\r\n }\r\n }\r\n if (Object.keys(pathCmd).length === 0 || p0 === undefined) {\r\n return undefined;\r\n }\r\n var needNewSegment = false;\r\n switch (pathCmd.command) {\r\n case 'L':\r\n if (Path.getLineLength(p0.x, p0.y, pathCmd.points[0], pathCmd.points[1]) > glyphWidth) {\r\n p1 = Path.getPointOnLine(glyphWidth, p0.x, p0.y, pathCmd.points[0], pathCmd.points[1], p0.x, p0.y);\r\n }\r\n else {\r\n pathCmd = undefined;\r\n }\r\n break;\r\n case 'A':\r\n var start = pathCmd.points[4];\r\n // 4 = theta\r\n var dTheta = pathCmd.points[5];\r\n // 5 = dTheta\r\n var end = pathCmd.points[4] + dTheta;\r\n if (currentT === 0) {\r\n currentT = start + 0.00000001;\r\n }\r\n else if (glyphWidth > currLen) {\r\n // Just in case start is 0\r\n currentT += ((Math.PI / 180.0) * dTheta) / Math.abs(dTheta);\r\n }\r\n else {\r\n currentT -= ((Math.PI / 360.0) * dTheta) / Math.abs(dTheta);\r\n }\r\n // Credit for bug fix: @therth https://github.com/ericdrowell/KonvaJS/issues/249\r\n // Old code failed to render text along arc of this path: \"M 50 50 a 150 50 0 0 1 250 50 l 50 0\"\r\n if ((dTheta < 0 && currentT < end) ||\r\n (dTheta >= 0 && currentT > end)) {\r\n currentT = end;\r\n needNewSegment = true;\r\n }\r\n p1 = Path.getPointOnEllipticalArc(pathCmd.points[0], pathCmd.points[1], pathCmd.points[2], pathCmd.points[3], currentT, pathCmd.points[6]);\r\n break;\r\n case 'C':\r\n if (currentT === 0) {\r\n if (glyphWidth > pathCmd.pathLength) {\r\n currentT = 0.00000001;\r\n }\r\n else {\r\n currentT = glyphWidth / pathCmd.pathLength;\r\n }\r\n }\r\n else if (glyphWidth > currLen) {\r\n currentT += (glyphWidth - currLen) / pathCmd.pathLength / 2;\r\n }\r\n else {\r\n currentT = Math.max(currentT - (currLen - glyphWidth) / pathCmd.pathLength / 2, 0);\r\n }\r\n if (currentT > 1.0) {\r\n currentT = 1.0;\r\n needNewSegment = true;\r\n }\r\n p1 = Path.getPointOnCubicBezier(currentT, pathCmd.start.x, pathCmd.start.y, pathCmd.points[0], pathCmd.points[1], pathCmd.points[2], pathCmd.points[3], pathCmd.points[4], pathCmd.points[5]);\r\n break;\r\n case 'Q':\r\n if (currentT === 0) {\r\n currentT = glyphWidth / pathCmd.pathLength;\r\n }\r\n else if (glyphWidth > currLen) {\r\n currentT += (glyphWidth - currLen) / pathCmd.pathLength;\r\n }\r\n else {\r\n currentT -= (currLen - glyphWidth) / pathCmd.pathLength;\r\n }\r\n if (currentT > 1.0) {\r\n currentT = 1.0;\r\n needNewSegment = true;\r\n }\r\n p1 = Path.getPointOnQuadraticBezier(currentT, pathCmd.start.x, pathCmd.start.y, pathCmd.points[0], pathCmd.points[1], pathCmd.points[2], pathCmd.points[3]);\r\n break;\r\n }\r\n if (p1 !== undefined) {\r\n currLen = Path.getLineLength(p0.x, p0.y, p1.x, p1.y);\r\n }\r\n if (needNewSegment) {\r\n needNewSegment = false;\r\n pathCmd = undefined;\r\n }\r\n }\r\n };\r\n // fake search for offset, this is the best approach\r\n var testChar = 'C';\r\n var glyphWidth = that._getTextSize(testChar).width + letterSpacing;\r\n var lettersInOffset = offset / glyphWidth - 1;\r\n // the idea is simple\r\n // try to draw testChar until we fill offset\r\n for (var k = 0; k < lettersInOffset; k++) {\r\n findSegmentToFitCharacter(testChar);\r\n if (p0 === undefined || p1 === undefined) {\r\n break;\r\n }\r\n p0 = p1;\r\n }\r\n for (var i = 0; i < charArr.length; i++) {\r\n // Find p1 such that line segment between p0 and p1 is approx. width of glyph\r\n findSegmentToFitCharacter(charArr[i]);\r\n if (p0 === undefined || p1 === undefined) {\r\n break;\r\n }\r\n var width = Path.getLineLength(p0.x, p0.y, p1.x, p1.y);\r\n var kern = 0;\r\n if (kerningFunc) {\r\n try {\r\n // getKerning is a user provided getter. Make sure it never breaks our logic\r\n kern = kerningFunc(charArr[i - 1], charArr[i]) * this.fontSize();\r\n }\r\n catch (e) {\r\n kern = 0;\r\n }\r\n }\r\n p0.x += kern;\r\n p1.x += kern;\r\n this.textWidth += kern;\r\n var midpoint = Path.getPointOnLine(kern + width / 2.0, p0.x, p0.y, p1.x, p1.y);\r\n var rotation = Math.atan2(p1.y - p0.y, p1.x - p0.x);\r\n this.glyphInfo.push({\r\n transposeX: midpoint.x,\r\n transposeY: midpoint.y,\r\n text: charArr[i],\r\n rotation: rotation,\r\n p0: p0,\r\n p1: p1,\r\n });\r\n p0 = p1;\r\n }\r\n }\r\n getSelfRect() {\r\n if (!this.glyphInfo.length) {\r\n return {\r\n x: 0,\r\n y: 0,\r\n width: 0,\r\n height: 0,\r\n };\r\n }\r\n var points = [];\r\n this.glyphInfo.forEach(function (info) {\r\n points.push(info.p0.x);\r\n points.push(info.p0.y);\r\n points.push(info.p1.x);\r\n points.push(info.p1.y);\r\n });\r\n var minX = points[0] || 0;\r\n var maxX = points[0] || 0;\r\n var minY = points[1] || 0;\r\n var maxY = points[1] || 0;\r\n var x, y;\r\n for (var i = 0; i < points.length / 2; i++) {\r\n x = points[i * 2];\r\n y = points[i * 2 + 1];\r\n minX = Math.min(minX, x);\r\n maxX = Math.max(maxX, x);\r\n minY = Math.min(minY, y);\r\n maxY = Math.max(maxY, y);\r\n }\r\n var fontSize = this.fontSize();\r\n return {\r\n x: minX - fontSize / 2,\r\n y: minY - fontSize / 2,\r\n width: maxX - minX + fontSize,\r\n height: maxY - minY + fontSize,\r\n };\r\n }\r\n destroy() {\r\n Util.releaseCanvas(this.dummyCanvas);\r\n return super.destroy();\r\n }\r\n }\r\n TextPath.prototype._fillFunc = _fillFunc;\r\n TextPath.prototype._strokeFunc = _strokeFunc;\r\n TextPath.prototype._fillFuncHit = _fillFunc;\r\n TextPath.prototype._strokeFuncHit = _strokeFunc;\r\n TextPath.prototype.className = 'TextPath';\r\n TextPath.prototype._attrsAffectingSize = ['text', 'fontSize', 'data'];\r\n _registerNode(TextPath);\r\n /**\r\n * get/set SVG path data string. This method\r\n * also automatically parses the data string\r\n * into a data array. Currently supported SVG data:\r\n * M, m, L, l, H, h, V, v, Q, q, T, t, C, c, S, s, A, a, Z, z\r\n * @name Konva.TextPath#data\r\n * @method\r\n * @param {String} data svg path string\r\n * @returns {String}\r\n * @example\r\n * // get data\r\n * var data = shape.data();\r\n *\r\n * // set data\r\n * shape.data('M200,100h100v50z');\r\n */\r\n Factory.addGetterSetter(TextPath, 'data');\r\n /**\r\n * get/set font family\r\n * @name Konva.TextPath#fontFamily\r\n * @method\r\n * @param {String} fontFamily\r\n * @returns {String}\r\n * @example\r\n * // get font family\r\n * var fontFamily = shape.fontFamily();\r\n *\r\n * // set font family\r\n * shape.fontFamily('Arial');\r\n */\r\n Factory.addGetterSetter(TextPath, 'fontFamily', 'Arial');\r\n /**\r\n * get/set font size in pixels\r\n * @name Konva.TextPath#fontSize\r\n * @method\r\n * @param {Number} fontSize\r\n * @returns {Number}\r\n * @example\r\n * // get font size\r\n * var fontSize = shape.fontSize();\r\n *\r\n * // set font size to 22px\r\n * shape.fontSize(22);\r\n */\r\n Factory.addGetterSetter(TextPath, 'fontSize', 12, getNumberValidator());\r\n /**\r\n * get/set font style. Can be 'normal', 'italic', or 'bold'. 'normal' is the default.\r\n * @name Konva.TextPath#fontStyle\r\n * @method\r\n * @param {String} fontStyle\r\n * @returns {String}\r\n * @example\r\n * // get font style\r\n * var fontStyle = shape.fontStyle();\r\n *\r\n * // set font style\r\n * shape.fontStyle('bold');\r\n */\r\n Factory.addGetterSetter(TextPath, 'fontStyle', NORMAL);\r\n /**\r\n * get/set horizontal align of text. Can be 'left', 'center', 'right' or 'justify'\r\n * @name Konva.TextPath#align\r\n * @method\r\n * @param {String} align\r\n * @returns {String}\r\n * @example\r\n * // get text align\r\n * var align = text.align();\r\n *\r\n * // center text\r\n * text.align('center');\r\n *\r\n * // align text to right\r\n * text.align('right');\r\n */\r\n Factory.addGetterSetter(TextPath, 'align', 'left');\r\n /**\r\n * get/set letter spacing. The default is 0.\r\n * @name Konva.TextPath#letterSpacing\r\n * @method\r\n * @param {Number} letterSpacing\r\n * @returns {Number}\r\n * @example\r\n * // get letter spacing value\r\n * var letterSpacing = shape.letterSpacing();\r\n *\r\n * // set the letter spacing value\r\n * shape.letterSpacing(2);\r\n */\r\n Factory.addGetterSetter(TextPath, 'letterSpacing', 0, getNumberValidator());\r\n /**\r\n * get/set text baseline. The default is 'middle'. Can be 'top', 'bottom', 'middle', 'alphabetic', 'hanging'\r\n * @name Konva.TextPath#textBaseline\r\n * @method\r\n * @param {String} textBaseline\r\n * @returns {String}\r\n * @example\r\n * // get current text baseline\r\n * var textBaseline = shape.textBaseline();\r\n *\r\n * // set new text baseline\r\n * shape.textBaseline('top');\r\n */\r\n Factory.addGetterSetter(TextPath, 'textBaseline', 'middle');\r\n /**\r\n * get/set font variant. Can be 'normal' or 'small-caps'. 'normal' is the default.\r\n * @name Konva.TextPath#fontVariant\r\n * @method\r\n * @param {String} fontVariant\r\n * @returns {String}\r\n * @example\r\n * // get font variant\r\n * var fontVariant = shape.fontVariant();\r\n *\r\n * // set font variant\r\n * shape.fontVariant('small-caps');\r\n */\r\n Factory.addGetterSetter(TextPath, 'fontVariant', NORMAL);\r\n /**\r\n * get/set text\r\n * @name Konva.TextPath#getText\r\n * @method\r\n * @param {String} text\r\n * @returns {String}\r\n * @example\r\n * // get text\r\n * var text = text.text();\r\n *\r\n * // set text\r\n * text.text('Hello world!');\r\n */\r\n Factory.addGetterSetter(TextPath, 'text', EMPTY_STRING);\r\n /**\r\n * get/set text decoration of a text. Can be '' or 'underline'.\r\n * @name Konva.TextPath#textDecoration\r\n * @method\r\n * @param {String} textDecoration\r\n * @returns {String}\r\n * @example\r\n * // get text decoration\r\n * var textDecoration = shape.textDecoration();\r\n *\r\n * // underline text\r\n * shape.textDecoration('underline');\r\n */\r\n Factory.addGetterSetter(TextPath, 'textDecoration', null);\r\n /**\r\n * get/set kerning function.\r\n * @name Konva.TextPath#kerningFunc\r\n * @method\r\n * @param {String} kerningFunc\r\n * @returns {String}\r\n * @example\r\n * // get text decoration\r\n * var kerningFunc = text.kerningFunc();\r\n *\r\n * // center text\r\n * text.kerningFunc(function(leftChar, rightChar) {\r\n * return 1;\r\n * });\r\n */\r\n Factory.addGetterSetter(TextPath, 'kerningFunc', null);\n\n var EVENTS_NAME = 'tr-konva';\r\n var ATTR_CHANGE_LIST = [\r\n 'resizeEnabledChange',\r\n 'rotateAnchorOffsetChange',\r\n 'rotateEnabledChange',\r\n 'enabledAnchorsChange',\r\n 'anchorSizeChange',\r\n 'borderEnabledChange',\r\n 'borderStrokeChange',\r\n 'borderStrokeWidthChange',\r\n 'borderDashChange',\r\n 'anchorStrokeChange',\r\n 'anchorStrokeWidthChange',\r\n 'anchorFillChange',\r\n 'anchorCornerRadiusChange',\r\n 'ignoreStrokeChange',\r\n ]\r\n .map((e) => e + `.${EVENTS_NAME}`)\r\n .join(' ');\r\n var NODES_RECT = 'nodesRect';\r\n var TRANSFORM_CHANGE_STR = [\r\n 'widthChange',\r\n 'heightChange',\r\n 'scaleXChange',\r\n 'scaleYChange',\r\n 'skewXChange',\r\n 'skewYChange',\r\n 'rotationChange',\r\n 'offsetXChange',\r\n 'offsetYChange',\r\n 'transformsEnabledChange',\r\n 'strokeWidthChange',\r\n ];\r\n var ANGLES = {\r\n 'top-left': -45,\r\n 'top-center': 0,\r\n 'top-right': 45,\r\n 'middle-right': -90,\r\n 'middle-left': 90,\r\n 'bottom-left': -135,\r\n 'bottom-center': 180,\r\n 'bottom-right': 135,\r\n };\r\n const TOUCH_DEVICE = 'ontouchstart' in Konva$2._global;\r\n function getCursor(anchorName, rad) {\r\n if (anchorName === 'rotater') {\r\n return 'crosshair';\r\n }\r\n rad += Util.degToRad(ANGLES[anchorName] || 0);\r\n var angle = ((Util.radToDeg(rad) % 360) + 360) % 360;\r\n if (Util._inRange(angle, 315 + 22.5, 360) || Util._inRange(angle, 0, 22.5)) {\r\n // TOP\r\n return 'ns-resize';\r\n }\r\n else if (Util._inRange(angle, 45 - 22.5, 45 + 22.5)) {\r\n // TOP - RIGHT\r\n return 'nesw-resize';\r\n }\r\n else if (Util._inRange(angle, 90 - 22.5, 90 + 22.5)) {\r\n // RIGHT\r\n return 'ew-resize';\r\n }\r\n else if (Util._inRange(angle, 135 - 22.5, 135 + 22.5)) {\r\n // BOTTOM - RIGHT\r\n return 'nwse-resize';\r\n }\r\n else if (Util._inRange(angle, 180 - 22.5, 180 + 22.5)) {\r\n // BOTTOM\r\n return 'ns-resize';\r\n }\r\n else if (Util._inRange(angle, 225 - 22.5, 225 + 22.5)) {\r\n // BOTTOM - LEFT\r\n return 'nesw-resize';\r\n }\r\n else if (Util._inRange(angle, 270 - 22.5, 270 + 22.5)) {\r\n // RIGHT\r\n return 'ew-resize';\r\n }\r\n else if (Util._inRange(angle, 315 - 22.5, 315 + 22.5)) {\r\n // BOTTOM - RIGHT\r\n return 'nwse-resize';\r\n }\r\n else {\r\n // how can we can there?\r\n Util.error('Transformer has unknown angle for cursor detection: ' + angle);\r\n return 'pointer';\r\n }\r\n }\r\n var ANCHORS_NAMES = [\r\n 'top-left',\r\n 'top-center',\r\n 'top-right',\r\n 'middle-right',\r\n 'middle-left',\r\n 'bottom-left',\r\n 'bottom-center',\r\n 'bottom-right',\r\n ];\r\n var MAX_SAFE_INTEGER = 100000000;\r\n function getCenter(shape) {\r\n return {\r\n x: shape.x +\r\n (shape.width / 2) * Math.cos(shape.rotation) +\r\n (shape.height / 2) * Math.sin(-shape.rotation),\r\n y: shape.y +\r\n (shape.height / 2) * Math.cos(shape.rotation) +\r\n (shape.width / 2) * Math.sin(shape.rotation),\r\n };\r\n }\r\n function rotateAroundPoint(shape, angleRad, point) {\r\n const x = point.x +\r\n (shape.x - point.x) * Math.cos(angleRad) -\r\n (shape.y - point.y) * Math.sin(angleRad);\r\n const y = point.y +\r\n (shape.x - point.x) * Math.sin(angleRad) +\r\n (shape.y - point.y) * Math.cos(angleRad);\r\n return Object.assign(Object.assign({}, shape), { rotation: shape.rotation + angleRad, x,\r\n y });\r\n }\r\n function rotateAroundCenter(shape, deltaRad) {\r\n const center = getCenter(shape);\r\n return rotateAroundPoint(shape, deltaRad, center);\r\n }\r\n function getSnap(snaps, newRotationRad, tol) {\r\n let snapped = newRotationRad;\r\n for (let i = 0; i < snaps.length; i++) {\r\n const angle = Konva$2.getAngle(snaps[i]);\r\n const absDiff = Math.abs(angle - newRotationRad) % (Math.PI * 2);\r\n const dif = Math.min(absDiff, Math.PI * 2 - absDiff);\r\n if (dif < tol) {\r\n snapped = angle;\r\n }\r\n }\r\n return snapped;\r\n }\r\n /**\r\n * Transformer constructor. Transformer is a special type of group that allow you transform Konva\r\n * primitives and shapes. Transforming tool is not changing `width` and `height` properties of nodes\r\n * when you resize them. Instead it changes `scaleX` and `scaleY` properties.\r\n * @constructor\r\n * @memberof Konva\r\n * @param {Object} config\r\n * @param {Boolean} [config.resizeEnabled] Default is true\r\n * @param {Boolean} [config.rotateEnabled] Default is true\r\n * @param {Array} [config.rotationSnaps] Array of angles for rotation snaps. Default is []\r\n * @param {Number} [config.rotationSnapTolerance] Snapping tolerance. If closer than this it will snap. Default is 5\r\n * @param {Number} [config.rotateAnchorOffset] Default is 50\r\n * @param {Number} [config.padding] Default is 0\r\n * @param {Boolean} [config.borderEnabled] Should we draw border? Default is true\r\n * @param {String} [config.borderStroke] Border stroke color\r\n * @param {Number} [config.borderStrokeWidth] Border stroke size\r\n * @param {Array} [config.borderDash] Array for border dash.\r\n * @param {String} [config.anchorFill] Anchor fill color\r\n * @param {String} [config.anchorStroke] Anchor stroke color\r\n * @param {String} [config.anchorCornerRadius] Anchor corner radius\r\n * @param {Number} [config.anchorStrokeWidth] Anchor stroke size\r\n * @param {Number} [config.anchorSize] Default is 10\r\n * @param {Boolean} [config.keepRatio] Should we keep ratio when we are moving edges? Default is true\r\n * @param {Boolean} [config.centeredScaling] Should we resize relative to node's center? Default is false\r\n * @param {Array} [config.enabledAnchors] Array of names of enabled handles\r\n * @param {Boolean} [config.flipEnabled] Can we flip/mirror shape on transform?. True by default\r\n * @param {Function} [config.boundBoxFunc] Bounding box function\r\n * @param {Function} [config.ignoreStroke] Should we ignore stroke size? Default is false\r\n * @param {Boolean} [config.useSingleNodeRotation] When just one node attached, should we use its rotation for transformer?\r\n * @param {Boolean} [config.shouldOverdrawWholeArea] Should we fill whole transformer area with fake transparent shape to enable dragging from empty spaces?\r\n * @example\r\n * var transformer = new Konva.Transformer({\r\n * nodes: [rectangle],\r\n * rotateAnchorOffset: 60,\r\n * enabledAnchors: ['top-left', 'top-right', 'bottom-left', 'bottom-right']\r\n * });\r\n * layer.add(transformer);\r\n */\r\n class Transformer extends Group {\r\n constructor(config) {\r\n // call super constructor\r\n super(config);\r\n this._transforming = false;\r\n this._createElements();\r\n // bindings\r\n this._handleMouseMove = this._handleMouseMove.bind(this);\r\n this._handleMouseUp = this._handleMouseUp.bind(this);\r\n this.update = this.update.bind(this);\r\n // update transformer data for certain attr changes\r\n this.on(ATTR_CHANGE_LIST, this.update);\r\n if (this.getNode()) {\r\n this.update();\r\n }\r\n }\r\n /**\r\n * alias to `tr.nodes([shape])`/ This method is deprecated and will be removed soon.\r\n * @method\r\n * @name Konva.Transformer#attachTo\r\n * @returns {Konva.Transformer}\r\n * @example\r\n * transformer.attachTo(shape);\r\n */\r\n attachTo(node) {\r\n this.setNode(node);\r\n return this;\r\n }\r\n setNode(node) {\r\n Util.warn('tr.setNode(shape), tr.node(shape) and tr.attachTo(shape) methods are deprecated. Please use tr.nodes(nodesArray) instead.');\r\n return this.setNodes([node]);\r\n }\r\n getNode() {\r\n return this._nodes && this._nodes[0];\r\n }\r\n _getEventNamespace() {\r\n return EVENTS_NAME + this._id;\r\n }\r\n setNodes(nodes = []) {\r\n if (this._nodes && this._nodes.length) {\r\n this.detach();\r\n }\r\n this._nodes = nodes;\r\n if (nodes.length === 1 && this.useSingleNodeRotation()) {\r\n this.rotation(nodes[0].getAbsoluteRotation());\r\n }\r\n else {\r\n this.rotation(0);\r\n }\r\n this._nodes.forEach((node) => {\r\n const onChange = () => {\r\n if (this.nodes().length === 1 && this.useSingleNodeRotation()) {\r\n this.rotation(this.nodes()[0].getAbsoluteRotation());\r\n }\r\n this._resetTransformCache();\r\n if (!this._transforming && !this.isDragging()) {\r\n this.update();\r\n }\r\n };\r\n const additionalEvents = node._attrsAffectingSize\r\n .map((prop) => prop + 'Change.' + this._getEventNamespace())\r\n .join(' ');\r\n node.on(additionalEvents, onChange);\r\n node.on(TRANSFORM_CHANGE_STR.map((e) => e + `.${this._getEventNamespace()}`).join(' '), onChange);\r\n node.on(`absoluteTransformChange.${this._getEventNamespace()}`, onChange);\r\n this._proxyDrag(node);\r\n });\r\n this._resetTransformCache();\r\n // we may need it if we set node in initial props\r\n // so elements are not defined yet\r\n var elementsCreated = !!this.findOne('.top-left');\r\n if (elementsCreated) {\r\n this.update();\r\n }\r\n return this;\r\n }\r\n _proxyDrag(node) {\r\n let lastPos;\r\n node.on(`dragstart.${this._getEventNamespace()}`, (e) => {\r\n lastPos = node.getAbsolutePosition();\r\n // actual dragging of Transformer doesn't make sense\r\n // but we need to make sure it also has all drag events\r\n if (!this.isDragging() && node !== this.findOne('.back')) {\r\n this.startDrag(e, false);\r\n }\r\n });\r\n node.on(`dragmove.${this._getEventNamespace()}`, (e) => {\r\n if (!lastPos) {\r\n return;\r\n }\r\n const abs = node.getAbsolutePosition();\r\n const dx = abs.x - lastPos.x;\r\n const dy = abs.y - lastPos.y;\r\n this.nodes().forEach((otherNode) => {\r\n if (otherNode === node) {\r\n return;\r\n }\r\n if (otherNode.isDragging()) {\r\n return;\r\n }\r\n const otherAbs = otherNode.getAbsolutePosition();\r\n otherNode.setAbsolutePosition({\r\n x: otherAbs.x + dx,\r\n y: otherAbs.y + dy,\r\n });\r\n otherNode.startDrag(e);\r\n });\r\n lastPos = null;\r\n });\r\n }\r\n getNodes() {\r\n return this._nodes || [];\r\n }\r\n /**\r\n * return the name of current active anchor\r\n * @method\r\n * @name Konva.Transformer#getActiveAnchor\r\n * @returns {String | Null}\r\n * @example\r\n * transformer.getActiveAnchor();\r\n */\r\n getActiveAnchor() {\r\n return this._movingAnchorName;\r\n }\r\n /**\r\n * detach transformer from an attached node\r\n * @method\r\n * @name Konva.Transformer#detach\r\n * @returns {Konva.Transformer}\r\n * @example\r\n * transformer.detach();\r\n */\r\n detach() {\r\n // remove events\r\n if (this._nodes) {\r\n this._nodes.forEach((node) => {\r\n node.off('.' + this._getEventNamespace());\r\n });\r\n }\r\n this._nodes = [];\r\n this._resetTransformCache();\r\n }\r\n _resetTransformCache() {\r\n this._clearCache(NODES_RECT);\r\n this._clearCache('transform');\r\n this._clearSelfAndDescendantCache('absoluteTransform');\r\n }\r\n _getNodeRect() {\r\n return this._getCache(NODES_RECT, this.__getNodeRect);\r\n }\r\n // return absolute rotated bounding rectangle\r\n __getNodeShape(node, rot = this.rotation(), relative) {\r\n var rect = node.getClientRect({\r\n skipTransform: true,\r\n skipShadow: true,\r\n skipStroke: this.ignoreStroke(),\r\n });\r\n var absScale = node.getAbsoluteScale(relative);\r\n var absPos = node.getAbsolutePosition(relative);\r\n var dx = rect.x * absScale.x - node.offsetX() * absScale.x;\r\n var dy = rect.y * absScale.y - node.offsetY() * absScale.y;\r\n const rotation = (Konva$2.getAngle(node.getAbsoluteRotation()) + Math.PI * 2) %\r\n (Math.PI * 2);\r\n const box = {\r\n x: absPos.x + dx * Math.cos(rotation) + dy * Math.sin(-rotation),\r\n y: absPos.y + dy * Math.cos(rotation) + dx * Math.sin(rotation),\r\n width: rect.width * absScale.x,\r\n height: rect.height * absScale.y,\r\n rotation: rotation,\r\n };\r\n return rotateAroundPoint(box, -Konva$2.getAngle(rot), {\r\n x: 0,\r\n y: 0,\r\n });\r\n }\r\n // returns box + rotation of all shapes\r\n __getNodeRect() {\r\n var node = this.getNode();\r\n if (!node) {\r\n return {\r\n x: -MAX_SAFE_INTEGER,\r\n y: -MAX_SAFE_INTEGER,\r\n width: 0,\r\n height: 0,\r\n rotation: 0,\r\n };\r\n }\r\n const totalPoints = [];\r\n this.nodes().map((node) => {\r\n const box = node.getClientRect({\r\n skipTransform: true,\r\n skipShadow: true,\r\n skipStroke: this.ignoreStroke(),\r\n });\r\n var points = [\r\n { x: box.x, y: box.y },\r\n { x: box.x + box.width, y: box.y },\r\n { x: box.x + box.width, y: box.y + box.height },\r\n { x: box.x, y: box.y + box.height },\r\n ];\r\n var trans = node.getAbsoluteTransform();\r\n points.forEach(function (point) {\r\n var transformed = trans.point(point);\r\n totalPoints.push(transformed);\r\n });\r\n });\r\n const tr = new Transform();\r\n tr.rotate(-Konva$2.getAngle(this.rotation()));\r\n var minX, minY, maxX, maxY;\r\n totalPoints.forEach(function (point) {\r\n var transformed = tr.point(point);\r\n if (minX === undefined) {\r\n minX = maxX = transformed.x;\r\n minY = maxY = transformed.y;\r\n }\r\n minX = Math.min(minX, transformed.x);\r\n minY = Math.min(minY, transformed.y);\r\n maxX = Math.max(maxX, transformed.x);\r\n maxY = Math.max(maxY, transformed.y);\r\n });\r\n tr.invert();\r\n const p = tr.point({ x: minX, y: minY });\r\n return {\r\n x: p.x,\r\n y: p.y,\r\n width: maxX - minX,\r\n height: maxY - minY,\r\n rotation: Konva$2.getAngle(this.rotation()),\r\n };\r\n // const shapes = this.nodes().map(node => {\r\n // return this.__getNodeShape(node);\r\n // });\r\n // const box = getShapesRect(shapes);\r\n // return rotateAroundPoint(box, Konva.getAngle(this.rotation()), {\r\n // x: 0,\r\n // y: 0\r\n // });\r\n }\r\n getX() {\r\n return this._getNodeRect().x;\r\n }\r\n getY() {\r\n return this._getNodeRect().y;\r\n }\r\n getWidth() {\r\n return this._getNodeRect().width;\r\n }\r\n getHeight() {\r\n return this._getNodeRect().height;\r\n }\r\n _createElements() {\r\n this._createBack();\r\n ANCHORS_NAMES.forEach(function (name) {\r\n this._createAnchor(name);\r\n }.bind(this));\r\n this._createAnchor('rotater');\r\n }\r\n _createAnchor(name) {\r\n var anchor = new Rect({\r\n stroke: 'rgb(0, 161, 255)',\r\n fill: 'white',\r\n strokeWidth: 1,\r\n name: name + ' _anchor',\r\n dragDistance: 0,\r\n // make it draggable,\r\n // so activating the anchor will not start drag&drop of any parent\r\n draggable: true,\r\n hitStrokeWidth: TOUCH_DEVICE ? 10 : 'auto',\r\n });\r\n var self = this;\r\n anchor.on('mousedown touchstart', function (e) {\r\n self._handleMouseDown(e);\r\n });\r\n anchor.on('dragstart', (e) => {\r\n anchor.stopDrag();\r\n e.cancelBubble = true;\r\n });\r\n anchor.on('dragend', (e) => {\r\n e.cancelBubble = true;\r\n });\r\n // add hover styling\r\n anchor.on('mouseenter', () => {\r\n var rad = Konva$2.getAngle(this.rotation());\r\n var cursor = getCursor(name, rad);\r\n anchor.getStage().content &&\r\n (anchor.getStage().content.style.cursor = cursor);\r\n this._cursorChange = true;\r\n });\r\n anchor.on('mouseout', () => {\r\n anchor.getStage().content &&\r\n (anchor.getStage().content.style.cursor = '');\r\n this._cursorChange = false;\r\n });\r\n this.add(anchor);\r\n }\r\n _createBack() {\r\n var back = new Shape({\r\n name: 'back',\r\n width: 0,\r\n height: 0,\r\n draggable: true,\r\n sceneFunc(ctx) {\r\n var tr = this.getParent();\r\n var padding = tr.padding();\r\n ctx.beginPath();\r\n ctx.rect(-padding, -padding, this.width() + padding * 2, this.height() + padding * 2);\r\n ctx.moveTo(this.width() / 2, -padding);\r\n if (tr.rotateEnabled()) {\r\n ctx.lineTo(this.width() / 2, -tr.rotateAnchorOffset() * Util._sign(this.height()) - padding);\r\n }\r\n ctx.fillStrokeShape(this);\r\n },\r\n hitFunc: (ctx, shape) => {\r\n if (!this.shouldOverdrawWholeArea()) {\r\n return;\r\n }\r\n var padding = this.padding();\r\n ctx.beginPath();\r\n ctx.rect(-padding, -padding, shape.width() + padding * 2, shape.height() + padding * 2);\r\n ctx.fillStrokeShape(shape);\r\n },\r\n });\r\n this.add(back);\r\n this._proxyDrag(back);\r\n // do not bubble drag from the back shape\r\n // because we already \"drag\" whole transformer\r\n // so we don't want to trigger drag twice on transformer\r\n back.on('dragstart', (e) => {\r\n e.cancelBubble = true;\r\n });\r\n back.on('dragmove', (e) => {\r\n e.cancelBubble = true;\r\n });\r\n back.on('dragend', (e) => {\r\n e.cancelBubble = true;\r\n });\r\n // force self update when we drag with shouldOverDrawWholeArea setting\r\n this.on('dragmove', (e) => {\r\n this.update();\r\n });\r\n }\r\n _handleMouseDown(e) {\r\n this._movingAnchorName = e.target.name().split(' ')[0];\r\n var attrs = this._getNodeRect();\r\n var width = attrs.width;\r\n var height = attrs.height;\r\n var hypotenuse = Math.sqrt(Math.pow(width, 2) + Math.pow(height, 2));\r\n this.sin = Math.abs(height / hypotenuse);\r\n this.cos = Math.abs(width / hypotenuse);\r\n if (typeof window !== 'undefined') {\r\n window.addEventListener('mousemove', this._handleMouseMove);\r\n window.addEventListener('touchmove', this._handleMouseMove);\r\n window.addEventListener('mouseup', this._handleMouseUp, true);\r\n window.addEventListener('touchend', this._handleMouseUp, true);\r\n }\r\n this._transforming = true;\r\n var ap = e.target.getAbsolutePosition();\r\n var pos = e.target.getStage().getPointerPosition();\r\n this._anchorDragOffset = {\r\n x: pos.x - ap.x,\r\n y: pos.y - ap.y,\r\n };\r\n this._fire('transformstart', { evt: e.evt, target: this.getNode() });\r\n this._nodes.forEach((target) => {\r\n target._fire('transformstart', { evt: e.evt, target });\r\n });\r\n }\r\n _handleMouseMove(e) {\r\n var x, y, newHypotenuse;\r\n var anchorNode = this.findOne('.' + this._movingAnchorName);\r\n var stage = anchorNode.getStage();\r\n stage.setPointersPositions(e);\r\n const pp = stage.getPointerPosition();\r\n let newNodePos = {\r\n x: pp.x - this._anchorDragOffset.x,\r\n y: pp.y - this._anchorDragOffset.y,\r\n };\r\n const oldAbs = anchorNode.getAbsolutePosition();\r\n if (this.anchorDragBoundFunc()) {\r\n newNodePos = this.anchorDragBoundFunc()(oldAbs, newNodePos, e);\r\n }\r\n anchorNode.setAbsolutePosition(newNodePos);\r\n const newAbs = anchorNode.getAbsolutePosition();\r\n // console.log(oldAbs, newNodePos, newAbs);\r\n if (oldAbs.x === newAbs.x && oldAbs.y === newAbs.y) {\r\n return;\r\n }\r\n // rotater is working very differently, so do it first\r\n if (this._movingAnchorName === 'rotater') {\r\n var attrs = this._getNodeRect();\r\n x = anchorNode.x() - attrs.width / 2;\r\n y = -anchorNode.y() + attrs.height / 2;\r\n // hor angle is changed?\r\n let delta = Math.atan2(-y, x) + Math.PI / 2;\r\n if (attrs.height < 0) {\r\n delta -= Math.PI;\r\n }\r\n var oldRotation = Konva$2.getAngle(this.rotation());\r\n const newRotation = oldRotation + delta;\r\n const tol = Konva$2.getAngle(this.rotationSnapTolerance());\r\n const snappedRot = getSnap(this.rotationSnaps(), newRotation, tol);\r\n const diff = snappedRot - attrs.rotation;\r\n const shape = rotateAroundCenter(attrs, diff);\r\n this._fitNodesInto(shape, e);\r\n return;\r\n }\r\n var keepProportion = this.keepRatio() || e.shiftKey;\r\n var centeredScaling = this.centeredScaling() || e.altKey;\r\n if (this._movingAnchorName === 'top-left') {\r\n if (keepProportion) {\r\n var comparePoint = centeredScaling\r\n ? {\r\n x: this.width() / 2,\r\n y: this.height() / 2,\r\n }\r\n : {\r\n x: this.findOne('.bottom-right').x(),\r\n y: this.findOne('.bottom-right').y(),\r\n };\r\n newHypotenuse = Math.sqrt(Math.pow(comparePoint.x - anchorNode.x(), 2) +\r\n Math.pow(comparePoint.y - anchorNode.y(), 2));\r\n var reverseX = this.findOne('.top-left').x() > comparePoint.x ? -1 : 1;\r\n var reverseY = this.findOne('.top-left').y() > comparePoint.y ? -1 : 1;\r\n x = newHypotenuse * this.cos * reverseX;\r\n y = newHypotenuse * this.sin * reverseY;\r\n this.findOne('.top-left').x(comparePoint.x - x);\r\n this.findOne('.top-left').y(comparePoint.y - y);\r\n }\r\n }\r\n else if (this._movingAnchorName === 'top-center') {\r\n this.findOne('.top-left').y(anchorNode.y());\r\n }\r\n else if (this._movingAnchorName === 'top-right') {\r\n if (keepProportion) {\r\n var comparePoint = centeredScaling\r\n ? {\r\n x: this.width() / 2,\r\n y: this.height() / 2,\r\n }\r\n : {\r\n x: this.findOne('.bottom-left').x(),\r\n y: this.findOne('.bottom-left').y(),\r\n };\r\n newHypotenuse = Math.sqrt(Math.pow(anchorNode.x() - comparePoint.x, 2) +\r\n Math.pow(comparePoint.y - anchorNode.y(), 2));\r\n var reverseX = this.findOne('.top-right').x() < comparePoint.x ? -1 : 1;\r\n var reverseY = this.findOne('.top-right').y() > comparePoint.y ? -1 : 1;\r\n x = newHypotenuse * this.cos * reverseX;\r\n y = newHypotenuse * this.sin * reverseY;\r\n this.findOne('.top-right').x(comparePoint.x + x);\r\n this.findOne('.top-right').y(comparePoint.y - y);\r\n }\r\n var pos = anchorNode.position();\r\n this.findOne('.top-left').y(pos.y);\r\n this.findOne('.bottom-right').x(pos.x);\r\n }\r\n else if (this._movingAnchorName === 'middle-left') {\r\n this.findOne('.top-left').x(anchorNode.x());\r\n }\r\n else if (this._movingAnchorName === 'middle-right') {\r\n this.findOne('.bottom-right').x(anchorNode.x());\r\n }\r\n else if (this._movingAnchorName === 'bottom-left') {\r\n if (keepProportion) {\r\n var comparePoint = centeredScaling\r\n ? {\r\n x: this.width() / 2,\r\n y: this.height() / 2,\r\n }\r\n : {\r\n x: this.findOne('.top-right').x(),\r\n y: this.findOne('.top-right').y(),\r\n };\r\n newHypotenuse = Math.sqrt(Math.pow(comparePoint.x - anchorNode.x(), 2) +\r\n Math.pow(anchorNode.y() - comparePoint.y, 2));\r\n var reverseX = comparePoint.x < anchorNode.x() ? -1 : 1;\r\n var reverseY = anchorNode.y() < comparePoint.y ? -1 : 1;\r\n x = newHypotenuse * this.cos * reverseX;\r\n y = newHypotenuse * this.sin * reverseY;\r\n anchorNode.x(comparePoint.x - x);\r\n anchorNode.y(comparePoint.y + y);\r\n }\r\n pos = anchorNode.position();\r\n this.findOne('.top-left').x(pos.x);\r\n this.findOne('.bottom-right').y(pos.y);\r\n }\r\n else if (this._movingAnchorName === 'bottom-center') {\r\n this.findOne('.bottom-right').y(anchorNode.y());\r\n }\r\n else if (this._movingAnchorName === 'bottom-right') {\r\n if (keepProportion) {\r\n var comparePoint = centeredScaling\r\n ? {\r\n x: this.width() / 2,\r\n y: this.height() / 2,\r\n }\r\n : {\r\n x: this.findOne('.top-left').x(),\r\n y: this.findOne('.top-left').y(),\r\n };\r\n newHypotenuse = Math.sqrt(Math.pow(anchorNode.x() - comparePoint.x, 2) +\r\n Math.pow(anchorNode.y() - comparePoint.y, 2));\r\n var reverseX = this.findOne('.bottom-right').x() < comparePoint.x ? -1 : 1;\r\n var reverseY = this.findOne('.bottom-right').y() < comparePoint.y ? -1 : 1;\r\n x = newHypotenuse * this.cos * reverseX;\r\n y = newHypotenuse * this.sin * reverseY;\r\n this.findOne('.bottom-right').x(comparePoint.x + x);\r\n this.findOne('.bottom-right').y(comparePoint.y + y);\r\n }\r\n }\r\n else {\r\n console.error(new Error('Wrong position argument of selection resizer: ' +\r\n this._movingAnchorName));\r\n }\r\n var centeredScaling = this.centeredScaling() || e.altKey;\r\n if (centeredScaling) {\r\n var topLeft = this.findOne('.top-left');\r\n var bottomRight = this.findOne('.bottom-right');\r\n var topOffsetX = topLeft.x();\r\n var topOffsetY = topLeft.y();\r\n var bottomOffsetX = this.getWidth() - bottomRight.x();\r\n var bottomOffsetY = this.getHeight() - bottomRight.y();\r\n bottomRight.move({\r\n x: -topOffsetX,\r\n y: -topOffsetY,\r\n });\r\n topLeft.move({\r\n x: bottomOffsetX,\r\n y: bottomOffsetY,\r\n });\r\n }\r\n var absPos = this.findOne('.top-left').getAbsolutePosition();\r\n x = absPos.x;\r\n y = absPos.y;\r\n var width = this.findOne('.bottom-right').x() - this.findOne('.top-left').x();\r\n var height = this.findOne('.bottom-right').y() - this.findOne('.top-left').y();\r\n this._fitNodesInto({\r\n x: x,\r\n y: y,\r\n width: width,\r\n height: height,\r\n rotation: Konva$2.getAngle(this.rotation()),\r\n }, e);\r\n }\r\n _handleMouseUp(e) {\r\n this._removeEvents(e);\r\n }\r\n getAbsoluteTransform() {\r\n return this.getTransform();\r\n }\r\n _removeEvents(e) {\r\n if (this._transforming) {\r\n this._transforming = false;\r\n if (typeof window !== 'undefined') {\r\n window.removeEventListener('mousemove', this._handleMouseMove);\r\n window.removeEventListener('touchmove', this._handleMouseMove);\r\n window.removeEventListener('mouseup', this._handleMouseUp, true);\r\n window.removeEventListener('touchend', this._handleMouseUp, true);\r\n }\r\n var node = this.getNode();\r\n this._fire('transformend', { evt: e, target: node });\r\n if (node) {\r\n this._nodes.forEach((target) => {\r\n target._fire('transformend', { evt: e, target });\r\n });\r\n }\r\n this._movingAnchorName = null;\r\n }\r\n }\r\n _fitNodesInto(newAttrs, evt) {\r\n var oldAttrs = this._getNodeRect();\r\n const minSize = 1;\r\n if (Util._inRange(newAttrs.width, -this.padding() * 2 - minSize, minSize)) {\r\n this.update();\r\n return;\r\n }\r\n if (Util._inRange(newAttrs.height, -this.padding() * 2 - minSize, minSize)) {\r\n this.update();\r\n return;\r\n }\r\n const allowNegativeScale = this.flipEnabled();\r\n var t = new Transform();\r\n t.rotate(Konva$2.getAngle(this.rotation()));\r\n if (this._movingAnchorName &&\r\n newAttrs.width < 0 &&\r\n this._movingAnchorName.indexOf('left') >= 0) {\r\n const offset = t.point({\r\n x: -this.padding() * 2,\r\n y: 0,\r\n });\r\n newAttrs.x += offset.x;\r\n newAttrs.y += offset.y;\r\n newAttrs.width += this.padding() * 2;\r\n this._movingAnchorName = this._movingAnchorName.replace('left', 'right');\r\n this._anchorDragOffset.x -= offset.x;\r\n this._anchorDragOffset.y -= offset.y;\r\n if (!allowNegativeScale) {\r\n this.update();\r\n return;\r\n }\r\n }\r\n else if (this._movingAnchorName &&\r\n newAttrs.width < 0 &&\r\n this._movingAnchorName.indexOf('right') >= 0) {\r\n const offset = t.point({\r\n x: this.padding() * 2,\r\n y: 0,\r\n });\r\n this._movingAnchorName = this._movingAnchorName.replace('right', 'left');\r\n this._anchorDragOffset.x -= offset.x;\r\n this._anchorDragOffset.y -= offset.y;\r\n newAttrs.width += this.padding() * 2;\r\n if (!allowNegativeScale) {\r\n this.update();\r\n return;\r\n }\r\n }\r\n if (this._movingAnchorName &&\r\n newAttrs.height < 0 &&\r\n this._movingAnchorName.indexOf('top') >= 0) {\r\n const offset = t.point({\r\n x: 0,\r\n y: -this.padding() * 2,\r\n });\r\n newAttrs.x += offset.x;\r\n newAttrs.y += offset.y;\r\n this._movingAnchorName = this._movingAnchorName.replace('top', 'bottom');\r\n this._anchorDragOffset.x -= offset.x;\r\n this._anchorDragOffset.y -= offset.y;\r\n newAttrs.height += this.padding() * 2;\r\n if (!allowNegativeScale) {\r\n this.update();\r\n return;\r\n }\r\n }\r\n else if (this._movingAnchorName &&\r\n newAttrs.height < 0 &&\r\n this._movingAnchorName.indexOf('bottom') >= 0) {\r\n const offset = t.point({\r\n x: 0,\r\n y: this.padding() * 2,\r\n });\r\n this._movingAnchorName = this._movingAnchorName.replace('bottom', 'top');\r\n this._anchorDragOffset.x -= offset.x;\r\n this._anchorDragOffset.y -= offset.y;\r\n newAttrs.height += this.padding() * 2;\r\n if (!allowNegativeScale) {\r\n this.update();\r\n return;\r\n }\r\n }\r\n if (this.boundBoxFunc()) {\r\n const bounded = this.boundBoxFunc()(oldAttrs, newAttrs);\r\n if (bounded) {\r\n newAttrs = bounded;\r\n }\r\n else {\r\n Util.warn('boundBoxFunc returned falsy. You should return new bound rect from it!');\r\n }\r\n }\r\n // base size value doesn't really matter\r\n // we just need to think about bounding boxes as transforms\r\n // but how?\r\n // the idea is that we have a transformed rectangle with the size of \"baseSize\"\r\n const baseSize = 10000000;\r\n const oldTr = new Transform();\r\n oldTr.translate(oldAttrs.x, oldAttrs.y);\r\n oldTr.rotate(oldAttrs.rotation);\r\n oldTr.scale(oldAttrs.width / baseSize, oldAttrs.height / baseSize);\r\n const newTr = new Transform();\r\n newTr.translate(newAttrs.x, newAttrs.y);\r\n newTr.rotate(newAttrs.rotation);\r\n newTr.scale(newAttrs.width / baseSize, newAttrs.height / baseSize);\r\n // now lets think we had [old transform] and n ow we have [new transform]\r\n // Now, the questions is: how can we transform \"parent\" to go from [old transform] into [new transform]\r\n // in equation it will be:\r\n // [delta transform] * [old transform] = [new transform]\r\n // that means that\r\n // [delta transform] = [new transform] * [old transform inverted]\r\n const delta = newTr.multiply(oldTr.invert());\r\n this._nodes.forEach((node) => {\r\n var _a;\r\n // for each node we have the same [delta transform]\r\n // the equations is\r\n // [delta transform] * [parent transform] * [old local transform] = [parent transform] * [new local transform]\r\n // and we need to find [new local transform]\r\n // [new local] = [parent inverted] * [delta] * [parent] * [old local]\r\n const parentTransform = node.getParent().getAbsoluteTransform();\r\n const localTransform = node.getTransform().copy();\r\n // skip offset:\r\n localTransform.translate(node.offsetX(), node.offsetY());\r\n const newLocalTransform = new Transform();\r\n newLocalTransform\r\n .multiply(parentTransform.copy().invert())\r\n .multiply(delta)\r\n .multiply(parentTransform)\r\n .multiply(localTransform);\r\n const attrs = newLocalTransform.decompose();\r\n node.setAttrs(attrs);\r\n this._fire('transform', { evt: evt, target: node });\r\n node._fire('transform', { evt: evt, target: node });\r\n (_a = node.getLayer()) === null || _a === void 0 ? void 0 : _a.batchDraw();\r\n });\r\n this.rotation(Util._getRotation(newAttrs.rotation));\r\n this._resetTransformCache();\r\n this.update();\r\n this.getLayer().batchDraw();\r\n }\r\n /**\r\n * force update of Konva.Transformer.\r\n * Use it when you updated attached Konva.Group and now you need to reset transformer size\r\n * @method\r\n * @name Konva.Transformer#forceUpdate\r\n */\r\n forceUpdate() {\r\n this._resetTransformCache();\r\n this.update();\r\n }\r\n _batchChangeChild(selector, attrs) {\r\n const anchor = this.findOne(selector);\r\n anchor.setAttrs(attrs);\r\n }\r\n update() {\r\n var _a;\r\n var attrs = this._getNodeRect();\r\n this.rotation(Util._getRotation(attrs.rotation));\r\n var width = attrs.width;\r\n var height = attrs.height;\r\n var enabledAnchors = this.enabledAnchors();\r\n var resizeEnabled = this.resizeEnabled();\r\n var padding = this.padding();\r\n var anchorSize = this.anchorSize();\r\n this.find('._anchor').forEach((node) => {\r\n node.setAttrs({\r\n width: anchorSize,\r\n height: anchorSize,\r\n offsetX: anchorSize / 2,\r\n offsetY: anchorSize / 2,\r\n stroke: this.anchorStroke(),\r\n strokeWidth: this.anchorStrokeWidth(),\r\n fill: this.anchorFill(),\r\n cornerRadius: this.anchorCornerRadius(),\r\n });\r\n });\r\n this._batchChangeChild('.top-left', {\r\n x: 0,\r\n y: 0,\r\n offsetX: anchorSize / 2 + padding,\r\n offsetY: anchorSize / 2 + padding,\r\n visible: resizeEnabled && enabledAnchors.indexOf('top-left') >= 0,\r\n });\r\n this._batchChangeChild('.top-center', {\r\n x: width / 2,\r\n y: 0,\r\n offsetY: anchorSize / 2 + padding,\r\n visible: resizeEnabled && enabledAnchors.indexOf('top-center') >= 0,\r\n });\r\n this._batchChangeChild('.top-right', {\r\n x: width,\r\n y: 0,\r\n offsetX: anchorSize / 2 - padding,\r\n offsetY: anchorSize / 2 + padding,\r\n visible: resizeEnabled && enabledAnchors.indexOf('top-right') >= 0,\r\n });\r\n this._batchChangeChild('.middle-left', {\r\n x: 0,\r\n y: height / 2,\r\n offsetX: anchorSize / 2 + padding,\r\n visible: resizeEnabled && enabledAnchors.indexOf('middle-left') >= 0,\r\n });\r\n this._batchChangeChild('.middle-right', {\r\n x: width,\r\n y: height / 2,\r\n offsetX: anchorSize / 2 - padding,\r\n visible: resizeEnabled && enabledAnchors.indexOf('middle-right') >= 0,\r\n });\r\n this._batchChangeChild('.bottom-left', {\r\n x: 0,\r\n y: height,\r\n offsetX: anchorSize / 2 + padding,\r\n offsetY: anchorSize / 2 - padding,\r\n visible: resizeEnabled && enabledAnchors.indexOf('bottom-left') >= 0,\r\n });\r\n this._batchChangeChild('.bottom-center', {\r\n x: width / 2,\r\n y: height,\r\n offsetY: anchorSize / 2 - padding,\r\n visible: resizeEnabled && enabledAnchors.indexOf('bottom-center') >= 0,\r\n });\r\n this._batchChangeChild('.bottom-right', {\r\n x: width,\r\n y: height,\r\n offsetX: anchorSize / 2 - padding,\r\n offsetY: anchorSize / 2 - padding,\r\n visible: resizeEnabled && enabledAnchors.indexOf('bottom-right') >= 0,\r\n });\r\n this._batchChangeChild('.rotater', {\r\n x: width / 2,\r\n y: -this.rotateAnchorOffset() * Util._sign(height) - padding,\r\n visible: this.rotateEnabled(),\r\n });\r\n this._batchChangeChild('.back', {\r\n width: width,\r\n height: height,\r\n visible: this.borderEnabled(),\r\n stroke: this.borderStroke(),\r\n strokeWidth: this.borderStrokeWidth(),\r\n dash: this.borderDash(),\r\n x: 0,\r\n y: 0,\r\n });\r\n (_a = this.getLayer()) === null || _a === void 0 ? void 0 : _a.batchDraw();\r\n }\r\n /**\r\n * determine if transformer is in active transform\r\n * @method\r\n * @name Konva.Transformer#isTransforming\r\n * @returns {Boolean}\r\n */\r\n isTransforming() {\r\n return this._transforming;\r\n }\r\n /**\r\n * Stop active transform action\r\n * @method\r\n * @name Konva.Transformer#stopTransform\r\n * @returns {Boolean}\r\n */\r\n stopTransform() {\r\n if (this._transforming) {\r\n this._removeEvents();\r\n var anchorNode = this.findOne('.' + this._movingAnchorName);\r\n if (anchorNode) {\r\n anchorNode.stopDrag();\r\n }\r\n }\r\n }\r\n destroy() {\r\n if (this.getStage() && this._cursorChange) {\r\n this.getStage().content && (this.getStage().content.style.cursor = '');\r\n }\r\n Group.prototype.destroy.call(this);\r\n this.detach();\r\n this._removeEvents();\r\n return this;\r\n }\r\n // do not work as a container\r\n // we will recreate inner nodes manually\r\n toObject() {\r\n return Node.prototype.toObject.call(this);\r\n }\r\n getClientRect() {\r\n if (this.nodes().length > 0) {\r\n return super.getClientRect();\r\n }\r\n else {\r\n // if we are detached return zero size\r\n // so it will be skipped in calculations\r\n return { x: 0, y: 0, width: 0, height: 0 };\r\n }\r\n }\r\n }\r\n function validateAnchors(val) {\r\n if (!(val instanceof Array)) {\r\n Util.warn('enabledAnchors value should be an array');\r\n }\r\n if (val instanceof Array) {\r\n val.forEach(function (name) {\r\n if (ANCHORS_NAMES.indexOf(name) === -1) {\r\n Util.warn('Unknown anchor name: ' +\r\n name +\r\n '. Available names are: ' +\r\n ANCHORS_NAMES.join(', '));\r\n }\r\n });\r\n }\r\n return val || [];\r\n }\r\n Transformer.prototype.className = 'Transformer';\r\n _registerNode(Transformer);\r\n /**\r\n * get/set enabled handlers\r\n * @name Konva.Transformer#enabledAnchors\r\n * @method\r\n * @param {Array} array\r\n * @returns {Array}\r\n * @example\r\n * // get list of handlers\r\n * var enabledAnchors = transformer.enabledAnchors();\r\n *\r\n * // set handlers\r\n * transformer.enabledAnchors(['top-left', 'top-center', 'top-right', 'middle-right', 'middle-left', 'bottom-left', 'bottom-center', 'bottom-right']);\r\n */\r\n Factory.addGetterSetter(Transformer, 'enabledAnchors', ANCHORS_NAMES, validateAnchors);\r\n /**\r\n * get/set flip enabled\r\n * @name Konva.Transformer#flipEnabled\r\n * @method\r\n * @param {Boolean} flag\r\n * @returns {Boolean}\r\n * @example\r\n * // get flip enabled property\r\n * var flipEnabled = transformer.flipEnabled();\r\n *\r\n * // set flip enabled property\r\n * transformer.flipEnabled(false);\r\n */\r\n Factory.addGetterSetter(Transformer, 'flipEnabled', true, getBooleanValidator());\r\n /**\r\n * get/set resize ability. If false it will automatically hide resizing handlers\r\n * @name Konva.Transformer#resizeEnabled\r\n * @method\r\n * @param {Array} array\r\n * @returns {Array}\r\n * @example\r\n * // get\r\n * var resizeEnabled = transformer.resizeEnabled();\r\n *\r\n * // set\r\n * transformer.resizeEnabled(false);\r\n */\r\n Factory.addGetterSetter(Transformer, 'resizeEnabled', true);\r\n /**\r\n * get/set anchor size. Default is 10\r\n * @name Konva.Transformer#validateAnchors\r\n * @method\r\n * @param {Number} 10\r\n * @returns {Number}\r\n * @example\r\n * // get\r\n * var anchorSize = transformer.anchorSize();\r\n *\r\n * // set\r\n * transformer.anchorSize(20)\r\n */\r\n Factory.addGetterSetter(Transformer, 'anchorSize', 10, getNumberValidator());\r\n /**\r\n * get/set ability to rotate.\r\n * @name Konva.Transformer#rotateEnabled\r\n * @method\r\n * @param {Boolean} enabled\r\n * @returns {Boolean}\r\n * @example\r\n * // get\r\n * var rotateEnabled = transformer.rotateEnabled();\r\n *\r\n * // set\r\n * transformer.rotateEnabled(false);\r\n */\r\n Factory.addGetterSetter(Transformer, 'rotateEnabled', true);\r\n /**\r\n * get/set rotation snaps angles.\r\n * @name Konva.Transformer#rotationSnaps\r\n * @method\r\n * @param {Array} array\r\n * @returns {Array}\r\n * @example\r\n * // get\r\n * var rotationSnaps = transformer.rotationSnaps();\r\n *\r\n * // set\r\n * transformer.rotationSnaps([0, 90, 180, 270]);\r\n */\r\n Factory.addGetterSetter(Transformer, 'rotationSnaps', []);\r\n /**\r\n * get/set distance for rotation handler\r\n * @name Konva.Transformer#rotateAnchorOffset\r\n * @method\r\n * @param {Number} offset\r\n * @returns {Number}\r\n * @example\r\n * // get\r\n * var rotateAnchorOffset = transformer.rotateAnchorOffset();\r\n *\r\n * // set\r\n * transformer.rotateAnchorOffset(100);\r\n */\r\n Factory.addGetterSetter(Transformer, 'rotateAnchorOffset', 50, getNumberValidator());\r\n /**\r\n * get/set distance for rotation tolerance\r\n * @name Konva.Transformer#rotationSnapTolerance\r\n * @method\r\n * @param {Number} tolerance\r\n * @returns {Number}\r\n * @example\r\n * // get\r\n * var rotationSnapTolerance = transformer.rotationSnapTolerance();\r\n *\r\n * // set\r\n * transformer.rotationSnapTolerance(100);\r\n */\r\n Factory.addGetterSetter(Transformer, 'rotationSnapTolerance', 5, getNumberValidator());\r\n /**\r\n * get/set visibility of border\r\n * @name Konva.Transformer#borderEnabled\r\n * @method\r\n * @param {Boolean} enabled\r\n * @returns {Boolean}\r\n * @example\r\n * // get\r\n * var borderEnabled = transformer.borderEnabled();\r\n *\r\n * // set\r\n * transformer.borderEnabled(false);\r\n */\r\n Factory.addGetterSetter(Transformer, 'borderEnabled', true);\r\n /**\r\n * get/set anchor stroke color\r\n * @name Konva.Transformer#anchorStroke\r\n * @method\r\n * @param {Boolean} enabled\r\n * @returns {Boolean}\r\n * @example\r\n * // get\r\n * var anchorStroke = transformer.anchorStroke();\r\n *\r\n * // set\r\n * transformer.anchorStroke('red');\r\n */\r\n Factory.addGetterSetter(Transformer, 'anchorStroke', 'rgb(0, 161, 255)');\r\n /**\r\n * get/set anchor stroke width\r\n * @name Konva.Transformer#anchorStrokeWidth\r\n * @method\r\n * @param {Boolean} enabled\r\n * @returns {Boolean}\r\n * @example\r\n * // get\r\n * var anchorStrokeWidth = transformer.anchorStrokeWidth();\r\n *\r\n * // set\r\n * transformer.anchorStrokeWidth(3);\r\n */\r\n Factory.addGetterSetter(Transformer, 'anchorStrokeWidth', 1, getNumberValidator());\r\n /**\r\n * get/set anchor fill color\r\n * @name Konva.Transformer#anchorFill\r\n * @method\r\n * @param {Boolean} enabled\r\n * @returns {Boolean}\r\n * @example\r\n * // get\r\n * var anchorFill = transformer.anchorFill();\r\n *\r\n * // set\r\n * transformer.anchorFill('red');\r\n */\r\n Factory.addGetterSetter(Transformer, 'anchorFill', 'white');\r\n /**\r\n * get/set anchor corner radius\r\n * @name Konva.Transformer#anchorCornerRadius\r\n * @method\r\n * @param {Number} enabled\r\n * @returns {Number}\r\n * @example\r\n * // get\r\n * var anchorCornerRadius = transformer.anchorCornerRadius();\r\n *\r\n * // set\r\n * transformer.anchorCornerRadius(3);\r\n */\r\n Factory.addGetterSetter(Transformer, 'anchorCornerRadius', 0, getNumberValidator());\r\n /**\r\n * get/set border stroke color\r\n * @name Konva.Transformer#borderStroke\r\n * @method\r\n * @param {Boolean} enabled\r\n * @returns {Boolean}\r\n * @example\r\n * // get\r\n * var borderStroke = transformer.borderStroke();\r\n *\r\n * // set\r\n * transformer.borderStroke('red');\r\n */\r\n Factory.addGetterSetter(Transformer, 'borderStroke', 'rgb(0, 161, 255)');\r\n /**\r\n * get/set border stroke width\r\n * @name Konva.Transformer#borderStrokeWidth\r\n * @method\r\n * @param {Boolean} enabled\r\n * @returns {Boolean}\r\n * @example\r\n * // get\r\n * var borderStrokeWidth = transformer.borderStrokeWidth();\r\n *\r\n * // set\r\n * transformer.borderStrokeWidth(3);\r\n */\r\n Factory.addGetterSetter(Transformer, 'borderStrokeWidth', 1, getNumberValidator());\r\n /**\r\n * get/set border dash array\r\n * @name Konva.Transformer#borderDash\r\n * @method\r\n * @param {Boolean} enabled\r\n * @returns {Boolean}\r\n * @example\r\n * // get\r\n * var borderDash = transformer.borderDash();\r\n *\r\n * // set\r\n * transformer.borderDash([2, 2]);\r\n */\r\n Factory.addGetterSetter(Transformer, 'borderDash');\r\n /**\r\n * get/set should we keep ratio while resize anchors at corners\r\n * @name Konva.Transformer#keepRatio\r\n * @method\r\n * @param {Boolean} keepRatio\r\n * @returns {Boolean}\r\n * @example\r\n * // get\r\n * var keepRatio = transformer.keepRatio();\r\n *\r\n * // set\r\n * transformer.keepRatio(false);\r\n */\r\n Factory.addGetterSetter(Transformer, 'keepRatio', true);\r\n /**\r\n * get/set should we resize relative to node's center?\r\n * @name Konva.Transformer#centeredScaling\r\n * @method\r\n * @param {Boolean} centeredScaling\r\n * @returns {Boolean}\r\n * @example\r\n * // get\r\n * var centeredScaling = transformer.centeredScaling();\r\n *\r\n * // set\r\n * transformer.centeredScaling(true);\r\n */\r\n Factory.addGetterSetter(Transformer, 'centeredScaling', false);\r\n /**\r\n * get/set should we think about stroke while resize? Good to use when a shape has strokeScaleEnabled = false\r\n * default is false\r\n * @name Konva.Transformer#ignoreStroke\r\n * @method\r\n * @param {Boolean} ignoreStroke\r\n * @returns {Boolean}\r\n * @example\r\n * // get\r\n * var ignoreStroke = transformer.ignoreStroke();\r\n *\r\n * // set\r\n * transformer.ignoreStroke(true);\r\n */\r\n Factory.addGetterSetter(Transformer, 'ignoreStroke', false);\r\n /**\r\n * get/set padding\r\n * @name Konva.Transformer#padding\r\n * @method\r\n * @param {Number} padding\r\n * @returns {Number}\r\n * @example\r\n * // get\r\n * var padding = transformer.padding();\r\n *\r\n * // set\r\n * transformer.padding(10);\r\n */\r\n Factory.addGetterSetter(Transformer, 'padding', 0, getNumberValidator());\r\n Factory.addGetterSetter(Transformer, 'node');\r\n /**\r\n * get/set attached nodes of the Transformer. Transformer will adapt to their size and listen to their events\r\n * @method\r\n * @name Konva.Transformer#nodes\r\n * @returns {Konva.Node}\r\n * @example\r\n * // get\r\n * const nodes = transformer.nodes();\r\n *\r\n * // set\r\n * transformer.nodes([rect, circle]);\r\n *\r\n * // push new item:\r\n * const oldNodes = transformer.nodes();\r\n * const newNodes = oldNodes.concat([newShape]);\r\n * // it is important to set new array instance (and concat method above will create it)\r\n * transformer.nodes(newNodes);\r\n */\r\n Factory.addGetterSetter(Transformer, 'nodes');\r\n /**\r\n * get/set bounding box function. **IMPORTANT!** boundBondFunc operates in absolute coordinates.\r\n * @name Konva.Transformer#boundBoxFunc\r\n * @method\r\n * @param {Function} func\r\n * @returns {Function}\r\n * @example\r\n * // get\r\n * var boundBoxFunc = transformer.boundBoxFunc();\r\n *\r\n * // set\r\n * transformer.boundBoxFunc(function(oldBox, newBox) {\r\n * // width and height of the boxes are corresponding to total absolute width and height of all nodes combined\r\n * // so it includes scale of the node.\r\n * if (newBox.width > 200) {\r\n * return oldBox;\r\n * }\r\n * return newBox;\r\n * });\r\n */\r\n Factory.addGetterSetter(Transformer, 'boundBoxFunc');\r\n /**\r\n * get/set dragging func for transformer anchors\r\n * @name Konva.Transformer#anchorDragBoundFunc\r\n * @method\r\n * @param {Function} func\r\n * @returns {Function}\r\n * @example\r\n * // get\r\n * var anchorDragBoundFunc = transformer.anchorDragBoundFunc();\r\n *\r\n * // set\r\n * transformer.anchorDragBoundFunc(function(oldAbsPos, newAbsPos, event) {\r\n * return {\r\n * x: 0,\r\n * y: newAbsolutePosition.y\r\n * }\r\n * });\r\n */\r\n Factory.addGetterSetter(Transformer, 'anchorDragBoundFunc');\r\n /**\r\n * using this setting you can drag transformer group by dragging empty space between attached nodes\r\n * shouldOverdrawWholeArea = true may temporary disable all events on attached nodes\r\n * @name Konva.Transformer#shouldOverdrawWholeArea\r\n * @method\r\n * @param {Boolean} shouldOverdrawWholeArea\r\n * @returns {Boolean}\r\n * @example\r\n * // get\r\n * var shouldOverdrawWholeArea = transformer.shouldOverdrawWholeArea();\r\n *\r\n * // set\r\n * transformer.shouldOverdrawWholeArea(true);\r\n */\r\n Factory.addGetterSetter(Transformer, 'shouldOverdrawWholeArea', false);\r\n /**\r\n * If you have just one attached node to Transformer it will set its initial rotation to the rotation of that node.\r\n * In some cases you may need to set a different rotation.\r\n * @name Konva.Transformer#useSingleNodeRotation\r\n * @method\r\n * @param {Boolean} useSingleNodeRotation\r\n * @returns {Boolean}\r\n * @example\r\n * // set flag to false\r\n * transformer.useSingleNodeRotation(false);\r\n * // attach a shape\r\n * transformer.nodes([shape]);\r\n * transformer.rotation(45);\r\n * transformer.update();\r\n */\r\n Factory.addGetterSetter(Transformer, 'useSingleNodeRotation', true);\r\n Factory.backCompat(Transformer, {\r\n lineEnabled: 'borderEnabled',\r\n rotateHandlerOffset: 'rotateAnchorOffset',\r\n enabledHandlers: 'enabledAnchors',\r\n });\n\n /**\r\n * Wedge constructor\r\n * @constructor\r\n * @memberof Konva\r\n * @augments Konva.Shape\r\n * @param {Object} config\r\n * @param {Number} config.angle in degrees\r\n * @param {Number} config.radius\r\n * @param {Boolean} [config.clockwise]\r\n * @param {String} [config.fill] fill color\n * @param {Image} [config.fillPatternImage] fill pattern image\n * @param {Number} [config.fillPatternX]\n * @param {Number} [config.fillPatternY]\n * @param {Object} [config.fillPatternOffset] object with x and y component\n * @param {Number} [config.fillPatternOffsetX] \n * @param {Number} [config.fillPatternOffsetY] \n * @param {Object} [config.fillPatternScale] object with x and y component\n * @param {Number} [config.fillPatternScaleX]\n * @param {Number} [config.fillPatternScaleY]\n * @param {Number} [config.fillPatternRotation]\n * @param {String} [config.fillPatternRepeat] can be \"repeat\", \"repeat-x\", \"repeat-y\", or \"no-repeat\". The default is \"no-repeat\"\n * @param {Object} [config.fillLinearGradientStartPoint] object with x and y component\n * @param {Number} [config.fillLinearGradientStartPointX]\n * @param {Number} [config.fillLinearGradientStartPointY]\n * @param {Object} [config.fillLinearGradientEndPoint] object with x and y component\n * @param {Number} [config.fillLinearGradientEndPointX]\n * @param {Number} [config.fillLinearGradientEndPointY]\n * @param {Array} [config.fillLinearGradientColorStops] array of color stops\n * @param {Object} [config.fillRadialGradientStartPoint] object with x and y component\n * @param {Number} [config.fillRadialGradientStartPointX]\n * @param {Number} [config.fillRadialGradientStartPointY]\n * @param {Object} [config.fillRadialGradientEndPoint] object with x and y component\n * @param {Number} [config.fillRadialGradientEndPointX] \n * @param {Number} [config.fillRadialGradientEndPointY] \n * @param {Number} [config.fillRadialGradientStartRadius]\n * @param {Number} [config.fillRadialGradientEndRadius]\n * @param {Array} [config.fillRadialGradientColorStops] array of color stops\n * @param {Boolean} [config.fillEnabled] flag which enables or disables the fill. The default value is true\n * @param {String} [config.fillPriority] can be color, linear-gradient, radial-graident, or pattern. The default value is color. The fillPriority property makes it really easy to toggle between different fill types. For example, if you want to toggle between a fill color style and a fill pattern style, simply set the fill property and the fillPattern properties, and then use setFillPriority('color') to render the shape with a color fill, or use setFillPriority('pattern') to render the shape with the pattern fill configuration\n * @param {String} [config.stroke] stroke color\n * @param {Number} [config.strokeWidth] stroke width\n * @param {Boolean} [config.fillAfterStrokeEnabled]. Should we draw fill AFTER stroke? Default is false.\n * @param {Number} [config.hitStrokeWidth] size of the stroke on hit canvas. The default is \"auto\" - equals to strokeWidth\n * @param {Boolean} [config.strokeHitEnabled] flag which enables or disables stroke hit region. The default is true\n * @param {Boolean} [config.perfectDrawEnabled] flag which enables or disables using buffer canvas. The default is true\n * @param {Boolean} [config.shadowForStrokeEnabled] flag which enables or disables shadow for stroke. The default is true\n * @param {Boolean} [config.strokeScaleEnabled] flag which enables or disables stroke scale. The default is true\n * @param {Boolean} [config.strokeEnabled] flag which enables or disables the stroke. The default value is true\n * @param {String} [config.lineJoin] can be miter, round, or bevel. The default\n * is miter\n * @param {String} [config.lineCap] can be butt, round, or square. The default\n * is butt\n * @param {String} [config.shadowColor]\n * @param {Number} [config.shadowBlur]\n * @param {Object} [config.shadowOffset] object with x and y component\n * @param {Number} [config.shadowOffsetX]\n * @param {Number} [config.shadowOffsetY]\n * @param {Number} [config.shadowOpacity] shadow opacity. Can be any real number\n * between 0 and 1\n * @param {Boolean} [config.shadowEnabled] flag which enables or disables the shadow. The default value is true\n * @param {Array} [config.dash]\n * @param {Boolean} [config.dashEnabled] flag which enables or disables the dashArray. The default value is true\n\r\n * @param {Number} [config.x]\n * @param {Number} [config.y]\n * @param {Number} [config.width]\n * @param {Number} [config.height]\n * @param {Boolean} [config.visible]\n * @param {Boolean} [config.listening] whether or not the node is listening for events\n * @param {String} [config.id] unique id\n * @param {String} [config.name] non-unique name\n * @param {Number} [config.opacity] determines node opacity. Can be any number between 0 and 1\n * @param {Object} [config.scale] set scale\n * @param {Number} [config.scaleX] set scale x\n * @param {Number} [config.scaleY] set scale y\n * @param {Number} [config.rotation] rotation in degrees\n * @param {Object} [config.offset] offset from center point and rotation point\n * @param {Number} [config.offsetX] set offset x\n * @param {Number} [config.offsetY] set offset y\n * @param {Boolean} [config.draggable] makes the node draggable. When stages are draggable, you can drag and drop\n * the entire stage by dragging any portion of the stage\n * @param {Number} [config.dragDistance]\n * @param {Function} [config.dragBoundFunc]\r\n * @example\r\n * // draw a wedge that's pointing downwards\r\n * var wedge = new Konva.Wedge({\r\n * radius: 40,\r\n * fill: 'red',\r\n * stroke: 'black'\r\n * strokeWidth: 5,\r\n * angleDeg: 60,\r\n * rotationDeg: -120\r\n * });\r\n */\r\n class Wedge extends Shape {\r\n _sceneFunc(context) {\r\n context.beginPath();\r\n context.arc(0, 0, this.radius(), 0, Konva$2.getAngle(this.angle()), this.clockwise());\r\n context.lineTo(0, 0);\r\n context.closePath();\r\n context.fillStrokeShape(this);\r\n }\r\n getWidth() {\r\n return this.radius() * 2;\r\n }\r\n getHeight() {\r\n return this.radius() * 2;\r\n }\r\n setWidth(width) {\r\n this.radius(width / 2);\r\n }\r\n setHeight(height) {\r\n this.radius(height / 2);\r\n }\r\n }\r\n Wedge.prototype.className = 'Wedge';\r\n Wedge.prototype._centroid = true;\r\n Wedge.prototype._attrsAffectingSize = ['radius'];\r\n _registerNode(Wedge);\r\n /**\r\n * get/set radius\r\n * @name Konva.Wedge#radius\r\n * @method\r\n * @param {Number} radius\r\n * @returns {Number}\r\n * @example\r\n * // get radius\r\n * var radius = wedge.radius();\r\n *\r\n * // set radius\r\n * wedge.radius(10);\r\n */\r\n Factory.addGetterSetter(Wedge, 'radius', 0, getNumberValidator());\r\n /**\r\n * get/set angle in degrees\r\n * @name Konva.Wedge#angle\r\n * @method\r\n * @param {Number} angle\r\n * @returns {Number}\r\n * @example\r\n * // get angle\r\n * var angle = wedge.angle();\r\n *\r\n * // set angle\r\n * wedge.angle(20);\r\n */\r\n Factory.addGetterSetter(Wedge, 'angle', 0, getNumberValidator());\r\n /**\r\n * get/set clockwise flag\r\n * @name Konva.Wedge#clockwise\r\n * @method\r\n * @param {Number} clockwise\r\n * @returns {Number}\r\n * @example\r\n * // get clockwise flag\r\n * var clockwise = wedge.clockwise();\r\n *\r\n * // draw wedge counter-clockwise\r\n * wedge.clockwise(false);\r\n *\r\n * // draw wedge clockwise\r\n * wedge.clockwise(true);\r\n */\r\n Factory.addGetterSetter(Wedge, 'clockwise', false);\r\n Factory.backCompat(Wedge, {\r\n angleDeg: 'angle',\r\n getAngleDeg: 'getAngle',\r\n setAngleDeg: 'setAngle',\r\n });\n\n /*\r\n the Gauss filter\r\n master repo: https://github.com/pavelpower/kineticjsGaussFilter\r\n */\r\n /*\r\n\n StackBlur - a fast almost Gaussian Blur For Canvas\r\n\n Version: 0.5\r\n Author: Mario Klingemann\r\n Contact: mario@quasimondo.com\r\n Website: http://www.quasimondo.com/StackBlurForCanvas\r\n Twitter: @quasimondo\r\n\n In case you find this class useful - especially in commercial projects -\r\n I am not totally unhappy for a small donation to my PayPal account\r\n mario@quasimondo.de\r\n\n Or support me on flattr:\r\n https://flattr.com/thing/72791/StackBlur-a-fast-almost-Gaussian-Blur-Effect-for-CanvasJavascript\r\n\n Copyright (c) 2010 Mario Klingemann\r\n\n Permission is hereby granted, free of charge, to any person\r\n obtaining a copy of this software and associated documentation\r\n files (the \"Software\"), to deal in the Software without\r\n restriction, including without limitation the rights to use,\r\n copy, modify, merge, publish, distribute, sublicense, and/or sell\r\n copies of the Software, and to permit persons to whom the\r\n Software is furnished to do so, subject to the following\r\n conditions:\r\n\n The above copyright notice and this permission notice shall be\r\n included in all copies or substantial portions of the Software.\r\n\n THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND,\r\n EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES\r\n OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND\r\n NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT\r\n HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,\r\n WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING\r\n FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR\r\n OTHER DEALINGS IN THE SOFTWARE.\r\n */\r\n function BlurStack() {\r\n this.r = 0;\r\n this.g = 0;\r\n this.b = 0;\r\n this.a = 0;\r\n this.next = null;\r\n }\r\n var mul_table = [\r\n 512,\r\n 512,\r\n 456,\r\n 512,\r\n 328,\r\n 456,\r\n 335,\r\n 512,\r\n 405,\r\n 328,\r\n 271,\r\n 456,\r\n 388,\r\n 335,\r\n 292,\r\n 512,\r\n 454,\r\n 405,\r\n 364,\r\n 328,\r\n 298,\r\n 271,\r\n 496,\r\n 456,\r\n 420,\r\n 388,\r\n 360,\r\n 335,\r\n 312,\r\n 292,\r\n 273,\r\n 512,\r\n 482,\r\n 454,\r\n 428,\r\n 405,\r\n 383,\r\n 364,\r\n 345,\r\n 328,\r\n 312,\r\n 298,\r\n 284,\r\n 271,\r\n 259,\r\n 496,\r\n 475,\r\n 456,\r\n 437,\r\n 420,\r\n 404,\r\n 388,\r\n 374,\r\n 360,\r\n 347,\r\n 335,\r\n 323,\r\n 312,\r\n 302,\r\n 292,\r\n 282,\r\n 273,\r\n 265,\r\n 512,\r\n 497,\r\n 482,\r\n 468,\r\n 454,\r\n 441,\r\n 428,\r\n 417,\r\n 405,\r\n 394,\r\n 383,\r\n 373,\r\n 364,\r\n 354,\r\n 345,\r\n 337,\r\n 328,\r\n 320,\r\n 312,\r\n 305,\r\n 298,\r\n 291,\r\n 284,\r\n 278,\r\n 271,\r\n 265,\r\n 259,\r\n 507,\r\n 496,\r\n 485,\r\n 475,\r\n 465,\r\n 456,\r\n 446,\r\n 437,\r\n 428,\r\n 420,\r\n 412,\r\n 404,\r\n 396,\r\n 388,\r\n 381,\r\n 374,\r\n 367,\r\n 360,\r\n 354,\r\n 347,\r\n 341,\r\n 335,\r\n 329,\r\n 323,\r\n 318,\r\n 312,\r\n 307,\r\n 302,\r\n 297,\r\n 292,\r\n 287,\r\n 282,\r\n 278,\r\n 273,\r\n 269,\r\n 265,\r\n 261,\r\n 512,\r\n 505,\r\n 497,\r\n 489,\r\n 482,\r\n 475,\r\n 468,\r\n 461,\r\n 454,\r\n 447,\r\n 441,\r\n 435,\r\n 428,\r\n 422,\r\n 417,\r\n 411,\r\n 405,\r\n 399,\r\n 394,\r\n 389,\r\n 383,\r\n 378,\r\n 373,\r\n 368,\r\n 364,\r\n 359,\r\n 354,\r\n 350,\r\n 345,\r\n 341,\r\n 337,\r\n 332,\r\n 328,\r\n 324,\r\n 320,\r\n 316,\r\n 312,\r\n 309,\r\n 305,\r\n 301,\r\n 298,\r\n 294,\r\n 291,\r\n 287,\r\n 284,\r\n 281,\r\n 278,\r\n 274,\r\n 271,\r\n 268,\r\n 265,\r\n 262,\r\n 259,\r\n 257,\r\n 507,\r\n 501,\r\n 496,\r\n 491,\r\n 485,\r\n 480,\r\n 475,\r\n 470,\r\n 465,\r\n 460,\r\n 456,\r\n 451,\r\n 446,\r\n 442,\r\n 437,\r\n 433,\r\n 428,\r\n 424,\r\n 420,\r\n 416,\r\n 412,\r\n 408,\r\n 404,\r\n 400,\r\n 396,\r\n 392,\r\n 388,\r\n 385,\r\n 381,\r\n 377,\r\n 374,\r\n 370,\r\n 367,\r\n 363,\r\n 360,\r\n 357,\r\n 354,\r\n 350,\r\n 347,\r\n 344,\r\n 341,\r\n 338,\r\n 335,\r\n 332,\r\n 329,\r\n 326,\r\n 323,\r\n 320,\r\n 318,\r\n 315,\r\n 312,\r\n 310,\r\n 307,\r\n 304,\r\n 302,\r\n 299,\r\n 297,\r\n 294,\r\n 292,\r\n 289,\r\n 287,\r\n 285,\r\n 282,\r\n 280,\r\n 278,\r\n 275,\r\n 273,\r\n 271,\r\n 269,\r\n 267,\r\n 265,\r\n 263,\r\n 261,\r\n 259,\r\n ];\r\n var shg_table = [\r\n 9,\r\n 11,\r\n 12,\r\n 13,\r\n 13,\r\n 14,\r\n 14,\r\n 15,\r\n 15,\r\n 15,\r\n 15,\r\n 16,\r\n 16,\r\n 16,\r\n 16,\r\n 17,\r\n 17,\r\n 17,\r\n 17,\r\n 17,\r\n 17,\r\n 17,\r\n 18,\r\n 18,\r\n 18,\r\n 18,\r\n 18,\r\n 18,\r\n 18,\r\n 18,\r\n 18,\r\n 19,\r\n 19,\r\n 19,\r\n 19,\r\n 19,\r\n 19,\r\n 19,\r\n 19,\r\n 19,\r\n 19,\r\n 19,\r\n 19,\r\n 19,\r\n 19,\r\n 20,\r\n 20,\r\n 20,\r\n 20,\r\n 20,\r\n 20,\r\n 20,\r\n 20,\r\n 20,\r\n 20,\r\n 20,\r\n 20,\r\n 20,\r\n 20,\r\n 20,\r\n 20,\r\n 20,\r\n 20,\r\n 21,\r\n 21,\r\n 21,\r\n 21,\r\n 21,\r\n 21,\r\n 21,\r\n 21,\r\n 21,\r\n 21,\r\n 21,\r\n 21,\r\n 21,\r\n 21,\r\n 21,\r\n 21,\r\n 21,\r\n 21,\r\n 21,\r\n 21,\r\n 21,\r\n 21,\r\n 21,\r\n 21,\r\n 21,\r\n 21,\r\n 21,\r\n 22,\r\n 22,\r\n 22,\r\n 22,\r\n 22,\r\n 22,\r\n 22,\r\n 22,\r\n 22,\r\n 22,\r\n 22,\r\n 22,\r\n 22,\r\n 22,\r\n 22,\r\n 22,\r\n 22,\r\n 22,\r\n 22,\r\n 22,\r\n 22,\r\n 22,\r\n 22,\r\n 22,\r\n 22,\r\n 22,\r\n 22,\r\n 22,\r\n 22,\r\n 22,\r\n 22,\r\n 22,\r\n 22,\r\n 22,\r\n 22,\r\n 22,\r\n 22,\r\n 23,\r\n 23,\r\n 23,\r\n 23,\r\n 23,\r\n 23,\r\n 23,\r\n 23,\r\n 23,\r\n 23,\r\n 23,\r\n 23,\r\n 23,\r\n 23,\r\n 23,\r\n 23,\r\n 23,\r\n 23,\r\n 23,\r\n 23,\r\n 23,\r\n 23,\r\n 23,\r\n 23,\r\n 23,\r\n 23,\r\n 23,\r\n 23,\r\n 23,\r\n 23,\r\n 23,\r\n 23,\r\n 23,\r\n 23,\r\n 23,\r\n 23,\r\n 23,\r\n 23,\r\n 23,\r\n 23,\r\n 23,\r\n 23,\r\n 23,\r\n 23,\r\n 23,\r\n 23,\r\n 23,\r\n 23,\r\n 23,\r\n 23,\r\n 23,\r\n 23,\r\n 23,\r\n 23,\r\n 24,\r\n 24,\r\n 24,\r\n 24,\r\n 24,\r\n 24,\r\n 24,\r\n 24,\r\n 24,\r\n 24,\r\n 24,\r\n 24,\r\n 24,\r\n 24,\r\n 24,\r\n 24,\r\n 24,\r\n 24,\r\n 24,\r\n 24,\r\n 24,\r\n 24,\r\n 24,\r\n 24,\r\n 24,\r\n 24,\r\n 24,\r\n 24,\r\n 24,\r\n 24,\r\n 24,\r\n 24,\r\n 24,\r\n 24,\r\n 24,\r\n 24,\r\n 24,\r\n 24,\r\n 24,\r\n 24,\r\n 24,\r\n 24,\r\n 24,\r\n 24,\r\n 24,\r\n 24,\r\n 24,\r\n 24,\r\n 24,\r\n 24,\r\n 24,\r\n 24,\r\n 24,\r\n 24,\r\n 24,\r\n 24,\r\n 24,\r\n 24,\r\n 24,\r\n 24,\r\n 24,\r\n 24,\r\n 24,\r\n 24,\r\n 24,\r\n 24,\r\n 24,\r\n 24,\r\n 24,\r\n 24,\r\n 24,\r\n 24,\r\n 24,\r\n 24,\r\n ];\r\n function filterGaussBlurRGBA(imageData, radius) {\r\n var pixels = imageData.data, width = imageData.width, height = imageData.height;\r\n var x, y, i, p, yp, yi, yw, r_sum, g_sum, b_sum, a_sum, r_out_sum, g_out_sum, b_out_sum, a_out_sum, r_in_sum, g_in_sum, b_in_sum, a_in_sum, pr, pg, pb, pa, rbs;\r\n var div = radius + radius + 1, widthMinus1 = width - 1, heightMinus1 = height - 1, radiusPlus1 = radius + 1, sumFactor = (radiusPlus1 * (radiusPlus1 + 1)) / 2, stackStart = new BlurStack(), stackEnd = null, stack = stackStart, stackIn = null, stackOut = null, mul_sum = mul_table[radius], shg_sum = shg_table[radius];\r\n for (i = 1; i < div; i++) {\r\n stack = stack.next = new BlurStack();\r\n if (i === radiusPlus1) {\r\n stackEnd = stack;\r\n }\r\n }\r\n stack.next = stackStart;\r\n yw = yi = 0;\r\n for (y = 0; y < height; y++) {\r\n r_in_sum = g_in_sum = b_in_sum = a_in_sum = r_sum = g_sum = b_sum = a_sum = 0;\r\n r_out_sum = radiusPlus1 * (pr = pixels[yi]);\r\n g_out_sum = radiusPlus1 * (pg = pixels[yi + 1]);\r\n b_out_sum = radiusPlus1 * (pb = pixels[yi + 2]);\r\n a_out_sum = radiusPlus1 * (pa = pixels[yi + 3]);\r\n r_sum += sumFactor * pr;\r\n g_sum += sumFactor * pg;\r\n b_sum += sumFactor * pb;\r\n a_sum += sumFactor * pa;\r\n stack = stackStart;\r\n for (i = 0; i < radiusPlus1; i++) {\r\n stack.r = pr;\r\n stack.g = pg;\r\n stack.b = pb;\r\n stack.a = pa;\r\n stack = stack.next;\r\n }\r\n for (i = 1; i < radiusPlus1; i++) {\r\n p = yi + ((widthMinus1 < i ? widthMinus1 : i) << 2);\r\n r_sum += (stack.r = pr = pixels[p]) * (rbs = radiusPlus1 - i);\r\n g_sum += (stack.g = pg = pixels[p + 1]) * rbs;\r\n b_sum += (stack.b = pb = pixels[p + 2]) * rbs;\r\n a_sum += (stack.a = pa = pixels[p + 3]) * rbs;\r\n r_in_sum += pr;\r\n g_in_sum += pg;\r\n b_in_sum += pb;\r\n a_in_sum += pa;\r\n stack = stack.next;\r\n }\r\n stackIn = stackStart;\r\n stackOut = stackEnd;\r\n for (x = 0; x < width; x++) {\r\n pixels[yi + 3] = pa = (a_sum * mul_sum) >> shg_sum;\r\n if (pa !== 0) {\r\n pa = 255 / pa;\r\n pixels[yi] = ((r_sum * mul_sum) >> shg_sum) * pa;\r\n pixels[yi + 1] = ((g_sum * mul_sum) >> shg_sum) * pa;\r\n pixels[yi + 2] = ((b_sum * mul_sum) >> shg_sum) * pa;\r\n }\r\n else {\r\n pixels[yi] = pixels[yi + 1] = pixels[yi + 2] = 0;\r\n }\r\n r_sum -= r_out_sum;\r\n g_sum -= g_out_sum;\r\n b_sum -= b_out_sum;\r\n a_sum -= a_out_sum;\r\n r_out_sum -= stackIn.r;\r\n g_out_sum -= stackIn.g;\r\n b_out_sum -= stackIn.b;\r\n a_out_sum -= stackIn.a;\r\n p = (yw + ((p = x + radius + 1) < widthMinus1 ? p : widthMinus1)) << 2;\r\n r_in_sum += stackIn.r = pixels[p];\r\n g_in_sum += stackIn.g = pixels[p + 1];\r\n b_in_sum += stackIn.b = pixels[p + 2];\r\n a_in_sum += stackIn.a = pixels[p + 3];\r\n r_sum += r_in_sum;\r\n g_sum += g_in_sum;\r\n b_sum += b_in_sum;\r\n a_sum += a_in_sum;\r\n stackIn = stackIn.next;\r\n r_out_sum += pr = stackOut.r;\r\n g_out_sum += pg = stackOut.g;\r\n b_out_sum += pb = stackOut.b;\r\n a_out_sum += pa = stackOut.a;\r\n r_in_sum -= pr;\r\n g_in_sum -= pg;\r\n b_in_sum -= pb;\r\n a_in_sum -= pa;\r\n stackOut = stackOut.next;\r\n yi += 4;\r\n }\r\n yw += width;\r\n }\r\n for (x = 0; x < width; x++) {\r\n g_in_sum = b_in_sum = a_in_sum = r_in_sum = g_sum = b_sum = a_sum = r_sum = 0;\r\n yi = x << 2;\r\n r_out_sum = radiusPlus1 * (pr = pixels[yi]);\r\n g_out_sum = radiusPlus1 * (pg = pixels[yi + 1]);\r\n b_out_sum = radiusPlus1 * (pb = pixels[yi + 2]);\r\n a_out_sum = radiusPlus1 * (pa = pixels[yi + 3]);\r\n r_sum += sumFactor * pr;\r\n g_sum += sumFactor * pg;\r\n b_sum += sumFactor * pb;\r\n a_sum += sumFactor * pa;\r\n stack = stackStart;\r\n for (i = 0; i < radiusPlus1; i++) {\r\n stack.r = pr;\r\n stack.g = pg;\r\n stack.b = pb;\r\n stack.a = pa;\r\n stack = stack.next;\r\n }\r\n yp = width;\r\n for (i = 1; i <= radius; i++) {\r\n yi = (yp + x) << 2;\r\n r_sum += (stack.r = pr = pixels[yi]) * (rbs = radiusPlus1 - i);\r\n g_sum += (stack.g = pg = pixels[yi + 1]) * rbs;\r\n b_sum += (stack.b = pb = pixels[yi + 2]) * rbs;\r\n a_sum += (stack.a = pa = pixels[yi + 3]) * rbs;\r\n r_in_sum += pr;\r\n g_in_sum += pg;\r\n b_in_sum += pb;\r\n a_in_sum += pa;\r\n stack = stack.next;\r\n if (i < heightMinus1) {\r\n yp += width;\r\n }\r\n }\r\n yi = x;\r\n stackIn = stackStart;\r\n stackOut = stackEnd;\r\n for (y = 0; y < height; y++) {\r\n p = yi << 2;\r\n pixels[p + 3] = pa = (a_sum * mul_sum) >> shg_sum;\r\n if (pa > 0) {\r\n pa = 255 / pa;\r\n pixels[p] = ((r_sum * mul_sum) >> shg_sum) * pa;\r\n pixels[p + 1] = ((g_sum * mul_sum) >> shg_sum) * pa;\r\n pixels[p + 2] = ((b_sum * mul_sum) >> shg_sum) * pa;\r\n }\r\n else {\r\n pixels[p] = pixels[p + 1] = pixels[p + 2] = 0;\r\n }\r\n r_sum -= r_out_sum;\r\n g_sum -= g_out_sum;\r\n b_sum -= b_out_sum;\r\n a_sum -= a_out_sum;\r\n r_out_sum -= stackIn.r;\r\n g_out_sum -= stackIn.g;\r\n b_out_sum -= stackIn.b;\r\n a_out_sum -= stackIn.a;\r\n p =\r\n (x +\r\n ((p = y + radiusPlus1) < heightMinus1 ? p : heightMinus1) * width) <<\r\n 2;\r\n r_sum += r_in_sum += stackIn.r = pixels[p];\r\n g_sum += g_in_sum += stackIn.g = pixels[p + 1];\r\n b_sum += b_in_sum += stackIn.b = pixels[p + 2];\r\n a_sum += a_in_sum += stackIn.a = pixels[p + 3];\r\n stackIn = stackIn.next;\r\n r_out_sum += pr = stackOut.r;\r\n g_out_sum += pg = stackOut.g;\r\n b_out_sum += pb = stackOut.b;\r\n a_out_sum += pa = stackOut.a;\r\n r_in_sum -= pr;\r\n g_in_sum -= pg;\r\n b_in_sum -= pb;\r\n a_in_sum -= pa;\r\n stackOut = stackOut.next;\r\n yi += width;\r\n }\r\n }\r\n }\r\n /**\r\n * Blur Filter\r\n * @function\r\n * @name Blur\r\n * @memberof Konva.Filters\r\n * @param {Object} imageData\r\n * @example\r\n * node.cache();\r\n * node.filters([Konva.Filters.Blur]);\r\n * node.blurRadius(10);\r\n */\r\n const Blur = function Blur(imageData) {\r\n var radius = Math.round(this.blurRadius());\r\n if (radius > 0) {\r\n filterGaussBlurRGBA(imageData, radius);\r\n }\r\n };\r\n Factory.addGetterSetter(Node, 'blurRadius', 0, getNumberValidator(), Factory.afterSetFilter);\r\n /**\r\n * get/set blur radius. Use with {@link Konva.Filters.Blur} filter\r\n * @name Konva.Node#blurRadius\r\n * @method\r\n * @param {Integer} radius\r\n * @returns {Integer}\r\n */\n\n /**\r\n * Brighten Filter.\r\n * @function\r\n * @memberof Konva.Filters\r\n * @param {Object} imageData\r\n * @example\r\n * node.cache();\r\n * node.filters([Konva.Filters.Brighten]);\r\n * node.brightness(0.8);\r\n */\r\n const Brighten = function (imageData) {\r\n var brightness = this.brightness() * 255, data = imageData.data, len = data.length, i;\r\n for (i = 0; i < len; i += 4) {\r\n // red\r\n data[i] += brightness;\r\n // green\r\n data[i + 1] += brightness;\r\n // blue\r\n data[i + 2] += brightness;\r\n }\r\n };\r\n Factory.addGetterSetter(Node, 'brightness', 0, getNumberValidator(), Factory.afterSetFilter);\r\n /**\r\n * get/set filter brightness. The brightness is a number between -1 and 1.  Positive values\r\n * brighten the pixels and negative values darken them. Use with {@link Konva.Filters.Brighten} filter.\r\n * @name Konva.Node#brightness\r\n * @method\r\n\n * @param {Number} brightness value between -1 and 1\r\n * @returns {Number}\r\n */\n\n /**\r\n * Contrast Filter.\r\n * @function\r\n * @memberof Konva.Filters\r\n * @param {Object} imageData\r\n * @example\r\n * node.cache();\r\n * node.filters([Konva.Filters.Contrast]);\r\n * node.contrast(10);\r\n */\r\n const Contrast = function (imageData) {\r\n var adjust = Math.pow((this.contrast() + 100) / 100, 2);\r\n var data = imageData.data, nPixels = data.length, red = 150, green = 150, blue = 150, i;\r\n for (i = 0; i < nPixels; i += 4) {\r\n red = data[i];\r\n green = data[i + 1];\r\n blue = data[i + 2];\r\n //Red channel\r\n red /= 255;\r\n red -= 0.5;\r\n red *= adjust;\r\n red += 0.5;\r\n red *= 255;\r\n //Green channel\r\n green /= 255;\r\n green -= 0.5;\r\n green *= adjust;\r\n green += 0.5;\r\n green *= 255;\r\n //Blue channel\r\n blue /= 255;\r\n blue -= 0.5;\r\n blue *= adjust;\r\n blue += 0.5;\r\n blue *= 255;\r\n red = red < 0 ? 0 : red > 255 ? 255 : red;\r\n green = green < 0 ? 0 : green > 255 ? 255 : green;\r\n blue = blue < 0 ? 0 : blue > 255 ? 255 : blue;\r\n data[i] = red;\r\n data[i + 1] = green;\r\n data[i + 2] = blue;\r\n }\r\n };\r\n /**\r\n * get/set filter contrast. The contrast is a number between -100 and 100.\r\n * Use with {@link Konva.Filters.Contrast} filter.\r\n * @name Konva.Node#contrast\r\n * @method\r\n * @param {Number} contrast value between -100 and 100\r\n * @returns {Number}\r\n */\r\n Factory.addGetterSetter(Node, 'contrast', 0, getNumberValidator(), Factory.afterSetFilter);\n\n /**\r\n * Emboss Filter.\r\n * Pixastic Lib - Emboss filter - v0.1.0\r\n * Copyright (c) 2008 Jacob Seidelin, jseidelin@nihilogic.dk, http://blog.nihilogic.dk/\r\n * License: [http://www.pixastic.com/lib/license.txt]\r\n * @function\r\n * @memberof Konva.Filters\r\n * @param {Object} imageData\r\n * @example\r\n * node.cache();\r\n * node.filters([Konva.Filters.Emboss]);\r\n * node.embossStrength(0.8);\r\n * node.embossWhiteLevel(0.3);\r\n * node.embossDirection('right');\r\n * node.embossBlend(true);\r\n */\r\n const Emboss = function (imageData) {\r\n // pixastic strength is between 0 and 10. I want it between 0 and 1\r\n // pixastic greyLevel is between 0 and 255. I want it between 0 and 1. Also,\r\n // a max value of greyLevel yields a white emboss, and the min value yields a black\r\n // emboss. Therefore, I changed greyLevel to whiteLevel\r\n var strength = this.embossStrength() * 10, greyLevel = this.embossWhiteLevel() * 255, direction = this.embossDirection(), blend = this.embossBlend(), dirY = 0, dirX = 0, data = imageData.data, w = imageData.width, h = imageData.height, w4 = w * 4, y = h;\r\n switch (direction) {\r\n case 'top-left':\r\n dirY = -1;\r\n dirX = -1;\r\n break;\r\n case 'top':\r\n dirY = -1;\r\n dirX = 0;\r\n break;\r\n case 'top-right':\r\n dirY = -1;\r\n dirX = 1;\r\n break;\r\n case 'right':\r\n dirY = 0;\r\n dirX = 1;\r\n break;\r\n case 'bottom-right':\r\n dirY = 1;\r\n dirX = 1;\r\n break;\r\n case 'bottom':\r\n dirY = 1;\r\n dirX = 0;\r\n break;\r\n case 'bottom-left':\r\n dirY = 1;\r\n dirX = -1;\r\n break;\r\n case 'left':\r\n dirY = 0;\r\n dirX = -1;\r\n break;\r\n default:\r\n Util.error('Unknown emboss direction: ' + direction);\r\n }\r\n do {\r\n var offsetY = (y - 1) * w4;\r\n var otherY = dirY;\r\n if (y + otherY < 1) {\r\n otherY = 0;\r\n }\r\n if (y + otherY > h) {\r\n otherY = 0;\r\n }\r\n var offsetYOther = (y - 1 + otherY) * w * 4;\r\n var x = w;\r\n do {\r\n var offset = offsetY + (x - 1) * 4;\r\n var otherX = dirX;\r\n if (x + otherX < 1) {\r\n otherX = 0;\r\n }\r\n if (x + otherX > w) {\r\n otherX = 0;\r\n }\r\n var offsetOther = offsetYOther + (x - 1 + otherX) * 4;\r\n var dR = data[offset] - data[offsetOther];\r\n var dG = data[offset + 1] - data[offsetOther + 1];\r\n var dB = data[offset + 2] - data[offsetOther + 2];\r\n var dif = dR;\r\n var absDif = dif > 0 ? dif : -dif;\r\n var absG = dG > 0 ? dG : -dG;\r\n var absB = dB > 0 ? dB : -dB;\r\n if (absG > absDif) {\r\n dif = dG;\r\n }\r\n if (absB > absDif) {\r\n dif = dB;\r\n }\r\n dif *= strength;\r\n if (blend) {\r\n var r = data[offset] + dif;\r\n var g = data[offset + 1] + dif;\r\n var b = data[offset + 2] + dif;\r\n data[offset] = r > 255 ? 255 : r < 0 ? 0 : r;\r\n data[offset + 1] = g > 255 ? 255 : g < 0 ? 0 : g;\r\n data[offset + 2] = b > 255 ? 255 : b < 0 ? 0 : b;\r\n }\r\n else {\r\n var grey = greyLevel - dif;\r\n if (grey < 0) {\r\n grey = 0;\r\n }\r\n else if (grey > 255) {\r\n grey = 255;\r\n }\r\n data[offset] = data[offset + 1] = data[offset + 2] = grey;\r\n }\r\n } while (--x);\r\n } while (--y);\r\n };\r\n Factory.addGetterSetter(Node, 'embossStrength', 0.5, getNumberValidator(), Factory.afterSetFilter);\r\n /**\r\n * get/set emboss strength. Use with {@link Konva.Filters.Emboss} filter.\r\n * @name Konva.Node#embossStrength\r\n * @method\r\n * @param {Number} level between 0 and 1. Default is 0.5\r\n * @returns {Number}\r\n */\r\n Factory.addGetterSetter(Node, 'embossWhiteLevel', 0.5, getNumberValidator(), Factory.afterSetFilter);\r\n /**\r\n * get/set emboss white level. Use with {@link Konva.Filters.Emboss} filter.\r\n * @name Konva.Node#embossWhiteLevel\r\n * @method\r\n * @param {Number} embossWhiteLevel between 0 and 1. Default is 0.5\r\n * @returns {Number}\r\n */\r\n Factory.addGetterSetter(Node, 'embossDirection', 'top-left', null, Factory.afterSetFilter);\r\n /**\r\n * get/set emboss direction. Use with {@link Konva.Filters.Emboss} filter.\r\n * @name Konva.Node#embossDirection\r\n * @method\r\n * @param {String} embossDirection can be top-left, top, top-right, right, bottom-right, bottom, bottom-left or left\r\n * The default is top-left\r\n * @returns {String}\r\n */\r\n Factory.addGetterSetter(Node, 'embossBlend', false, null, Factory.afterSetFilter);\r\n /**\r\n * get/set emboss blend. Use with {@link Konva.Filters.Emboss} filter.\r\n * @name Konva.Node#embossBlend\r\n * @method\r\n * @param {Boolean} embossBlend\r\n * @returns {Boolean}\r\n */\n\n function remap(fromValue, fromMin, fromMax, toMin, toMax) {\r\n // Compute the range of the data\r\n var fromRange = fromMax - fromMin, toRange = toMax - toMin, toValue;\r\n // If either range is 0, then the value can only be mapped to 1 value\r\n if (fromRange === 0) {\r\n return toMin + toRange / 2;\r\n }\r\n if (toRange === 0) {\r\n return toMin;\r\n }\r\n // (1) untranslate, (2) unscale, (3) rescale, (4) retranslate\r\n toValue = (fromValue - fromMin) / fromRange;\r\n toValue = toRange * toValue + toMin;\r\n return toValue;\r\n }\r\n /**\r\n * Enhance Filter. Adjusts the colors so that they span the widest\r\n * possible range (ie 0-255). Performs w*h pixel reads and w*h pixel\r\n * writes.\r\n * @function\r\n * @name Enhance\r\n * @memberof Konva.Filters\r\n * @param {Object} imageData\r\n * @author ippo615\r\n * @example\r\n * node.cache();\r\n * node.filters([Konva.Filters.Enhance]);\r\n * node.enhance(0.4);\r\n */\r\n const Enhance = function (imageData) {\r\n var data = imageData.data, nSubPixels = data.length, rMin = data[0], rMax = rMin, r, gMin = data[1], gMax = gMin, g, bMin = data[2], bMax = bMin, b, i;\r\n // If we are not enhancing anything - don't do any computation\r\n var enhanceAmount = this.enhance();\r\n if (enhanceAmount === 0) {\r\n return;\r\n }\r\n // 1st Pass - find the min and max for each channel:\r\n for (i = 0; i < nSubPixels; i += 4) {\r\n r = data[i + 0];\r\n if (r < rMin) {\r\n rMin = r;\r\n }\r\n else if (r > rMax) {\r\n rMax = r;\r\n }\r\n g = data[i + 1];\r\n if (g < gMin) {\r\n gMin = g;\r\n }\r\n else if (g > gMax) {\r\n gMax = g;\r\n }\r\n b = data[i + 2];\r\n if (b < bMin) {\r\n bMin = b;\r\n }\r\n else if (b > bMax) {\r\n bMax = b;\r\n }\r\n //a = data[i + 3];\r\n //if (a < aMin) { aMin = a; } else\r\n //if (a > aMax) { aMax = a; }\r\n }\r\n // If there is only 1 level - don't remap\r\n if (rMax === rMin) {\r\n rMax = 255;\r\n rMin = 0;\r\n }\r\n if (gMax === gMin) {\r\n gMax = 255;\r\n gMin = 0;\r\n }\r\n if (bMax === bMin) {\r\n bMax = 255;\r\n bMin = 0;\r\n }\r\n var rMid, rGoalMax, rGoalMin, gMid, gGoalMax, gGoalMin, bMid, bGoalMax, bGoalMin;\r\n // If the enhancement is positive - stretch the histogram\r\n if (enhanceAmount > 0) {\r\n rGoalMax = rMax + enhanceAmount * (255 - rMax);\r\n rGoalMin = rMin - enhanceAmount * (rMin - 0);\r\n gGoalMax = gMax + enhanceAmount * (255 - gMax);\r\n gGoalMin = gMin - enhanceAmount * (gMin - 0);\r\n bGoalMax = bMax + enhanceAmount * (255 - bMax);\r\n bGoalMin = bMin - enhanceAmount * (bMin - 0);\r\n // If the enhancement is negative - compress the histogram\r\n }\r\n else {\r\n rMid = (rMax + rMin) * 0.5;\r\n rGoalMax = rMax + enhanceAmount * (rMax - rMid);\r\n rGoalMin = rMin + enhanceAmount * (rMin - rMid);\r\n gMid = (gMax + gMin) * 0.5;\r\n gGoalMax = gMax + enhanceAmount * (gMax - gMid);\r\n gGoalMin = gMin + enhanceAmount * (gMin - gMid);\r\n bMid = (bMax + bMin) * 0.5;\r\n bGoalMax = bMax + enhanceAmount * (bMax - bMid);\r\n bGoalMin = bMin + enhanceAmount * (bMin - bMid);\r\n }\r\n // Pass 2 - remap everything, except the alpha\r\n for (i = 0; i < nSubPixels; i += 4) {\r\n data[i + 0] = remap(data[i + 0], rMin, rMax, rGoalMin, rGoalMax);\r\n data[i + 1] = remap(data[i + 1], gMin, gMax, gGoalMin, gGoalMax);\r\n data[i + 2] = remap(data[i + 2], bMin, bMax, bGoalMin, bGoalMax);\r\n //data[i + 3] = remap(data[i + 3], aMin, aMax, aGoalMin, aGoalMax);\r\n }\r\n };\r\n /**\r\n * get/set enhance. Use with {@link Konva.Filters.Enhance} filter. -1 to 1 values\r\n * @name Konva.Node#enhance\r\n * @method\r\n * @param {Float} amount\r\n * @returns {Float}\r\n */\r\n Factory.addGetterSetter(Node, 'enhance', 0, getNumberValidator(), Factory.afterSetFilter);\n\n /**\r\n * Grayscale Filter\r\n * @function\r\n * @memberof Konva.Filters\r\n * @param {Object} imageData\r\n * @example\r\n * node.cache();\r\n * node.filters([Konva.Filters.Grayscale]);\r\n */\r\n const Grayscale = function (imageData) {\r\n var data = imageData.data, len = data.length, i, brightness;\r\n for (i = 0; i < len; i += 4) {\r\n brightness = 0.34 * data[i] + 0.5 * data[i + 1] + 0.16 * data[i + 2];\r\n // red\r\n data[i] = brightness;\r\n // green\r\n data[i + 1] = brightness;\r\n // blue\r\n data[i + 2] = brightness;\r\n }\r\n };\n\n Factory.addGetterSetter(Node, 'hue', 0, getNumberValidator(), Factory.afterSetFilter);\r\n /**\r\n * get/set hsv hue in degrees. Use with {@link Konva.Filters.HSV} or {@link Konva.Filters.HSL} filter.\r\n * @name Konva.Node#hue\r\n * @method\r\n * @param {Number} hue value between 0 and 359\r\n * @returns {Number}\r\n */\r\n Factory.addGetterSetter(Node, 'saturation', 0, getNumberValidator(), Factory.afterSetFilter);\r\n /**\r\n * get/set hsv saturation. Use with {@link Konva.Filters.HSV} or {@link Konva.Filters.HSL} filter.\r\n * @name Konva.Node#saturation\r\n * @method\r\n * @param {Number} saturation 0 is no change, -1.0 halves the saturation, 1.0 doubles, etc..\r\n * @returns {Number}\r\n */\r\n Factory.addGetterSetter(Node, 'luminance', 0, getNumberValidator(), Factory.afterSetFilter);\r\n /**\r\n * get/set hsl luminance. Use with {@link Konva.Filters.HSL} filter.\r\n * @name Konva.Node#luminance\r\n * @method\r\n * @param {Number} value from -1 to 1\r\n * @returns {Number}\r\n */\r\n /**\r\n * HSL Filter. Adjusts the hue, saturation and luminance (or lightness)\r\n * @function\r\n * @memberof Konva.Filters\r\n * @param {Object} imageData\r\n * @author ippo615\r\n * @example\r\n * image.filters([Konva.Filters.HSL]);\r\n * image.luminance(0.2);\r\n */\r\n const HSL = function (imageData) {\r\n var data = imageData.data, nPixels = data.length, v = 1, s = Math.pow(2, this.saturation()), h = Math.abs(this.hue() + 360) % 360, l = this.luminance() * 127, i;\r\n // Basis for the technique used:\r\n // http://beesbuzz.biz/code/hsv_color_transforms.php\r\n // V is the value multiplier (1 for none, 2 for double, 0.5 for half)\r\n // S is the saturation multiplier (1 for none, 2 for double, 0.5 for half)\r\n // H is the hue shift in degrees (0 to 360)\r\n // vsu = V*S*cos(H*PI/180);\r\n // vsw = V*S*sin(H*PI/180);\r\n //[ .299V+.701vsu+.168vsw .587V-.587vsu+.330vsw .114V-.114vsu-.497vsw ] [R]\r\n //[ .299V-.299vsu-.328vsw .587V+.413vsu+.035vsw .114V-.114vsu+.292vsw ]*[G]\r\n //[ .299V-.300vsu+1.25vsw .587V-.588vsu-1.05vsw .114V+.886vsu-.203vsw ] [B]\r\n // Precompute the values in the matrix:\r\n var vsu = v * s * Math.cos((h * Math.PI) / 180), vsw = v * s * Math.sin((h * Math.PI) / 180);\r\n // (result spot)(source spot)\r\n var rr = 0.299 * v + 0.701 * vsu + 0.167 * vsw, rg = 0.587 * v - 0.587 * vsu + 0.33 * vsw, rb = 0.114 * v - 0.114 * vsu - 0.497 * vsw;\r\n var gr = 0.299 * v - 0.299 * vsu - 0.328 * vsw, gg = 0.587 * v + 0.413 * vsu + 0.035 * vsw, gb = 0.114 * v - 0.114 * vsu + 0.293 * vsw;\r\n var br = 0.299 * v - 0.3 * vsu + 1.25 * vsw, bg = 0.587 * v - 0.586 * vsu - 1.05 * vsw, bb = 0.114 * v + 0.886 * vsu - 0.2 * vsw;\r\n var r, g, b, a;\r\n for (i = 0; i < nPixels; i += 4) {\r\n r = data[i + 0];\r\n g = data[i + 1];\r\n b = data[i + 2];\r\n a = data[i + 3];\r\n data[i + 0] = rr * r + rg * g + rb * b + l;\r\n data[i + 1] = gr * r + gg * g + gb * b + l;\r\n data[i + 2] = br * r + bg * g + bb * b + l;\r\n data[i + 3] = a; // alpha\r\n }\r\n };\n\n /**\r\n * HSV Filter. Adjusts the hue, saturation and value\r\n * @function\r\n * @name HSV\r\n * @memberof Konva.Filters\r\n * @param {Object} imageData\r\n * @author ippo615\r\n * @example\r\n * image.filters([Konva.Filters.HSV]);\r\n * image.value(200);\r\n */\r\n const HSV = function (imageData) {\r\n var data = imageData.data, nPixels = data.length, v = Math.pow(2, this.value()), s = Math.pow(2, this.saturation()), h = Math.abs(this.hue() + 360) % 360, i;\r\n // Basis for the technique used:\r\n // http://beesbuzz.biz/code/hsv_color_transforms.php\r\n // V is the value multiplier (1 for none, 2 for double, 0.5 for half)\r\n // S is the saturation multiplier (1 for none, 2 for double, 0.5 for half)\r\n // H is the hue shift in degrees (0 to 360)\r\n // vsu = V*S*cos(H*PI/180);\r\n // vsw = V*S*sin(H*PI/180);\r\n //[ .299V+.701vsu+.168vsw .587V-.587vsu+.330vsw .114V-.114vsu-.497vsw ] [R]\r\n //[ .299V-.299vsu-.328vsw .587V+.413vsu+.035vsw .114V-.114vsu+.292vsw ]*[G]\r\n //[ .299V-.300vsu+1.25vsw .587V-.588vsu-1.05vsw .114V+.886vsu-.203vsw ] [B]\r\n // Precompute the values in the matrix:\r\n var vsu = v * s * Math.cos((h * Math.PI) / 180), vsw = v * s * Math.sin((h * Math.PI) / 180);\r\n // (result spot)(source spot)\r\n var rr = 0.299 * v + 0.701 * vsu + 0.167 * vsw, rg = 0.587 * v - 0.587 * vsu + 0.33 * vsw, rb = 0.114 * v - 0.114 * vsu - 0.497 * vsw;\r\n var gr = 0.299 * v - 0.299 * vsu - 0.328 * vsw, gg = 0.587 * v + 0.413 * vsu + 0.035 * vsw, gb = 0.114 * v - 0.114 * vsu + 0.293 * vsw;\r\n var br = 0.299 * v - 0.3 * vsu + 1.25 * vsw, bg = 0.587 * v - 0.586 * vsu - 1.05 * vsw, bb = 0.114 * v + 0.886 * vsu - 0.2 * vsw;\r\n var r, g, b, a;\r\n for (i = 0; i < nPixels; i += 4) {\r\n r = data[i + 0];\r\n g = data[i + 1];\r\n b = data[i + 2];\r\n a = data[i + 3];\r\n data[i + 0] = rr * r + rg * g + rb * b;\r\n data[i + 1] = gr * r + gg * g + gb * b;\r\n data[i + 2] = br * r + bg * g + bb * b;\r\n data[i + 3] = a; // alpha\r\n }\r\n };\r\n Factory.addGetterSetter(Node, 'hue', 0, getNumberValidator(), Factory.afterSetFilter);\r\n /**\r\n * get/set hsv hue in degrees. Use with {@link Konva.Filters.HSV} or {@link Konva.Filters.HSL} filter.\r\n * @name Konva.Node#hue\r\n * @method\r\n * @param {Number} hue value between 0 and 359\r\n * @returns {Number}\r\n */\r\n Factory.addGetterSetter(Node, 'saturation', 0, getNumberValidator(), Factory.afterSetFilter);\r\n /**\r\n * get/set hsv saturation. Use with {@link Konva.Filters.HSV} or {@link Konva.Filters.HSL} filter.\r\n * @name Konva.Node#saturation\r\n * @method\r\n * @param {Number} saturation 0 is no change, -1.0 halves the saturation, 1.0 doubles, etc..\r\n * @returns {Number}\r\n */\r\n Factory.addGetterSetter(Node, 'value', 0, getNumberValidator(), Factory.afterSetFilter);\r\n /**\r\n * get/set hsv value. Use with {@link Konva.Filters.HSV} filter.\r\n * @name Konva.Node#value\r\n * @method\r\n * @param {Number} value 0 is no change, -1.0 halves the value, 1.0 doubles, etc..\r\n * @returns {Number}\r\n */\n\n /**\r\n * Invert Filter\r\n * @function\r\n * @memberof Konva.Filters\r\n * @param {Object} imageData\r\n * @example\r\n * node.cache();\r\n * node.filters([Konva.Filters.Invert]);\r\n */\r\n const Invert = function (imageData) {\r\n var data = imageData.data, len = data.length, i;\r\n for (i = 0; i < len; i += 4) {\r\n // red\r\n data[i] = 255 - data[i];\r\n // green\r\n data[i + 1] = 255 - data[i + 1];\r\n // blue\r\n data[i + 2] = 255 - data[i + 2];\r\n }\r\n };\n\n /*\r\n * ToPolar Filter. Converts image data to polar coordinates. Performs\r\n * w*h*4 pixel reads and w*h pixel writes. The r axis is placed along\r\n * what would be the y axis and the theta axis along the x axis.\r\n * @function\r\n * @author ippo615\r\n * @memberof Konva.Filters\r\n * @param {ImageData} src, the source image data (what will be transformed)\r\n * @param {ImageData} dst, the destination image data (where it will be saved)\r\n * @param {Object} opt\r\n * @param {Number} [opt.polarCenterX] horizontal location for the center of the circle,\r\n * default is in the middle\r\n * @param {Number} [opt.polarCenterY] vertical location for the center of the circle,\r\n * default is in the middle\r\n */\r\n var ToPolar = function (src, dst, opt) {\r\n var srcPixels = src.data, dstPixels = dst.data, xSize = src.width, ySize = src.height, xMid = opt.polarCenterX || xSize / 2, yMid = opt.polarCenterY || ySize / 2, i, x, y, r = 0, g = 0, b = 0, a = 0;\r\n // Find the largest radius\r\n var rad, rMax = Math.sqrt(xMid * xMid + yMid * yMid);\r\n x = xSize - xMid;\r\n y = ySize - yMid;\r\n rad = Math.sqrt(x * x + y * y);\r\n rMax = rad > rMax ? rad : rMax;\r\n // We'll be uisng y as the radius, and x as the angle (theta=t)\r\n var rSize = ySize, tSize = xSize, radius, theta;\r\n // We want to cover all angles (0-360) and we need to convert to\r\n // radians (*PI/180)\r\n var conversion = ((360 / tSize) * Math.PI) / 180, sin, cos;\r\n // var x1, x2, x1i, x2i, y1, y2, y1i, y2i, scale;\r\n for (theta = 0; theta < tSize; theta += 1) {\r\n sin = Math.sin(theta * conversion);\r\n cos = Math.cos(theta * conversion);\r\n for (radius = 0; radius < rSize; radius += 1) {\r\n x = Math.floor(xMid + ((rMax * radius) / rSize) * cos);\r\n y = Math.floor(yMid + ((rMax * radius) / rSize) * sin);\r\n i = (y * xSize + x) * 4;\r\n r = srcPixels[i + 0];\r\n g = srcPixels[i + 1];\r\n b = srcPixels[i + 2];\r\n a = srcPixels[i + 3];\r\n // Store it\r\n //i = (theta * xSize + radius) * 4;\r\n i = (theta + radius * xSize) * 4;\r\n dstPixels[i + 0] = r;\r\n dstPixels[i + 1] = g;\r\n dstPixels[i + 2] = b;\r\n dstPixels[i + 3] = a;\r\n }\r\n }\r\n };\r\n /*\r\n * FromPolar Filter. Converts image data from polar coordinates back to rectangular.\r\n * Performs w*h*4 pixel reads and w*h pixel writes.\r\n * @function\r\n * @author ippo615\r\n * @memberof Konva.Filters\r\n * @param {ImageData} src, the source image data (what will be transformed)\r\n * @param {ImageData} dst, the destination image data (where it will be saved)\r\n * @param {Object} opt\r\n * @param {Number} [opt.polarCenterX] horizontal location for the center of the circle,\r\n * default is in the middle\r\n * @param {Number} [opt.polarCenterY] vertical location for the center of the circle,\r\n * default is in the middle\r\n * @param {Number} [opt.polarRotation] amount to rotate the image counterclockwis,\r\n * 0 is no rotation, 360 degrees is a full rotation\r\n */\r\n var FromPolar = function (src, dst, opt) {\r\n var srcPixels = src.data, dstPixels = dst.data, xSize = src.width, ySize = src.height, xMid = opt.polarCenterX || xSize / 2, yMid = opt.polarCenterY || ySize / 2, i, x, y, dx, dy, r = 0, g = 0, b = 0, a = 0;\r\n // Find the largest radius\r\n var rad, rMax = Math.sqrt(xMid * xMid + yMid * yMid);\r\n x = xSize - xMid;\r\n y = ySize - yMid;\r\n rad = Math.sqrt(x * x + y * y);\r\n rMax = rad > rMax ? rad : rMax;\r\n // We'll be uisng x as the radius, and y as the angle (theta=t)\r\n var rSize = ySize, tSize = xSize, radius, theta, phaseShift = opt.polarRotation || 0;\r\n // We need to convert to degrees and we need to make sure\r\n // it's between (0-360)\r\n // var conversion = tSize/360*180/Math.PI;\r\n //var conversion = tSize/360*180/Math.PI;\r\n var x1, y1;\r\n for (x = 0; x < xSize; x += 1) {\r\n for (y = 0; y < ySize; y += 1) {\r\n dx = x - xMid;\r\n dy = y - yMid;\r\n radius = (Math.sqrt(dx * dx + dy * dy) * rSize) / rMax;\r\n theta = ((Math.atan2(dy, dx) * 180) / Math.PI + 360 + phaseShift) % 360;\r\n theta = (theta * tSize) / 360;\r\n x1 = Math.floor(theta);\r\n y1 = Math.floor(radius);\r\n i = (y1 * xSize + x1) * 4;\r\n r = srcPixels[i + 0];\r\n g = srcPixels[i + 1];\r\n b = srcPixels[i + 2];\r\n a = srcPixels[i + 3];\r\n // Store it\r\n i = (y * xSize + x) * 4;\r\n dstPixels[i + 0] = r;\r\n dstPixels[i + 1] = g;\r\n dstPixels[i + 2] = b;\r\n dstPixels[i + 3] = a;\r\n }\r\n }\r\n };\r\n //Konva.Filters.ToPolar = Util._FilterWrapDoubleBuffer(ToPolar);\r\n //Konva.Filters.FromPolar = Util._FilterWrapDoubleBuffer(FromPolar);\r\n // create a temporary canvas for working - shared between multiple calls\r\n /*\r\n * Kaleidoscope Filter.\r\n * @function\r\n * @name Kaleidoscope\r\n * @author ippo615\r\n * @memberof Konva.Filters\r\n * @example\r\n * node.cache();\r\n * node.filters([Konva.Filters.Kaleidoscope]);\r\n * node.kaleidoscopePower(3);\r\n * node.kaleidoscopeAngle(45);\r\n */\r\n const Kaleidoscope = function (imageData) {\r\n var xSize = imageData.width, ySize = imageData.height;\r\n var x, y, xoff, i, r, g, b, a, srcPos, dstPos;\r\n var power = Math.round(this.kaleidoscopePower());\r\n var angle = Math.round(this.kaleidoscopeAngle());\r\n var offset = Math.floor((xSize * (angle % 360)) / 360);\r\n if (power < 1) {\r\n return;\r\n }\r\n // Work with our shared buffer canvas\r\n var tempCanvas = Util.createCanvasElement();\r\n tempCanvas.width = xSize;\r\n tempCanvas.height = ySize;\r\n var scratchData = tempCanvas\r\n .getContext('2d')\r\n .getImageData(0, 0, xSize, ySize);\r\n Util.releaseCanvas(tempCanvas);\r\n // Convert thhe original to polar coordinates\r\n ToPolar(imageData, scratchData, {\r\n polarCenterX: xSize / 2,\r\n polarCenterY: ySize / 2,\r\n });\r\n // Determine how big each section will be, if it's too small\r\n // make it bigger\r\n var minSectionSize = xSize / Math.pow(2, power);\r\n while (minSectionSize <= 8) {\r\n minSectionSize = minSectionSize * 2;\r\n power -= 1;\r\n }\r\n minSectionSize = Math.ceil(minSectionSize);\r\n var sectionSize = minSectionSize;\r\n // Copy the offset region to 0\r\n // Depending on the size of filter and location of the offset we may need\r\n // to copy the section backwards to prevent it from rewriting itself\r\n var xStart = 0, xEnd = sectionSize, xDelta = 1;\r\n if (offset + minSectionSize > xSize) {\r\n xStart = sectionSize;\r\n xEnd = 0;\r\n xDelta = -1;\r\n }\r\n for (y = 0; y < ySize; y += 1) {\r\n for (x = xStart; x !== xEnd; x += xDelta) {\r\n xoff = Math.round(x + offset) % xSize;\r\n srcPos = (xSize * y + xoff) * 4;\r\n r = scratchData.data[srcPos + 0];\r\n g = scratchData.data[srcPos + 1];\r\n b = scratchData.data[srcPos + 2];\r\n a = scratchData.data[srcPos + 3];\r\n dstPos = (xSize * y + x) * 4;\r\n scratchData.data[dstPos + 0] = r;\r\n scratchData.data[dstPos + 1] = g;\r\n scratchData.data[dstPos + 2] = b;\r\n scratchData.data[dstPos + 3] = a;\r\n }\r\n }\r\n // Perform the actual effect\r\n for (y = 0; y < ySize; y += 1) {\r\n sectionSize = Math.floor(minSectionSize);\r\n for (i = 0; i < power; i += 1) {\r\n for (x = 0; x < sectionSize + 1; x += 1) {\r\n srcPos = (xSize * y + x) * 4;\r\n r = scratchData.data[srcPos + 0];\r\n g = scratchData.data[srcPos + 1];\r\n b = scratchData.data[srcPos + 2];\r\n a = scratchData.data[srcPos + 3];\r\n dstPos = (xSize * y + sectionSize * 2 - x - 1) * 4;\r\n scratchData.data[dstPos + 0] = r;\r\n scratchData.data[dstPos + 1] = g;\r\n scratchData.data[dstPos + 2] = b;\r\n scratchData.data[dstPos + 3] = a;\r\n }\r\n sectionSize *= 2;\r\n }\r\n }\r\n // Convert back from polar coordinates\r\n FromPolar(scratchData, imageData, { polarRotation: 0 });\r\n };\r\n /**\r\n * get/set kaleidoscope power. Use with {@link Konva.Filters.Kaleidoscope} filter.\r\n * @name Konva.Node#kaleidoscopePower\r\n * @method\r\n * @param {Integer} power of kaleidoscope\r\n * @returns {Integer}\r\n */\r\n Factory.addGetterSetter(Node, 'kaleidoscopePower', 2, getNumberValidator(), Factory.afterSetFilter);\r\n /**\r\n * get/set kaleidoscope angle. Use with {@link Konva.Filters.Kaleidoscope} filter.\r\n * @name Konva.Node#kaleidoscopeAngle\r\n * @method\r\n * @param {Integer} degrees\r\n * @returns {Integer}\r\n */\r\n Factory.addGetterSetter(Node, 'kaleidoscopeAngle', 0, getNumberValidator(), Factory.afterSetFilter);\n\n function pixelAt(idata, x, y) {\r\n var idx = (y * idata.width + x) * 4;\r\n var d = [];\r\n d.push(idata.data[idx++], idata.data[idx++], idata.data[idx++], idata.data[idx++]);\r\n return d;\r\n }\r\n function rgbDistance(p1, p2) {\r\n return Math.sqrt(Math.pow(p1[0] - p2[0], 2) +\r\n Math.pow(p1[1] - p2[1], 2) +\r\n Math.pow(p1[2] - p2[2], 2));\r\n }\r\n function rgbMean(pTab) {\r\n var m = [0, 0, 0];\r\n for (var i = 0; i < pTab.length; i++) {\r\n m[0] += pTab[i][0];\r\n m[1] += pTab[i][1];\r\n m[2] += pTab[i][2];\r\n }\r\n m[0] /= pTab.length;\r\n m[1] /= pTab.length;\r\n m[2] /= pTab.length;\r\n return m;\r\n }\r\n function backgroundMask(idata, threshold) {\r\n var rgbv_no = pixelAt(idata, 0, 0);\r\n var rgbv_ne = pixelAt(idata, idata.width - 1, 0);\r\n var rgbv_so = pixelAt(idata, 0, idata.height - 1);\r\n var rgbv_se = pixelAt(idata, idata.width - 1, idata.height - 1);\r\n var thres = threshold || 10;\r\n if (rgbDistance(rgbv_no, rgbv_ne) < thres &&\r\n rgbDistance(rgbv_ne, rgbv_se) < thres &&\r\n rgbDistance(rgbv_se, rgbv_so) < thres &&\r\n rgbDistance(rgbv_so, rgbv_no) < thres) {\r\n // Mean color\r\n var mean = rgbMean([rgbv_ne, rgbv_no, rgbv_se, rgbv_so]);\r\n // Mask based on color distance\r\n var mask = [];\r\n for (var i = 0; i < idata.width * idata.height; i++) {\r\n var d = rgbDistance(mean, [\r\n idata.data[i * 4],\r\n idata.data[i * 4 + 1],\r\n idata.data[i * 4 + 2],\r\n ]);\r\n mask[i] = d < thres ? 0 : 255;\r\n }\r\n return mask;\r\n }\r\n }\r\n function applyMask(idata, mask) {\r\n for (var i = 0; i < idata.width * idata.height; i++) {\r\n idata.data[4 * i + 3] = mask[i];\r\n }\r\n }\r\n function erodeMask(mask, sw, sh) {\r\n var weights = [1, 1, 1, 1, 0, 1, 1, 1, 1];\r\n var side = Math.round(Math.sqrt(weights.length));\r\n var halfSide = Math.floor(side / 2);\r\n var maskResult = [];\r\n for (var y = 0; y < sh; y++) {\r\n for (var x = 0; x < sw; x++) {\r\n var so = y * sw + x;\r\n var a = 0;\r\n for (var cy = 0; cy < side; cy++) {\r\n for (var cx = 0; cx < side; cx++) {\r\n var scy = y + cy - halfSide;\r\n var scx = x + cx - halfSide;\r\n if (scy >= 0 && scy < sh && scx >= 0 && scx < sw) {\r\n var srcOff = scy * sw + scx;\r\n var wt = weights[cy * side + cx];\r\n a += mask[srcOff] * wt;\r\n }\r\n }\r\n }\r\n maskResult[so] = a === 255 * 8 ? 255 : 0;\r\n }\r\n }\r\n return maskResult;\r\n }\r\n function dilateMask(mask, sw, sh) {\r\n var weights = [1, 1, 1, 1, 1, 1, 1, 1, 1];\r\n var side = Math.round(Math.sqrt(weights.length));\r\n var halfSide = Math.floor(side / 2);\r\n var maskResult = [];\r\n for (var y = 0; y < sh; y++) {\r\n for (var x = 0; x < sw; x++) {\r\n var so = y * sw + x;\r\n var a = 0;\r\n for (var cy = 0; cy < side; cy++) {\r\n for (var cx = 0; cx < side; cx++) {\r\n var scy = y + cy - halfSide;\r\n var scx = x + cx - halfSide;\r\n if (scy >= 0 && scy < sh && scx >= 0 && scx < sw) {\r\n var srcOff = scy * sw + scx;\r\n var wt = weights[cy * side + cx];\r\n a += mask[srcOff] * wt;\r\n }\r\n }\r\n }\r\n maskResult[so] = a >= 255 * 4 ? 255 : 0;\r\n }\r\n }\r\n return maskResult;\r\n }\r\n function smoothEdgeMask(mask, sw, sh) {\r\n var weights = [1 / 9, 1 / 9, 1 / 9, 1 / 9, 1 / 9, 1 / 9, 1 / 9, 1 / 9, 1 / 9];\r\n var side = Math.round(Math.sqrt(weights.length));\r\n var halfSide = Math.floor(side / 2);\r\n var maskResult = [];\r\n for (var y = 0; y < sh; y++) {\r\n for (var x = 0; x < sw; x++) {\r\n var so = y * sw + x;\r\n var a = 0;\r\n for (var cy = 0; cy < side; cy++) {\r\n for (var cx = 0; cx < side; cx++) {\r\n var scy = y + cy - halfSide;\r\n var scx = x + cx - halfSide;\r\n if (scy >= 0 && scy < sh && scx >= 0 && scx < sw) {\r\n var srcOff = scy * sw + scx;\r\n var wt = weights[cy * side + cx];\r\n a += mask[srcOff] * wt;\r\n }\r\n }\r\n }\r\n maskResult[so] = a;\r\n }\r\n }\r\n return maskResult;\r\n }\r\n /**\r\n * Mask Filter\r\n * @function\r\n * @name Mask\r\n * @memberof Konva.Filters\r\n * @param {Object} imageData\r\n * @example\r\n * node.cache();\r\n * node.filters([Konva.Filters.Mask]);\r\n * node.threshold(200);\r\n */\r\n const Mask = function (imageData) {\r\n // Detect pixels close to the background color\r\n var threshold = this.threshold(), mask = backgroundMask(imageData, threshold);\r\n if (mask) {\r\n // Erode\r\n mask = erodeMask(mask, imageData.width, imageData.height);\r\n // Dilate\r\n mask = dilateMask(mask, imageData.width, imageData.height);\r\n // Gradient\r\n mask = smoothEdgeMask(mask, imageData.width, imageData.height);\r\n // Apply mask\r\n applyMask(imageData, mask);\r\n }\r\n return imageData;\r\n };\r\n Factory.addGetterSetter(Node, 'threshold', 0, getNumberValidator(), Factory.afterSetFilter);\n\n /**\r\n * Noise Filter. Randomly adds or substracts to the color channels\r\n * @function\r\n * @name Noise\r\n * @memberof Konva.Filters\r\n * @param {Object} imageData\r\n * @author ippo615\r\n * @example\r\n * node.cache();\r\n * node.filters([Konva.Filters.Noise]);\r\n * node.noise(0.8);\r\n */\r\n const Noise = function (imageData) {\r\n var amount = this.noise() * 255, data = imageData.data, nPixels = data.length, half = amount / 2, i;\r\n for (i = 0; i < nPixels; i += 4) {\r\n data[i + 0] += half - 2 * half * Math.random();\r\n data[i + 1] += half - 2 * half * Math.random();\r\n data[i + 2] += half - 2 * half * Math.random();\r\n }\r\n };\r\n Factory.addGetterSetter(Node, 'noise', 0.2, getNumberValidator(), Factory.afterSetFilter);\r\n /**\r\n * get/set noise amount. Must be a value between 0 and 1. Use with {@link Konva.Filters.Noise} filter.\r\n * @name Konva.Node#noise\r\n * @method\r\n * @param {Number} noise\r\n * @returns {Number}\r\n */\n\n /*eslint-disable max-depth */\r\n /**\r\n * Pixelate Filter. Averages groups of pixels and redraws\r\n * them as larger pixels\r\n * @function\r\n * @name Pixelate\r\n * @memberof Konva.Filters\r\n * @param {Object} imageData\r\n * @author ippo615\r\n * @example\r\n * node.cache();\r\n * node.filters([Konva.Filters.Pixelate]);\r\n * node.pixelSize(10);\r\n */\r\n const Pixelate = function (imageData) {\r\n var pixelSize = Math.ceil(this.pixelSize()), width = imageData.width, height = imageData.height, x, y, i, \r\n //pixelsPerBin = pixelSize * pixelSize,\r\n red, green, blue, alpha, nBinsX = Math.ceil(width / pixelSize), nBinsY = Math.ceil(height / pixelSize), xBinStart, xBinEnd, yBinStart, yBinEnd, xBin, yBin, pixelsInBin, data = imageData.data;\r\n if (pixelSize <= 0) {\r\n Util.error('pixelSize value can not be <= 0');\r\n return;\r\n }\r\n for (xBin = 0; xBin < nBinsX; xBin += 1) {\r\n for (yBin = 0; yBin < nBinsY; yBin += 1) {\r\n // Initialize the color accumlators to 0\r\n red = 0;\r\n green = 0;\r\n blue = 0;\r\n alpha = 0;\r\n // Determine which pixels are included in this bin\r\n xBinStart = xBin * pixelSize;\r\n xBinEnd = xBinStart + pixelSize;\r\n yBinStart = yBin * pixelSize;\r\n yBinEnd = yBinStart + pixelSize;\r\n // Add all of the pixels to this bin!\r\n pixelsInBin = 0;\r\n for (x = xBinStart; x < xBinEnd; x += 1) {\r\n if (x >= width) {\r\n continue;\r\n }\r\n for (y = yBinStart; y < yBinEnd; y += 1) {\r\n if (y >= height) {\r\n continue;\r\n }\r\n i = (width * y + x) * 4;\r\n red += data[i + 0];\r\n green += data[i + 1];\r\n blue += data[i + 2];\r\n alpha += data[i + 3];\r\n pixelsInBin += 1;\r\n }\r\n }\r\n // Make sure the channels are between 0-255\r\n red = red / pixelsInBin;\r\n green = green / pixelsInBin;\r\n blue = blue / pixelsInBin;\r\n alpha = alpha / pixelsInBin;\r\n // Draw this bin\r\n for (x = xBinStart; x < xBinEnd; x += 1) {\r\n if (x >= width) {\r\n continue;\r\n }\r\n for (y = yBinStart; y < yBinEnd; y += 1) {\r\n if (y >= height) {\r\n continue;\r\n }\r\n i = (width * y + x) * 4;\r\n data[i + 0] = red;\r\n data[i + 1] = green;\r\n data[i + 2] = blue;\r\n data[i + 3] = alpha;\r\n }\r\n }\r\n }\r\n }\r\n };\r\n Factory.addGetterSetter(Node, 'pixelSize', 8, getNumberValidator(), Factory.afterSetFilter);\r\n /**\r\n * get/set pixel size. Use with {@link Konva.Filters.Pixelate} filter.\r\n * @name Konva.Node#pixelSize\r\n * @method\r\n * @param {Integer} pixelSize\r\n * @returns {Integer}\r\n */\n\n /**\r\n * Posterize Filter. Adjusts the channels so that there are no more\r\n * than n different values for that channel. This is also applied\r\n * to the alpha channel.\r\n * @function\r\n * @name Posterize\r\n * @author ippo615\r\n * @memberof Konva.Filters\r\n * @param {Object} imageData\r\n * @example\r\n * node.cache();\r\n * node.filters([Konva.Filters.Posterize]);\r\n * node.levels(0.8); // between 0 and 1\r\n */\r\n const Posterize = function (imageData) {\r\n // level must be between 1 and 255\r\n var levels = Math.round(this.levels() * 254) + 1, data = imageData.data, len = data.length, scale = 255 / levels, i;\r\n for (i = 0; i < len; i += 1) {\r\n data[i] = Math.floor(data[i] / scale) * scale;\r\n }\r\n };\r\n Factory.addGetterSetter(Node, 'levels', 0.5, getNumberValidator(), Factory.afterSetFilter);\r\n /**\r\n * get/set levels. Must be a number between 0 and 1. Use with {@link Konva.Filters.Posterize} filter.\r\n * @name Konva.Node#levels\r\n * @method\r\n * @param {Number} level between 0 and 1\r\n * @returns {Number}\r\n */\n\n /**\r\n * RGB Filter\r\n * @function\r\n * @name RGB\r\n * @memberof Konva.Filters\r\n * @param {Object} imageData\r\n * @author ippo615\r\n * @example\r\n * node.cache();\r\n * node.filters([Konva.Filters.RGB]);\r\n * node.blue(120);\r\n * node.green(200);\r\n */\r\n const RGB = function (imageData) {\r\n var data = imageData.data, nPixels = data.length, red = this.red(), green = this.green(), blue = this.blue(), i, brightness;\r\n for (i = 0; i < nPixels; i += 4) {\r\n brightness =\r\n (0.34 * data[i] + 0.5 * data[i + 1] + 0.16 * data[i + 2]) / 255;\r\n data[i] = brightness * red; // r\r\n data[i + 1] = brightness * green; // g\r\n data[i + 2] = brightness * blue; // b\r\n data[i + 3] = data[i + 3]; // alpha\r\n }\r\n };\r\n Factory.addGetterSetter(Node, 'red', 0, function (val) {\r\n this._filterUpToDate = false;\r\n if (val > 255) {\r\n return 255;\r\n }\r\n else if (val < 0) {\r\n return 0;\r\n }\r\n else {\r\n return Math.round(val);\r\n }\r\n });\r\n /**\r\n * get/set filter red value. Use with {@link Konva.Filters.RGB} filter.\r\n * @name red\r\n * @method\r\n * @memberof Konva.Node.prototype\r\n * @param {Integer} red value between 0 and 255\r\n * @returns {Integer}\r\n */\r\n Factory.addGetterSetter(Node, 'green', 0, function (val) {\r\n this._filterUpToDate = false;\r\n if (val > 255) {\r\n return 255;\r\n }\r\n else if (val < 0) {\r\n return 0;\r\n }\r\n else {\r\n return Math.round(val);\r\n }\r\n });\r\n /**\r\n * get/set filter green value. Use with {@link Konva.Filters.RGB} filter.\r\n * @name green\r\n * @method\r\n * @memberof Konva.Node.prototype\r\n * @param {Integer} green value between 0 and 255\r\n * @returns {Integer}\r\n */\r\n Factory.addGetterSetter(Node, 'blue', 0, RGBComponent, Factory.afterSetFilter);\r\n /**\r\n * get/set filter blue value. Use with {@link Konva.Filters.RGB} filter.\r\n * @name blue\r\n * @method\r\n * @memberof Konva.Node.prototype\r\n * @param {Integer} blue value between 0 and 255\r\n * @returns {Integer}\r\n */\n\n /**\r\n * RGBA Filter\r\n * @function\r\n * @name RGBA\r\n * @memberof Konva.Filters\r\n * @param {Object} imageData\r\n * @author codefo\r\n * @example\r\n * node.cache();\r\n * node.filters([Konva.Filters.RGBA]);\r\n * node.blue(120);\r\n * node.green(200);\r\n * node.alpha(0.3);\r\n */\r\n const RGBA = function (imageData) {\r\n var data = imageData.data, nPixels = data.length, red = this.red(), green = this.green(), blue = this.blue(), alpha = this.alpha(), i, ia;\r\n for (i = 0; i < nPixels; i += 4) {\r\n ia = 1 - alpha;\r\n data[i] = red * alpha + data[i] * ia; // r\r\n data[i + 1] = green * alpha + data[i + 1] * ia; // g\r\n data[i + 2] = blue * alpha + data[i + 2] * ia; // b\r\n }\r\n };\r\n Factory.addGetterSetter(Node, 'red', 0, function (val) {\r\n this._filterUpToDate = false;\r\n if (val > 255) {\r\n return 255;\r\n }\r\n else if (val < 0) {\r\n return 0;\r\n }\r\n else {\r\n return Math.round(val);\r\n }\r\n });\r\n /**\r\n * get/set filter red value. Use with {@link Konva.Filters.RGBA} filter.\r\n * @name red\r\n * @method\r\n * @memberof Konva.Node.prototype\r\n * @param {Integer} red value between 0 and 255\r\n * @returns {Integer}\r\n */\r\n Factory.addGetterSetter(Node, 'green', 0, function (val) {\r\n this._filterUpToDate = false;\r\n if (val > 255) {\r\n return 255;\r\n }\r\n else if (val < 0) {\r\n return 0;\r\n }\r\n else {\r\n return Math.round(val);\r\n }\r\n });\r\n /**\r\n * get/set filter green value. Use with {@link Konva.Filters.RGBA} filter.\r\n * @name green\r\n * @method\r\n * @memberof Konva.Node.prototype\r\n * @param {Integer} green value between 0 and 255\r\n * @returns {Integer}\r\n */\r\n Factory.addGetterSetter(Node, 'blue', 0, RGBComponent, Factory.afterSetFilter);\r\n /**\r\n * get/set filter blue value. Use with {@link Konva.Filters.RGBA} filter.\r\n * @name blue\r\n * @method\r\n * @memberof Konva.Node.prototype\r\n * @param {Integer} blue value between 0 and 255\r\n * @returns {Integer}\r\n */\r\n Factory.addGetterSetter(Node, 'alpha', 1, function (val) {\r\n this._filterUpToDate = false;\r\n if (val > 1) {\r\n return 1;\r\n }\r\n else if (val < 0) {\r\n return 0;\r\n }\r\n else {\r\n return val;\r\n }\r\n });\r\n /**\r\n * get/set filter alpha value. Use with {@link Konva.Filters.RGBA} filter.\r\n * @name alpha\r\n * @method\r\n * @memberof Konva.Node.prototype\r\n * @param {Float} alpha value between 0 and 1\r\n * @returns {Float}\r\n */\n\n // based on https://stackoverflow.com/questions/1061093/how-is-a-sepia-tone-created\r\n /**\r\n * @function\r\n * @name Sepia\r\n * @memberof Konva.Filters\r\n * @param {Object} imageData\r\n * @example\r\n * node.cache();\r\n * node.filters([Konva.Filters.Sepia]);\r\n */\r\n const Sepia = function (imageData) {\r\n var data = imageData.data, nPixels = data.length, i, r, g, b;\r\n for (i = 0; i < nPixels; i += 4) {\r\n r = data[i + 0];\r\n g = data[i + 1];\r\n b = data[i + 2];\r\n data[i + 0] = Math.min(255, r * 0.393 + g * 0.769 + b * 0.189);\r\n data[i + 1] = Math.min(255, r * 0.349 + g * 0.686 + b * 0.168);\r\n data[i + 2] = Math.min(255, r * 0.272 + g * 0.534 + b * 0.131);\r\n }\r\n };\n\n /**\r\n * Solarize Filter\r\n * Pixastic Lib - Solarize filter - v0.1.0\r\n * Copyright (c) 2008 Jacob Seidelin, jseidelin@nihilogic.dk, http://blog.nihilogic.dk/\r\n * License: [http://www.pixastic.com/lib/license.txt]\r\n * @function\r\n * @name Solarize\r\n * @memberof Konva.Filters\r\n * @param {Object} imageData\r\n * @example\r\n * node.cache();\r\n * node.filters([Konva.Filters.Solarize]);\r\n */\r\n const Solarize = function (imageData) {\r\n var data = imageData.data, w = imageData.width, h = imageData.height, w4 = w * 4, y = h;\r\n do {\r\n var offsetY = (y - 1) * w4;\r\n var x = w;\r\n do {\r\n var offset = offsetY + (x - 1) * 4;\r\n var r = data[offset];\r\n var g = data[offset + 1];\r\n var b = data[offset + 2];\r\n if (r > 127) {\r\n r = 255 - r;\r\n }\r\n if (g > 127) {\r\n g = 255 - g;\r\n }\r\n if (b > 127) {\r\n b = 255 - b;\r\n }\r\n data[offset] = r;\r\n data[offset + 1] = g;\r\n data[offset + 2] = b;\r\n } while (--x);\r\n } while (--y);\r\n };\n\n /**\r\n * Threshold Filter. Pushes any value above the mid point to\r\n * the max and any value below the mid point to the min.\r\n * This affects the alpha channel.\r\n * @function\r\n * @name Threshold\r\n * @memberof Konva.Filters\r\n * @param {Object} imageData\r\n * @author ippo615\r\n * @example\r\n * node.cache();\r\n * node.filters([Konva.Filters.Threshold]);\r\n * node.threshold(0.1);\r\n */\r\n const Threshold = function (imageData) {\r\n var level = this.threshold() * 255, data = imageData.data, len = data.length, i;\r\n for (i = 0; i < len; i += 1) {\r\n data[i] = data[i] < level ? 0 : 255;\r\n }\r\n };\r\n Factory.addGetterSetter(Node, 'threshold', 0.5, getNumberValidator(), Factory.afterSetFilter);\r\n /**\r\n * get/set threshold. Must be a value between 0 and 1. Use with {@link Konva.Filters.Threshold} or {@link Konva.Filters.Mask} filter.\r\n * @name threshold\r\n * @method\r\n * @memberof Konva.Node.prototype\r\n * @param {Number} threshold\r\n * @returns {Number}\r\n */\n\n // we need to import core of the Konva and then extend it with all additional objects\r\n const Konva = Konva$1.Util._assign(Konva$1, {\r\n Arc,\r\n Arrow,\r\n Circle,\r\n Ellipse,\r\n Image,\r\n Label,\r\n Tag,\r\n Line,\r\n Path,\r\n Rect,\r\n RegularPolygon,\r\n Ring,\r\n Sprite,\r\n Star,\r\n Text,\r\n TextPath,\r\n Transformer,\r\n Wedge,\r\n /**\r\n * @namespace Filters\r\n * @memberof Konva\r\n */\r\n Filters: {\r\n Blur,\r\n Brighten,\r\n Contrast,\r\n Emboss,\r\n Enhance,\r\n Grayscale,\r\n HSL,\r\n HSV,\r\n Invert,\r\n Kaleidoscope,\r\n Mask,\r\n Noise,\r\n Pixelate,\r\n Posterize,\r\n RGB,\r\n RGBA,\r\n Sepia,\r\n Solarize,\r\n Threshold,\r\n },\r\n });\n\n return Konva;\n\n}));\n","import * as i3 from '@angular/common';\nimport { DOCUMENT, CommonModule } from '@angular/common';\nimport * as i0 from '@angular/core';\nimport { forwardRef, EventEmitter, Component, ViewEncapsulation, ChangeDetectionStrategy, Optional, Attribute, Inject, Input, Output, ViewChild, NgModule } from '@angular/core';\nimport { mixinTabIndex, mixinColor, mixinDisabled, MatCommonModule } from '@angular/material/core';\nimport { coerceBooleanProperty, coerceNumberProperty } from '@angular/cdk/coercion';\nimport { hasModifierKey, DOWN_ARROW, RIGHT_ARROW, UP_ARROW, LEFT_ARROW, HOME, END, PAGE_DOWN, PAGE_UP } from '@angular/cdk/keycodes';\nimport { NG_VALUE_ACCESSOR } from '@angular/forms';\nimport { ANIMATION_MODULE_TYPE } from '@angular/platform-browser/animations';\nimport { normalizePassiveListenerOptions } from '@angular/cdk/platform';\nimport { Subscription } from 'rxjs';\nimport * as i1 from '@angular/cdk/a11y';\nimport * as i2 from '@angular/cdk/bidi';\n\nconst activeEventOptions = normalizePassiveListenerOptions({ passive: false });\n/**\n * Visually, a 30px separation between tick marks looks best. This is very subjective but it is\n * the default separation we chose.\n */\nconst MIN_AUTO_TICK_SEPARATION = 30;\n/** The thumb gap size for a disabled slider. */\nconst DISABLED_THUMB_GAP = 7;\n/** The thumb gap size for a non-active slider at its minimum value. */\nconst MIN_VALUE_NONACTIVE_THUMB_GAP = 7;\n/** The thumb gap size for an active slider at its minimum value. */\nconst MIN_VALUE_ACTIVE_THUMB_GAP = 10;\n/**\n * Provider Expression that allows mat-slider to register as a ControlValueAccessor.\n * This allows it to support [(ngModel)] and [formControl].\n * @docs-private\n */\nconst MAT_SLIDER_VALUE_ACCESSOR = {\n provide: NG_VALUE_ACCESSOR,\n useExisting: forwardRef(() => MatSlider),\n multi: true,\n};\n/** A simple change event emitted by the MatSlider component. */\nclass MatSliderChange {\n}\n// Boilerplate for applying mixins to MatSlider.\n/** @docs-private */\nconst _MatSliderBase = mixinTabIndex(mixinColor(mixinDisabled(class {\n constructor(_elementRef) {\n this._elementRef = _elementRef;\n }\n}), 'accent'));\n/**\n * Allows users to select from a range of values by moving the slider thumb. It is similar in\n * behavior to the native `` element.\n */\nclass MatSlider extends _MatSliderBase {\n constructor(elementRef, _focusMonitor, _changeDetectorRef, _dir, tabIndex, _ngZone, _document, _animationMode) {\n super(elementRef);\n this._focusMonitor = _focusMonitor;\n this._changeDetectorRef = _changeDetectorRef;\n this._dir = _dir;\n this._ngZone = _ngZone;\n this._animationMode = _animationMode;\n this._invert = false;\n this._max = 100;\n this._min = 0;\n this._step = 1;\n this._thumbLabel = false;\n this._tickInterval = 0;\n this._value = null;\n this._vertical = false;\n /** Event emitted when the slider value has changed. */\n this.change = new EventEmitter();\n /** Event emitted when the slider thumb moves. */\n this.input = new EventEmitter();\n /**\n * Emits when the raw value of the slider changes. This is here primarily\n * to facilitate the two-way binding for the `value` input.\n * @docs-private\n */\n this.valueChange = new EventEmitter();\n /** onTouch function registered via registerOnTouch (ControlValueAccessor). */\n this.onTouched = () => { };\n this._percent = 0;\n /**\n * Whether or not the thumb is sliding and what the user is using to slide it with.\n * Used to determine if there should be a transition for the thumb and fill track.\n */\n this._isSliding = null;\n /**\n * Whether or not the slider is active (clicked or sliding).\n * Used to shrink and grow the thumb as according to the Material Design spec.\n */\n this._isActive = false;\n /** The size of a tick interval as a percentage of the size of the track. */\n this._tickIntervalPercent = 0;\n /** The dimensions of the slider. */\n this._sliderDimensions = null;\n this._controlValueAccessorChangeFn = () => { };\n /** Subscription to the Directionality change EventEmitter. */\n this._dirChangeSubscription = Subscription.EMPTY;\n /** Called when the user has put their pointer down on the slider. */\n this._pointerDown = (event) => {\n // Don't do anything if the slider is disabled or the\n // user is using anything other than the main mouse button.\n if (this.disabled || this._isSliding || (!isTouchEvent(event) && event.button !== 0)) {\n return;\n }\n this._ngZone.run(() => {\n this._touchId = isTouchEvent(event)\n ? getTouchIdForSlider(event, this._elementRef.nativeElement)\n : undefined;\n const pointerPosition = getPointerPositionOnPage(event, this._touchId);\n if (pointerPosition) {\n const oldValue = this.value;\n this._isSliding = 'pointer';\n this._lastPointerEvent = event;\n this._focusHostElement();\n this._onMouseenter(); // Simulate mouseenter in case this is a mobile device.\n this._bindGlobalEvents(event);\n this._focusHostElement();\n this._updateValueFromPosition(pointerPosition);\n this._valueOnSlideStart = oldValue;\n // Despite the fact that we explicitly bind active events, in some cases the browser\n // still dispatches non-cancelable events which cause this call to throw an error.\n // There doesn't appear to be a good way of avoiding them. See #23820.\n if (event.cancelable) {\n event.preventDefault();\n }\n // Emit a change and input event if the value changed.\n if (oldValue != this.value) {\n this._emitInputEvent();\n }\n }\n });\n };\n /**\n * Called when the user has moved their pointer after\n * starting to drag. Bound on the document level.\n */\n this._pointerMove = (event) => {\n if (this._isSliding === 'pointer') {\n const pointerPosition = getPointerPositionOnPage(event, this._touchId);\n if (pointerPosition) {\n // Prevent the slide from selecting anything else.\n event.preventDefault();\n const oldValue = this.value;\n this._lastPointerEvent = event;\n this._updateValueFromPosition(pointerPosition);\n // Native range elements always emit `input` events when the value changed while sliding.\n if (oldValue != this.value) {\n this._emitInputEvent();\n }\n }\n }\n };\n /** Called when the user has lifted their pointer. Bound on the document level. */\n this._pointerUp = (event) => {\n if (this._isSliding === 'pointer') {\n if (!isTouchEvent(event) ||\n typeof this._touchId !== 'number' ||\n // Note that we use `changedTouches`, rather than `touches` because it\n // seems like in most cases `touches` is empty for `touchend` events.\n findMatchingTouch(event.changedTouches, this._touchId)) {\n event.preventDefault();\n this._removeGlobalEvents();\n this._isSliding = null;\n this._touchId = undefined;\n if (this._valueOnSlideStart != this.value && !this.disabled) {\n this._emitChangeEvent();\n }\n this._valueOnSlideStart = this._lastPointerEvent = null;\n }\n }\n };\n /** Called when the window has lost focus. */\n this._windowBlur = () => {\n // If the window is blurred while dragging we need to stop dragging because the\n // browser won't dispatch the `mouseup` and `touchend` events anymore.\n if (this._lastPointerEvent) {\n this._pointerUp(this._lastPointerEvent);\n }\n };\n this._document = _document;\n this.tabIndex = parseInt(tabIndex) || 0;\n _ngZone.runOutsideAngular(() => {\n const element = elementRef.nativeElement;\n element.addEventListener('mousedown', this._pointerDown, activeEventOptions);\n element.addEventListener('touchstart', this._pointerDown, activeEventOptions);\n });\n }\n /** Whether the slider is inverted. */\n get invert() {\n return this._invert;\n }\n set invert(value) {\n this._invert = coerceBooleanProperty(value);\n }\n /** The maximum value that the slider can have. */\n get max() {\n return this._max;\n }\n set max(v) {\n this._max = coerceNumberProperty(v, this._max);\n this._percent = this._calculatePercentage(this._value);\n // Since this also modifies the percentage, we need to let the change detection know.\n this._changeDetectorRef.markForCheck();\n }\n /** The minimum value that the slider can have. */\n get min() {\n return this._min;\n }\n set min(v) {\n this._min = coerceNumberProperty(v, this._min);\n this._percent = this._calculatePercentage(this._value);\n // Since this also modifies the percentage, we need to let the change detection know.\n this._changeDetectorRef.markForCheck();\n }\n /** The values at which the thumb will snap. */\n get step() {\n return this._step;\n }\n set step(v) {\n this._step = coerceNumberProperty(v, this._step);\n if (this._step % 1 !== 0) {\n this._roundToDecimal = this._step.toString().split('.').pop().length;\n }\n // Since this could modify the label, we need to notify the change detection.\n this._changeDetectorRef.markForCheck();\n }\n /** Whether or not to show the thumb label. */\n get thumbLabel() {\n return this._thumbLabel;\n }\n set thumbLabel(value) {\n this._thumbLabel = coerceBooleanProperty(value);\n }\n /**\n * How often to show ticks. Relative to the step so that a tick always appears on a step.\n * Ex: Tick interval of 4 with a step of 3 will draw a tick every 4 steps (every 12 values).\n */\n get tickInterval() {\n return this._tickInterval;\n }\n set tickInterval(value) {\n if (value === 'auto') {\n this._tickInterval = 'auto';\n }\n else if (typeof value === 'number' || typeof value === 'string') {\n this._tickInterval = coerceNumberProperty(value, this._tickInterval);\n }\n else {\n this._tickInterval = 0;\n }\n }\n /** Value of the slider. */\n get value() {\n // If the value needs to be read and it is still uninitialized, initialize it to the min.\n if (this._value === null) {\n this.value = this._min;\n }\n return this._value;\n }\n set value(v) {\n if (v !== this._value) {\n let value = coerceNumberProperty(v, 0);\n // While incrementing by a decimal we can end up with values like 33.300000000000004.\n // Truncate it to ensure that it matches the label and to make it easier to work with.\n if (this._roundToDecimal && value !== this.min && value !== this.max) {\n value = parseFloat(value.toFixed(this._roundToDecimal));\n }\n this._value = value;\n this._percent = this._calculatePercentage(this._value);\n // Since this also modifies the percentage, we need to let the change detection know.\n this._changeDetectorRef.markForCheck();\n }\n }\n /** Whether the slider is vertical. */\n get vertical() {\n return this._vertical;\n }\n set vertical(value) {\n this._vertical = coerceBooleanProperty(value);\n }\n /** The value to be used for display purposes. */\n get displayValue() {\n if (this.displayWith) {\n // Value is never null but since setters and getters cannot have\n // different types, the value getter is also typed to return null.\n return this.displayWith(this.value);\n }\n // Note that this could be improved further by rounding something like 0.999 to 1 or\n // 0.899 to 0.9, however it is very performance sensitive, because it gets called on\n // every change detection cycle.\n if (this._roundToDecimal && this.value && this.value % 1 !== 0) {\n return this.value.toFixed(this._roundToDecimal);\n }\n return this.value || 0;\n }\n /** set focus to the host element */\n focus(options) {\n this._focusHostElement(options);\n }\n /** blur the host element */\n blur() {\n this._blurHostElement();\n }\n /** The percentage of the slider that coincides with the value. */\n get percent() {\n return this._clamp(this._percent);\n }\n /**\n * Whether the axis of the slider is inverted.\n * (i.e. whether moving the thumb in the positive x or y direction decreases the slider's value).\n */\n _shouldInvertAxis() {\n // Standard non-inverted mode for a vertical slider should be dragging the thumb from bottom to\n // top. However from a y-axis standpoint this is inverted.\n return this.vertical ? !this.invert : this.invert;\n }\n /** Whether the slider is at its minimum value. */\n _isMinValue() {\n return this.percent === 0;\n }\n /**\n * The amount of space to leave between the slider thumb and the track fill & track background\n * elements.\n */\n _getThumbGap() {\n if (this.disabled) {\n return DISABLED_THUMB_GAP;\n }\n if (this._isMinValue() && !this.thumbLabel) {\n return this._isActive ? MIN_VALUE_ACTIVE_THUMB_GAP : MIN_VALUE_NONACTIVE_THUMB_GAP;\n }\n return 0;\n }\n /** CSS styles for the track background element. */\n _getTrackBackgroundStyles() {\n const axis = this.vertical ? 'Y' : 'X';\n const scale = this.vertical ? `1, ${1 - this.percent}, 1` : `${1 - this.percent}, 1, 1`;\n const sign = this._shouldInvertMouseCoords() ? '-' : '';\n return {\n // scale3d avoids some rendering issues in Chrome. See #12071.\n transform: `translate${axis}(${sign}${this._getThumbGap()}px) scale3d(${scale})`,\n };\n }\n /** CSS styles for the track fill element. */\n _getTrackFillStyles() {\n const percent = this.percent;\n const axis = this.vertical ? 'Y' : 'X';\n const scale = this.vertical ? `1, ${percent}, 1` : `${percent}, 1, 1`;\n const sign = this._shouldInvertMouseCoords() ? '' : '-';\n return {\n // scale3d avoids some rendering issues in Chrome. See #12071.\n transform: `translate${axis}(${sign}${this._getThumbGap()}px) scale3d(${scale})`,\n // iOS Safari has a bug where it won't re-render elements which start of as `scale(0)` until\n // something forces a style recalculation on it. Since we'll end up with `scale(0)` when\n // the value of the slider is 0, we can easily get into this situation. We force a\n // recalculation by changing the element's `display` when it goes from 0 to any other value.\n display: percent === 0 ? 'none' : '',\n };\n }\n /** CSS styles for the ticks container element. */\n _getTicksContainerStyles() {\n let axis = this.vertical ? 'Y' : 'X';\n // For a horizontal slider in RTL languages we push the ticks container off the left edge\n // instead of the right edge to avoid causing a horizontal scrollbar to appear.\n let sign = !this.vertical && this._getDirection() == 'rtl' ? '' : '-';\n let offset = (this._tickIntervalPercent / 2) * 100;\n return {\n 'transform': `translate${axis}(${sign}${offset}%)`,\n };\n }\n /** CSS styles for the ticks element. */\n _getTicksStyles() {\n let tickSize = this._tickIntervalPercent * 100;\n let backgroundSize = this.vertical ? `2px ${tickSize}%` : `${tickSize}% 2px`;\n let axis = this.vertical ? 'Y' : 'X';\n // Depending on the direction we pushed the ticks container, push the ticks the opposite\n // direction to re-center them but clip off the end edge. In RTL languages we need to flip the\n // ticks 180 degrees so we're really cutting off the end edge abd not the start.\n let sign = !this.vertical && this._getDirection() == 'rtl' ? '-' : '';\n let rotate = !this.vertical && this._getDirection() == 'rtl' ? ' rotate(180deg)' : '';\n let styles = {\n 'backgroundSize': backgroundSize,\n // Without translateZ ticks sometimes jitter as the slider moves on Chrome & Firefox.\n 'transform': `translateZ(0) translate${axis}(${sign}${tickSize / 2}%)${rotate}`,\n };\n if (this._isMinValue() && this._getThumbGap()) {\n const shouldInvertAxis = this._shouldInvertAxis();\n let side;\n if (this.vertical) {\n side = shouldInvertAxis ? 'Bottom' : 'Top';\n }\n else {\n side = shouldInvertAxis ? 'Right' : 'Left';\n }\n styles[`padding${side}`] = `${this._getThumbGap()}px`;\n }\n return styles;\n }\n _getThumbContainerStyles() {\n const shouldInvertAxis = this._shouldInvertAxis();\n let axis = this.vertical ? 'Y' : 'X';\n // For a horizontal slider in RTL languages we push the thumb container off the left edge\n // instead of the right edge to avoid causing a horizontal scrollbar to appear.\n let invertOffset = this._getDirection() == 'rtl' && !this.vertical ? !shouldInvertAxis : shouldInvertAxis;\n let offset = (invertOffset ? this.percent : 1 - this.percent) * 100;\n return {\n 'transform': `translate${axis}(-${offset}%)`,\n };\n }\n /**\n * Whether mouse events should be converted to a slider position by calculating their distance\n * from the right or bottom edge of the slider as opposed to the top or left.\n */\n _shouldInvertMouseCoords() {\n const shouldInvertAxis = this._shouldInvertAxis();\n return this._getDirection() == 'rtl' && !this.vertical ? !shouldInvertAxis : shouldInvertAxis;\n }\n /** The language direction for this slider element. */\n _getDirection() {\n return this._dir && this._dir.value == 'rtl' ? 'rtl' : 'ltr';\n }\n ngAfterViewInit() {\n this._focusMonitor.monitor(this._elementRef, true).subscribe((origin) => {\n this._isActive = !!origin && origin !== 'keyboard';\n this._changeDetectorRef.detectChanges();\n });\n if (this._dir) {\n this._dirChangeSubscription = this._dir.change.subscribe(() => {\n this._changeDetectorRef.markForCheck();\n });\n }\n }\n ngOnDestroy() {\n const element = this._elementRef.nativeElement;\n element.removeEventListener('mousedown', this._pointerDown, activeEventOptions);\n element.removeEventListener('touchstart', this._pointerDown, activeEventOptions);\n this._lastPointerEvent = null;\n this._removeGlobalEvents();\n this._focusMonitor.stopMonitoring(this._elementRef);\n this._dirChangeSubscription.unsubscribe();\n }\n _onMouseenter() {\n if (this.disabled) {\n return;\n }\n // We save the dimensions of the slider here so we can use them to update the spacing of the\n // ticks and determine where on the slider click and slide events happen.\n this._sliderDimensions = this._getSliderDimensions();\n this._updateTickIntervalPercent();\n }\n _onFocus() {\n // We save the dimensions of the slider here so we can use them to update the spacing of the\n // ticks and determine where on the slider click and slide events happen.\n this._sliderDimensions = this._getSliderDimensions();\n this._updateTickIntervalPercent();\n }\n _onBlur() {\n this.onTouched();\n }\n _onKeydown(event) {\n if (this.disabled ||\n hasModifierKey(event) ||\n (this._isSliding && this._isSliding !== 'keyboard')) {\n return;\n }\n const oldValue = this.value;\n switch (event.keyCode) {\n case PAGE_UP:\n this._increment(10);\n break;\n case PAGE_DOWN:\n this._increment(-10);\n break;\n case END:\n this.value = this.max;\n break;\n case HOME:\n this.value = this.min;\n break;\n case LEFT_ARROW:\n // NOTE: For a sighted user it would make more sense that when they press an arrow key on an\n // inverted slider the thumb moves in that direction. However for a blind user, nothing\n // about the slider indicates that it is inverted. They will expect left to be decrement,\n // regardless of how it appears on the screen. For speakers ofRTL languages, they probably\n // expect left to mean increment. Therefore we flip the meaning of the side arrow keys for\n // RTL. For inverted sliders we prefer a good a11y experience to having it \"look right\" for\n // sighted users, therefore we do not swap the meaning.\n this._increment(this._getDirection() == 'rtl' ? 1 : -1);\n break;\n case UP_ARROW:\n this._increment(1);\n break;\n case RIGHT_ARROW:\n // See comment on LEFT_ARROW about the conditions under which we flip the meaning.\n this._increment(this._getDirection() == 'rtl' ? -1 : 1);\n break;\n case DOWN_ARROW:\n this._increment(-1);\n break;\n default:\n // Return if the key is not one that we explicitly handle to avoid calling preventDefault on\n // it.\n return;\n }\n if (oldValue != this.value) {\n this._emitInputEvent();\n this._emitChangeEvent();\n }\n this._isSliding = 'keyboard';\n event.preventDefault();\n }\n _onKeyup() {\n if (this._isSliding === 'keyboard') {\n this._isSliding = null;\n }\n }\n /** Use defaultView of injected document if available or fallback to global window reference */\n _getWindow() {\n return this._document.defaultView || window;\n }\n /**\n * Binds our global move and end events. They're bound at the document level and only while\n * dragging so that the user doesn't have to keep their pointer exactly over the slider\n * as they're swiping across the screen.\n */\n _bindGlobalEvents(triggerEvent) {\n // Note that we bind the events to the `document`, because it allows us to capture\n // drag cancel events where the user's pointer is outside the browser window.\n const document = this._document;\n const isTouch = isTouchEvent(triggerEvent);\n const moveEventName = isTouch ? 'touchmove' : 'mousemove';\n const endEventName = isTouch ? 'touchend' : 'mouseup';\n document.addEventListener(moveEventName, this._pointerMove, activeEventOptions);\n document.addEventListener(endEventName, this._pointerUp, activeEventOptions);\n if (isTouch) {\n document.addEventListener('touchcancel', this._pointerUp, activeEventOptions);\n }\n const window = this._getWindow();\n if (typeof window !== 'undefined' && window) {\n window.addEventListener('blur', this._windowBlur);\n }\n }\n /** Removes any global event listeners that we may have added. */\n _removeGlobalEvents() {\n const document = this._document;\n document.removeEventListener('mousemove', this._pointerMove, activeEventOptions);\n document.removeEventListener('mouseup', this._pointerUp, activeEventOptions);\n document.removeEventListener('touchmove', this._pointerMove, activeEventOptions);\n document.removeEventListener('touchend', this._pointerUp, activeEventOptions);\n document.removeEventListener('touchcancel', this._pointerUp, activeEventOptions);\n const window = this._getWindow();\n if (typeof window !== 'undefined' && window) {\n window.removeEventListener('blur', this._windowBlur);\n }\n }\n /** Increments the slider by the given number of steps (negative number decrements). */\n _increment(numSteps) {\n // Pre-clamp the current value since it's allowed to be\n // out of bounds when assigned programmatically.\n const clampedValue = this._clamp(this.value || 0, this.min, this.max);\n this.value = this._clamp(clampedValue + this.step * numSteps, this.min, this.max);\n }\n /** Calculate the new value from the new physical location. The value will always be snapped. */\n _updateValueFromPosition(pos) {\n if (!this._sliderDimensions) {\n return;\n }\n let offset = this.vertical ? this._sliderDimensions.top : this._sliderDimensions.left;\n let size = this.vertical ? this._sliderDimensions.height : this._sliderDimensions.width;\n let posComponent = this.vertical ? pos.y : pos.x;\n // The exact value is calculated from the event and used to find the closest snap value.\n let percent = this._clamp((posComponent - offset) / size);\n if (this._shouldInvertMouseCoords()) {\n percent = 1 - percent;\n }\n // Since the steps may not divide cleanly into the max value, if the user\n // slid to 0 or 100 percent, we jump to the min/max value. This approach\n // is slightly more intuitive than using `Math.ceil` below, because it\n // follows the user's pointer closer.\n if (percent === 0) {\n this.value = this.min;\n }\n else if (percent === 1) {\n this.value = this.max;\n }\n else {\n const exactValue = this._calculateValue(percent);\n // This calculation finds the closest step by finding the closest\n // whole number divisible by the step relative to the min.\n const closestValue = Math.round((exactValue - this.min) / this.step) * this.step + this.min;\n // The value needs to snap to the min and max.\n this.value = this._clamp(closestValue, this.min, this.max);\n }\n }\n /** Emits a change event if the current value is different from the last emitted value. */\n _emitChangeEvent() {\n this._controlValueAccessorChangeFn(this.value);\n this.valueChange.emit(this.value);\n this.change.emit(this._createChangeEvent());\n }\n /** Emits an input event when the current value is different from the last emitted value. */\n _emitInputEvent() {\n this.input.emit(this._createChangeEvent());\n }\n /** Updates the amount of space between ticks as a percentage of the width of the slider. */\n _updateTickIntervalPercent() {\n if (!this.tickInterval || !this._sliderDimensions) {\n return;\n }\n let tickIntervalPercent;\n if (this.tickInterval == 'auto') {\n let trackSize = this.vertical ? this._sliderDimensions.height : this._sliderDimensions.width;\n let pixelsPerStep = (trackSize * this.step) / (this.max - this.min);\n let stepsPerTick = Math.ceil(MIN_AUTO_TICK_SEPARATION / pixelsPerStep);\n let pixelsPerTick = stepsPerTick * this.step;\n tickIntervalPercent = pixelsPerTick / trackSize;\n }\n else {\n tickIntervalPercent = (this.tickInterval * this.step) / (this.max - this.min);\n }\n this._tickIntervalPercent = isSafeNumber(tickIntervalPercent) ? tickIntervalPercent : 0;\n }\n /** Creates a slider change object from the specified value. */\n _createChangeEvent(value = this.value) {\n let event = new MatSliderChange();\n event.source = this;\n event.value = value;\n return event;\n }\n /** Calculates the percentage of the slider that a value is. */\n _calculatePercentage(value) {\n const percentage = ((value || 0) - this.min) / (this.max - this.min);\n return isSafeNumber(percentage) ? percentage : 0;\n }\n /** Calculates the value a percentage of the slider corresponds to. */\n _calculateValue(percentage) {\n return this.min + percentage * (this.max - this.min);\n }\n /** Return a number between two numbers. */\n _clamp(value, min = 0, max = 1) {\n return Math.max(min, Math.min(value, max));\n }\n /**\n * Get the bounding client rect of the slider track element.\n * The track is used rather than the native element to ignore the extra space that the thumb can\n * take up.\n */\n _getSliderDimensions() {\n return this._sliderWrapper ? this._sliderWrapper.nativeElement.getBoundingClientRect() : null;\n }\n /**\n * Focuses the native element.\n * Currently only used to allow a blur event to fire but will be used with keyboard input later.\n */\n _focusHostElement(options) {\n this._elementRef.nativeElement.focus(options);\n }\n /** Blurs the native element. */\n _blurHostElement() {\n this._elementRef.nativeElement.blur();\n }\n /**\n * Sets the model value. Implemented as part of ControlValueAccessor.\n * @param value\n */\n writeValue(value) {\n this.value = value;\n }\n /**\n * Registers a callback to be triggered when the value has changed.\n * Implemented as part of ControlValueAccessor.\n * @param fn Callback to be registered.\n */\n registerOnChange(fn) {\n this._controlValueAccessorChangeFn = fn;\n }\n /**\n * Registers a callback to be triggered when the component is touched.\n * Implemented as part of ControlValueAccessor.\n * @param fn Callback to be registered.\n */\n registerOnTouched(fn) {\n this.onTouched = fn;\n }\n /**\n * Sets whether the component should be disabled.\n * Implemented as part of ControlValueAccessor.\n * @param isDisabled\n */\n setDisabledState(isDisabled) {\n this.disabled = isDisabled;\n }\n}\nMatSlider.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: \"12.0.0\", version: \"13.3.0\", ngImport: i0, type: MatSlider, deps: [{ token: i0.ElementRef }, { token: i1.FocusMonitor }, { token: i0.ChangeDetectorRef }, { token: i2.Directionality, optional: true }, { token: 'tabindex', attribute: true }, { token: i0.NgZone }, { token: DOCUMENT }, { token: ANIMATION_MODULE_TYPE, optional: true }], target: i0.ɵɵFactoryTarget.Component });\nMatSlider.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: \"12.0.0\", version: \"13.3.0\", type: MatSlider, selector: \"mat-slider\", inputs: { disabled: \"disabled\", color: \"color\", tabIndex: \"tabIndex\", invert: \"invert\", max: \"max\", min: \"min\", step: \"step\", thumbLabel: \"thumbLabel\", tickInterval: \"tickInterval\", value: \"value\", displayWith: \"displayWith\", valueText: \"valueText\", vertical: \"vertical\" }, outputs: { change: \"change\", input: \"input\", valueChange: \"valueChange\" }, host: { attributes: { \"role\": \"slider\" }, listeners: { \"focus\": \"_onFocus()\", \"blur\": \"_onBlur()\", \"keydown\": \"_onKeydown($event)\", \"keyup\": \"_onKeyup()\", \"mouseenter\": \"_onMouseenter()\", \"selectstart\": \"$event.preventDefault()\" }, properties: { \"tabIndex\": \"tabIndex\", \"attr.aria-disabled\": \"disabled\", \"attr.aria-valuemax\": \"max\", \"attr.aria-valuemin\": \"min\", \"attr.aria-valuenow\": \"value\", \"attr.aria-valuetext\": \"valueText == null ? displayValue : valueText\", \"attr.aria-orientation\": \"vertical ? \\\"vertical\\\" : \\\"horizontal\\\"\", \"class.mat-slider-disabled\": \"disabled\", \"class.mat-slider-has-ticks\": \"tickInterval\", \"class.mat-slider-horizontal\": \"!vertical\", \"class.mat-slider-axis-inverted\": \"_shouldInvertAxis()\", \"class.mat-slider-invert-mouse-coords\": \"_shouldInvertMouseCoords()\", \"class.mat-slider-sliding\": \"_isSliding\", \"class.mat-slider-thumb-label-showing\": \"thumbLabel\", \"class.mat-slider-vertical\": \"vertical\", \"class.mat-slider-min-value\": \"_isMinValue()\", \"class.mat-slider-hide-last-tick\": \"disabled || _isMinValue() && _getThumbGap() && _shouldInvertAxis()\", \"class._mat-animation-noopable\": \"_animationMode === \\\"NoopAnimations\\\"\" }, classAttribute: \"mat-slider mat-focus-indicator\" }, providers: [MAT_SLIDER_VALUE_ACCESSOR], viewQueries: [{ propertyName: \"_sliderWrapper\", first: true, predicate: [\"sliderWrapper\"], descendants: true }], exportAs: [\"matSlider\"], usesInheritance: true, ngImport: i0, template: \"
\\n
\\n
\\n
\\n
\\n
\\n
\\n
\\n
\\n
\\n
\\n
\\n {{displayValue}}\\n
\\n
\\n
\\n\", styles: [\".mat-slider{display:inline-block;position:relative;box-sizing:border-box;padding:8px;outline:none;vertical-align:middle}.mat-slider:not(.mat-slider-disabled):active,.mat-slider.mat-slider-sliding:not(.mat-slider-disabled){cursor:grabbing}.mat-slider-wrapper{-webkit-print-color-adjust:exact;color-adjust:exact;position:absolute}.mat-slider-track-wrapper{position:absolute;top:0;left:0;overflow:hidden}.mat-slider-track-fill{position:absolute;transform-origin:0 0;transition:transform 400ms cubic-bezier(0.25, 0.8, 0.25, 1),background-color 400ms cubic-bezier(0.25, 0.8, 0.25, 1)}.mat-slider-track-background{position:absolute;transform-origin:100% 100%;transition:transform 400ms cubic-bezier(0.25, 0.8, 0.25, 1),background-color 400ms cubic-bezier(0.25, 0.8, 0.25, 1)}.mat-slider-ticks-container{position:absolute;left:0;top:0;overflow:hidden}.mat-slider-ticks{-webkit-background-clip:content-box;background-clip:content-box;background-repeat:repeat;box-sizing:border-box;opacity:0;transition:opacity 400ms cubic-bezier(0.25, 0.8, 0.25, 1)}.mat-slider-thumb-container{position:absolute;z-index:1;transition:transform 400ms cubic-bezier(0.25, 0.8, 0.25, 1)}.mat-slider-focus-ring{position:absolute;width:30px;height:30px;border-radius:50%;transform:scale(0);opacity:0;transition:transform 400ms cubic-bezier(0.25, 0.8, 0.25, 1),background-color 400ms cubic-bezier(0.25, 0.8, 0.25, 1),opacity 400ms cubic-bezier(0.25, 0.8, 0.25, 1)}.mat-slider.cdk-keyboard-focused .mat-slider-focus-ring,.mat-slider.cdk-program-focused .mat-slider-focus-ring{transform:scale(1);opacity:1}.mat-slider:not(.mat-slider-disabled):not(.mat-slider-sliding) .mat-slider-thumb-label,.mat-slider:not(.mat-slider-disabled):not(.mat-slider-sliding) .mat-slider-thumb{cursor:grab}.mat-slider-thumb{position:absolute;right:-10px;bottom:-10px;box-sizing:border-box;width:20px;height:20px;border:3px solid transparent;border-radius:50%;transform:scale(0.7);transition:transform 400ms cubic-bezier(0.25, 0.8, 0.25, 1),background-color 400ms cubic-bezier(0.25, 0.8, 0.25, 1),border-color 400ms cubic-bezier(0.25, 0.8, 0.25, 1)}.mat-slider-thumb-label{display:none;align-items:center;justify-content:center;position:absolute;width:28px;height:28px;border-radius:50%;transition:transform 400ms cubic-bezier(0.25, 0.8, 0.25, 1),border-radius 400ms cubic-bezier(0.25, 0.8, 0.25, 1),background-color 400ms cubic-bezier(0.25, 0.8, 0.25, 1)}.cdk-high-contrast-active .mat-slider-thumb-label{outline:solid 1px}.mat-slider-thumb-label-text{z-index:1;opacity:0;transition:opacity 400ms cubic-bezier(0.25, 0.8, 0.25, 1)}.mat-slider-sliding .mat-slider-track-fill,.mat-slider-sliding .mat-slider-track-background,.mat-slider-sliding .mat-slider-thumb-container{transition-duration:0ms}.mat-slider-has-ticks .mat-slider-wrapper::after{content:\\\"\\\";position:absolute;border-width:0;border-style:solid;opacity:0;transition:opacity 400ms cubic-bezier(0.25, 0.8, 0.25, 1)}.mat-slider-has-ticks.cdk-focused:not(.mat-slider-hide-last-tick) .mat-slider-wrapper::after,.mat-slider-has-ticks:hover:not(.mat-slider-hide-last-tick) .mat-slider-wrapper::after{opacity:1}.mat-slider-has-ticks.cdk-focused:not(.mat-slider-disabled) .mat-slider-ticks,.mat-slider-has-ticks:hover:not(.mat-slider-disabled) .mat-slider-ticks{opacity:1}.mat-slider-thumb-label-showing .mat-slider-focus-ring{display:none}.mat-slider-thumb-label-showing .mat-slider-thumb-label{display:flex}.mat-slider-axis-inverted .mat-slider-track-fill{transform-origin:100% 100%}.mat-slider-axis-inverted .mat-slider-track-background{transform-origin:0 0}.mat-slider:not(.mat-slider-disabled).cdk-focused.mat-slider-thumb-label-showing .mat-slider-thumb{transform:scale(0)}.mat-slider:not(.mat-slider-disabled).cdk-focused .mat-slider-thumb-label{border-radius:50% 50% 0}.mat-slider:not(.mat-slider-disabled).cdk-focused .mat-slider-thumb-label-text{opacity:1}.mat-slider:not(.mat-slider-disabled).cdk-mouse-focused .mat-slider-thumb,.mat-slider:not(.mat-slider-disabled).cdk-touch-focused .mat-slider-thumb,.mat-slider:not(.mat-slider-disabled).cdk-program-focused .mat-slider-thumb{border-width:2px;transform:scale(1)}.mat-slider-disabled .mat-slider-focus-ring{transform:scale(0);opacity:0}.mat-slider-disabled .mat-slider-thumb{border-width:4px;transform:scale(0.5)}.mat-slider-disabled .mat-slider-thumb-label{display:none}.mat-slider-horizontal{height:48px;min-width:128px}.mat-slider-horizontal .mat-slider-wrapper{height:2px;top:23px;left:8px;right:8px}.mat-slider-horizontal .mat-slider-wrapper::after{height:2px;border-left-width:2px;right:0;top:0}.mat-slider-horizontal .mat-slider-track-wrapper{height:2px;width:100%}.mat-slider-horizontal .mat-slider-track-fill{height:2px;width:100%;transform:scaleX(0)}.mat-slider-horizontal .mat-slider-track-background{height:2px;width:100%;transform:scaleX(1)}.mat-slider-horizontal .mat-slider-ticks-container{height:2px;width:100%}.cdk-high-contrast-active .mat-slider-horizontal .mat-slider-ticks-container{height:0;outline:solid 2px;top:1px}.mat-slider-horizontal .mat-slider-ticks{height:2px;width:100%}.mat-slider-horizontal .mat-slider-thumb-container{width:100%;height:0;top:50%}.mat-slider-horizontal .mat-slider-focus-ring{top:-15px;right:-15px}.mat-slider-horizontal .mat-slider-thumb-label{right:-14px;top:-40px;transform:translateY(26px) scale(0.01) rotate(45deg)}.mat-slider-horizontal .mat-slider-thumb-label-text{transform:rotate(-45deg)}.mat-slider-horizontal.cdk-focused .mat-slider-thumb-label{transform:rotate(45deg)}.cdk-high-contrast-active .mat-slider-horizontal.cdk-focused .mat-slider-thumb-label,.cdk-high-contrast-active .mat-slider-horizontal.cdk-focused .mat-slider-thumb-label-text{transform:none}.mat-slider-vertical{width:48px;min-height:128px}.mat-slider-vertical .mat-slider-wrapper{width:2px;top:8px;bottom:8px;left:23px}.mat-slider-vertical .mat-slider-wrapper::after{width:2px;border-top-width:2px;bottom:0;left:0}.mat-slider-vertical .mat-slider-track-wrapper{height:100%;width:2px}.mat-slider-vertical .mat-slider-track-fill{height:100%;width:2px;transform:scaleY(0)}.mat-slider-vertical .mat-slider-track-background{height:100%;width:2px;transform:scaleY(1)}.mat-slider-vertical .mat-slider-ticks-container{width:2px;height:100%}.cdk-high-contrast-active .mat-slider-vertical .mat-slider-ticks-container{width:0;outline:solid 2px;left:1px}.mat-slider-vertical .mat-slider-focus-ring{bottom:-15px;left:-15px}.mat-slider-vertical .mat-slider-ticks{width:2px;height:100%}.mat-slider-vertical .mat-slider-thumb-container{height:100%;width:0;left:50%}.mat-slider-vertical .mat-slider-thumb{-webkit-backface-visibility:hidden;backface-visibility:hidden}.mat-slider-vertical .mat-slider-thumb-label{bottom:-14px;left:-40px;transform:translateX(26px) scale(0.01) rotate(-45deg)}.mat-slider-vertical .mat-slider-thumb-label-text{transform:rotate(45deg)}.mat-slider-vertical.cdk-focused .mat-slider-thumb-label{transform:rotate(-45deg)}[dir=rtl] .mat-slider-wrapper::after{left:0;right:auto}[dir=rtl] .mat-slider-horizontal .mat-slider-track-fill{transform-origin:100% 100%}[dir=rtl] .mat-slider-horizontal .mat-slider-track-background{transform-origin:0 0}[dir=rtl] .mat-slider-horizontal.mat-slider-axis-inverted .mat-slider-track-fill{transform-origin:0 0}[dir=rtl] .mat-slider-horizontal.mat-slider-axis-inverted .mat-slider-track-background{transform-origin:100% 100%}.mat-slider._mat-animation-noopable .mat-slider-track-fill,.mat-slider._mat-animation-noopable .mat-slider-track-background,.mat-slider._mat-animation-noopable .mat-slider-ticks,.mat-slider._mat-animation-noopable .mat-slider-thumb-container,.mat-slider._mat-animation-noopable .mat-slider-focus-ring,.mat-slider._mat-animation-noopable .mat-slider-thumb,.mat-slider._mat-animation-noopable .mat-slider-thumb-label,.mat-slider._mat-animation-noopable .mat-slider-thumb-label-text,.mat-slider._mat-animation-noopable .mat-slider-has-ticks .mat-slider-wrapper::after{transition:none}\\n\"], directives: [{ type: i3.NgStyle, selector: \"[ngStyle]\", inputs: [\"ngStyle\"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });\ni0.ɵɵngDeclareClassMetadata({ minVersion: \"12.0.0\", version: \"13.3.0\", ngImport: i0, type: MatSlider, decorators: [{\n type: Component,\n args: [{ selector: 'mat-slider', exportAs: 'matSlider', providers: [MAT_SLIDER_VALUE_ACCESSOR], host: {\n '(focus)': '_onFocus()',\n '(blur)': '_onBlur()',\n '(keydown)': '_onKeydown($event)',\n '(keyup)': '_onKeyup()',\n '(mouseenter)': '_onMouseenter()',\n // On Safari starting to slide temporarily triggers text selection mode which\n // show the wrong cursor. We prevent it by stopping the `selectstart` event.\n '(selectstart)': '$event.preventDefault()',\n 'class': 'mat-slider mat-focus-indicator',\n 'role': 'slider',\n '[tabIndex]': 'tabIndex',\n '[attr.aria-disabled]': 'disabled',\n '[attr.aria-valuemax]': 'max',\n '[attr.aria-valuemin]': 'min',\n '[attr.aria-valuenow]': 'value',\n // NVDA and Jaws appear to announce the `aria-valuenow` by calculating its percentage based\n // on its value between `aria-valuemin` and `aria-valuemax`. Due to how decimals are handled,\n // it can cause the slider to read out a very long value like 0.20000068 if the current value\n // is 0.2 with a min of 0 and max of 1. We work around the issue by setting `aria-valuetext`\n // to the same value that we set on the slider's thumb which will be truncated.\n '[attr.aria-valuetext]': 'valueText == null ? displayValue : valueText',\n '[attr.aria-orientation]': 'vertical ? \"vertical\" : \"horizontal\"',\n '[class.mat-slider-disabled]': 'disabled',\n '[class.mat-slider-has-ticks]': 'tickInterval',\n '[class.mat-slider-horizontal]': '!vertical',\n '[class.mat-slider-axis-inverted]': '_shouldInvertAxis()',\n // Class binding which is only used by the test harness as there is no other\n // way for the harness to detect if mouse coordinates need to be inverted.\n '[class.mat-slider-invert-mouse-coords]': '_shouldInvertMouseCoords()',\n '[class.mat-slider-sliding]': '_isSliding',\n '[class.mat-slider-thumb-label-showing]': 'thumbLabel',\n '[class.mat-slider-vertical]': 'vertical',\n '[class.mat-slider-min-value]': '_isMinValue()',\n '[class.mat-slider-hide-last-tick]': 'disabled || _isMinValue() && _getThumbGap() && _shouldInvertAxis()',\n '[class._mat-animation-noopable]': '_animationMode === \"NoopAnimations\"',\n }, inputs: ['disabled', 'color', 'tabIndex'], encapsulation: ViewEncapsulation.None, changeDetection: ChangeDetectionStrategy.OnPush, template: \"
\\n
\\n
\\n
\\n
\\n
\\n
\\n
\\n
\\n
\\n
\\n
\\n {{displayValue}}\\n
\\n
\\n
\\n\", styles: [\".mat-slider{display:inline-block;position:relative;box-sizing:border-box;padding:8px;outline:none;vertical-align:middle}.mat-slider:not(.mat-slider-disabled):active,.mat-slider.mat-slider-sliding:not(.mat-slider-disabled){cursor:grabbing}.mat-slider-wrapper{-webkit-print-color-adjust:exact;color-adjust:exact;position:absolute}.mat-slider-track-wrapper{position:absolute;top:0;left:0;overflow:hidden}.mat-slider-track-fill{position:absolute;transform-origin:0 0;transition:transform 400ms cubic-bezier(0.25, 0.8, 0.25, 1),background-color 400ms cubic-bezier(0.25, 0.8, 0.25, 1)}.mat-slider-track-background{position:absolute;transform-origin:100% 100%;transition:transform 400ms cubic-bezier(0.25, 0.8, 0.25, 1),background-color 400ms cubic-bezier(0.25, 0.8, 0.25, 1)}.mat-slider-ticks-container{position:absolute;left:0;top:0;overflow:hidden}.mat-slider-ticks{-webkit-background-clip:content-box;background-clip:content-box;background-repeat:repeat;box-sizing:border-box;opacity:0;transition:opacity 400ms cubic-bezier(0.25, 0.8, 0.25, 1)}.mat-slider-thumb-container{position:absolute;z-index:1;transition:transform 400ms cubic-bezier(0.25, 0.8, 0.25, 1)}.mat-slider-focus-ring{position:absolute;width:30px;height:30px;border-radius:50%;transform:scale(0);opacity:0;transition:transform 400ms cubic-bezier(0.25, 0.8, 0.25, 1),background-color 400ms cubic-bezier(0.25, 0.8, 0.25, 1),opacity 400ms cubic-bezier(0.25, 0.8, 0.25, 1)}.mat-slider.cdk-keyboard-focused .mat-slider-focus-ring,.mat-slider.cdk-program-focused .mat-slider-focus-ring{transform:scale(1);opacity:1}.mat-slider:not(.mat-slider-disabled):not(.mat-slider-sliding) .mat-slider-thumb-label,.mat-slider:not(.mat-slider-disabled):not(.mat-slider-sliding) .mat-slider-thumb{cursor:grab}.mat-slider-thumb{position:absolute;right:-10px;bottom:-10px;box-sizing:border-box;width:20px;height:20px;border:3px solid transparent;border-radius:50%;transform:scale(0.7);transition:transform 400ms cubic-bezier(0.25, 0.8, 0.25, 1),background-color 400ms cubic-bezier(0.25, 0.8, 0.25, 1),border-color 400ms cubic-bezier(0.25, 0.8, 0.25, 1)}.mat-slider-thumb-label{display:none;align-items:center;justify-content:center;position:absolute;width:28px;height:28px;border-radius:50%;transition:transform 400ms cubic-bezier(0.25, 0.8, 0.25, 1),border-radius 400ms cubic-bezier(0.25, 0.8, 0.25, 1),background-color 400ms cubic-bezier(0.25, 0.8, 0.25, 1)}.cdk-high-contrast-active .mat-slider-thumb-label{outline:solid 1px}.mat-slider-thumb-label-text{z-index:1;opacity:0;transition:opacity 400ms cubic-bezier(0.25, 0.8, 0.25, 1)}.mat-slider-sliding .mat-slider-track-fill,.mat-slider-sliding .mat-slider-track-background,.mat-slider-sliding .mat-slider-thumb-container{transition-duration:0ms}.mat-slider-has-ticks .mat-slider-wrapper::after{content:\\\"\\\";position:absolute;border-width:0;border-style:solid;opacity:0;transition:opacity 400ms cubic-bezier(0.25, 0.8, 0.25, 1)}.mat-slider-has-ticks.cdk-focused:not(.mat-slider-hide-last-tick) .mat-slider-wrapper::after,.mat-slider-has-ticks:hover:not(.mat-slider-hide-last-tick) .mat-slider-wrapper::after{opacity:1}.mat-slider-has-ticks.cdk-focused:not(.mat-slider-disabled) .mat-slider-ticks,.mat-slider-has-ticks:hover:not(.mat-slider-disabled) .mat-slider-ticks{opacity:1}.mat-slider-thumb-label-showing .mat-slider-focus-ring{display:none}.mat-slider-thumb-label-showing .mat-slider-thumb-label{display:flex}.mat-slider-axis-inverted .mat-slider-track-fill{transform-origin:100% 100%}.mat-slider-axis-inverted .mat-slider-track-background{transform-origin:0 0}.mat-slider:not(.mat-slider-disabled).cdk-focused.mat-slider-thumb-label-showing .mat-slider-thumb{transform:scale(0)}.mat-slider:not(.mat-slider-disabled).cdk-focused .mat-slider-thumb-label{border-radius:50% 50% 0}.mat-slider:not(.mat-slider-disabled).cdk-focused .mat-slider-thumb-label-text{opacity:1}.mat-slider:not(.mat-slider-disabled).cdk-mouse-focused .mat-slider-thumb,.mat-slider:not(.mat-slider-disabled).cdk-touch-focused .mat-slider-thumb,.mat-slider:not(.mat-slider-disabled).cdk-program-focused .mat-slider-thumb{border-width:2px;transform:scale(1)}.mat-slider-disabled .mat-slider-focus-ring{transform:scale(0);opacity:0}.mat-slider-disabled .mat-slider-thumb{border-width:4px;transform:scale(0.5)}.mat-slider-disabled .mat-slider-thumb-label{display:none}.mat-slider-horizontal{height:48px;min-width:128px}.mat-slider-horizontal .mat-slider-wrapper{height:2px;top:23px;left:8px;right:8px}.mat-slider-horizontal .mat-slider-wrapper::after{height:2px;border-left-width:2px;right:0;top:0}.mat-slider-horizontal .mat-slider-track-wrapper{height:2px;width:100%}.mat-slider-horizontal .mat-slider-track-fill{height:2px;width:100%;transform:scaleX(0)}.mat-slider-horizontal .mat-slider-track-background{height:2px;width:100%;transform:scaleX(1)}.mat-slider-horizontal .mat-slider-ticks-container{height:2px;width:100%}.cdk-high-contrast-active .mat-slider-horizontal .mat-slider-ticks-container{height:0;outline:solid 2px;top:1px}.mat-slider-horizontal .mat-slider-ticks{height:2px;width:100%}.mat-slider-horizontal .mat-slider-thumb-container{width:100%;height:0;top:50%}.mat-slider-horizontal .mat-slider-focus-ring{top:-15px;right:-15px}.mat-slider-horizontal .mat-slider-thumb-label{right:-14px;top:-40px;transform:translateY(26px) scale(0.01) rotate(45deg)}.mat-slider-horizontal .mat-slider-thumb-label-text{transform:rotate(-45deg)}.mat-slider-horizontal.cdk-focused .mat-slider-thumb-label{transform:rotate(45deg)}.cdk-high-contrast-active .mat-slider-horizontal.cdk-focused .mat-slider-thumb-label,.cdk-high-contrast-active .mat-slider-horizontal.cdk-focused .mat-slider-thumb-label-text{transform:none}.mat-slider-vertical{width:48px;min-height:128px}.mat-slider-vertical .mat-slider-wrapper{width:2px;top:8px;bottom:8px;left:23px}.mat-slider-vertical .mat-slider-wrapper::after{width:2px;border-top-width:2px;bottom:0;left:0}.mat-slider-vertical .mat-slider-track-wrapper{height:100%;width:2px}.mat-slider-vertical .mat-slider-track-fill{height:100%;width:2px;transform:scaleY(0)}.mat-slider-vertical .mat-slider-track-background{height:100%;width:2px;transform:scaleY(1)}.mat-slider-vertical .mat-slider-ticks-container{width:2px;height:100%}.cdk-high-contrast-active .mat-slider-vertical .mat-slider-ticks-container{width:0;outline:solid 2px;left:1px}.mat-slider-vertical .mat-slider-focus-ring{bottom:-15px;left:-15px}.mat-slider-vertical .mat-slider-ticks{width:2px;height:100%}.mat-slider-vertical .mat-slider-thumb-container{height:100%;width:0;left:50%}.mat-slider-vertical .mat-slider-thumb{-webkit-backface-visibility:hidden;backface-visibility:hidden}.mat-slider-vertical .mat-slider-thumb-label{bottom:-14px;left:-40px;transform:translateX(26px) scale(0.01) rotate(-45deg)}.mat-slider-vertical .mat-slider-thumb-label-text{transform:rotate(45deg)}.mat-slider-vertical.cdk-focused .mat-slider-thumb-label{transform:rotate(-45deg)}[dir=rtl] .mat-slider-wrapper::after{left:0;right:auto}[dir=rtl] .mat-slider-horizontal .mat-slider-track-fill{transform-origin:100% 100%}[dir=rtl] .mat-slider-horizontal .mat-slider-track-background{transform-origin:0 0}[dir=rtl] .mat-slider-horizontal.mat-slider-axis-inverted .mat-slider-track-fill{transform-origin:0 0}[dir=rtl] .mat-slider-horizontal.mat-slider-axis-inverted .mat-slider-track-background{transform-origin:100% 100%}.mat-slider._mat-animation-noopable .mat-slider-track-fill,.mat-slider._mat-animation-noopable .mat-slider-track-background,.mat-slider._mat-animation-noopable .mat-slider-ticks,.mat-slider._mat-animation-noopable .mat-slider-thumb-container,.mat-slider._mat-animation-noopable .mat-slider-focus-ring,.mat-slider._mat-animation-noopable .mat-slider-thumb,.mat-slider._mat-animation-noopable .mat-slider-thumb-label,.mat-slider._mat-animation-noopable .mat-slider-thumb-label-text,.mat-slider._mat-animation-noopable .mat-slider-has-ticks .mat-slider-wrapper::after{transition:none}\\n\"] }]\n }], ctorParameters: function () {\n return [{ type: i0.ElementRef }, { type: i1.FocusMonitor }, { type: i0.ChangeDetectorRef }, { type: i2.Directionality, decorators: [{\n type: Optional\n }] }, { type: undefined, decorators: [{\n type: Attribute,\n args: ['tabindex']\n }] }, { type: i0.NgZone }, { type: undefined, decorators: [{\n type: Inject,\n args: [DOCUMENT]\n }] }, { type: undefined, decorators: [{\n type: Optional\n }, {\n type: Inject,\n args: [ANIMATION_MODULE_TYPE]\n }] }];\n }, propDecorators: { invert: [{\n type: Input\n }], max: [{\n type: Input\n }], min: [{\n type: Input\n }], step: [{\n type: Input\n }], thumbLabel: [{\n type: Input\n }], tickInterval: [{\n type: Input\n }], value: [{\n type: Input\n }], displayWith: [{\n type: Input\n }], valueText: [{\n type: Input\n }], vertical: [{\n type: Input\n }], change: [{\n type: Output\n }], input: [{\n type: Output\n }], valueChange: [{\n type: Output\n }], _sliderWrapper: [{\n type: ViewChild,\n args: ['sliderWrapper']\n }] } });\n/** Checks if number is safe for calculation */\nfunction isSafeNumber(value) {\n return !isNaN(value) && isFinite(value);\n}\n/** Returns whether an event is a touch event. */\nfunction isTouchEvent(event) {\n // This function is called for every pixel that the user has dragged so we need it to be\n // as fast as possible. Since we only bind mouse events and touch events, we can assume\n // that if the event's name starts with `t`, it's a touch event.\n return event.type[0] === 't';\n}\n/** Gets the coordinates of a touch or mouse event relative to the viewport. */\nfunction getPointerPositionOnPage(event, id) {\n let point;\n if (isTouchEvent(event)) {\n // The `identifier` could be undefined if the browser doesn't support `TouchEvent.identifier`.\n // If that's the case, attribute the first touch to all active sliders. This should still cover\n // the most common case while only breaking multi-touch.\n if (typeof id === 'number') {\n point = findMatchingTouch(event.touches, id) || findMatchingTouch(event.changedTouches, id);\n }\n else {\n // `touches` will be empty for start/end events so we have to fall back to `changedTouches`.\n point = event.touches[0] || event.changedTouches[0];\n }\n }\n else {\n point = event;\n }\n return point ? { x: point.clientX, y: point.clientY } : undefined;\n}\n/** Finds a `Touch` with a specific ID in a `TouchList`. */\nfunction findMatchingTouch(touches, id) {\n for (let i = 0; i < touches.length; i++) {\n if (touches[i].identifier === id) {\n return touches[i];\n }\n }\n return undefined;\n}\n/** Gets the unique ID of a touch that matches a specific slider. */\nfunction getTouchIdForSlider(event, sliderHost) {\n for (let i = 0; i < event.touches.length; i++) {\n const target = event.touches[i].target;\n if (sliderHost === target || sliderHost.contains(target)) {\n return event.touches[i].identifier;\n }\n }\n return undefined;\n}\n\n/**\n * @license\n * Copyright Google LLC All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.io/license\n */\nclass MatSliderModule {\n}\nMatSliderModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: \"12.0.0\", version: \"13.3.0\", ngImport: i0, type: MatSliderModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });\nMatSliderModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: \"12.0.0\", version: \"13.3.0\", ngImport: i0, type: MatSliderModule, declarations: [MatSlider], imports: [CommonModule, MatCommonModule], exports: [MatSlider, MatCommonModule] });\nMatSliderModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: \"12.0.0\", version: \"13.3.0\", ngImport: i0, type: MatSliderModule, imports: [[CommonModule, MatCommonModule], MatCommonModule] });\ni0.ɵɵngDeclareClassMetadata({ minVersion: \"12.0.0\", version: \"13.3.0\", ngImport: i0, type: MatSliderModule, decorators: [{\n type: NgModule,\n args: [{\n imports: [CommonModule, MatCommonModule],\n exports: [MatSlider, MatCommonModule],\n declarations: [MatSlider],\n }]\n }] });\n\n/**\n * @license\n * Copyright Google LLC All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.io/license\n */\n\n/**\n * @license\n * Copyright Google LLC All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.io/license\n */\n\n/**\n * Generated bundle index. Do not edit.\n */\n\nexport { MAT_SLIDER_VALUE_ACCESSOR, MatSlider, MatSliderChange, MatSliderModule };\n"]}