Hi, thank you very much!
I have a new problem, I insterted the code below and it works good, except for the button ‘Button_Clear’. It is the only one which is actually a real button and not a picture, furthermore the button clear gets small with the zoom, but after using the button (the function is to dissapear with click and come back with another click) it is on the original position and not like the others in the fitting size for the zoom.
Do you have any advise for me? I checked allready that the name of ‘Button_Clear’ fits with the name in the code.
Best wishes and thank you for your help.
Selina (I am using the newest version 8.1.1 of AP)
var $zoomNode = $(’.ap-slides’, prez.container),
zoomTransform = ‘none’,
buttonNames = [‘Button_Pause’, ‘Button_Play’, ‘Button_10Sec’, ‘Button_Backwards’, ‘Button_Clear’], // plz update this array
firstButton = prez.object(buttonNames[0]),// cache to check slide change
$buttonNodes = [];
// cache button jQuery object for faster speed
for (var i = 0; i < buttonNames.length; ++i)
$buttonNodes.push($(prez.object(buttonNames[i]).node));
function invertZoom() {
if (prez.object(buttonNames[0]) != firstButton) {
// slide changed, should not update buttons anymore
return;
}
// update buttons
var currentZoomTransform = $zoomNode.css(‘transform’);
if (currentZoomTransform != zoomTransform) {
zoomTransform = currentZoomTransform;
var zoomMatrixData = zoomTransform.split(/\s*[(),]\s*/).slice(1, -1);
var scale = 1, x = 0, y = 0;
var buttonCSS = {
transformOrigin: ‘’,
transform: ‘’
};
if (zoomMatrixData.length == 6) { // matrix(a, b, c, d, tx, ty)
scale = 1 / zoomMatrixData[0];
if (scale != 1) {
x = -zoomMatrixData[4];
y = -zoomMatrixData[5];
buttonCSS.transform = ‘scale(’ + scale + ', ’ + scale + ‘) translate(’ + x + 'px, ’ + y + ‘px)’;
}
}
for (var i = 0; i < $buttonNodes.length; ++i) {
var $buttonNode = $buttonNodes[i];
if (scale != 1)
buttonCSS.transformOrigin = '-' + $buttonNode.css('left') + ' -' + $buttonNode.css('top');
$buttonNode.css(buttonCSS);
}
}
// request update button in next animation frame
requestAnimationFrame(invertZoom);
}
requestAnimationFrame(invertZoom);