Proyectos de Subversion Moodle

Rev

Rev 11 | Mostrar el archivo completo | | | Autoría | Ultima modificación | Ver Log |

Rev 11 Rev 1441
Línea 45... Línea 45...
45
 * @private
45
 * @private
46
 * @constant
46
 * @constant
47
 * @type {number}
47
 * @type {number}
48
 */
48
 */
49
const MINSPACING = 10;
49
const MINSPACING = 10;
-
 
50
const BUFFER = 10;
Línea 50... Línea 51...
50
 
51
 
51
/**
52
/**
52
 * A user tour.
53
 * A user tour.
53
 *
54
 *
Línea 803... Línea 804...
803
            .stop(true, true);
804
            .stop(true, true);
Línea 804... Línea 805...
804
 
805
 
805
        if (this.isStepActuallyVisible(stepConfig)) {
806
        if (this.isStepActuallyVisible(stepConfig)) {
Línea 806... Línea -...
806
            let targetNode = this.getStepTarget(stepConfig);
-
 
807
 
-
 
808
            if (targetNode.parents('[data-usertour="scroller"]').length) {
-
 
809
                animationTarget = targetNode.parents('[data-usertour="scroller"]');
-
 
810
            }
807
            let targetNode = this.getStepTarget(stepConfig);
Línea 811... Línea -...
811
 
-
 
812
            targetNode.data('flexitour', 'target');
-
 
813
 
-
 
814
            let zIndex = this.calculateZIndex(targetNode);
-
 
815
            if (zIndex) {
-
 
816
                stepConfig.zIndex = zIndex + 1;
-
 
817
            }
-
 
818
 
-
 
819
            if (stepConfig.zIndex) {
-
 
820
                currentStepNode.css('zIndex', stepConfig.zIndex + 1);
808
 
821
            }
809
            targetNode.data('flexitour', 'target');
Línea 822... Línea 810...
822
 
810
 
823
            // Add the backdrop.
811
            // Add the backdrop.
Línea 1207... Línea 1195...
1207
 
1195
 
1208
            // Clear the step configuration.
1196
            // Clear the step configuration.
1209
            this.currentStepConfig = null;
1197
            this.currentStepConfig = null;
Línea 1210... Línea 1198...
1210
        }
1198
        }
1211
 
-
 
1212
        // Remove the backdrop features.
1199
 
Línea 1213... Línea 1200...
1213
        $('[data-flexitour="step-background"]').remove();
1200
        // Remove the highlight attribute when the hide occurs.
1214
        $('[data-flexitour="step-backdrop"]').removeAttr('data-flexitour');
1201
        $('[data-flexitour="highlight"]').removeAttr('data-flexitour');
1215
 
1202
 
1216
        const backdrop = $('[data-flexitour="backdrop"]');
1203
        const backdrop = $('[data-flexitour="backdrop"]');
Línea 1273... Línea 1260...
1273
    getStepContainer() {
1260
    getStepContainer() {
1274
        return $(this.currentStepNode);
1261
        return $(this.currentStepNode);
1275
    }
1262
    }
Línea 1276... Línea 1263...
1276
 
1263
 
-
 
1264
    /**
-
 
1265
     * Check whether the target node has a fixed position, or is nested within one.
-
 
1266
     *
-
 
1267
     * @param {Object} targetNode The target element to check.
-
 
1268
     * @return {Boolean} Return true if fixed position found.
-
 
1269
     */
-
 
1270
    hasFixedPosition = (targetNode) => {
-
 
1271
        let currentElement = targetNode[0];
-
 
1272
        while (currentElement) {
-
 
1273
            const computedStyle = window.getComputedStyle(currentElement);
-
 
1274
            if (computedStyle.position === 'fixed') {
-
 
1275
                return true;
-
 
1276
            }
-
 
1277
            currentElement = currentElement.parentElement;
-
 
1278
        }
-
 
1279
 
-
 
1280
        return false;
-
 
1281
    };
-
 
1282
 
1277
    /**
1283
    /**
1278
     * Calculate scrollTop.
1284
     * Calculate scrollTop.
1279
     *
1285
     *
1280
     * @method  calculateScrollTop
1286
     * @method  calculateScrollTop
1281
     * @param   {Object}    stepConfig      The step configuration of the step
1287
     * @param   {Object}    stepConfig      The step configuration of the step
Línea 1289... Línea 1295...
1289
        if (targetNode.parents('[data-usertour="scroller"]').length) {
1295
        if (targetNode.parents('[data-usertour="scroller"]').length) {
1290
            scrollParent = targetNode.parents('[data-usertour="scroller"]');
1296
            scrollParent = targetNode.parents('[data-usertour="scroller"]');
1291
        }
1297
        }
1292
        let scrollTop = scrollParent.scrollTop();
1298
        let scrollTop = scrollParent.scrollTop();
Línea -... Línea 1299...
-
 
1299
 
-
 
1300
        if (this.hasFixedPosition(targetNode)) {
1293
 
1301
            // Target must be in a fixed or custom position. No need to modify the scrollTop.
1294
        if (stepConfig.placement === 'top') {
1302
        } else if (stepConfig.placement === 'top') {
1295
            // If the placement is top, center scroll at the top of the target.
1303
            // If the placement is top, center scroll at the top of the target.
1296
            scrollTop = targetNode.offset().top - (viewportHeight / 2);
1304
            scrollTop = targetNode.offset().top - (viewportHeight / 2);
1297
        } else if (stepConfig.placement === 'bottom') {
1305
        } else if (stepConfig.placement === 'bottom') {
1298
            // If the placement is bottom, center scroll at the bottom of the target.
1306
            // If the placement is bottom, center scroll at the bottom of the target.
Línea 1379... Línea 1387...
1379
            default:
1387
            default:
1380
                flipBehavior = 'flip';
1388
                flipBehavior = 'flip';
1381
                break;
1389
                break;
1382
        }
1390
        }
Línea -... Línea 1391...
-
 
1391
 
-
 
1392
        let offset = '0';
-
 
1393
        if (stepConfig.backdrop) {
-
 
1394
            // Offset the arrow so that it points to the cut-out in the backdrop.
-
 
1395
            offset = `-${BUFFER}, ${BUFFER}`;
-
 
1396
        }
1383
 
1397
 
1384
        let target = this.getStepTarget(stepConfig);
1398
        let target = this.getStepTarget(stepConfig);
1385
        var config = {
1399
        var config = {
1386
            placement: stepConfig.placement + '-start',
1400
            placement: stepConfig.placement + '-start',
1387
            removeOnDestroy: true,
1401
            removeOnDestroy: true,
Línea 1390... Línea 1404...
1390
                    behaviour: flipBehavior,
1404
                    behaviour: flipBehavior,
1391
                },
1405
                },
1392
                arrow: {
1406
                arrow: {
1393
                    element: '[data-role="arrow"]',
1407
                    element: '[data-role="arrow"]',
1394
                },
1408
                },
-
 
1409
                offset: {
-
 
1410
                    offset: offset
-
 
1411
                }
1395
            },
1412
            },
1396
            onCreate: function(data) {
1413
            onCreate: function(data) {
1397
                recalculateArrowPosition(data);
1414
                recalculateArrowPosition(data);
1398
                recalculateStepPosition(data);
1415
                recalculateStepPosition(data);
1399
            },
1416
            },
Línea 1402... Línea 1419...
1402
                if (thisT.possitionNeedToBeRecalculated) {
1419
                if (thisT.possitionNeedToBeRecalculated) {
1403
                    thisT.recalculatedNo++;
1420
                    thisT.recalculatedNo++;
1404
                    thisT.possitionNeedToBeRecalculated = false;
1421
                    thisT.possitionNeedToBeRecalculated = false;
1405
                    recalculateStepPosition(data);
1422
                    recalculateStepPosition(data);
1406
                }
1423
                }
-
 
1424
                // Reset backdrop position when things update.
-
 
1425
                thisT.recalculateBackdropPosition(stepConfig);
1407
            },
1426
            },
1408
        };
1427
        };
Línea 1409... Línea 1428...
1409
 
1428
 
1410
        let recalculateArrowPosition = function(data) {
1429
        let recalculateArrowPosition = function(data) {
Línea 1535... Línea 1554...
1535
            }
1554
            }
1536
            // Call the Popper update method to update the position.
1555
            // Call the Popper update method to update the position.
1537
            thisT.currentStepPopper.update();
1556
            thisT.currentStepPopper.update();
1538
        };
1557
        };
Línea 1539... Línea 1558...
1539
 
1558
 
1540
        let background = $('[data-flexitour="step-background"]');
1559
        let background = $('[data-flexitour="highlight"]');
1541
        if (background.length) {
1560
        if (background.length) {
1542
            target = background;
1561
            target = background;
1543
        }
1562
        }
Línea 1554... Línea 1573...
1554
     * @method  recalculatePlacement
1573
     * @method  recalculatePlacement
1555
     * @param   {Object}    stepConfig      The step configuration of the step
1574
     * @param   {Object}    stepConfig      The step configuration of the step
1556
     * @return  {String}                    The placement after recalculate
1575
     * @return  {String}                    The placement after recalculate
1557
     */
1576
     */
1558
    recalculatePlacement(stepConfig) {
1577
    recalculatePlacement(stepConfig) {
1559
        const buffer = 10;
-
 
1560
        const arrowWidth = 16;
1578
        const arrowWidth = 16;
1561
        let target = this.getStepTarget(stepConfig);
1579
        let target = this.getStepTarget(stepConfig);
1562
        let widthContent = this.currentStepNode.width() + arrowWidth;
1580
        let widthContent = this.currentStepNode.width() + arrowWidth;
1563
        let targetOffsetLeft = target.offset().left - buffer;
1581
        let targetOffsetLeft = target.offset().left - BUFFER;
1564
        let targetOffsetRight = target.offset().left + target.width() + buffer;
1582
        let targetOffsetRight = target.offset().left + target.width() + BUFFER;
1565
        let placement = stepConfig.placement;
1583
        let placement = stepConfig.placement;
Línea 1566... Línea 1584...
1566
 
1584
 
1567
        if (['left', 'right'].indexOf(placement) !== -1) {
1585
        if (['left', 'right'].indexOf(placement) !== -1) {
1568
            if ((targetOffsetLeft < (widthContent + buffer)) &&
1586
            if ((targetOffsetLeft < (widthContent + BUFFER)) &&
1569
                ((targetOffsetRight + widthContent + buffer) > document.documentElement.clientWidth)) {
1587
                ((targetOffsetRight + widthContent + BUFFER) > document.documentElement.clientWidth)) {
1570
                placement = 'top';
1588
                placement = 'top';
1571
            }
1589
            }
1572
        }
1590
        }
1573
        return placement;
1591
        return placement;
Línea 1574... Línea 1592...
1574
    }
1592
    }
-
 
1593
 
-
 
1594
    /**
-
 
1595
     * Recaculate where the backdrop and its cut-out should be.
-
 
1596
     *
-
 
1597
     * This is needed when highlighted elements are off the page.
-
 
1598
     * This can be called on update to recalculate it all.
-
 
1599
     *
-
 
1600
     * @method recalculateBackdropPosition
-
 
1601
     * @param  {Object} stepConfig The step configuration of the step
-
 
1602
     */
-
 
1603
    recalculateBackdropPosition(stepConfig) {
-
 
1604
        if (stepConfig.backdrop) {
-
 
1605
            this.positionBackdrop(stepConfig);
-
 
1606
        }
-
 
1607
    }
1575
 
1608
 
1576
    /**
1609
    /**
1577
     * Add the backdrop.
1610
     * Add the backdrop.
1578
     *
1611
     *
1579
     * @method  positionBackdrop
1612
     * @method  positionBackdrop
1580
     * @param   {Object}    stepConfig      The step configuration of the step
1613
     * @param   {Object}    stepConfig      The step configuration of the step
1581
     * @chainable
1614
     * @chainable
1582
     * @return {Object} this.
1615
     * @return {Object} this.
1583
     */
1616
     */
1584
    positionBackdrop(stepConfig) {
1617
    positionBackdrop(stepConfig) {
1585
        if (stepConfig.backdrop) {
-
 
Línea 1586... Línea -...
1586
            this.currentStepConfig.hasBackdrop = true;
-
 
1587
            let backdrop = $('<div data-flexitour="backdrop"></div>');
1618
        if (stepConfig.backdrop) {
1588
 
1619
            this.currentStepConfig.hasBackdrop = true;
1589
            if (stepConfig.zIndex) {
1620
 
1590
                if (stepConfig.attachPoint === 'append') {
1621
            // Position our backdrop above everything else.
1591
                    stepConfig.attachTo.append(backdrop);
-
 
1592
                } else {
-
 
1593
                    backdrop.insertAfter(stepConfig.attachTo);
1622
            let backdrop = $('div[data-flexitour="backdrop"]');
1594
                }
1623
            if (!backdrop.length) {
Línea 1595... Línea 1624...
1595
            } else {
1624
                backdrop = $('<div data-flexitour="backdrop"></div>');
1596
                $('body').append(backdrop);
-
 
1597
            }
-
 
1598
 
-
 
1599
            if (this.isStepActuallyVisible(stepConfig)) {
-
 
1600
                // The step has a visible target.
-
 
1601
                // Punch a hole through the backdrop.
-
 
1602
                let background = $('[data-flexitour="step-background"]');
-
 
1603
                if (!background.length) {
1625
                $('body').append(backdrop);
-
 
1626
            }
Línea -... Línea 1627...
-
 
1627
 
1604
                    background = $('<div data-flexitour="step-background"></div>');
1628
            if (this.isStepActuallyVisible(stepConfig)) {
Línea -... Línea 1629...
-
 
1629
                let targetNode = this.getStepTarget(stepConfig);
1605
                }
1630
                targetNode.attr('data-flexitour', 'highlight');
-
 
1631
 
-
 
1632
                let distanceFromTop = targetNode[0].getBoundingClientRect().top;
-
 
1633
                let relativeTop = targetNode.offset().top - distanceFromTop;
-
 
1634
 
-
 
1635
                /*
-
 
1636
                Draw a clip-path that makes the backdrop a window.
-
 
1637
                The clip-path is drawn with x/y coordinates in the following sequence.
-
 
1638
 
-
 
1639
                1--------------------------------------------------2
-
 
1640
                11                                                 |
-
 
1641
                |                                                  |
1606
 
1642
                |        8-----------------------------7           |
1607
                let targetNode = this.getStepTarget(stepConfig);
1643
                |        |                             |           |
-
 
1644
                |        |                             |           |
1608
 
1645
                |        |                             |           |
-
 
1646
                10-------9                             |           |
-
 
1647
                5--------------------------------------6           |
-
 
1648
                |                                                  |
-
 
1649
                |                                                  |
-
 
1650
                4--------------------------------------------------3
-
 
1651
                */
-
 
1652
 
-
 
1653
                // These values will help us draw the backdrop.
1609
                let buffer = 10;
1654
                const viewportHeight = $(window).height();
-
 
1655
                const viewportWidth = $(window).width();
-
 
1656
                const elementWidth = targetNode.outerWidth() + (BUFFER * 2);
1610
 
1657
                let elementHeight = targetNode.outerHeight() + (BUFFER * 2);
1611
                let colorNode = targetNode;
1658
                const elementLeft = targetNode.offset().left - BUFFER;
-
 
1659
                let elementTop = targetNode.offset().top - BUFFER - relativeTop;
1612
                if (buffer) {
1660
 
1613
                    colorNode = $('body');
1661
                // Check the amount of navbar overlap the highlight element has.
1614
                }
1662
                // We will adjust the backdrop shape to compensate for the fixed navbar.
1615
 
1663
                let navbarOverlap = 0;
1616
                let drawertop = 0;
-
 
1617
                if (targetNode.parents('[data-usertour="scroller"]').length) {
1664
                if (targetNode.parents('[data-usertour="scroller"]').length) {
1618
                    const scrollerElement = targetNode.parents('[data-usertour="scroller"]');
-
 
1619
                    const navigationBuffer = scrollerElement.offset().top;
-
 
1620
                    if (scrollerElement.scrollTop() >= navigationBuffer) {
1665
                    // Determine the navbar height.
Línea 1621... Línea -...
1621
                        drawertop = scrollerElement.scrollTop() - navigationBuffer;
-
 
1622
                        background.css({
-
 
1623
                            position: 'fixed'
1666
                    const scrollerElement = targetNode.parents('[data-usertour="scroller"]');
1624
                        });
-
 
1625
                    }
-
 
1626
                }
1667
                    const navbarHeight = scrollerElement.offset().top;
1627
 
-
 
1628
                background.css({
-
 
1629
                    width: targetNode.outerWidth() + buffer + buffer,
1668
                    navbarOverlap = Math.max(Math.ceil(navbarHeight - elementTop), 0);
1630
                    height: targetNode.outerHeight() + buffer + buffer,
-
 
1631
                    left: targetNode.offset().left - buffer,
-
 
1632
                    top: targetNode.offset().top + drawertop - buffer,
-
 
1633
                    backgroundColor: this.calculateInherittedBackgroundColor(colorNode),
-
 
1634
                });
-
 
1635
 
-
 
1636
                if (targetNode.offset().left < buffer) {
-
 
1637
                    background.css({
-
 
1638
                        width: targetNode.outerWidth() + targetNode.offset().left + buffer,
-
 
1639
                        left: targetNode.offset().left,
-
 
1640
                    });
-
 
1641
                }
-
 
1642
 
-
 
1643
                if ((targetNode.offset().top + drawertop) < buffer) {
-
 
1644
                    background.css({
-
 
1645
                        height: targetNode.outerHeight() + targetNode.offset().top + buffer,
-
 
1646
                        top: targetNode.offset().top,
-
 
1647
                    });
-
 
1648
                }
1669
                    elementTop = elementTop + navbarOverlap;
1649
 
-
 
1650
                let targetRadius = targetNode.css('borderRadius');
-
 
1651
                if (targetRadius && targetRadius !== $('body').css('borderRadius')) {
-
 
1652
                    background.css('borderRadius', targetRadius);
-
 
1653
                }
-
 
1654
 
-
 
1655
                let targetPosition = this.calculatePosition(targetNode);
-
 
1656
                if (targetPosition === 'absolute') {
-
 
1657
                    background.css('position', 'fixed');
-
 
1658
                }
-
 
1659
 
-
 
1660
                let fader = background.clone();
-
 
1661
                fader.css({
-
 
1662
                    backgroundColor: backdrop.css('backgroundColor'),
-
 
1663
                    opacity: backdrop.css('opacity'),
-
 
1664
                });
-
 
1665
                fader.attr('data-flexitour', 'step-background-fader');
-
 
1666
 
1670
                    elementHeight = elementHeight - navbarOverlap;
1667
                if (!stepConfig.zIndex) {
1671
                }
1668
                    let targetClone = targetNode.clone();
1672
 
1669
                    background.append(targetClone.first());
1673
                // Check if the step container is in the 'top' position.
1670
                    $('body').append(fader);
-
 
1671
                    $('body').append(background);
1674
                // We will re-anchor the step container to the shifted backdrop edge as opposed to the actual element.
1672
                } else {
1675
                if (this.currentStepNode && this.currentStepNode.length) {
Línea 1673... Línea -...
1673
                    if (stepConfig.attachPoint === 'append') {
-
 
1674
                        stepConfig.attachTo.append(background);
-
 
1675
                    } else {
1676
                    const xPlacement = this.currentStepNode[0].getAttribute('x-placement');
1676
                        fader.insertAfter(stepConfig.attachTo);
-
 
1677
                        background.insertAfter(stepConfig.attachTo);
1677
                    if (xPlacement === 'top-start') {
1678
                    }
-
 
1679
                }
-
 
1680
 
-
 
1681
                // Add the backdrop data to the actual target.
-
 
Línea -... Línea 1678...
-
 
1678
                        this.currentStepNode[0].style.top = `${navbarOverlap}px`;
-
 
1679
                    } else {
-
 
1680
                        this.currentStepNode[0].style.top = '0px';
-
 
1681
                    }
-
 
1682
                }
-
 
1683
 
-
 
1684
                let backdropPath = document.querySelector('div[data-flexitour="backdrop"]');
-
 
1685
                const radius = 10;
-
 
1686
 
-
 
1687
                const bottomRight = {
-
 
1688
                    'x1': elementLeft + elementWidth - radius,
-
 
1689
                    'y1': elementTop + elementHeight,
-
 
1690
                    'x2': elementLeft + elementWidth,
-
 
1691
                    'y2': elementTop + elementHeight - radius,
-
 
1692
                };
1682
                // This is the part which actually does the work.
1693
 
-
 
1694
                const topRight = {
1683
                targetNode.attr('data-flexitour', 'step-backdrop');
1695
                    'x1': elementLeft + elementWidth,
-
 
1696
                    'y1': elementTop + radius,
-
 
1697
                    'x2': elementLeft + elementWidth - radius,
-
 
1698
                    'y2': elementTop,
-
 
1699
                };
-
 
1700
 
-
 
1701
                const topLeft = {
-
 
1702
                    'x1': elementLeft + radius,
-
 
1703
                    'y1': elementTop,
1684
 
1704
                    'x2': elementLeft,
-
 
1705
                    'y2': elementTop + radius,
-
 
1706
                };
-
 
1707
 
-
 
1708
                const bottomLeft = {
-
 
1709
                    'x1': elementLeft,
-
 
1710
                    'y1': elementTop + elementHeight - radius,
-
 
1711
                    'x2': elementLeft + radius,
-
 
1712
                    'y2': elementTop + elementHeight,
-
 
1713
                };
-
 
1714
 
-
 
1715
                // L = line.
-
 
1716
                // C = Bezier curve.
-
 
1717
                // Z = Close path.
-
 
1718
                backdropPath.style.clipPath = `path('M 0 0 \
-
 
1719
                    L ${viewportWidth} 0 \
-
 
1720
                    L ${viewportWidth} ${viewportHeight} \
-
 
1721
                    L 0 ${viewportHeight} \
-
 
1722
                    L 0 ${elementTop + elementHeight} \
-
 
1723
                    L ${bottomRight.x1} ${bottomRight.y1} \
-
 
1724
                    C ${bottomRight.x1} ${bottomRight.y1} ${bottomRight.x2} ${bottomRight.y1} ${bottomRight.x2} ${bottomRight.y2} \
1685
                if (stepConfig.zIndex) {
1725
                    L ${topRight.x1} ${topRight.y1} \
1686
                    backdrop.css('zIndex', stepConfig.zIndex);
1726
                    C ${topRight.x1} ${topRight.y1} ${topRight.x1} ${topRight.y2} ${topRight.x2} ${topRight.y2} \
1687
                    background.css('zIndex', stepConfig.zIndex + 1);
1727
                    L ${topLeft.x1} ${topLeft.y1} \
1688
                    targetNode.css('zIndex', stepConfig.zIndex + 2);
1728
                    C ${topLeft.x1} ${topLeft.y1} ${topLeft.x2} ${topLeft.y1} ${topLeft.x2} ${topLeft.y2} \
Línea 1689... Línea 1729...
1689
                }
1729
                    L ${bottomLeft.x1} ${bottomLeft.y1} \
1690
 
-
 
1691
                fader.fadeOut('2000', function() {
-
 
1692
                    $(this).remove();
-
 
1693
                });
-
 
1694
            }
-
 
1695
        }
-
 
1696
        return this;
-
 
1697
    }
-
 
1698
 
-
 
1699
    /**
-
 
1700
     * Calculate the inheritted z-index.
-
 
1701
     *
-
 
1702
     * @method  calculateZIndex
-
 
1703
     * @param   {jQuery}    elem                        The element to calculate z-index for
-
 
1704
     * @return  {Number}                                Calculated z-index
-
 
1705
     */
-
 
1706
    calculateZIndex(elem) {
-
 
1707
        elem = $(elem);
-
 
1708
        if (this.requireDefaultTourZindex(elem)) {
-
 
1709
            return 0;
-
 
1710
        }
-
 
1711
        while (elem.length && elem[0] !== document) {
-
 
1712
            // Ignore z-index if position is set to a value where z-index is ignored by the browser
-
 
1713
            // This makes behavior of this function consistent across browsers
-
 
1714
            // WebKit always returns auto if the element is positioned.
-
 
1715
            let position = elem.css("position");
-
 
1716
            if (position === "absolute" || position === "fixed") {
-
 
1717
                // IE returns 0 when zIndex is not specified
-
 
1718
                // other browsers return a string
-
 
1719
                // we ignore the case of nested elements with an explicit value of 0
-
 
1720
                // <div style="z-index: -10;"><div style="z-index: 0;"></div></div>
-
 
1721
                let value = parseInt(elem.css("zIndex"), 10);
-
 
1722
                if (!isNaN(value) && value !== 0) {
-
 
1723
                    return value;
-
 
1724
                }
-
 
1725
            }
-
 
1726
            elem = elem.parent();
-
 
1727
        }
-
 
1728
 
-
 
1729
        return 0;
-
 
1730
    }
-
 
1731
 
-
 
1732
    /**
-
 
1733
     * Check if the element require the default tour z-index.
-
 
1734
     *
-
 
1735
     * Some page elements have fixed z-index. However, their weight is not enough to cover
-
 
1736
     * other page elements like the top navbar or a sticky footer so they use the default
-
 
1737
     * tour z-index instead.
-
 
1738
     *
-
 
1739
     * @param {jQuery} elem the page element to highlight
-
 
1740
     * @return {Boolean} true if the element requires the default tour z-index instead of the calculated one
-
 
1741
     */
-
 
1742
    requireDefaultTourZindex(elem) {
-
 
1743
        if (elem.parents('[data-region="fixed-drawer"]').length !== 0) {
-
 
1744
            return true;
-
 
1745
        }
-
 
1746
        return false;
-
 
1747
    }
-
 
1748
 
-
 
1749
    /**
-
 
1750
     * Calculate the inheritted background colour.
-
 
1751
     *
-
 
1752
     * @method  calculateInherittedBackgroundColor
-
 
1753
     * @param   {jQuery}    elem                        The element to calculate colour for
-
 
1754
     * @return  {String}                                Calculated background colour
-
 
1755
     */
-
 
1756
    calculateInherittedBackgroundColor(elem) {
-
 
1757
        // Use a fake node to compare each element against.
-
 
1758
        let fakeNode = $('<div>').hide();
-
 
1759
        $('body').append(fakeNode);
-
 
1760
        let fakeElemColor = fakeNode.css('backgroundColor');
-
 
1761
        fakeNode.remove();
-
 
1762
 
-
 
1763
        elem = $(elem);
-
 
1764
        while (elem.length && elem[0] !== document) {
-
 
1765
            let color = elem.css('backgroundColor');
-
 
1766
            if (color !== fakeElemColor) {
1730
                    C ${bottomLeft.x1} ${bottomLeft.y1} ${bottomLeft.x1} ${bottomLeft.y2} ${bottomLeft.x2} ${bottomLeft.y2} \
1767
                return color;
1731
                    L 0 ${elementTop + elementHeight} \
1768
            }
1732
                    Z'
1769
            elem = elem.parent();
1733
                )`;
1770
        }
1734
            }