- skew.offset = matrix.offset();
- }
- else {
- deltaX = matrix.matrix[0][2];
- deltaY = matrix.matrix[1][2];
- // Scale via coordsize property
- zoomScaleX = zoom / deltaScaleX;
- zoomScaleY = zoom / deltaScaleY;
-
- dom.coordsize = Math.abs(zoomScaleX) + " " + Math.abs(zoomScaleY);
-
- // Rotate via rotation property
- newAngle = deltaDegrees * (deltaScaleX * ((deltaScaleY < 0) ? -1 : 1));
- if (newAngle != domStyle.rotation && !(newAngle === 0 && !domStyle.rotation)) {
- domStyle.rotation = newAngle;
- }
- if (deltaDegrees) {
- // Compensate x/y position due to rotation
- compensate = me.rotationCompensation(deltaDegrees, deltaX, deltaY);
- deltaX = compensate.x;
- deltaY = compensate.y;
- }
-
- // Handle negative scaling via flipping
- if (deltaScaleX < 0) {
- flip += "x";
- }
- if (deltaScaleY < 0) {
- flip += " y";
- y = -1;
- }
- if (flip != "" && !dom.style.flip) {
- domStyle.flip = flip;
- }
-
- // Translate via coordorigin property
- newOrigin = (deltaX * -zoomScaleX) + " " + (deltaY * -zoomScaleY);
- if (newOrigin != dom.coordorigin) {
- dom.coordorigin = (deltaX * -zoomScaleX) + " " + (deltaY * -zoomScaleY);
+ // skew.offset = '32767,1' OK
+ // skew.offset = '32768,1' Crash
+ // M$, R U kidding??
+ offset = matrix.offset();
+ if (offset[0] > 32767) {
+ offset[0] = 32767;
+ } else if (offset[0] < -32768) {
+ offset[0] = -32768
+ }
+ if (offset[1] > 32767) {
+ offset[1] = 32767;
+ } else if (offset[1] < -32768) {
+ offset[1] = -32768
+ }
+ skew.offset = offset;
+ } else {
+ if (skew) {
+ skew.matrix = "1 0 0 1";
+ skew.offset = "0 0";
+ }
+ split = matrix.split();
+ if (split.isSimple) {
+ domStyle.filter = '';
+ me.setSimpleCoords(sprite, split.scaleX, split.scaleY, split.translateX, split.translateY, split.rotate / Math.PI * 180);
+ } else {
+ domStyle.filter = matrix.toFilter();
+ var bb = me.getBBox(sprite),
+ dx = bb.x - sprite.x,
+ dy = bb.y - sprite.y;
+ dom.coordorigin = (dx * -zoom) + ' ' + (dy * -zoom);
+ if (fill) {
+ dom.removeChild(fill);
+ fill.position = dx + ' ' + dy;
+ fill.size = sprite.width * sprite.scale.x + ' ' + sprite.height * 1.1;
+ dom.appendChild(fill);
+ }