Created
March 23, 2010 22:24
-
-
Save j4johnfox/341760 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- (void)setAnchorPoint:(CGPoint)anAnchorPoint | |
inPhotoLayer:(CALayer)aPhotoLayer | |
{ | |
log('anAnchorPoint is ' +CPStringFromPoint(anAnchorPoint)); | |
if (aPhotoLayer._DOMContentsElement == null) | |
{ | |
log('aPhotoLayer has no _DOMContentsElement cannot set its anchor point, bail'); | |
return; | |
} | |
var styleObject = aPhotoLayer._DOMContentsElement.style; | |
var xVal = (anAnchorPoint.x * 100 +'%'); | |
var yVal = (anAnchorPoint.y * 100 +'%'); | |
log('xVal is ' +xVal +' yVal is ' +yVal); | |
if (CPBrowserIsEngine(CPWebKitBrowserEngine) && (typeof styleObject.WebkitTransformOrigin != "undefined")) | |
{ | |
styleObject.WebkitTransformOrigin = +xVal +" " +yVal; | |
[aPhotoLayer setNeedsDisplay]; | |
} | |
else if (CPBrowserIsEngine(CPGeckoBrowserEngine) && (typeof styleObject.MozTransformOrigin != "undefined")) | |
{ | |
styleObject.MozTransformOrigin = +xVal +" " +yVal; | |
[aPhotoLayer setNeedsDisplay]; | |
} | |
/* | |
else if (CPBrowserIsEngine(CPOperaBrowserEngine)) | |
{ | |
//transformName = '-o-transform'; | |
} | |
*/ | |
else | |
{ | |
[aPhotoLayer setAnchorPoint:anAnchorPoint]; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment