Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Irregular rotation of an image in google chrome. #3513

Closed
alexsilva opened this issue Aug 31, 2022 · 1 comment
Closed

Irregular rotation of an image in google chrome. #3513

alexsilva opened this issue Aug 31, 2022 · 1 comment

Comments

@alexsilva
Copy link

alexsilva commented Aug 31, 2022

Describe the bug
Image rotation does not occur smoothly when clicking rotation buttons. It seems calling animate with value + 'deg' causes the problem (the slider doesn't have this problem).

To Reproduce
Steps to reproduce the behavior:

  1. Select an image with the 'resize' plugin properly configured and activated.
  2. Select the rotate and resize menu.
  3. Click on the rotate menu.
  4. Click the rotate 90 degrees button.
  5. See error

Expected behavior
I expect smooth rotation between different angle -90, -180, -270 and -360 or 90, 180, 270 and 360.

Screenshots
If applicable, add screenshots to help explain your problem.

Desktop (please complete the following information):

  • OS: [Windows]
  • Browser [chrome]
  • Version [104.0.5112.102 64 bits]

Additional context
I already understand that the problem is in the image update function.

resize.js#L913

update : function(value, animate) {
	if (typeof value == 'undefined') {
		rdegree = value = parseInt(degree.val());
	}
	if (typeof animate == 'undefined') {
		animate = true;
	}
	if (! animate || fm.UA.Opera || fm.UA.ltIE8) {
		imgr.rotate(value);
	} else {
		imgr.animate({rotate: value + 'deg'});
	}
	value = value % 360;
	if (value < 0) {
		value += 360;
	}
	degree.val(parseInt(value));

	uidegslider.slider('value', degree.val());
	
	rotate.setQuality();
}

See that with this small snippet of code solve the problem for me.

} else if (fm.UA.Chrome) {
    imgr.animate({rotate: value});

And the complete code with the fix.

update : function(value, animate) {
	if (typeof value == 'undefined') {
		rdegree = value = parseInt(degree.val());
	}
	if (typeof animate == 'undefined') {
		animate = true;
	}
	if (! animate || fm.UA.Opera || fm.UA.ltIE8) {
		imgr.rotate(value);
	} else if (fm.UA.Chrome) {
		imgr.animate({rotate: value});
	} else {
		imgr.animate({rotate: value + 'deg'});
	}
	value = value % 360;
	if (value < 0) {
		value += 360;
	}
	degree.val(parseInt(value));

	uidegslider.slider('value', degree.val());
	
	rotate.setQuality();
}
@nao-pon nao-pon closed this as completed in bcda6e2 Sep 1, 2022
@nao-pon
Copy link
Member

nao-pon commented Sep 1, 2022

@alexsilva Thanks! 👍

Bit-Code-Developer pushed a commit to Bit-Apps-Pro/elFinder that referenced this issue Oct 22, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants