Make WordPress Core

Opened 12 years ago

Closed 11 years ago

#22011 closed defect (bug) (fixed)

Janky behavior with imageEdit.scaleChanged() in inline image editor

Reported by: drewapicture's profile DrewAPicture Owned by: nacin's profile nacin
Milestone: 3.5 Priority: normal
Severity: normal Version: 3.4.2
Component: Media Keywords: dev-feedback has-patch
Focuses: Cc:

Description

As noted in ticket:21391:39, there's some janky behavior when tabbing between the width and height scaling values in the inline image editor. Tabbing between values appears to increment the values down 1 unit at a time. Short screencast to illustrate: http://screencast.com/t/tPiq9KlYVzzj

My best guess is something with the imageEdit logic in image-edit.js. Javascript is not my forte.

I reproduced in FF15 on trunk and @ocean90 in Chrome on 3.4.2.

Attachments (1)

22011.patch (669 bytes) - added by SergeyBiryukov 11 years ago.

Download all attachments as: .zip

Change History (9)

#1 @nacin
12 years ago

  • Milestone changed from Awaiting Review to 3.5

#2 @DrewAPicture
12 years ago

  • Keywords punt added

The scaling ratio works, there's just some weirdness with moving between the values. I propose we look at this in the next cycle.

#3 @helenyhou
12 years ago

You know... I bet it's a problem with rounding. Looks like it's probably floor-ing, which will keep ticking numbers down if it doesn't divide evenly. Just tried it on a square image and it didn't do that, but can reproduce on others. Not sure about a punt - does feel kind of buggy.

#4 @helenyhou
12 years ago

  • Keywords punt removed

#5 @SergeyBiryukov
11 years ago

  • Keywords has-patch added

#6 @SergeyBiryukov
11 years ago

this.intval() removes the fractional part, which leads to unwanted decrementing.

Math.round() gives more accurate results and doesn't trigger unwanted incrementing in my testing.

#7 @SergeyBiryukov
11 years ago

To reproduce:

  1. Click "Edit Image" on a non-square image (e.g. 1000 × 662).
  2. Click "Scale Image".
  3. If the width is 1000px, change that to a non-round number (e.g. 999 × 661).
  4. Keep tabbing between the width and height values. You'll see 998 × 661, 996 × 660, 995 × 659, 993 × 658, etc.
Last edited 11 years ago by SergeyBiryukov (previous) (diff)

#8 @nacin
11 years ago

  • Owner set to nacin
  • Resolution set to fixed
  • Status changed from new to closed

In 22592:

Round rather than floor values in image editing JS to avoid decrementing values on each run. props SergeyBiryukov. fixes #22011.

Note: See TracTickets for help on using tickets.