(core)
| 214 | }, |
| 215 | _coreInitted, |
| 216 | _initCore = function _initCore(core) { |
| 217 | _doc = document; |
| 218 | _win = window; |
| 219 | _body = _doc.body; |
| 220 | gsap = gsap || core || _win.gsap || console.warn("Please gsap.registerPlugin(PathEditor)"); |
| 221 | |
| 222 | _context = gsap && gsap.core.context || function () {}; |
| 223 | |
| 224 | _tempDiv = _createElement("div"); |
| 225 | _copyElement = _createElement("textarea"); |
| 226 | _copyElement.style.display = "none"; |
| 227 | _body && _body.appendChild(_copyElement); |
| 228 | |
| 229 | _touchEventLookup = function (types) { |
| 230 | //we create an object that makes it easy to translate touch event types into their "pointer" counterparts if we're in a browser that uses those instead. Like IE10 uses "MSPointerDown" instead of "touchstart", for example. |
| 231 | var standard = types.split(","), |
| 232 | converted = (_tempDiv.onpointerdown !== undefined ? "pointerdown,pointermove,pointerup,pointercancel" : _tempDiv.onmspointerdown !== undefined ? "MSPointerDown,MSPointerMove,MSPointerUp,MSPointerCancel" : types).split(","), |
| 233 | obj = {}, |
| 234 | i = 4; |
| 235 | |
| 236 | while (--i > -1) { |
| 237 | obj[standard[i]] = converted[i]; |
| 238 | obj[converted[i]] = standard[i]; |
| 239 | } |
| 240 | |
| 241 | return obj; |
| 242 | }("touchstart,touchmove,touchend,touchcancel"); |
| 243 | |
| 244 | SVGElement.prototype.getTransformToElement = SVGElement.prototype.getTransformToElement || function (e) { |
| 245 | //adds Chrome support |
| 246 | return e.getScreenCTM().inverse().multiply(this.getScreenCTM()); |
| 247 | }; |
| 248 | |
| 249 | _doc.addEventListener("keydown", function (e) { |
| 250 | var key = e.keyCode || e.which, |
| 251 | keyString = e.key || key, |
| 252 | i, |
| 253 | state, |
| 254 | a, |
| 255 | path; |
| 256 | |
| 257 | if (keyString === "Shift" || key === 16) { |
| 258 | _SHIFT = true; |
| 259 | } else if (keyString === "Control" || key === 17) { |
| 260 | _CTRL = true; |
| 261 | } else if (keyString === "Meta" || key === 91) { |
| 262 | _CMD = true; |
| 263 | } else if (keyString === "Alt" || key === 18) { |
| 264 | _ALT = true; |
| 265 | i = _selectedPaths.length; |
| 266 | |
| 267 | while (--i > -1) { |
| 268 | _selectedPaths[i]._onPressAlt(); |
| 269 | } |
| 270 | } else if ((keyString === "z" || key === 90) && (_CTRL || _CMD) && _history.length > 1) { |
| 271 | //UNDO |
| 272 | _history.shift(); |
| 273 |
no test coverage detected
searching dependent graphs…