(svgDoc, callback)
| 997 | return this; |
| 998 | } |
| 999 | function layoutDone(svgDoc, callback) { |
| 1000 | var keyMode = this._options.keyMode; |
| 1001 | var tweenPaths = this._options.tweenPaths; |
| 1002 | var tweenShapes = this._options.tweenShapes; |
| 1003 | if (typeof this._options.tweenPrecision == 'string' && this._options.tweenPrecision.includes('%')) { |
| 1004 | var tweenPrecision = +this._options.tweenPrecision.split('%')[0] / 100; |
| 1005 | var tweenPrecisionIsRelative = this._options.tweenPrecision.includes('%'); |
| 1006 | } else { |
| 1007 | var tweenPrecision = this._options.tweenPrecision; |
| 1008 | var tweenPrecisionIsRelative = false; |
| 1009 | } |
| 1010 | var growEnteringEdges = this._options.growEnteringEdges; |
| 1011 | var dictionary = {}; |
| 1012 | var prevDictionary = this._dictionary || {}; |
| 1013 | var nodeDictionary = {}; |
| 1014 | var prevNodeDictionary = this._nodeDictionary || {}; |
| 1015 | function setKey(datum, index) { |
| 1016 | var tag = datum.tag; |
| 1017 | if (keyMode == 'index') { |
| 1018 | datum.key = index; |
| 1019 | } else if (tag[0] != '#') { |
| 1020 | if (keyMode == 'id') { |
| 1021 | datum.key = datum.attributes.id; |
| 1022 | } else if (keyMode == 'title') { |
| 1023 | var title = datum.children.find(function (childData) { |
| 1024 | return childData.tag == 'title'; |
| 1025 | }); |
| 1026 | if (title) { |
| 1027 | if (title.children.length > 0) { |
| 1028 | datum.key = title.children[0].text; |
| 1029 | } else { |
| 1030 | datum.key = ''; |
| 1031 | } |
| 1032 | } |
| 1033 | } |
| 1034 | } |
| 1035 | if (datum.key == null) { |
| 1036 | if (tweenShapes) { |
| 1037 | if (tag == 'ellipse' || tag == 'polygon') { |
| 1038 | tag = 'path'; |
| 1039 | } |
| 1040 | } |
| 1041 | datum.key = tag + '-' + index; |
| 1042 | } |
| 1043 | } |
| 1044 | function setId(datum, parentData) { |
| 1045 | var id = (parentData ? parentData.id + '.' : '') + datum.key; |
| 1046 | datum.id = id; |
| 1047 | } |
| 1048 | function addToDictionary(datum) { |
| 1049 | dictionary[datum.id] = datum; |
| 1050 | } |
| 1051 | function calculateAlternativeShapeData(datum, prevDatum) { |
| 1052 | if (tweenShapes && datum.id in prevDictionary) { |
| 1053 | if ((prevDatum.tag == 'polygon' || prevDatum.tag == 'ellipse' || prevDatum.tag == 'path') && (prevDatum.tag != datum.tag || datum.tag == 'polygon')) { |
| 1054 | if (prevDatum.tag != 'path') { |
| 1055 | datum.alternativeOld = convertToPathData(prevDatum, datum); |
| 1056 | } |
nothing calls this directly
no test coverage detected