Best JavaScript code snippet using fast-check-monorepo
owl.carousel.js
Source:owl.carousel.js
1/*2 * jQuery OwlCarousel v1.313 *4 * Copyright (c) 2013 Bartosz Wojciechowski5 * http://www.owlgraphic.com/owlcarousel/6 *7 * Licensed under MIT8 *9 */10if ( typeof Object.create !== "function" ) {11 Object.create = function( obj ) {12 function F() {};13 F.prototype = obj;14 return new F();15 };16}17(function( $, window, document, undefined ) {18 var Carousel = {19 init :function(options, el){20 var base = this;21 base.$elem = $(el);22 // options passed via js override options passed via data attributes23 base.options = $.extend({}, $.fn.owlCarousel.options, base.$elem.data(), options);24 base.userOptions = options;25 base.loadContent();26 },27 loadContent : function(){28 var base = this;29 if (typeof base.options.beforeInit === "function") {30 base.options.beforeInit.apply(this,[base.$elem]);31 }32 if (typeof base.options.jsonPath === "string") {33 var url = base.options.jsonPath;34 function getData(data) {35 if (typeof base.options.jsonSuccess === "function") {36 base.options.jsonSuccess.apply(this,[data]);37 } else {38 var content = "";39 for(var i in data["owl"]){40 content += data["owl"][i]["item"];41 }42 base.$elem.html(content);43 }44 base.logIn();45 }46 $.getJSON(url,getData);47 } else {48 base.logIn();49 }50 },51 logIn : function(action){52 var base = this;53 base.$elem.data("owl-originalStyles", base.$elem.attr("style"))54 .data("owl-originalClasses", base.$elem.attr("class"));55 base.$elem.css({opacity: 0});56 base.orignalItems = base.options.items;57 base.checkBrowser();58 base.wrapperWidth = 0;59 base.checkVisible;60 base.setVars();61 },62 setVars : function(){63 var base = this;64 if(base.$elem.children().length === 0){return false}65 base.baseClass();66 base.eventTypes();67 base.$userItems = base.$elem.children();68 base.itemsAmount = base.$userItems.length;69 base.wrapItems();70 base.$owlItems = base.$elem.find(".owl-item");71 base.$owlWrapper = base.$elem.find(".owl-wrapper");72 base.playDirection = "next";73 base.prevItem = 0;74 base.prevArr = [0];75 base.currentItem = 0;76 base.customEvents();77 base.onStartup();78 },79 onStartup : function(){80 var base = this;81 base.updateItems();82 base.calculateAll();83 base.buildControls();84 base.updateControls();85 base.response();86 base.moveEvents();87 base.stopOnHover();88 base.owlStatus();89 if(base.options.transitionStyle !== false){90 base.transitionTypes(base.options.transitionStyle);91 }92 if(base.options.autoPlay === true){93 base.options.autoPlay = 5000;94 }95 base.play();96 base.$elem.find(".owl-wrapper").css("display","block")97 if(!base.$elem.is(":visible")){98 base.watchVisibility();99 } else {100 base.$elem.css("opacity",1);101 }102 base.onstartup = false;103 base.eachMoveUpdate();104 if (typeof base.options.afterInit === "function") {105 base.options.afterInit.apply(this,[base.$elem]);106 }107 },108 eachMoveUpdate : function(){109 var base = this;110 if(base.options.lazyLoad === true){111 base.lazyLoad();112 }113 if(base.options.autoHeight === true){114 base.autoHeight();115 }116 base.onVisibleItems();117 if (typeof base.options.afterAction === "function") {118 base.options.afterAction.apply(this,[base.$elem]);119 }120 },121 updateVars : function(){122 var base = this;123 if(typeof base.options.beforeUpdate === "function") {124 base.options.beforeUpdate.apply(this,[base.$elem]);125 }126 base.watchVisibility();127 base.updateItems();128 base.calculateAll();129 base.updatePosition();130 base.updateControls();131 base.eachMoveUpdate();132 if(typeof base.options.afterUpdate === "function") {133 base.options.afterUpdate.apply(this,[base.$elem]);134 }135 },136 reload : function(elements){137 var base = this;138 setTimeout(function(){139 base.updateVars();140 },0)141 },142 watchVisibility : function(){143 var base = this;144 if(base.$elem.is(":visible") === false){145 base.$elem.css({opacity: 0});146 clearInterval(base.autoPlayInterval);147 clearInterval(base.checkVisible);148 } else {149 return false;150 }151 base.checkVisible = setInterval(function(){152 if (base.$elem.is(":visible")) {153 base.reload();154 base.$elem.animate({opacity: 1},200);155 clearInterval(base.checkVisible);156 }157 }, 500);158 },159 wrapItems : function(){160 var base = this;161 base.$userItems.wrapAll("<div class=\"owl-wrapper\">").wrap("<div class=\"owl-item\"></div>");162 base.$elem.find(".owl-wrapper").wrap("<div class=\"owl-wrapper-outer\">");163 base.wrapperOuter = base.$elem.find(".owl-wrapper-outer");164 base.$elem.css("display","block");165 },166 baseClass : function(){167 var base = this;168 var hasBaseClass = base.$elem.hasClass(base.options.baseClass);169 var hasThemeClass = base.$elem.hasClass(base.options.theme);170 if(!hasBaseClass){171 base.$elem.addClass(base.options.baseClass);172 }173 if(!hasThemeClass){174 base.$elem.addClass(base.options.theme);175 }176 },177 updateItems : function(){178 var base = this;179 if(base.options.responsive === false){180 return false;181 }182 if(base.options.singleItem === true){183 base.options.items = base.orignalItems = 1;184 base.options.itemsCustom = false;185 base.options.itemsDesktop = false;186 base.options.itemsDesktopSmall = false;187 base.options.itemsTablet = false;188 base.options.itemsTabletSmall = false;189 base.options.itemsMobile = false;190 return false;191 }192 var width = $(base.options.responsiveBaseWidth).width();193 if(width > (base.options.itemsDesktop[0] || base.orignalItems) ){194 base.options.items = base.orignalItems;195 }196 if(typeof(base.options.itemsCustom) !== 'undefined' && base.options.itemsCustom !== false){197 //Reorder array by screen size198 base.options.itemsCustom.sort(function(a,b){return a[0]-b[0];});199 for(var i in base.options.itemsCustom){200 if(typeof(base.options.itemsCustom[i]) !== 'undefined' && base.options.itemsCustom[i][0] <= width){201 base.options.items = base.options.itemsCustom[i][1];202 }203 }204 } else {205 if(width <= base.options.itemsDesktop[0] && base.options.itemsDesktop !== false){206 base.options.items = base.options.itemsDesktop[1];207 }208 if(width <= base.options.itemsDesktopSmall[0] && base.options.itemsDesktopSmall !== false){209 base.options.items = base.options.itemsDesktopSmall[1];210 }211 if(width <= base.options.itemsTablet[0] && base.options.itemsTablet !== false){212 base.options.items = base.options.itemsTablet[1];213 }214 if(width <= base.options.itemsTabletSmall[0] && base.options.itemsTabletSmall !== false){215 base.options.items = base.options.itemsTabletSmall[1];216 }217 if(width <= base.options.itemsMobile[0] && base.options.itemsMobile !== false){218 base.options.items = base.options.itemsMobile[1];219 }220 }221 //if number of items is less than declared222 if(base.options.items > base.itemsAmount && base.options.itemsScaleUp === true){223 base.options.items = base.itemsAmount;224 }225 },226 response : function(){227 var base = this,228 smallDelay;229 if(base.options.responsive !== true){230 return false231 }232 var lastWindowWidth = $(window).width();233 base.resizer = function(){234 if($(window).width() !== lastWindowWidth){235 if(base.options.autoPlay !== false){236 clearInterval(base.autoPlayInterval);237 }238 clearTimeout(smallDelay);239 smallDelay = setTimeout(function(){240 lastWindowWidth = $(window).width();241 base.updateVars();242 },base.options.responsiveRefreshRate);243 }244 }245 $(window).resize(base.resizer)246 },247 updatePosition : function(){248 var base = this;249 base.jumpTo(base.currentItem);250 if(base.options.autoPlay !== false){251 base.checkAp();252 }253 },254 appendItemsSizes : function(){255 var base = this;256 var roundPages = 0;257 var lastItem = base.itemsAmount - base.options.items;258 base.$owlItems.each(function(index){259 var $this = $(this);260 $this261 .css({"width": base.itemWidth})262 .data("owl-item",Number(index));263 if(index % base.options.items === 0 || index === lastItem){264 if(!(index > lastItem)){265 roundPages +=1;266 }267 }268 $this.data("owl-roundPages",roundPages)269 });270 },271 appendWrapperSizes : function(){272 var base = this;273 var width = 0;274 var width = base.$owlItems.length * base.itemWidth;275 base.$owlWrapper.css({276 "width": width*2,277 "left": 0278 });279 base.appendItemsSizes();280 },281 calculateAll : function(){282 var base = this;283 base.calculateWidth();284 base.appendWrapperSizes();285 base.loops();286 base.max();287 },288 calculateWidth : function(){289 var base = this;290 base.itemWidth = Math.round(base.$elem.width()/base.options.items)291 },292 max : function(){293 var base = this;294 var maximum = ((base.itemsAmount * base.itemWidth) - base.options.items * base.itemWidth) * -1;295 if(base.options.items > base.itemsAmount){296 base.maximumItem = 0;297 maximum = 0298 base.maximumPixels = 0;299 } else {300 base.maximumItem = base.itemsAmount - base.options.items;301 base.maximumPixels = maximum;302 }303 return maximum;304 },305 min : function(){306 return 0;307 },308 loops : function(){309 var base = this;310 base.positionsInArray = [0];311 base.pagesInArray = [];312 var prev = 0;313 var elWidth = 0;314 for(var i = 0; i<base.itemsAmount; i++){315 elWidth += base.itemWidth;316 base.positionsInArray.push(-elWidth);317 if(base.options.scrollPerPage === true){318 var item = $(base.$owlItems[i]);319 var roundPageNum = item.data("owl-roundPages");320 if(roundPageNum !== prev){321 base.pagesInArray[prev] = base.positionsInArray[i];322 prev = roundPageNum;323 }324 }325 }326 },327 buildControls : function(){328 var base = this;329 if(base.options.navigation === true || base.options.pagination === true){330 base.owlControls = $("<div class=\"owl-controls\"/>").toggleClass("clickable", !base.browser.isTouch).appendTo(base.$elem);331 }332 if(base.options.pagination === true){333 base.buildPagination();334 }335 if(base.options.navigation === true){336 base.buildButtons();337 }338 },339 buildButtons : function(){340 var base = this;341 var buttonsWrapper = $("<div class=\"owl-buttons\"/>")342 base.owlControls.append(buttonsWrapper);343 base.buttonPrev = $("<div/>",{344 "class" : "owl-prev",345 "html" : base.options.navigationText[0] || ""346 });347 base.buttonNext = $("<div/>",{348 "class" : "owl-next",349 "html" : base.options.navigationText[1] || ""350 });351 buttonsWrapper352 .append(base.buttonPrev)353 .append(base.buttonNext);354 buttonsWrapper.on("touchstart.owlControls mousedown.owlControls", "div[class^=\"owl\"]", function(event){355 event.preventDefault();356 })357 buttonsWrapper.on("touchend.owlControls mouseup.owlControls", "div[class^=\"owl\"]", function(event){358 event.preventDefault();359 if($(this).hasClass("owl-next")){360 base.next();361 } else{362 base.prev();363 }364 })365 },366 buildPagination : function(){367 var base = this;368 base.paginationWrapper = $("<div class=\"owl-pagination\"/>");369 base.owlControls.append(base.paginationWrapper);370 base.paginationWrapper.on("touchend.owlControls mouseup.owlControls", ".owl-page", function(event){371 event.preventDefault();372 if(Number($(this).data("owl-page")) !== base.currentItem){373 base.goTo( Number($(this).data("owl-page")), true);374 }375 });376 },377 updatePagination : function(){378 var base = this;379 if(base.options.pagination === false){380 return false;381 }382 base.paginationWrapper.html("");383 var counter = 0;384 var lastPage = base.itemsAmount - base.itemsAmount % base.options.items;385 for(var i = 0; i<base.itemsAmount; i++){386 if(i % base.options.items === 0){387 counter +=1;388 if(lastPage === i){389 var lastItem = base.itemsAmount - base.options.items;390 }391 var paginationButton = $("<div/>",{392 "class" : "owl-page"393 });394 var paginationButtonInner = $("<span></span>",{395 "text": base.options.paginationNumbers === true ? counter : "",396 "class": base.options.paginationNumbers === true ? "owl-numbers" : ""397 });398 paginationButton.append(paginationButtonInner);399 paginationButton.data("owl-page",lastPage === i ? lastItem : i);400 paginationButton.data("owl-roundPages",counter);401 base.paginationWrapper.append(paginationButton);402 }403 }404 base.checkPagination();405 },406 checkPagination : function(){407 var base = this;408 if(base.options.pagination === false){409 return false;410 }411 base.paginationWrapper.find(".owl-page").each(function(i,v){412 if($(this).data("owl-roundPages") === $(base.$owlItems[base.currentItem]).data("owl-roundPages") ){413 base.paginationWrapper414 .find(".owl-page")415 .removeClass("active");416 $(this).addClass("active");417 }418 });419 },420 checkNavigation : function(){421 var base = this;422 if(base.options.navigation === false){423 return false;424 }425 if(base.options.rewindNav === false){426 if(base.currentItem === 0 && base.maximumItem === 0){427 base.buttonPrev.addClass("disabled");428 base.buttonNext.addClass("disabled");429 } else if(base.currentItem === 0 && base.maximumItem !== 0){430 base.buttonPrev.addClass("disabled");431 base.buttonNext.removeClass("disabled");432 } else if (base.currentItem === base.maximumItem){433 base.buttonPrev.removeClass("disabled");434 base.buttonNext.addClass("disabled");435 } else if(base.currentItem !== 0 && base.currentItem !== base.maximumItem){436 base.buttonPrev.removeClass("disabled");437 base.buttonNext.removeClass("disabled");438 }439 }440 },441 updateControls : function(){442 var base = this;443 base.updatePagination();444 base.checkNavigation();445 if(base.owlControls){446 if(base.options.items >= base.itemsAmount){447 base.owlControls.hide();448 } else {449 base.owlControls.show();450 }451 }452 },453 destroyControls : function(){454 var base = this;455 if(base.owlControls){456 base.owlControls.remove();457 }458 },459 next : function(speed){460 var base = this;461 if(base.isTransition){462 return false;463 }464 base.currentItem += base.options.scrollPerPage === true ? base.options.items : 1;465 if(base.currentItem > base.maximumItem + (base.options.scrollPerPage == true ? (base.options.items - 1) : 0)){466 if(base.options.rewindNav === true){467 base.currentItem = 0;468 speed = "rewind";469 } else {470 base.currentItem = base.maximumItem;471 return false;472 }473 }474 base.goTo(base.currentItem,speed);475 },476 prev : function(speed){477 var base = this;478 if(base.isTransition){479 return false;480 }481 if(base.options.scrollPerPage === true && base.currentItem > 0 && base.currentItem < base.options.items){482 base.currentItem = 0483 } else {484 base.currentItem -= base.options.scrollPerPage === true ? base.options.items : 1;485 }486 if(base.currentItem < 0){487 if(base.options.rewindNav === true){488 base.currentItem = base.maximumItem;489 speed = "rewind"490 } else {491 base.currentItem =0;492 return false;493 }494 }495 base.goTo(base.currentItem,speed);496 },497 goTo : function(position,speed,drag){498 var base = this;499 if(base.isTransition){500 return false;501 }502 if(typeof base.options.beforeMove === "function") {503 base.options.beforeMove.apply(this,[base.$elem]);504 }505 if(position >= base.maximumItem){506 position = base.maximumItem;507 }508 else if( position <= 0 ){509 position = 0;510 }511 base.currentItem = base.owl.currentItem = position;512 if( base.options.transitionStyle !== false && drag !== "drag" && base.options.items === 1 && base.browser.support3d === true){513 base.swapSpeed(0)514 if(base.browser.support3d === true){515 base.transition3d(base.positionsInArray[position]);516 } else {517 base.css2slide(base.positionsInArray[position],1);518 }519 base.afterGo();520 base.singleItemTransition();521 522 return false;523 }524 var goToPixel = base.positionsInArray[position];525 if(base.browser.support3d === true){526 base.isCss3Finish = false;527 if(speed === true){528 base.swapSpeed("paginationSpeed");529 setTimeout(function() {530 base.isCss3Finish = true;531 }, base.options.paginationSpeed);532 } else if(speed === "rewind" ){533 base.swapSpeed(base.options.rewindSpeed);534 setTimeout(function() {535 base.isCss3Finish = true;536 }, base.options.rewindSpeed);537 } else {538 base.swapSpeed("slideSpeed");539 setTimeout(function() {540 base.isCss3Finish = true;541 }, base.options.slideSpeed);542 }543 base.transition3d(goToPixel);544 } else {545 if(speed === true){546 base.css2slide(goToPixel, base.options.paginationSpeed);547 } else if(speed === "rewind" ){548 base.css2slide(goToPixel, base.options.rewindSpeed);549 } else {550 base.css2slide(goToPixel, base.options.slideSpeed);551 }552 }553 base.afterGo();554 },555 jumpTo : function(position){556 var base = this;557 if(typeof base.options.beforeMove === "function") {558 base.options.beforeMove.apply(this,[base.$elem]);559 }560 if(position >= base.maximumItem || position === -1){561 position = base.maximumItem;562 }563 else if( position <= 0 ){564 position = 0;565 }566 base.swapSpeed(0)567 if(base.browser.support3d === true){568 base.transition3d(base.positionsInArray[position]);569 } else {570 base.css2slide(base.positionsInArray[position],1);571 }572 base.currentItem = base.owl.currentItem = position;573 base.afterGo();574 },575 afterGo : function(){576 var base = this;577 base.prevArr.push(base.currentItem);578 base.prevItem = base.owl.prevItem = base.prevArr[base.prevArr.length -2];579 base.prevArr.shift(0)580 if(base.prevItem !== base.currentItem){581 base.checkPagination();582 base.checkNavigation();583 base.eachMoveUpdate();584 if(base.options.autoPlay !== false){585 base.checkAp();586 }587 }588 if(typeof base.options.afterMove === "function" && base.prevItem !== base.currentItem) {589 base.options.afterMove.apply(this,[base.$elem]);590 }591 },592 stop : function(){593 var base = this;594 base.apStatus = "stop";595 clearInterval(base.autoPlayInterval);596 },597 checkAp : function(){598 var base = this;599 if(base.apStatus !== "stop"){600 base.play();601 }602 },603 play : function(){604 var base = this;605 base.apStatus = "play";606 if(base.options.autoPlay === false){607 return false;608 }609 clearInterval(base.autoPlayInterval);610 base.autoPlayInterval = setInterval(function(){611 base.next(true);612 },base.options.autoPlay);613 },614 swapSpeed : function(action){615 var base = this;616 if(action === "slideSpeed"){617 base.$owlWrapper.css(base.addCssSpeed(base.options.slideSpeed));618 } else if(action === "paginationSpeed" ){619 base.$owlWrapper.css(base.addCssSpeed(base.options.paginationSpeed));620 } else if(typeof action !== "string"){621 base.$owlWrapper.css(base.addCssSpeed(action));622 }623 },624 addCssSpeed : function(speed){625 var base = this;626 return {627 "-webkit-transition": "all "+ speed +"ms ease",628 "-moz-transition": "all "+ speed +"ms ease",629 "-o-transition": "all "+ speed +"ms ease",630 "transition": "all "+ speed +"ms ease"631 };632 },633 removeTransition : function(){634 return {635 "-webkit-transition": "",636 "-moz-transition": "",637 "-o-transition": "",638 "transition": ""639 };640 },641 doTranslate : function(pixels){642 return {643 "-webkit-transform": "translate3d("+pixels+"px, 0px, 0px)",644 "-moz-transform": "translate3d("+pixels+"px, 0px, 0px)",645 "-o-transform": "translate3d("+pixels+"px, 0px, 0px)",646 "-ms-transform": "translate3d("+pixels+"px, 0px, 0px)",647 "transform": "translate3d("+pixels+"px, 0px,0px)"648 };649 },650 transition3d : function(value){651 var base = this;652 base.$owlWrapper.css(base.doTranslate(value));653 },654 css2move : function(value){655 var base = this;656 base.$owlWrapper.css({"left" : value})657 },658 css2slide : function(value,speed){659 var base = this;660 base.isCssFinish = false;661 base.$owlWrapper.stop(true,true).animate({662 "left" : value663 }, {664 duration : speed || base.options.slideSpeed ,665 complete : function(){666 base.isCssFinish = true;667 }668 });669 },670 checkBrowser : function(){671 var base = this;672 //Check 3d support673 var translate3D = "translate3d(0px, 0px, 0px)",674 tempElem = document.createElement("div");675 tempElem.style.cssText= " -moz-transform:" + translate3D +676 "; -ms-transform:" + translate3D +677 "; -o-transform:" + translate3D +678 "; -webkit-transform:" + translate3D +679 "; transform:" + translate3D;680 var regex = /translate3d\(0px, 0px, 0px\)/g,681 asSupport = tempElem.style.cssText.match(regex),682 support3d = (asSupport !== null && asSupport.length === 1);683 var isTouch = "ontouchstart" in window || navigator.msMaxTouchPoints;684 base.browser = {685 "support3d" : support3d,686 "isTouch" : isTouch687 }688 },689 moveEvents : function(){690 var base = this;691 if(base.options.mouseDrag !== false || base.options.touchDrag !== false){692 base.gestures();693 base.disabledEvents();694 }695 },696 eventTypes : function(){697 var base = this;698 var types = ["s","e","x"];699 base.ev_types = {};700 if(base.options.mouseDrag === true && base.options.touchDrag === true){701 types = [702 "touchstart.owl mousedown.owl",703 "touchmove.owl mousemove.owl",704 "touchend.owl touchcancel.owl mouseup.owl"705 ];706 } else if(base.options.mouseDrag === false && base.options.touchDrag === true){707 types = [708 "touchstart.owl",709 "touchmove.owl",710 "touchend.owl touchcancel.owl"711 ];712 } else if(base.options.mouseDrag === true && base.options.touchDrag === false){713 types = [714 "mousedown.owl",715 "mousemove.owl",716 "mouseup.owl"717 ];718 }719 base.ev_types["start"] = types[0];720 base.ev_types["move"] = types[1];721 base.ev_types["end"] = types[2];722 },723 disabledEvents : function(){724 var base = this;725 base.$elem.on("dragstart.owl", function(event) { event.preventDefault();});726 base.$elem.on("mousedown.disableTextSelect", function(e) {727 return $(e.target).is('input, textarea, select, option');728 });729 },730 gestures : function(){731 var base = this;732 var locals = {733 offsetX : 0,734 offsetY : 0,735 baseElWidth : 0,736 relativePos : 0,737 position: null,738 minSwipe : null,739 maxSwipe: null,740 sliding : null,741 dargging: null,742 targetElement : null743 }744 base.isCssFinish = true;745 function getTouches(event){746 if(event.touches){747 return {748 x : event.touches[0].pageX,749 y : event.touches[0].pageY750 }751 } else {752 if(event.pageX !== undefined){753 return {754 x : event.pageX,755 y : event.pageY756 }757 } else {758 return {759 x : event.clientX,760 y : event.clientY761 }762 }763 }764 }765 function swapEvents(type){766 if(type === "on"){767 $(document).on(base.ev_types["move"], dragMove);768 $(document).on(base.ev_types["end"], dragEnd);769 } else if(type === "off"){770 $(document).off(base.ev_types["move"]);771 $(document).off(base.ev_types["end"]);772 }773 }774 function dragStart(event) {775 var event = event.originalEvent || event || window.event;776 if (event.which === 3) {777 return false;778 }779 if(base.itemsAmount <= base.options.items){780 return;781 }782 if(base.isCssFinish === false && !base.options.dragBeforeAnimFinish ){783 return false;784 }785 if(base.isCss3Finish === false && !base.options.dragBeforeAnimFinish ){786 return false;787 }788 if(base.options.autoPlay !== false){789 clearInterval(base.autoPlayInterval);790 }791 if(base.browser.isTouch !== true && !base.$owlWrapper.hasClass("grabbing")){792 base.$owlWrapper.addClass("grabbing")793 }794 base.newPosX = 0;795 base.newRelativeX = 0;796 $(this).css(base.removeTransition());797 var position = $(this).position();798 locals.relativePos = position.left;799 800 locals.offsetX = getTouches(event).x - position.left;801 locals.offsetY = getTouches(event).y - position.top;802 swapEvents("on");803 locals.sliding = false;804 locals.targetElement = event.target || event.srcElement;805 }806 function dragMove(event){807 var event = event.originalEvent || event || window.event;808 base.newPosX = getTouches(event).x- locals.offsetX;809 base.newPosY = getTouches(event).y - locals.offsetY;810 base.newRelativeX = base.newPosX - locals.relativePos; 811 if (typeof base.options.startDragging === "function" && locals.dragging !== true && base.newRelativeX !== 0) {812 locals.dragging = true;813 base.options.startDragging.apply(base,[base.$elem]);814 }815 if(base.newRelativeX > 8 || base.newRelativeX < -8 && base.browser.isTouch === true){816 event.preventDefault ? event.preventDefault() : event.returnValue = false;817 locals.sliding = true;818 }819 if((base.newPosY > 10 || base.newPosY < -10) && locals.sliding === false){820 $(document).off("touchmove.owl");821 }822 var minSwipe = function(){823 return base.newRelativeX / 5;824 }825 var maxSwipe = function(){826 return base.maximumPixels + base.newRelativeX / 5;827 }828 base.newPosX = Math.max(Math.min( base.newPosX, minSwipe() ), maxSwipe() );829 if(base.browser.support3d === true){830 base.transition3d(base.newPosX);831 } else {832 base.css2move(base.newPosX);833 }834 }835 function dragEnd(event){836 var event = event.originalEvent || event || window.event;837 event.target = event.target || event.srcElement;838 locals.dragging = false;839 if(base.browser.isTouch !== true){840 base.$owlWrapper.removeClass("grabbing");841 }842 if(base.newRelativeX<0){843 base.dragDirection = base.owl.dragDirection = "left"844 } else {845 base.dragDirection = base.owl.dragDirection = "right"846 }847 if(base.newRelativeX !== 0){848 var newPosition = base.getNewPosition();849 base.goTo(newPosition,false,"drag");850 if(locals.targetElement === event.target && base.browser.isTouch !== true){851 $(event.target).on("click.disable", function(ev){852 ev.stopImmediatePropagation();853 ev.stopPropagation();854 ev.preventDefault();855 $(event.target).off("click.disable");856 });857 var handlers = $._data(event.target, "events")["click"];858 var owlStopEvent = handlers.pop();859 handlers.splice(0, 0, owlStopEvent);860 }861 }862 swapEvents("off");863 }864 base.$elem.on(base.ev_types["start"], ".owl-wrapper", dragStart); 865 },866 getNewPosition : function(){867 var base = this,868 newPosition;869 870 newPosition = base.closestItem();871 if(newPosition>base.maximumItem){872 base.currentItem = base.maximumItem;873 newPosition = base.maximumItem;874 } else if( base.newPosX >=0 ){875 newPosition = 0;876 base.currentItem = 0;877 }878 return newPosition;879 },880 closestItem : function(){881 var base = this,882 array = base.options.scrollPerPage === true ? base.pagesInArray : base.positionsInArray,883 goal = base.newPosX,884 closest = null;885 $.each(array, function(i,v){886 if( goal - (base.itemWidth/20) > array[i+1] && goal - (base.itemWidth/20)< v && base.moveDirection() === "left") {887 closest = v;888 if(base.options.scrollPerPage === true){889 base.currentItem = $.inArray(closest, base.positionsInArray);890 } else {891 base.currentItem = i;892 }893 } 894 else if (goal + (base.itemWidth/20) < v && goal + (base.itemWidth/20) > (array[i+1] || array[i]-base.itemWidth) && base.moveDirection() === "right"){895 if(base.options.scrollPerPage === true){896 closest = array[i+1] || array[array.length-1];897 base.currentItem = $.inArray(closest, base.positionsInArray);898 } else {899 closest = array[i+1];900 base.currentItem = i+1;901 }902 }903 });904 return base.currentItem;905 },906 moveDirection : function(){907 var base = this,908 direction;909 if(base.newRelativeX < 0 ){910 direction = "right"911 base.playDirection = "next"912 } else {913 direction = "left"914 base.playDirection = "prev"915 }916 return direction917 },918 customEvents : function(){919 var base = this;920 base.$elem.on("owl.next",function(){921 base.next();922 });923 base.$elem.on("owl.prev",function(){924 base.prev();925 });926 base.$elem.on("owl.play",function(event,speed){927 base.options.autoPlay = speed;928 base.play();929 base.hoverStatus = "play";930 });931 base.$elem.on("owl.stop",function(){932 base.stop();933 base.hoverStatus = "stop";934 });935 base.$elem.on("owl.goTo",function(event,item){936 base.goTo(item)937 });938 base.$elem.on("owl.jumpTo",function(event,item){939 base.jumpTo(item)940 });941 },942 943 stopOnHover : function(){944 var base = this;945 if(base.options.stopOnHover === true && base.browser.isTouch !== true && base.options.autoPlay !== false){946 base.$elem.on("mouseover", function(){947 base.stop();948 });949 base.$elem.on("mouseout", function(){950 if(base.hoverStatus !== "stop"){951 base.play();952 }953 });954 }955 },956 lazyLoad : function(){957 var base = this;958 if(base.options.lazyLoad === false){959 return false;960 }961 for(var i=0; i<base.itemsAmount; i++){962 var $item = $(base.$owlItems[i]);963 if($item.data("owl-loaded") === "loaded"){964 continue;965 }966 var itemNumber = $item.data("owl-item"),967 $lazyImg = $item.find(".lazyOwl"),968 follow;969 if( typeof $lazyImg.data("src") !== "string"){970 $item.data("owl-loaded","loaded");971 continue;972 } 973 if($item.data("owl-loaded") === undefined){974 $lazyImg.hide();975 $item.addClass("loading").data("owl-loaded","checked");976 }977 if(base.options.lazyFollow === true){978 follow = itemNumber >= base.currentItem;979 } else {980 follow = true;981 }982 if(follow && itemNumber < base.currentItem + base.options.items && $lazyImg.length){983 base.lazyPreload($item,$lazyImg);984 }985 }986 },987 lazyPreload : function($item,$lazyImg){988 var base = this,989 iterations = 0;990 if ($lazyImg.prop("tagName") === "DIV") {991 $lazyImg.css("background-image", "url(" + $lazyImg.data("src")+ ")" );992 var isBackgroundImg=true;993 } else {994 $lazyImg[0].src = $lazyImg.data("src");995 }996 checkLazyImage();997 function checkLazyImage(){998 iterations += 1;999 if (base.completeImg($lazyImg.get(0)) || isBackgroundImg === true) {1000 showImage();1001 } else if(iterations <= 100){//if image loads in less than 10 seconds 1002 setTimeout(checkLazyImage,100);1003 } else {1004 showImage();1005 }1006 }1007 function showImage(){1008 $item.data("owl-loaded", "loaded").removeClass("loading");1009 $lazyImg.removeAttr("data-src");1010 base.options.lazyEffect === "fade" ? $lazyImg.fadeIn(400) : $lazyImg.show();1011 if(typeof base.options.afterLazyLoad === "function") {1012 base.options.afterLazyLoad.apply(this,[base.$elem]);1013 }1014 }1015 },1016 autoHeight : function(){1017 var base = this;1018 var $currentimg = $(base.$owlItems[base.currentItem]).find("img");1019 if($currentimg.get(0) !== undefined ){1020 var iterations = 0;1021 checkImage();1022 } else {1023 addHeight();1024 }1025 function checkImage(){1026 iterations += 1;1027 if ( base.completeImg($currentimg.get(0)) ) {1028 addHeight();1029 } else if(iterations <= 100){ //if image loads in less than 10 seconds 1030 setTimeout(checkImage,100);1031 } else {1032 base.wrapperOuter.css("height", ""); //Else remove height attribute1033 }1034 }1035 function addHeight(){1036 var $currentItem = $(base.$owlItems[base.currentItem]).height();1037 base.wrapperOuter.css("height",$currentItem+"px");1038 if(!base.wrapperOuter.hasClass("autoHeight")){1039 setTimeout(function(){1040 base.wrapperOuter.addClass("autoHeight");1041 },0);1042 }1043 }1044 },1045 completeImg : function(img) {1046 if (!img.complete) {1047 return false;1048 }1049 if (typeof img.naturalWidth !== "undefined" && img.naturalWidth == 0) {1050 return false;1051 }1052 return true;1053 },1054 onVisibleItems : function(){1055 var base = this;1056 if(base.options.addClassActive === true){1057 base.$owlItems.removeClass("active");1058 }1059 base.visibleItems = [];1060 for(var i=base.currentItem; i<base.currentItem + base.options.items; i++){1061 base.visibleItems.push(i);1062 if(base.options.addClassActive === true){1063 $(base.$owlItems[i]).addClass("active");1064 }1065 }1066 base.owl.visibleItems = base.visibleItems;1067 },1068 transitionTypes : function(className){1069 var base = this;1070 //Currently available: "fade","backSlide","goDown","fadeUp"1071 base.outClass = "owl-"+className+"-out";1072 base.inClass = "owl-"+className+"-in";1073 },1074 singleItemTransition : function(){1075 var base = this;1076 base.isTransition = true;1077 var outClass = base.outClass,1078 inClass = base.inClass,1079 $currentItem = base.$owlItems.eq(base.currentItem),1080 $prevItem = base.$owlItems.eq(base.prevItem),1081 prevPos = Math.abs(base.positionsInArray[base.currentItem]) + base.positionsInArray[base.prevItem],1082 origin = Math.abs(base.positionsInArray[base.currentItem])+base.itemWidth/2;1083 base.$owlWrapper1084 .addClass('owl-origin')1085 .css({1086 "-webkit-transform-origin" : origin+"px",1087 "-moz-perspective-origin" : origin+"px",1088 "perspective-origin" : origin+"px"1089 });1090 function transStyles(prevPos,zindex){1091 return {1092 "position" : "relative",1093 "left" : prevPos+"px"1094 };1095 }1096 var animEnd = 'webkitAnimationEnd oAnimationEnd MSAnimationEnd animationend';1097 $prevItem1098 .css(transStyles(prevPos,10))1099 .addClass(outClass)1100 .on(animEnd, function() {1101 base.endPrev = true;1102 $prevItem.off(animEnd);1103 base.clearTransStyle($prevItem,outClass);1104 });1105 $currentItem1106 .addClass(inClass)1107 .on(animEnd, function() {1108 base.endCurrent = true;1109 $currentItem.off(animEnd);1110 base.clearTransStyle($currentItem,inClass);1111 });1112 },1113 clearTransStyle : function(item,classToRemove){1114 var base = this;1115 item.css({1116 "position" : "",1117 "left" : ""1118 })1119 .removeClass(classToRemove);1120 if(base.endPrev && base.endCurrent){1121 base.$owlWrapper.removeClass('owl-origin');1122 base.endPrev = false;1123 base.endCurrent = false;1124 base.isTransition = false;1125 }1126 },1127 owlStatus : function(){1128 var base = this;1129 base.owl = {1130 "userOptions" : base.userOptions,1131 "baseElement" : base.$elem,1132 "userItems" : base.$userItems,1133 "owlItems" : base.$owlItems,1134 "currentItem" : base.currentItem,1135 "prevItem" : base.prevItem,1136 "visibleItems" : base.visibleItems,1137 "isTouch" : base.browser.isTouch,1138 "browser" : base.browser,1139 "dragDirection" : base.dragDirection1140 }1141 },1142 clearEvents : function(){1143 var base = this;1144 base.$elem.off(".owl owl mousedown.disableTextSelect");1145 $(document).off(".owl owl");1146 $(window).off("resize", base.resizer);1147 },1148 unWrap : function(){1149 var base = this;1150 if(base.$elem.children().length !== 0){1151 base.$owlWrapper.unwrap();1152 base.$userItems.unwrap().unwrap();1153 if(base.owlControls){1154 base.owlControls.remove();1155 }1156 }1157 base.clearEvents();1158 base.$elem1159 .attr("style", base.$elem.data("owl-originalStyles") || "")1160 .attr("class", base.$elem.data("owl-originalClasses"));1161 },1162 destroy : function(){1163 var base = this;1164 base.stop();1165 clearInterval(base.checkVisible);1166 base.unWrap();1167 base.$elem.removeData();1168 },1169 reinit : function(newOptions){1170 var base = this;1171 var options = $.extend({}, base.userOptions, newOptions);1172 base.unWrap();1173 base.init(options,base.$elem);1174 },1175 addItem : function(htmlString,targetPosition){1176 var base = this,1177 position;1178 if(!htmlString){return false}1179 if(base.$elem.children().length === 0){1180 base.$elem.append(htmlString);1181 base.setVars();1182 return false;1183 }1184 base.unWrap();1185 if(targetPosition === undefined || targetPosition === -1){1186 position = -1;1187 } else {1188 position = targetPosition;1189 }1190 if(position >= base.$userItems.length || position === -1){1191 base.$userItems.eq(-1).after(htmlString)1192 } else {1193 base.$userItems.eq(position).before(htmlString)1194 }1195 base.setVars();1196 },1197 removeItem : function(targetPosition){1198 var base = this,1199 position;1200 if(base.$elem.children().length === 0){return false}1201 1202 if(targetPosition === undefined || targetPosition === -1){1203 position = -1;1204 } else {1205 position = targetPosition;1206 }1207 base.unWrap();1208 base.$userItems.eq(position).remove();1209 base.setVars();1210 }1211 };1212 $.fn.owlCarousel = function( options ){1213 return this.each(function() {1214 if($(this).data("owl-init") === true){1215 return false;1216 }1217 $(this).data("owl-init", true);1218 var carousel = Object.create( Carousel );1219 carousel.init( options, this );1220 $.data( this, "owlCarousel", carousel );1221 });1222 };1223 $.fn.owlCarousel.options = {1224 items : 5,1225 itemsCustom : false,1226 itemsDesktop : [1199,4],1227 itemsDesktopSmall : [979,3],1228 itemsTablet : [768,2],1229 itemsTabletSmall : false,1230 itemsMobile : [479,1],1231 singleItem : false,1232 itemsScaleUp : false,1233 slideSpeed : 200,1234 paginationSpeed : 800,1235 rewindSpeed : 1000,1236 autoPlay : false,1237 stopOnHover : false,1238 navigation : false,1239 navigationText : ["prev","next"],1240 rewindNav : true,1241 scrollPerPage : false,1242 pagination : true,1243 paginationNumbers : false,1244 responsive : true,1245 responsiveRefreshRate : 200,1246 responsiveBaseWidth : window,1247 1248 baseClass : "owl-carousel",1249 theme : "owl-theme",1250 lazyLoad : false,1251 lazyFollow : true,1252 lazyEffect : "fade",1253 autoHeight : false,1254 jsonPath : false,1255 jsonSuccess : false,1256 dragBeforeAnimFinish : true,1257 mouseDrag : true,1258 touchDrag : true,1259 addClassActive : false,1260 transitionStyle : false,1261 beforeUpdate : false,1262 afterUpdate : false,1263 beforeInit : false,1264 afterInit : false,1265 beforeMove : false,1266 afterMove : false,1267 afterAction : false,1268 startDragging : false,1269 afterLazyLoad: false1270 1271 };...
BaseCorpo.js
Source:BaseCorpo.js
1/**2 * Copyright (c) 2020 by Jasmine Moreira. All rights reserved.3 * 4 * This file is part of the QCAD project.5 *6 * QCAD is free software: you can redistribute it and/or modify7 * it under the terms of the GNU General Public License as published by8 * the Free Software Foundation, either version 3 of the License, or9 * (at your option) any later version.10 *11 * QCAD is distributed in the hope that it will be useful,12 * but WITHOUT ANY WARRANTY; without even the implied warranty of13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the14 * GNU General Public License for more details.15 *16 * You should have received a copy of the GNU General Public License17 * along with QCAD.18 */19// BaseCorpo.js20//! [include]21// library.js contains some convenience functions like 'isNull':22include("scripts/library.js");23//! [include]24function BaseCorpo() {25}26//! [init]27BaseCorpo.init = function(formWidget) {28 if (!isNull(formWidget)) {29 BaseCorpo.widgets = getWidgets(formWidget);30 }31};32//! [init]33//! [generate]34BaseCorpo.generate = function(documentInterface, file) {35 BaseCorpo.factor = 1;36 BaseCorpo.ombro = parseFloat(BaseCorpo.widgets["Ombro"].text);37 if (isNaN(BaseCorpo.ombro)) {38 BaseCorpo.busto = 13;39 }40 BaseCorpo.busto = parseFloat(BaseCorpo.widgets["Busto"].text);41 if (isNaN(BaseCorpo.busto)) {42 BaseCorpo.busto = 123;43 }44 BaseCorpo.cintura = parseFloat(BaseCorpo.widgets["Cintura"].text);45 if (isNaN(BaseCorpo.cintura)) {46 BaseCorpo.cintura = 106;47 }48 BaseCorpo.quadril = parseFloat(BaseCorpo.widgets["Quadril"].text);49 if (isNaN(BaseCorpo.quadril)) {50 BaseCorpo.quadril = 116;51 }52 BaseCorpo.altCorpo = parseFloat(BaseCorpo.widgets["AltCorpo"].text);53 if (isNaN(BaseCorpo.altCorpo)) {54 BaseCorpo.altCorpo = 41;55 }56 BaseCorpo.altQuadril = parseFloat(BaseCorpo.widgets["AltQuadril"].text);57 if (isNaN(BaseCorpo.altQuadril)) {58 BaseCorpo.altQuadril = 29;59 }60 BaseCorpo.compSaia = parseFloat(BaseCorpo.widgets["CompSaia"].text);61 if (isNaN(BaseCorpo.compSaia)) {62 BaseCorpo.compSaia = 71;63 }64 BaseCorpo.largBraco = parseFloat(BaseCorpo.widgets["LargBraco"].text);65 if (isNaN(BaseCorpo.largBraco)) {66 BaseCorpo.largBraco = 34.5;67 }68 BaseCorpo.altBusto = parseFloat(BaseCorpo.widgets["AltBusto"].text);69 if (isNaN(BaseCorpo.altBusto)) {70 BaseCorpo.altBusto = 28;71 }72 BaseCorpo.sepBusto = parseFloat(BaseCorpo.widgets["SepBusto"].text);73 if (isNaN(BaseCorpo.sepBusto)) {74 BaseCorpo.sepBusto = 30;75 }76 // Tecido Plano77 if(BaseCorpo.widgets["Plano"].checked){78 BaseCorpo.tecido = "tecido plano";79 BaseCorpo.widgets["Modelagem"].enabled = false;80 BaseCorpo.widgets["Elasticidade"].enabled = false;81 BaseCorpo.margVest = 2.0;82 }83 // Compensação de malha84 if(BaseCorpo.widgets["Malha"].checked){85 BaseCorpo.tecido = "malha";86 BaseCorpo.widgets["Modelagem"].enabled = true;87 BaseCorpo.widgets["Elasticidade"].enabled = true;88 BaseCorpo.margVest = 0.5;89 if(BaseCorpo.widgets["Justa"].checked){90 BaseCorpo.modelagem = "justa";91 if(BaseCorpo.widgets["Baixa"].checked){92 BaseCorpo.elasticidade = "baixa";93 BaseCorpo.ombro = BaseCorpo.ombro*0.9;94 BaseCorpo.busto = BaseCorpo.busto*0.9;95 BaseCorpo.cintura = BaseCorpo.cintura*0.9;96 BaseCorpo.quadril = BaseCorpo.quadril*0.9;97 BaseCorpo.altCorpo = BaseCorpo.altCorpo-1;98 BaseCorpo.altQuadril = BaseCorpo.altQuadril-0.5;99 BaseCorpo.compSaia = BaseCorpo.compSaia-1;100 BaseCorpo.largBraco = BaseCorpo.largBraco-1;101 BaseCorpo.altBusto = BaseCorpo.altBusto-0.5;102 BaseCorpo.sepBusto = BaseCorpo.sepBusto*0.9;103 }104 if(BaseCorpo.widgets["Media"].checked){105 BaseCorpo.elasticidade = "média";106 BaseCorpo.ombro = BaseCorpo.ombro*0.8;107 BaseCorpo.busto = BaseCorpo.busto*0.8;108 BaseCorpo.cintura = BaseCorpo.cintura*0.8;109 BaseCorpo.quadril = BaseCorpo.quadril*0.8;110 BaseCorpo.altCorpo = BaseCorpo.altCorpo-2;111 BaseCorpo.altQuadril = BaseCorpo.altQuadril-1;112 BaseCorpo.compSaia = BaseCorpo.compSaia-2;113 BaseCorpo.largBraco = BaseCorpo.largBraco-2;114 BaseCorpo.altBusto = BaseCorpo.altBusto-1;115 BaseCorpo.sepBusto = BaseCorpo.sepBusto*0.8;116 }117 if(BaseCorpo.widgets["Alta"].checked){118 BaseCorpo.elasticidade = "alta";119 BaseCorpo.ombro = BaseCorpo.ombro*0.7;120 BaseCorpo.busto = BaseCorpo.busto*0.7;121 BaseCorpo.cintura = BaseCorpo.cintura*0.7;122 BaseCorpo.quadril = BaseCorpo.quadril*0.7;123 BaseCorpo.altCorpo = BaseCorpo.altCorpo-3.5;124 BaseCorpo.altQuadril = BaseCorpo.altQuadril-1.5;125 BaseCorpo.compSaia = BaseCorpo.compSaia-3;126 BaseCorpo.largBraco = BaseCorpo.largBraco-3;127 BaseCorpo.altBusto = BaseCorpo.altBusto-1.5;128 BaseCorpo.sepBusto = BaseCorpo.sepBusto*0.7;129 }130 }131 if(BaseCorpo.widgets["Folgada"].checked){132 BaseCorpo.modelagem = "folgada";133 if(BaseCorpo.widgets["Baixa"].checked){134 BaseCorpo.elasticidade = "baixa";135 BaseCorpo.ombro = BaseCorpo.ombro*0.95;136 BaseCorpo.busto = BaseCorpo.busto*0.95;137 BaseCorpo.cintura = BaseCorpo.cintura*0.95;138 BaseCorpo.quadril = BaseCorpo.quadril*0.95;139 BaseCorpo.altCorpo = BaseCorpo.altCorpo-1;140 BaseCorpo.altQuadril = BaseCorpo.altQuadril-0.5;141 BaseCorpo.compSaia = BaseCorpo.compSaia-1;142 BaseCorpo.largBraco = BaseCorpo.largBraco-1;143 BaseCorpo.altBusto = BaseCorpo.altBusto-0.5;144 BaseCorpo.sepBusto = BaseCorpo.sepBusto*0.95;145 }146 if(BaseCorpo.widgets["Media"].checked){147 BaseCorpo.elasticidade = "média";148 BaseCorpo.ombro = BaseCorpo.ombro*0.9;149 BaseCorpo.busto = BaseCorpo.busto*0.9;150 BaseCorpo.cintura = BaseCorpo.cintura*0.9;151 BaseCorpo.quadril = BaseCorpo.quadril*0.9;152 BaseCorpo.altCorpo = BaseCorpo.altCorpo-2;153 BaseCorpo.altQuadril = BaseCorpo.altQuadril-1;154 BaseCorpo.compSaia = BaseCorpo.compSaia-2;155 BaseCorpo.largBraco = BaseCorpo.largBraco-2;156 BaseCorpo.altBusto = BaseCorpo.altBusto-1;157 BaseCorpo.sepBusto = BaseCorpo.sepBusto*0.9;158 }159 if(BaseCorpo.widgets["Alta"].checked){160 BaseCorpo.elasticidade = "alta";161 BaseCorpo.ombro = BaseCorpo.ombro*0.85;162 BaseCorpo.busto = BaseCorpo.busto*0.85;163 BaseCorpo.cintura = BaseCorpo.cintura*0.85;164 BaseCorpo.quadril = BaseCorpo.quadril*0.85;165 BaseCorpo.altCorpo = BaseCorpo.altCorpo-3.5;166 BaseCorpo.altQuadril = BaseCorpo.altQuadril-1.5;167 BaseCorpo.compSaia = BaseCorpo.compSaia-3;168 BaseCorpo.largBraco = BaseCorpo.largBraco-3;169 BaseCorpo.altBusto = BaseCorpo.altBusto-1.5;170 BaseCorpo.sepBusto = BaseCorpo.sepBusto*0.85;171 }172 }173 }174 return BaseCorpo.criarCorpo(documentInterface);175};176//! [generate]177//! [generatePreview]178BaseCorpo.generatePreview = function(documentInterface, iconSize) {179 BaseCorpo.ombro = 13;180 BaseCorpo.busto = 123;181 BaseCorpo.cintura = 106;182 BaseCorpo.quadril = 116;183 BaseCorpo.altCorpo = 41;184 BaseCorpo.altQuadril = 29;185 BaseCorpo.compSaia = 71;186 BaseCorpo.largBraco = 34.5;187 BaseCorpo.altBusto = 28;188 BaseCorpo.sepBusto = 30;189 BaseCorpo.margVest = 0.5;190 BaseCorpo.factor = iconSize/(BaseCorpo.altCorpo+BaseCorpo.compSaia);191 return BaseCorpo.criarCorpo(documentInterface);192};193//! [generatePreview]194//! [createCuttingOut]195BaseCorpo.criarCorpo = function(documentInterface) {196 var addOperation = new RAddObjectsOperation(false);197 var doc = documentInterface.getDocument()198 // Quadro básico199 addOperation.addObject(new RLineEntity(doc, new RLineData(new RVector(0, 0), new RVector(0, (BaseCorpo.altCorpo+BaseCorpo.compSaia)*BaseCorpo.factor))));200 addOperation.addObject(new RLineEntity(doc, new RLineData(new RVector(0, 0), new RVector((BaseCorpo.busto/4+BaseCorpo.margVest)*BaseCorpo.factor, 0))));201 addOperation.addObject(new RLineEntity(doc, new RLineData(new RVector(0, (BaseCorpo.compSaia+BaseCorpo.altCorpo)*BaseCorpo.factor), new RVector((BaseCorpo.busto/4+BaseCorpo.margVest)*BaseCorpo.factor, (BaseCorpo.compSaia+BaseCorpo.altCorpo)*BaseCorpo.factor))));202 addOperation.addObject(new RLineEntity(doc, new RLineData(new RVector((BaseCorpo.busto/4+BaseCorpo.margVest)*BaseCorpo.factor, (BaseCorpo.compSaia+BaseCorpo.altCorpo)*BaseCorpo.factor), new RVector((BaseCorpo.busto/4+BaseCorpo.margVest)*BaseCorpo.factor, 0))));203 // Cintura204 addOperation.addObject(new RLineEntity(doc, new RLineData(new RVector(0, BaseCorpo.compSaia*BaseCorpo.factor), new RVector((BaseCorpo.cintura/4+BaseCorpo.margVest)*BaseCorpo.factor, BaseCorpo.compSaia*BaseCorpo.factor)))); 205 // Quadril206 addOperation.addObject(new RLineEntity(doc, new RLineData(new RVector(0, (BaseCorpo.compSaia-BaseCorpo.altQuadril)*BaseCorpo.factor), new RVector((BaseCorpo.quadril/4+BaseCorpo.margVest)*BaseCorpo.factor, (BaseCorpo.compSaia-BaseCorpo.altQuadril)*BaseCorpo.factor)))); 207 addOperation.addObject(new RLineEntity(doc, new RLineData(new RVector((BaseCorpo.quadril/4+BaseCorpo.margVest)*BaseCorpo.factor, 0), new RVector((BaseCorpo.quadril/4+BaseCorpo.margVest)*BaseCorpo.factor, 1)))); 208 // Gola largura209 addOperation.addObject(new RLineEntity(doc, new RLineData(new RVector(BaseCorpo.ombro/2, (BaseCorpo.altCorpo+BaseCorpo.compSaia-0.5)*BaseCorpo.factor), new RVector(BaseCorpo.ombro/2, (BaseCorpo.altCorpo+BaseCorpo.compSaia+0.5)*BaseCorpo.factor))));210 addOperation.addObject(new RLineEntity(doc, new RLineData(new RVector(BaseCorpo.ombro/2+1, (BaseCorpo.altCorpo+BaseCorpo.compSaia-0.5)*BaseCorpo.factor), new RVector(BaseCorpo.ombro/2+1, (BaseCorpo.altCorpo+BaseCorpo.compSaia+0.5)*BaseCorpo.factor))));211 addOperation.addObject(new RLineEntity(doc, new RLineData(new RVector(BaseCorpo.ombro/2+2, (BaseCorpo.altCorpo+BaseCorpo.compSaia-0.5)*BaseCorpo.factor), new RVector(BaseCorpo.ombro/2+2, (BaseCorpo.altCorpo+BaseCorpo.compSaia+0.5)*BaseCorpo.factor))));212 addOperation.addObject(new RLineEntity(doc, new RLineData(new RVector(BaseCorpo.ombro/2+3, (BaseCorpo.altCorpo+BaseCorpo.compSaia-0.5)*BaseCorpo.factor), new RVector(BaseCorpo.ombro/2+3, (BaseCorpo.altCorpo+BaseCorpo.compSaia+0.5)*BaseCorpo.factor))));213 addOperation.addObject(new RLineEntity(doc, new RLineData(new RVector(BaseCorpo.ombro/2+4, (BaseCorpo.altCorpo+BaseCorpo.compSaia-0.5)*BaseCorpo.factor), new RVector(BaseCorpo.ombro/2+4, (BaseCorpo.altCorpo+BaseCorpo.compSaia+0.5)*BaseCorpo.factor))));214 addOperation.addObject(new RLineEntity(doc, new RLineData(new RVector(BaseCorpo.ombro/2+5, (BaseCorpo.altCorpo+BaseCorpo.compSaia-0.5)*BaseCorpo.factor), new RVector(BaseCorpo.ombro/2+5, (BaseCorpo.altCorpo+BaseCorpo.compSaia+0.5)*BaseCorpo.factor))));215 // Gola altura216 addOperation.addObject(new RLineEntity(doc, new RLineData(new RVector(-0.5, (BaseCorpo.altCorpo+BaseCorpo.compSaia-2)*BaseCorpo.factor), new RVector(0.5, (BaseCorpo.altCorpo+BaseCorpo.compSaia-2)*BaseCorpo.factor))));217 addOperation.addObject(new RLineEntity(doc, new RLineData(new RVector(-0.5, (BaseCorpo.altCorpo+BaseCorpo.compSaia-BaseCorpo.ombro/2)*BaseCorpo.factor), new RVector(0.5, (BaseCorpo.altCorpo+BaseCorpo.compSaia-BaseCorpo.ombro/2)*BaseCorpo.factor))));218 addOperation.addObject(new RLineEntity(doc, new RLineData(new RVector(-0.5, (BaseCorpo.altCorpo+BaseCorpo.compSaia-BaseCorpo.ombro/2-1)*BaseCorpo.factor), new RVector(0.5, (BaseCorpo.altCorpo+BaseCorpo.compSaia-BaseCorpo.ombro/2-1)*BaseCorpo.factor))));219 addOperation.addObject(new RLineEntity(doc, new RLineData(new RVector(-0.5, (BaseCorpo.altCorpo+BaseCorpo.compSaia-BaseCorpo.ombro/2-2)*BaseCorpo.factor), new RVector(0.5, (BaseCorpo.altCorpo+BaseCorpo.compSaia-BaseCorpo.ombro/2-2)*BaseCorpo.factor))));220 addOperation.addObject(new RLineEntity(doc, new RLineData(new RVector(-0.5, (BaseCorpo.altCorpo+BaseCorpo.compSaia-BaseCorpo.ombro/2-3)*BaseCorpo.factor), new RVector(0.5, (BaseCorpo.altCorpo+BaseCorpo.compSaia-BaseCorpo.ombro/2-3)*BaseCorpo.factor))));221 addOperation.addObject(new RLineEntity(doc, new RLineData(new RVector(-0.5, (BaseCorpo.altCorpo+BaseCorpo.compSaia-BaseCorpo.ombro/2-4)*BaseCorpo.factor), new RVector(0.5, (BaseCorpo.altCorpo+BaseCorpo.compSaia-BaseCorpo.ombro/2-4)*BaseCorpo.factor))));222 addOperation.addObject(new RLineEntity(doc, new RLineData(new RVector(-0.5, (BaseCorpo.altCorpo+BaseCorpo.compSaia-BaseCorpo.ombro/2-5)*BaseCorpo.factor), new RVector(0.5, (BaseCorpo.altCorpo+BaseCorpo.compSaia-BaseCorpo.ombro/2-5)*BaseCorpo.factor))));223 addOperation.addObject(new RLineEntity(doc, new RLineData(new RVector(-0.5, (BaseCorpo.altCorpo+BaseCorpo.compSaia-BaseCorpo.ombro/2-6)*BaseCorpo.factor), new RVector(0.5, (BaseCorpo.altCorpo+BaseCorpo.compSaia-BaseCorpo.ombro/2-6)*BaseCorpo.factor))));224 // Cava referência superior225 addOperation.addObject(new RLineEntity(doc, new RLineData(new RVector((BaseCorpo.busto/4+BaseCorpo.margVest)*BaseCorpo.factor-0.8, (BaseCorpo.compSaia+BaseCorpo.altCorpo)*BaseCorpo.factor), new RVector((BaseCorpo.busto/4+BaseCorpo.margVest)*BaseCorpo.factor+0.8, (BaseCorpo.compSaia+BaseCorpo.altCorpo)*BaseCorpo.factor))));226 addOperation.addObject(new RLineEntity(doc, new RLineData(new RVector((BaseCorpo.busto/4+BaseCorpo.margVest)*BaseCorpo.factor-0.5, (BaseCorpo.compSaia+BaseCorpo.altCorpo-1)*BaseCorpo.factor), new RVector((BaseCorpo.busto/4+BaseCorpo.margVest)*BaseCorpo.factor+0.5, (BaseCorpo.compSaia+BaseCorpo.altCorpo-1)*BaseCorpo.factor))));227 addOperation.addObject(new RLineEntity(doc, new RLineData(new RVector((BaseCorpo.busto/4+BaseCorpo.margVest)*BaseCorpo.factor-0.5, (BaseCorpo.compSaia+BaseCorpo.altCorpo-2)*BaseCorpo.factor), new RVector((BaseCorpo.busto/4+BaseCorpo.margVest)*BaseCorpo.factor+0.5, (BaseCorpo.compSaia+BaseCorpo.altCorpo-2)*BaseCorpo.factor))));228 addOperation.addObject(new RLineEntity(doc, new RLineData(new RVector((BaseCorpo.busto/4+BaseCorpo.margVest)*BaseCorpo.factor-0.5, (BaseCorpo.compSaia+BaseCorpo.altCorpo-3)*BaseCorpo.factor), new RVector((BaseCorpo.busto/4+BaseCorpo.margVest)*BaseCorpo.factor+0.5, (BaseCorpo.compSaia+BaseCorpo.altCorpo-3)*BaseCorpo.factor))));229 addOperation.addObject(new RLineEntity(doc, new RLineData(new RVector((BaseCorpo.busto/4+BaseCorpo.margVest)*BaseCorpo.factor-0.5, (BaseCorpo.compSaia+BaseCorpo.altCorpo-4)*BaseCorpo.factor), new RVector((BaseCorpo.busto/4+BaseCorpo.margVest)*BaseCorpo.factor+0.5, (BaseCorpo.compSaia+BaseCorpo.altCorpo-4)*BaseCorpo.factor))));230 addOperation.addObject(new RLineEntity(doc, new RLineData(new RVector((BaseCorpo.busto/4+BaseCorpo.margVest)*BaseCorpo.factor-0.8, (BaseCorpo.compSaia+BaseCorpo.altCorpo-5)*BaseCorpo.factor), new RVector((BaseCorpo.busto/4+BaseCorpo.margVest)*BaseCorpo.factor+0.8, (BaseCorpo.compSaia+BaseCorpo.altCorpo-5)*BaseCorpo.factor))));231 addOperation.addObject(new RLineEntity(doc, new RLineData(new RVector((BaseCorpo.busto/4+BaseCorpo.margVest)*BaseCorpo.factor-0.5, (BaseCorpo.compSaia+BaseCorpo.altCorpo-6)*BaseCorpo.factor), new RVector((BaseCorpo.busto/4+BaseCorpo.margVest)*BaseCorpo.factor+0.5, (BaseCorpo.compSaia+BaseCorpo.altCorpo-6)*BaseCorpo.factor))));232 //addOperation.addObject(new RLineEntity(doc, new RLineData(new RVector((BaseCorpo.busto/4+BaseCorpo.margVest)*BaseCorpo.factor-0.5, (BaseCorpo.compSaia+BaseCorpo.altCorpo-7)*BaseCorpo.factor), new RVector((BaseCorpo.busto/4+BaseCorpo.margVest)*BaseCorpo.factor+0.5, (BaseCorpo.compSaia+BaseCorpo.altCorpo-7)*BaseCorpo.factor))));233 //addOperation.addObject(new RLineEntity(doc, new RLineData(new RVector((BaseCorpo.busto/4+BaseCorpo.margVest)*BaseCorpo.factor-0.5, (BaseCorpo.compSaia+BaseCorpo.altCorpo-8)*BaseCorpo.factor), new RVector((BaseCorpo.busto/4+BaseCorpo.margVest)*BaseCorpo.factor+0.5, (BaseCorpo.compSaia+BaseCorpo.altCorpo-8)*BaseCorpo.factor))));234 //addOperation.addObject(new RLineEntity(doc, new RLineData(new RVector((BaseCorpo.busto/4+BaseCorpo.margVest)*BaseCorpo.factor-0.5, (BaseCorpo.compSaia+BaseCorpo.altCorpo-9)*BaseCorpo.factor), new RVector((BaseCorpo.busto/4+BaseCorpo.margVest)*BaseCorpo.factor+0.5, (BaseCorpo.compSaia+BaseCorpo.altCorpo-9)*BaseCorpo.factor))));235 //addOperation.addObject(new RLineEntity(doc, new RLineData(new RVector((BaseCorpo.busto/4+BaseCorpo.margVest)*BaseCorpo.factor-0.5, (BaseCorpo.compSaia+BaseCorpo.altCorpo-10)*BaseCorpo.factor), new RVector((BaseCorpo.busto/4+BaseCorpo.margVest)*BaseCorpo.factor+0.5, (BaseCorpo.compSaia+BaseCorpo.altCorpo-10)*BaseCorpo.factor))));236 // Cava referência inferior (soma 1/2 larg. braço)237 addOperation.addObject(new RLineEntity(doc, new RLineData(new RVector((BaseCorpo.busto/4+BaseCorpo.margVest)*BaseCorpo.factor-0.8, (BaseCorpo.compSaia+BaseCorpo.altCorpo-BaseCorpo.largBraco/2)*BaseCorpo.factor), new RVector((BaseCorpo.busto/4+BaseCorpo.margVest)*BaseCorpo.factor+0.8, (BaseCorpo.compSaia+BaseCorpo.altCorpo-BaseCorpo.largBraco/2)*BaseCorpo.factor))));238 addOperation.addObject(new RLineEntity(doc, new RLineData(new RVector((BaseCorpo.busto/4+BaseCorpo.margVest)*BaseCorpo.factor-0.5, (BaseCorpo.compSaia+BaseCorpo.altCorpo-1-BaseCorpo.largBraco/2)*BaseCorpo.factor), new RVector((BaseCorpo.busto/4+BaseCorpo.margVest)*BaseCorpo.factor+0.5, (BaseCorpo.compSaia+BaseCorpo.altCorpo-1-BaseCorpo.largBraco/2)*BaseCorpo.factor))));239 addOperation.addObject(new RLineEntity(doc, new RLineData(new RVector((BaseCorpo.busto/4+BaseCorpo.margVest)*BaseCorpo.factor-0.5, (BaseCorpo.compSaia+BaseCorpo.altCorpo-2-BaseCorpo.largBraco/2)*BaseCorpo.factor), new RVector((BaseCorpo.busto/4+BaseCorpo.margVest)*BaseCorpo.factor+0.5, (BaseCorpo.compSaia+BaseCorpo.altCorpo-2-BaseCorpo.largBraco/2)*BaseCorpo.factor))));240 addOperation.addObject(new RLineEntity(doc, new RLineData(new RVector((BaseCorpo.busto/4+BaseCorpo.margVest)*BaseCorpo.factor-0.5, (BaseCorpo.compSaia+BaseCorpo.altCorpo-3-BaseCorpo.largBraco/2)*BaseCorpo.factor), new RVector((BaseCorpo.busto/4+BaseCorpo.margVest)*BaseCorpo.factor+0.5, (BaseCorpo.compSaia+BaseCorpo.altCorpo-3-BaseCorpo.largBraco/2)*BaseCorpo.factor))));241 addOperation.addObject(new RLineEntity(doc, new RLineData(new RVector((BaseCorpo.busto/4+BaseCorpo.margVest)*BaseCorpo.factor-0.5, (BaseCorpo.compSaia+BaseCorpo.altCorpo-4-BaseCorpo.largBraco/2)*BaseCorpo.factor), new RVector((BaseCorpo.busto/4+BaseCorpo.margVest)*BaseCorpo.factor+0.5, (BaseCorpo.compSaia+BaseCorpo.altCorpo-4-BaseCorpo.largBraco/2)*BaseCorpo.factor))));242 addOperation.addObject(new RLineEntity(doc, new RLineData(new RVector((BaseCorpo.busto/4+BaseCorpo.margVest)*BaseCorpo.factor-0.8, (BaseCorpo.compSaia+BaseCorpo.altCorpo-5-BaseCorpo.largBraco/2)*BaseCorpo.factor), new RVector((BaseCorpo.busto/4+BaseCorpo.margVest)*BaseCorpo.factor+0.8, (BaseCorpo.compSaia+BaseCorpo.altCorpo-5-BaseCorpo.largBraco/2)*BaseCorpo.factor))));243 addOperation.addObject(new RLineEntity(doc, new RLineData(new RVector((BaseCorpo.busto/4+BaseCorpo.margVest)*BaseCorpo.factor-0.5, (BaseCorpo.compSaia+BaseCorpo.altCorpo-6-BaseCorpo.largBraco/2)*BaseCorpo.factor), new RVector((BaseCorpo.busto/4+BaseCorpo.margVest)*BaseCorpo.factor+0.5, (BaseCorpo.compSaia+BaseCorpo.altCorpo-6-BaseCorpo.largBraco/2)*BaseCorpo.factor))));244 addOperation.addObject(new RLineEntity(doc, new RLineData(new RVector((BaseCorpo.busto/4+BaseCorpo.margVest)*BaseCorpo.factor-0.5, (BaseCorpo.compSaia+BaseCorpo.altCorpo-7-BaseCorpo.largBraco/2)*BaseCorpo.factor), new RVector((BaseCorpo.busto/4+BaseCorpo.margVest)*BaseCorpo.factor+0.5, (BaseCorpo.compSaia+BaseCorpo.altCorpo-7-BaseCorpo.largBraco/2)*BaseCorpo.factor)))); 245 addOperation.addObject(new RLineEntity(doc, new RLineData(new RVector((BaseCorpo.busto/4+BaseCorpo.margVest)*BaseCorpo.factor-0.5, (BaseCorpo.compSaia+BaseCorpo.altCorpo-8-BaseCorpo.largBraco/2)*BaseCorpo.factor), new RVector((BaseCorpo.busto/4+BaseCorpo.margVest)*BaseCorpo.factor+0.5, (BaseCorpo.compSaia+BaseCorpo.altCorpo-8-BaseCorpo.largBraco/2)*BaseCorpo.factor)))); 246 addOperation.addObject(new RLineEntity(doc, new RLineData(new RVector((BaseCorpo.busto/4+BaseCorpo.margVest)*BaseCorpo.factor-0.5, (BaseCorpo.compSaia+BaseCorpo.altCorpo-9-BaseCorpo.largBraco/2)*BaseCorpo.factor), new RVector((BaseCorpo.busto/4+BaseCorpo.margVest)*BaseCorpo.factor+0.5, (BaseCorpo.compSaia+BaseCorpo.altCorpo-9-BaseCorpo.largBraco/2)*BaseCorpo.factor)))); 247 addOperation.addObject(new RLineEntity(doc, new RLineData(new RVector((BaseCorpo.busto/4+BaseCorpo.margVest)*BaseCorpo.factor-0.8, (BaseCorpo.compSaia+BaseCorpo.altCorpo-10-BaseCorpo.largBraco/2)*BaseCorpo.factor), new RVector((BaseCorpo.busto/4+BaseCorpo.margVest)*BaseCorpo.factor+0.8, (BaseCorpo.compSaia+BaseCorpo.altCorpo-10-BaseCorpo.largBraco/2)*BaseCorpo.factor)))); 248 // Linhas auxiliares para volume 15cm, 20cm, 1/4 Quadril249 addOperation.addObject(new RLineEntity(doc, new RLineData(new RVector((BaseCorpo.busto/4+BaseCorpo.margVest+15)*BaseCorpo.factor, 0), new RVector((BaseCorpo.busto/4+BaseCorpo.margVest+15)*BaseCorpo.factor, 10*BaseCorpo.factor))));250 addOperation.addObject(new RLineEntity(doc, new RLineData(new RVector((BaseCorpo.busto/4+BaseCorpo.margVest+20)*BaseCorpo.factor, 0), new RVector((BaseCorpo.busto/4+BaseCorpo.margVest+20)*BaseCorpo.factor, 10*BaseCorpo.factor))));251 addOperation.addObject(new RLineEntity(doc, new RLineData(new RVector((BaseCorpo.busto/4+BaseCorpo.margVest+BaseCorpo.quadril/4)*BaseCorpo.factor, 0), new RVector((BaseCorpo.busto/4+BaseCorpo.margVest+BaseCorpo.quadril/4)*BaseCorpo.factor, 12*BaseCorpo.factor))));252 // Referência do seio253 addOperation.addObject(new RLineEntity(doc, new RLineData(new RVector((BaseCorpo.sepBusto/2-0.5)*BaseCorpo.factor, (BaseCorpo.altCorpo+BaseCorpo.compSaia-BaseCorpo.altBusto)*BaseCorpo.factor), new RVector((BaseCorpo.sepBusto/2+0.5)*BaseCorpo.factor, (BaseCorpo.altCorpo+BaseCorpo.compSaia-BaseCorpo.altBusto)*BaseCorpo.factor))));254 addOperation.addObject(new RLineEntity(doc, new RLineData(new RVector((BaseCorpo.sepBusto/2)*BaseCorpo.factor, (BaseCorpo.altCorpo+BaseCorpo.compSaia-BaseCorpo.altBusto-0.5)*BaseCorpo.factor), new RVector((BaseCorpo.sepBusto/2)*BaseCorpo.factor, (BaseCorpo.altCorpo+BaseCorpo.compSaia-BaseCorpo.altBusto+0.5)*BaseCorpo.factor)))); 255 addOperation.addObject(new RLineEntity(doc, new RLineData(new RVector((BaseCorpo.sepBusto/2)*BaseCorpo.factor, (BaseCorpo.compSaia-0.5)*BaseCorpo.factor), new RVector((BaseCorpo.sepBusto/2)*BaseCorpo.factor, (BaseCorpo.compSaia+0.5)*BaseCorpo.factor)))); 256 addOperation.addObject(new RLineEntity(doc, new RLineData(new RVector((BaseCorpo.sepBusto/2)*BaseCorpo.factor, (BaseCorpo.compSaia-BaseCorpo.altQuadril-0.5)*BaseCorpo.factor), new RVector((BaseCorpo.sepBusto/2)*BaseCorpo.factor, (BaseCorpo.compSaia-BaseCorpo.altQuadril+0.5)*BaseCorpo.factor)))); 257 // Tabela de medidas258 table = "Tecido: "+BaseCorpo.tecido+"\n";259 if(BaseCorpo.tecido=="malha"){260 table += "Modelagem: "+BaseCorpo.modelagem+"\n";261 table += "Elasticidade: "+BaseCorpo.elasticidade+"\n";262 }263 table += "\nAlt. Busto: "+BaseCorpo.altBusto.toFixed(2)+"\n";264 table += "Alt. Corpo: "+BaseCorpo.altCorpo.toFixed(2)+"\n";265 table += "Alt. Quadril: "+BaseCorpo.altQuadril.toFixed(2)+"\n";266 table += "Busto: "+BaseCorpo.busto.toFixed(2)+"\n";267 table += "Cintura: "+BaseCorpo.cintura.toFixed(2)+"\n";268 table += "Comp. Saia: "+BaseCorpo.compSaia.toFixed(2)+"\n";269 table += "Larg. Braço: "+BaseCorpo.largBraco.toFixed(2)+"\n";270 table += "Ombro: "+BaseCorpo.ombro.toFixed(2)+"\n";271 table += "Quadril: "+BaseCorpo.quadril.toFixed(2)+"\n";272 table += "Sep. Busto: "+BaseCorpo.sepBusto.toFixed(2)+"\n";273 table += "Marg. Vest: "+BaseCorpo.margVest.toFixed(2)+"\n";274 var textData = new RTextData(new RVector(2,10),new RVector(2,10),0.4,0.4,0,0,0,0,1,table,"Arial",false,false,0,false);275 addOperation.addObject(new RTextEntity(doc,textData));276 return addOperation;277};...
Using AI Code Generation
1const { base } = require('fast-check-monorepo');2const { derived } = require('fast-check-monorepo');3const { base } = require('fast-check-monorepo');4const { derived } = require('fast-check-monorepo');5const { base } = require('fast-check-monorepo');6const { derived } = require('fast-check-monorepo');7const { base } = require('fast-check-monorepo');8const { derived } = require('fast-check-monorepo');9const { base } = require('fast-check-monorepo');10const { derived } = require('fast-check-monorepo');11const { base } = require('fast-check-monorepo');12const { derived } = require('fast-check-monorepo');13const { base } = require('fast-check-monorepo');14const { derived } = require('fast-check-monorepo');15const { base } = require('fast-check-monorepo');16const { derived } = require('fast-check-monorepo');17const { base } = require('fast-check-monorepo');18const { derived } = require('fast-check-monorepo');19const { base } = require('fast-check-monorepo');20const { derived }
Using AI Code Generation
1const { base } = require('fast-check-monorepo');2console.log(base());3const { base } = require('fast-check-monorepo');4console.log(base());5const { base } = require('fast-check-monorepo');6console.log(base());7const { base } = require('fast-check-monorepo');8console.log(base());9const { base } = require('fast-check-monorepo');10console.log(base());11const { base } = require('fast-check-monorepo');12console.log(base());13const { base } = require('fast-check-monorepo');14console.log(base());15const { base } = require('fast-check-monorepo');16console.log(base());17const { base } = require('fast-check-monorepo');18console.log(base());19const { base } = require('fast-check-monorepo');20console.log(base());21const { base } = require('fast-check-monorepo');22console.log(base());23const { base } = require('fast-check-monorepo');24console.log(base());25const { base } = require('fast-check-monorepo');26console.log(base());27const { base } = require('fast-check-monorepo');28console.log(base());
Using AI Code Generation
1import { base } from 'fast-check-monorepo';2base();3import { base } from 'fast-check-monorepo';4base();5import { base } from 'fast-check-monorepo';6base();7import { base } from 'fast-check-monorepo';8base();9import { base } from 'fast-check-monorepo';10base();11import { base } from 'fast-check-monorepo';12base();13import { base } from 'fast-check-monorepo';14base();15import { base } from 'fast-check-monorepo';16base();17import { base } from 'fast-check-monorepo';18base();19import { base } from 'fast-check-monorepo';20base();21import { base } from 'fast-check-monorepo';22base();23import { base } from 'fast-check-monorepo';24base();25import { base } from 'fast-check-monorepo';26base();27import { base } from 'fast-check-monorepo';28base();29import { base } from 'fast-check-monorepo';30base();
Using AI Code Generation
1const fc = require("fast-check");2fc.assert(fc.property(fc.integer(), fc.integer(), (a, b) => a + b >= a));3const fc = require("../src/fast-check");4fc.assert(fc.property(fc.integer(), fc.integer(), (a, b) => a + b >= a));5const fc = require("fast-check");6fc.assert(fc.property(fc.integer(), fc.integer(), (a, b) => a + b >= a));7const fc = require("../src/fast-check");8fc.assert(fc.property(fc.integer(), fc.integer(), (a, b) => a + b >= a));9const fc = require("fast-check");10fc.assert(fc.property(fc.integer(), fc.integer(), (a, b) => a + b >= a));11const fc = require("../src/fast-check");12fc.assert(fc.property(fc.integer(), fc.integer(), (a, b) => a + b >= a));13const fc = require("fast-check");14fc.assert(fc.property(fc.integer(), fc.integer(), (a, b) => a + b >= a));15const fc = require("../src/fast-check");16fc.assert(fc.property(fc.integer(), fc.integer(), (a, b) => a + b >= a));17const fc = require("fast-check");18fc.assert(fc.property(fc.integer(), fc.integer(), (a, b) => a + b >= a));19const fc = require("../src/fast-check");20fc.assert(fc.property(fc.integer(), fc.integer(), (a, b) => a + b >= a));21const fc = require("fast-check");22fc.assert(fc.property(fc.integer(), fc.integer(), (a, b) => a + b >= a));
Using AI Code Generation
1const fc = require('fast-check');2fc.assert(3 fc.property(fc.string(), fc.string(), (a, b) => a.length + b.length >= a.length),4 { verbose: true, seed: 42 }5);6const fc = require('fast-check');7fc.assert(8 fc.property(fc.string(), fc.string(), (a, b) => a.length + b.length >= a.length),9 { verbose: true, seed: 42 }10);11const fc = require('fast-check');12fc.assert(13 fc.property(fc.string(), fc.string(), (a, b) => a.length + b.length >= a.length),14 { verbose: true, seed: 42 }15);16const fc = require('fast-check');17fc.assert(18 fc.property(fc.string(), fc.string(), (a, b) => a.length + b.length >= a.length),19 { verbose: true, seed: 42 }20);21const fc = require('fast-check');22fc.assert(23 fc.property(fc.string(), fc.string(), (a, b) => a.length + b.length >= a.length),24 { verbose: true, seed: 42 }25);26const fc = require('fast-check');27fc.assert(28 fc.property(fc.string(), fc.string(), (a, b) => a.length + b.length >= a.length),29 { verbose: true, seed: 42 }30);31const fc = require('fast-check');32fc.assert(33 fc.property(fc.string(), fc.string(), (a, b) => a.length + b.length >= a.length),34 { verbose: true, seed: 42 }35);36const fc = require('fast-check');37fc.assert(38 fc.property(fc.string(), fc.string(), (a, b) => a.length + b.length >= a.length),39 { verbose: true, seed: 42 }40);41const fc = require('fast-check');42fc.assert(43 fc.property(fc.string(), fc
Using AI Code Generation
1const { baseMethod } = require('fast-check-monorepo');2describe('test', () => {3 it('should work', () => {4 expect(baseMethod()).toBe('base');5 });6});7const { baseMethod } = require('fast-check-monorepo');8describe('test', () => {9 it('should work', () => {10 expect(baseMethod()).toBe('base');11 });12});13const { baseMethod } = require('fast-check-monorepo');14describe('test', () => {15 it('should work', () => {16 expect(baseMethod()).toBe('base');17 });18});19const { baseMethod } = require('fast-check-monorepo');20describe('test', () => {21 it('should work', () => {22 expect(baseMethod()).toBe('base');23 });24});25const { baseMethod } = require('fast-check-monorepo');26describe('test', () => {27 it('should work', () => {28 expect(baseMethod()).toBe('base');29 });30});31const { baseMethod } = require('fast-check-monorepo');32describe('test', () => {33 it('should work', () => {34 expect(baseMethod()).toBe('base');35 });36});37const { baseMethod } = require('fast-check-monorepo');38describe('test', () => {39 it('should work', () => {40 expect(baseMethod()).toBe('base');41 });42});43const { baseMethod } = require('fast-check-monorepo');44describe('test', () => {45 it('should work', () => {46 expect(baseMethod()).toBe('base');47 });48});
Using AI Code Generation
1import {base} from 'fast-check-monorepo';2base();3import {method} from 'fast-check-monorepo/lib/src';4method();5import {methodSubfolder} from 'fast-check-monorepo/lib/src/subfolder';6methodSubfolder();7import {methodSubfolder} from 'fast-check-monorepo/lib/subfolder';8methodSubfolder();9import {methodSubfolder} from 'fast-check-monorepo/subfolder';10methodSubfolder();11{12 "dependencies": {13 }14}
Using AI Code Generation
1const { testProp } = require('fast-check');2const { base } = require('fast-check-monorepo');3testProp('base', [base], (base) => {4 console.log(base);5 return true;6});7const { testProp } = require('fast-check');8const { derived } = require('fast-check-monorepo');9testProp('derived', [derived], (derived) => {10 console.log(derived);11 return true;12});13const { testProp } = require('fast-check');14const { base } = require('fast-check');15testProp('base', [base], (base) => {16 console.log(base);17 return true;18});19const { testProp } = require('fast-check');20const { derived } = require('fast-check');21testProp('derived', [derived], (derived) => {22 console.log(derived);23 return true;24});25const { testProp } = require('fast-check');26const { base } = require('fast-check');27testProp('base', [base], (base) => {28 console.log(base);29 return true;30});31const { testProp } = require('fast-check');32const { derived } = require('fast-check');33testProp('derived', [derived], (derived) => {34 console.log(derived);35 return true;36});37 ✓ base (6 ms)38 ✓ derived (3 ms)39 ✓ base (3 ms)40 ✓ derived (3 ms)41 ✓ base (3 ms)42 ✓ derived (3 ms)
Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.
You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.
Get 100 minutes of automation test minutes FREE!!