all files / circularchart3d/user-interaction/ selection.js

92.25% Statements 345/374
85.34% Branches 262/307
97.62% Functions 41/42
92.43% Lines 342/370
11 statements, 6 functions, 9 branches Ignored     
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558          97× 97× 97× 97× 97×   97×     97× 97×   44×   41× 41×   56× 56× 56× 56×   56× 56× 56× 56× 56×   5101×   1112× 1112× 1112× 1112× 15614× 14894×     1112× 1112× 1112× 1112× 906×   1112×     1112× 906×   1112×   54× 25× 25× 25×   29× 29× 29×   54× 18×       54× 13× 13× 13× 13×   13× 208× 208×   118× 118× 121×       118× 118×     118× 118×   90×       13× 13× 208×     54×       90×     90×   48×   42×       42× 42× 40×       23838× 23838× 23114×   724×     724× 284× 284×   440×     440× 147× 147×   293×   292× 290× 290×         23838×   60× 60× 60× 60×     60× 60× 60× 43× 43× 43×           60×         60×   70×   29×   70× 70×           64× 64× 64×   64× 23×     41×       11× 11× 11×         11×   11× 11×   11× 12× 12×   11× 11× 96× 96×     12×                       12× 12× 12× 12× 12× 12× 12×     10× 100× 100× 90× 90× 90×     10× 10× 10× 10× 10× 10×         67× 67× 17× 17× 17× 16×       29× 12×       83×   83× 762× 762× 762× 759× 759×       769× 769× 769× 100×   769× 769× 769× 769× 11359× 11359× 1156×     11359× 9206×     2153× 2153× 335×   2153× 2153×   11359× 1278× 34×   1278× 1278× 800× 92×           769× 769× 769× 769× 478×   769× 627×   142× 142×   769× 627×     142× 142× 71×     71×           64× 64× 1097× 1097× 1097× 1097× 1097×     1097× 1097× 995×   1097× 382×       64× 64× 64× 64×     4004×   92× 40×   16× 16× 16×                       120× 1778× 1778× 1778×       190× 20× 15× 15×     190× 64×     32×   60× 60× 60× 58× 58×   58×     52× 52×       52×           12× 12× 12× 12× 19× 19× 19×     12× 12× 196× 196× 196× 196× 196×                                 1315×   44×        
/* istanbul ignore next */ 
var __extends = (this && this.__extends) || (function () {
    var extendStatics = function (d, b) {
        extendStatics = Object.setPrototypeOf ||
            ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
            function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
        return extendStatics(d, b);
    };
    return function (d, b) {
        extendStatics(d, b);
        function __() { this.constructor = d; }
        d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
    };
})();
define(["require", "exports", "@syncfusion/ej2-base", "../../common/utils/helper", "../../common/model/base", "../../common/user-interaction/selection", "../../common/model/constants"], function (require, exports, ej2_base_1, helper_1, base_1, selection_1, constants_1) {
    "use strict";
    Object.defineProperty(exports, "__esModule", { value: true });
    var CircularChartSelection3D = (function (_super) {
        __extends(CircularChartSelection3D, _super);
        function CircularChartSelection3D(circular3D) {
            var _this = _super.call(this, circular3D) || this;
            _this.circular3D = circular3D;
            _this.renderer = circular3D.renderer;
            _this.addEventListener();
            return _this;
        }
        CircularChartSelection3D.prototype.addEventListener = function () {
            Iif (this.circular3D.isDestroyed) {
                return;
            }
            this.circular3D.on(ej2_base_1.Browser.touchMoveEvent, this.mouseMove, this);
            this.circular3D.on('click', this.mouseClick, this);
        };
        CircularChartSelection3D.prototype.removeEventListener = function () {
            if (this.circular3D.isDestroyed) {
                return;
            }
            this.circular3D.off(ej2_base_1.Browser.touchMoveEvent, this.mouseMove);
            this.circular3D.off('click', this.mouseClick);
        };
        CircularChartSelection3D.prototype.initPrivateVariables = function (circular3D) {
            this.styleId = circular3D.element.id + '_ej2_chart_selection';
            this.unselected = circular3D.element.id + '_ej2_deselected';
            this.selectedDataIndexes = [];
            this.rectPoints = null;
        };
        CircularChartSelection3D.prototype.invokeSelection = function (circular3D) {
            this.initPrivateVariables(circular3D);
            this.series = ej2_base_1.extend({}, circular3D.visibleSeries, null, true);
            this.seriesStyles();
            this.currentMode = circular3D.selectionMode;
            this.selectDataIndex(this.concatIndexes(circular3D.selectedDataIndexes, this.selectedDataIndexes), circular3D);
        };
        CircularChartSelection3D.prototype.generateStyle = function (series, point) {
            return (this.styleId + '_series_' + series.index + '_point_' + point);
        };
        CircularChartSelection3D.prototype.getElementByIndex = function (index) {
            var _this = this;
            var pointElements = [];
            var elements = document.querySelectorAll('[id*="-region-series-' + index.series + '-point-' + index.point + '"]');
            elements.forEach(function (pointElement) {
                if (pointElement.id.indexOf(_this.circular3D.element.id + '-') > -1 && _this.indexFinder(pointElement.id).point === index.point) {
                    pointElements.push(pointElement);
                }
            });
            var element = document.getElementById(this.control.element.id + '-svg-data-label-text-' + index.point);
            var connectorElement = document.getElementById(this.control.element.id + '-datalabel-series-0-connector-' + index.point);
            var shapeElement = document.getElementById(this.control.element.id + '-svg-data-label-series-0-shape-' + index.point);
            if (element) {
                pointElements.push(element);
            }
            Iif (connectorElement) {
                pointElements.push(connectorElement);
            }
            if (shapeElement) {
                pointElements.push(shapeElement);
            }
            return pointElements;
        };
        CircularChartSelection3D.prototype.isAlreadySelected = function (targetElement, eventType, index) {
            if (eventType === 'mousemove') {
                this.currentMode = this.circular3D.highlightMode;
                this.highlightDataIndexes = [];
                this.styleId = this.circular3D.element.id + '_ej2_chart_highlight';
            }
            else Eif (eventType === 'click' || eventType === 'keyup') {
                this.currentMode = this.circular3D.selectionMode;
                this.styleId = this.circular3D.element.id + '_ej2_chart_selection';
            }
            if (this.circular3D.highlightMode !== 'None' && this.circular3D.selectionMode === 'None') {
                Iif (eventType === 'click') {
                    return false;
                }
            }
            if (((this.circular3D.highlightMode !== 'None' || this.circular3D.legendSettings.enableHighlight) && this.previousSelectedElement && this.previousSelectedElement[0])) {
                var isElement = void 0;
                var nodeName = targetElement.nodeName;
                Eif (targetElement.parentNode) {
                    isElement = ((nodeName === 'path' || nodeName === 'shape') && targetElement.id.indexOf('region') > 1) ? true : false;
                }
                var _loop_1 = function (i) {
                    Eif (this_1.previousSelectedElement[i].hasAttribute('class')) {
                        if (this_1.previousSelectedElement[i].getAttribute('class').indexOf('highlight') > -1 &&
                            (isElement || eventType === 'click' || eventType === 'keyup')) {
                            var selectionClass_1;
                            this_1.previousSelectedElement[i].classList.forEach(function (className) {
                                Iif (className.indexOf('selection') > -1) {
                                    selectionClass_1 = className;
                                }
                            });
                            this_1.previousSelectedElement[i].removeAttribute('class');
                            Iif (selectionClass_1) {
                                this_1.addSvgClass(this_1.previousSelectedElement[i], selectionClass_1);
                            }
                            this_1.previousSelectedElement[i].classList.remove(this_1.styleId + '_series_' + index.series);
                            this_1.addOrRemoveIndex(this_1.highlightDataIndexes, this_1.indexFinder(this_1.previousSelectedElement[i].id));
                        }
                        else if (!isElement && this_1.previousSelectedElement[i].getAttribute('class').indexOf('highlight') > -1) {
                            this_1.performSelection(this_1.indexFinder(this_1.previousSelectedElement[i].id), this_1.circular3D, this_1.previousSelectedElement[i]);
                        }
                    }
                };
                var this_1 = this;
                for (var i = 0; i < this.previousSelectedElement.length; i++) {
                    _loop_1(i);
                }
            }
            return true;
        };
        CircularChartSelection3D.prototype.mouseClick = function (circular3D, event) {
            this.calculateSelectedElements(circular3D, event.target, event.type);
        };
        CircularChartSelection3D.prototype.calculateSelectedElements = function (circular3D, targetElement, eventType) {
            Iif (ej2_base_1.isNullOrUndefined(targetElement)) {
                return;
            }
            if ((circular3D.selectionMode === 'None' && circular3D.highlightMode === 'None') ||
                targetElement.id && targetElement.id.indexOf(circular3D.element.id + '-') === -1) {
                return;
            }
            Iif (targetElement.getAttribute('id').indexOf('_connector_') > -1) {
                return;
            }
            else {
                this.isAlreadySelected(targetElement, eventType, this.indexFinder(targetElement.id));
                if (targetElement.id.indexOf('-series-') > -1 || targetElement.id.indexOf('-data-label-') > -1) {
                    this.performSelection(this.indexFinder(targetElement.id), circular3D, targetElement);
                }
            }
        };
        CircularChartSelection3D.prototype.indexFinder = function (id) {
            var ids = ['NaN', 'NaN'];
            if (id.indexOf('-point-') > -1) {
                ids = id.split('-series-')[1].split('-point-');
            }
            else Iif (id.indexOf('-border-') > -1) {
                ids[0] = id.split('-border-')[1];
            }
            else if (id.indexOf('data-label-series-0-shape-') > -1 && this.control.series[0].dataLabel.position === 'Inside') {
                ids[0] = '0';
                ids[1] = id.split('-shape-')[1];
            }
            else Iif (id.indexOf('-series-') > -1) {
                ids[0] = id.split('-series-')[1];
            }
            else if (id.indexOf('_chart_legend_shape_') > -1) {
                ids = id.split('_chart_legend_shape_');
                ids[0] = '0';
            }
            else if (id.indexOf('_chart_legend_g_') > -1) {
                ids = id.split('_chart_legend_g_');
                ids[0] = '0';
            }
            else if (id.indexOf('-data-label-') > -1) {
                ids[0] = '0';
                ids[1] = id.split('-data-label-text-')[1];
            }
            else Iif (id.indexOf('-connector-') > -1) {
                ids[0] = '0';
                ids[1] = id.split('-connector-')[1];
            }
            return new base_1.Index(parseInt(ids[0], 10), parseInt(ids[1], 10));
        };
        CircularChartSelection3D.prototype.performSelection = function (index, circular3D, element) {
            Eif (!isNaN(index.point) && this.currentMode === 'Point' && element && this.getElementByIndex(index).length > 0) {
                this.selection(circular3D, index, this.getElementByIndex(index));
                this.selectionComplete(circular3D, circular3D.series[0]);
                this.blurEffect(circular3D.element.id, circular3D.visibleSeries);
            }
        };
        CircularChartSelection3D.prototype.selectionComplete = function (circular3D, series) {
            var pointIndex;
            var selectedPointValues = [];
            for (var i = 0; i < this.selectedDataIndexes.length; i++) {
                pointIndex = this.selectedDataIndexes[i].point;
                Eif (!isNaN(pointIndex)) {
                    selectedPointValues.push({
                        x: series.dataSource[pointIndex][series.xName], y: series.points[pointIndex].y,
                        seriesIndex: this.selectedDataIndexes[i].series, pointIndex: pointIndex
                    });
                }
            }
            var args = {
                name: constants_1.selectionComplete,
                selectedDataValues: selectedPointValues,
                cancel: false
            };
            circular3D.trigger(constants_1.selectionComplete, args);
        };
        CircularChartSelection3D.prototype.selection = function (circular3D, index, selectedElements) {
            if (!circular3D.isMultiSelect && this.styleId.indexOf('highlight') === -1 &&
                circular3D.selectionMode !== 'None') {
                this.removeMultiSelectElements(circular3D, this.selectedDataIndexes, index);
            }
            var className = selectedElements[0] && (selectedElements[0].getAttribute('class') || '');
            if (selectedElements[0] && className.indexOf(this.getSelectionClass(selectedElements[0].id)) > -1) {
                this.removeStyles(selectedElements);
                if (this.styleId.indexOf('highlight') > 0 && (circular3D.highlightMode !== 'None' || circular3D.legendSettings.enableHighlight)) {
                    this.addOrRemoveIndex(this.highlightDataIndexes, index);
                }
                else {
                    this.addOrRemoveIndex(this.selectedDataIndexes, index);
                }
            }
            else {
                this.previousSelectedElement = circular3D.highlightMode !== 'None' ? selectedElements : [];
                Eif (className.indexOf('selection') < 0) {
                    this.applyStyles(selectedElements, index);
                }
                if (this.styleId.indexOf('highlight') > 0 && (circular3D.highlightMode !== 'None' || circular3D.legendSettings.enableHighlight)) {
                    this.addOrRemoveIndex(this.highlightDataIndexes, index, true);
                }
                else {
                    this.addOrRemoveIndex(this.selectedDataIndexes, index, true);
                }
            }
        };
        CircularChartSelection3D.prototype.redrawSelection = function (circular3D) {
            var selectedDataIndexes = ej2_base_1.extend([], this.selectedDataIndexes, null, true);
            var highlightDataIndexes = ej2_base_1.extend([], this.highlightDataIndexes, null, true);
            Iif (this.styleId.indexOf('highlight') > 0 && highlightDataIndexes.length > 0) {
                this.removeSelectedElements(circular3D, this.highlightDataIndexes);
                selectedDataIndexes = highlightDataIndexes;
            }
            else {
                this.removeSelectedElements(circular3D, this.selectedDataIndexes);
            }
            this.blurEffect(circular3D.element.id, circular3D.visibleSeries);
            this.selectDataIndex(selectedDataIndexes, circular3D);
        };
        CircularChartSelection3D.prototype.removeSelectedElements = function (circular3D, indexes) {
            for (var _i = 0, indexes_1 = indexes; _i < indexes_1.length; _i++) {
                var index = indexes_1[_i];
                this.removeStyles(this.getElementByIndex(index));
            }
            var points = circular3D.visibleSeries[0].points;
            for (var i = 0; i < points.length; i++) {
                var index = new base_1.Index(0, points[i].index);
                this.removeStyles(this.getElementByIndex(index).length === 0 ? [document.getElementById(this.control.element.id + '_chart_legend_shape_' + index.point)] : this.getElementByIndex(index));
            }
        };
        CircularChartSelection3D.prototype.legendSelection = function (chart, targetElement, eventType) {
            if (eventType === 'mousemove') {
                if (targetElement.id.indexOf('text') > 1) {
                    targetElement = helper_1.getElement(targetElement.id.replace('text', 'shape'));
                }
                Iif (targetElement.id.indexOf('marker') > 1) {
                    targetElement = helper_1.getElement(targetElement.id.replace('_marker', ''));
                }
                Eif (targetElement.id.indexOf('g') > 1) {
                    targetElement = helper_1.getElement(targetElement.id.replace('_g_', '_shape_'));
                }
                Iif (targetElement.hasAttribute('class') && (targetElement.getAttribute('class').indexOf('highlight') > -1 ||
                    targetElement.getAttribute('class').indexOf('selection') > -1)) {
                    return;
                }
                this.currentMode = this.circular3D.highlightMode;
            }
            else if (eventType === 'click') {
                if (targetElement.id.indexOf('text') > 1) {
                    targetElement = helper_1.getElement(targetElement.id.replace('text', 'shape'));
                }
                Eif (targetElement.id.indexOf('g') > 1) {
                    targetElement = helper_1.getElement(targetElement.id.replace('_g_', '_shape_'));
                }
            }
            var index = this.indexFinder(targetElement.id);
            var isPreSelected = this.isAlreadySelected(targetElement, eventType, index);
            Eif (isPreSelected) {
                var seriesStyle = this.generateStyle(chart.visibleSeries[index.series], index.point);
                var selectedElements = (document.querySelectorAll('.' + seriesStyle));
                var isBlurEffectNeeded = true;
                if (selectedElements.length > 0) {
                    this.removeSelection(chart, index.series, selectedElements, seriesStyle, isBlurEffectNeeded, index);
                }
                else {
                    for (var _i = 0, _a = chart.visibleSeries[0].points; _i < _a.length; _i++) {
                        var element = _a[_i];
                        if (element.index !== index.point && (!chart.isMultiSelect || seriesStyle.indexOf('highlight') > 0)) {
                            seriesStyle = this.generateStyle(chart.visibleSeries[index.series], element.index);
                            selectedElements = document.querySelectorAll('.' + seriesStyle);
                            this.removeSelection(chart, index.series, selectedElements, seriesStyle, isBlurEffectNeeded, index);
                        }
                    }
                    var seriesElements = [];
                    seriesElements = this.getElementByIndex(index);
                    Eif (seriesElements.length > 0) {
                        this.checkSelectionElements(seriesElements, seriesStyle, false, index.point);
                        this.selection(chart, index, seriesElements);
                        this.blurEffect(chart.element.id, chart.visibleSeries);
                    }
                }
            }
        };
        CircularChartSelection3D.prototype.selectDataIndex = function (indexes, circular3D) {
            var element;
            for (var _i = 0, indexes_2 = indexes; _i < indexes_2.length; _i++) {
                var index = indexes_2[_i];
                element = this.getElementByIndex(index)[0];
                if (element) {
                    this.performSelection(index, circular3D, element);
                }
            }
        };
        CircularChartSelection3D.prototype.removeMultiSelectElements = function (circular3D, index, currentIndex) {
            for (var i = 0; i < index.length; i++) {
                if (!this.checkEquals(index[i], currentIndex)) {
                    this.removeStyles(this.getElementByIndex(index[i]));
                    index.splice(i, 1);
                    i--;
                }
            }
        };
        CircularChartSelection3D.prototype.blurEffect = function (pieId, visibleSeries) {
            var visibility = (this.checkVisibility(this.highlightDataIndexes) ||
                this.checkVisibility(this.selectedDataIndexes));
            for (var _i = 0, _a = visibleSeries[0].points; _i < _a.length; _i++) {
                var point = _a[_i];
                var pointElements = [];
                if (point.visible) {
                    pointElements = this.getElementByIndex({ series: 0, point: point.index });
                    this.checkSelectionElements(pointElements, this.generateStyle(visibleSeries[0], point.index), visibility, point.index);
                }
            }
        };
        CircularChartSelection3D.prototype.checkSelectionElements = function (element, className, visibility, point) {
            Iif (point === void 0) { point = 0; }
            var children = element;
            if (this.circular3D.selectionMode !== 'None' && (this.circular3D.highlightMode !== 'None' || this.circular3D.legendSettings.enableHighlight)) {
                children = element;
            }
            var elementClassName;
            var legendShape;
            var selectElement = element;
            for (var i = 0; i < children.length; i++) {
                elementClassName = children[i].getAttribute('class') || '';
                if (this.circular3D.selectionMode !== 'None' && (this.circular3D.highlightMode !== 'None' || this.circular3D.legendSettings.enableHighlight)) {
                    className = elementClassName.indexOf('selection') > 0 ||
                        elementClassName.indexOf('highlight') > 0 ? elementClassName : className;
                }
                if (elementClassName.indexOf(className) === -1 && visibility) {
                    this.addSvgClass(children[i], this.unselected);
                }
                else {
                    selectElement = children[i];
                    if (elementClassName.indexOf(this.unselected) !== -1 && className.indexOf('highlight') > 0) {
                        this.circular3D.highlightAnimation(children[i], 700, 0.3);
                    }
                    this.removeSvgClass(children[i], this.unselected);
                    this.removeSvgClass(children[i].parentNode, this.unselected);
                }
                if (children[i].id.indexOf('-data-label-text-') !== -1 || children[i].id.indexOf('-connector-') !== -1 || children[i].id.indexOf('-data-label-series-0-shape-') !== -1) {
                    if (this.highlightDataIndexes && this.highlightDataIndexes[0] && point === this.highlightDataIndexes[0].point) {
                        this.removeSvgClass(children[i], this.unselected);
                    }
                    Eif (this.selectedDataIndexes) {
                        for (var j = 0; j < this.selectedDataIndexes.length; j++) {
                            if (point === this.selectedDataIndexes[j].point) {
                                this.removeSvgClass(children[i], this.unselected);
                            }
                        }
                    }
                }
            }
            Eif (this.control.circularChartLegend3DModule && this.control.legendSettings.visible) {
                legendShape = helper_1.getElement(this.control.element.id + '_chart_legend_shape_' + point);
                Eif (legendShape) {
                    if (legendShape.hasAttribute('class')) {
                        this.removeSvgClass(legendShape, legendShape.getAttribute('class'));
                    }
                    if (selectElement.length > 0) {
                        elementClassName = selectElement[0].getAttribute('class');
                    }
                    else Eif (selectElement) {
                        elementClassName = selectElement.getAttribute('class') || '';
                    }
                    if (elementClassName.indexOf(className) === -1 && visibility) {
                        this.addSvgClass(legendShape, this.unselected);
                    }
                    else {
                        this.removeSvgClass(legendShape, this.unselected);
                        if (elementClassName === '') {
                            this.removeSvgClass(legendShape, className);
                        }
                        else {
                            this.addSvgClass(legendShape, className);
                        }
                    }
                }
            }
        };
        CircularChartSelection3D.prototype.applyStyles = function (elements, index) {
            var circular3DTooltip = this.control.circularChartTooltip3DModule;
            for (var _i = 0, elements_1 = elements; _i < elements_1.length; _i++) {
                var element = elements_1[_i];
                Eif (element) {
                    this.removeSvgClass(element.parentNode, this.unselected);
                    this.removeSvgClass(element, this.unselected);
                    var opacity = circular3DTooltip && (circular3DTooltip.previousPoints.length > 0 &&
                        circular3DTooltip.previousPoints[0].point.index !== index.point) ?
                        circular3DTooltip.svgTooltip.opacity : this.series[index.series].opacity;
                    element.setAttribute('opacity', opacity.toString());
                    if (element.id.indexOf('-data-label-text-') === -1 && element.id.indexOf('-connector-') === -1 && element.id.indexOf('-data-label-series-0-shape-') === -1) {
                        this.addSvgClass(element, this.getSelectionClass(element.id));
                    }
                    if (this.getSelectionClass(element.id).indexOf('highlight') > 0) {
                        this.circular3D.stopElementAnimation(element);
                    }
                }
            }
            Eif (this.control.circularChartLegend3DModule && this.control.legendSettings.visible) {
                var legendShape = document.getElementById(this.control.element.id + '_chart_legend_shape_' + index.point);
                this.removeSvgClass(legendShape, legendShape.getAttribute('class'));
                this.addSvgClass(legendShape, this.getSelectionClass(legendShape.id));
            }
        };
        CircularChartSelection3D.prototype.getSelectionClass = function (id) {
            return this.generateStyle(this.control.series[this.indexFinder(id).series], this.indexFinder(id).point);
        };
        CircularChartSelection3D.prototype.removeSelection = function (chart, series, selectedElements, seriesStyle, isBlurEffectNeeded, index) {
            if (selectedElements.length > 0) {
                var elements = [];
                for (var i = 0; i < selectedElements.length; i++) {
                    elements.push(selectedElements[i]);
                }
                this.removeStyles(elements);
                this.addOrRemoveIndex(this.selectedDataIndexes, new base_1.Index(series, index.point));
                for (var _i = 0, _a = chart.visibleSeries[0].points; _i < _a.length; _i++) {
                    var value = _a[_i];
                    seriesStyle = this.generateStyle(chart.visibleSeries[0], value.index);
                    Iif (document.querySelectorAll('.' + seriesStyle).length > 0) {
                        for (var _b = 0, elements_2 = elements; _b < elements_2.length; _b++) {
                            var element = elements_2[_b];
                            this.checkSelectionElements(element, seriesStyle, true, index.point);
                        }
                        isBlurEffectNeeded = false;
                        break;
                    }
                }
                Eif (isBlurEffectNeeded) {
                    this.blurEffect(chart.element.id, chart.visibleSeries);
                }
            }
        };
        CircularChartSelection3D.prototype.removeStyles = function (elements) {
            for (var _i = 0, elements_3 = elements; _i < elements_3.length; _i++) {
                var element = elements_3[_i];
                Eif (element) {
                    this.removeSvgClass(element, this.getSelectionClass(element.id));
                }
            }
        };
        CircularChartSelection3D.prototype.addOrRemoveIndex = function (indexes, index, add) {
            for (var i = 0; i < indexes.length; i++) {
                if (this.checkEquals(indexes[i], index)) {
                    indexes.splice(i, 1);
                    i--;
                }
            }
            if (add) {
                indexes.push(index);
            }
        };
        CircularChartSelection3D.prototype.checkEquals = function (first, second) {
            return ((first.point === second.point) && (first.series === second.series));
        };
        CircularChartSelection3D.prototype.mouseMove = function (event) {
            var circular3D = this.circular3D;
            var targetElement = event.target;
            if (!circular3D.rotateActivate && circular3D.circularChartHighlight3DModule && (circular3D.highlightMode !== 'None' || circular3D.legendSettings.enableHighlight)) {
                Eif (!ej2_base_1.isNullOrUndefined(targetElement)) {
                    if (event.target.id.indexOf('text') > 1 && event.target.id.indexOf('legend') > -1) {
                        targetElement = helper_1.getElement(event.target.id.replace('text', 'shape'));
                    }
                    if ((targetElement).hasAttribute('class') && ((targetElement).getAttribute('class').indexOf('highlight') > -1 ||
                        targetElement.getAttribute('class').indexOf('selection') > -1)) {
                        return;
                    }
                    this.calculateSelectedElements(circular3D, event.target, event.type);
                    if (this.highlightDataIndexes && (targetElement.id.indexOf('_chart_legend_') === -1 || targetElement.id.indexOf('_legend_element') !== -1) &&
                        this.highlightDataIndexes.length > 0 && targetElement.id.indexOf('-series-') === -1 &&
                        targetElement.id.indexOf('-data-label-') === -1) {
                        this.removeLegendHighlightStyles();
                    }
                    return;
                }
            }
            Iif (circular3D.selectionMode === 'None') {
                return;
            }
        };
        CircularChartSelection3D.prototype.removeLegendHighlightStyles = function () {
            this.circular3D.circularChartHighlight3DModule.highlightDataIndexes = [];
            var elementCollection;
            for (var i = 0; i < this.circular3D.visibleSeries[0].points.length; i++) {
                elementCollection = document.getElementsByClassName(this.generateStyle(this.circular3D.visibleSeries[0], i));
                Eif (this.selectedDataIndexes.length === 0) {
                    elementCollection = document.getElementsByClassName(this.generateStyle(this.circular3D.visibleSeries[0], i));
                    while (elementCollection.length > 0) {
                        var element = elementCollection[0];
                        Eif (element) {
                            this.removeSvgClass(element, element.getAttribute('class'));
                        }
                    }
                    elementCollection = document.getElementsByClassName(this.unselected);
                    while (elementCollection.length > 0) {
                        var element = elementCollection[0];
                        Eif (element) {
                            this.removeSvgClass(element, element.getAttribute('class'));
                            Eif (this.generateStyle(this.circular3D.visibleSeries[0], i).indexOf('highlight') > -1) {
                                this.circular3D.highlightAnimation(element, 700, 0.3);
                            }
                        }
                    }
                }
                else {
                    elementCollection = document.getElementsByClassName(this.generateStyle(this.circular3D.visibleSeries[0], i));
                    while (elementCollection.length > 0) {
                        var element = elementCollection[0];
                        if (element) {
                            this.removeSvgClass(element, element.getAttribute('class'));
                            this.addSvgClass(element, this.unselected);
                        }
                    }
                }
            }
        };
        CircularChartSelection3D.prototype.getModuleName = function () {
            return 'CircularChartSelection3D';
        };
        CircularChartSelection3D.prototype.destroy = function () {
            this.removeEventListener();
        };
        return CircularChartSelection3D;
    }(selection_1.BaseSelection));
    exports.CircularChartSelection3D = CircularChartSelection3D;
});