"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = generateTransform;

var PIXI = _interopRequireWildcard(require("pixi.js"));

function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = Object.defineProperty && Object.getOwnPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : {}; if (desc.get || desc.set) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } } newObj.default = obj; return newObj; } }

/**
 * PIXI.Transform
 *
 * @follow PIXI V4.x
 */

/**
 * 生成tranform
 *
 * @export
 * @param {*} matrixData
 * @returns Transform
 */
function generateTransform(data) {
  // HACK
  if (data.localTransform) {
    return data;
  }

  var _ref = data,
      a = _ref.a,
      b = _ref.b,
      c = _ref.c,
      d = _ref.d,
      tx = _ref.tx,
      ty = _ref.ty;
  var transform = new PIXI.Transform();
  var matrix = new PIXI.Matrix(a, b, c, d, tx, ty);
  transform.setFromMatrix(matrix);
  return transform;
}