History | Log In     View a printable version of the current page.  
Issue Details (XML)

Key: SDK-13009
Type: Bug Bug
Status: Closed Closed
Resolution: Not a Bug
Priority: C C
Assignee: Joan Lafferty
Reporter: Ryan Gardner
Votes: 2
Watchers: 2
Operations

If you were logged in you would be able to see more operations.
Flex SDK

Canvas clips left half of contents when it is zoomed in and horizontalCenter = 0

Created: 10/11/07 12:14 PM   Updated: 04/03/09 11:05 AM
Component/s: mx: Canvas View
Security Level: Public (All JIRA Users )

File Attachments: 1. File zoomCanvas.mxml (0.6 kb)
2. File zoomCanvas.swf (144 kb)
3. File zoomCanvasNew.mxml (1 kb)

Image Attachments:

1. umbrellas.jpg
(36 kb)

Severity: Incorrectly Functioning
Reproducibility: Every Time
Discoverability: Medium
Found in Version: SDK Moxie M3 (Beta 2)
Milestone:
Affected OS(s): All OS Platforms - All
Steps to Reproduce:
Steps to reproduce:
1. Create a canvas
2. Create a child of that canvas (such as SWFLoader or other DisplayObject) and set the style to have a horizontalCenter = 0
3. Set the scaleX and scaleY of that child object to a large value
 
 Actual Results:
 Document zooms in from center, and scroll grows from left size. The more you zoom into the document, the less of the left-hand side of the document is scrollable.
 
 Expected Results:
As the zoom level of the object increases, the canvas with an automatic scroll policy should add scroll bars sufficient to scroll through the entire document - not just the right side. (When the X:0 and Y:0 is set on the child object, it can be zoomed in and the entire child element will be scrollable. This is what leads me to expect the entire child element to be scrollable when it is horizontally centered as well.)
 
 
 Workaround (if any):
 
 
 
Language Found: English
Bugbase Id: none
Triaged: Yes
Regression: No
QA Owner: Joan Lafferty
Resolved by: Corey Lucier
Participants: Corey Lucier, Hans Muller, Joan Lafferty, Pedro Teixeira, Ryan Gardner, Rémy Roy, Scott Roberts and Steve Breinberg
Browser: Safari
JDK: Sun 1.6.x


 All   Comments      Sort Order:
Joan Lafferty - [10/11/07 12:54 PM ]
I confirmed this behavior in Moxie and in Flex 2.0.1. If you increase the scaleX and scaleY properties, the Canvas does not produce enough of a scrollbar to scroll through the entire image. To reproduce this with the Application that I have uploaded, do the following:

1. Load the application.
2. Using the horizontal slider, increase the scaleX and scaleY properties to something like 1.45.
3. Try to use the horizontal scrollbar to scroll to the left most edge of the photo.

Results, the left umbrella is cut off and you can't scroll to the left most edge.

This is not a regression, however.

Rémy Roy - [11/02/07 12:43 PM ]
We have the same issue here.

We are creating a image viewer application that display a list of thumbnails and a central image. Our central image is in a canvas with horizontalCenter = 0 and verticalCenter = 0. We use the scaleX and scaleY properties of the image to zoom in or out within our application. When the zooming cause the canvas to have scrollbar, a section of the top and a section of the left part of the image is not displayed. It looks like there is not enough space in the scrolling area to display it all.

Severity: Incorrectly Functioning
Found in Version: SDK Moxie M3 (Beta 2) (build 3.0.183654)
Reproducibility: Every Time
Affected OS(s): Windows 2003
Language Found: English
Browser: Internet Explorer 7.x
Player version: 9,0,60,235
CPU: Intel Core 2 6400 @ 2.13GHz
Memory: 2 Gig

Corey Lucier - [11/04/07 11:27 PM ]
Flex is working as designed here. With box model overflow, any portion of a child in negative coordinate space is clipped and does not count towards overflow width (or height).

In the zoom example, when the child image becomes larger than the parent canvas, it is centered relative to the canvas (as intended) but its left and top is now in negative space. And the portion in negative coordinate space is what you don't see (by design).

For example if you had a 10x10 box positioned at -10, -10 within a canvas, it would not inherently trigger overflow (scrollbars), and is hidden from the user.

The same behavior is present with CSS overflow, see the HTML document below:

<html>
<head>
</head>
<body>
<p>The overflow property decides what to do if the content inside an element exceeds the given width and height properties.</p>
<div style="overflow:scroll;width:150px;height:150px;">
<div style="position:relative;top:-20px; width:150px; height:200px;">
Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo
</div>
</div>
</body>
</html>

See also the attached revised sample (zoomCanvasNew) that takes this overflow behavior into consideration. The approach is that the child image is constrained to the positive coordinate space, making use of horizontalCenter and verticalCenter only up to the point of overflow.


Corey Lucier - [11/04/07 11:36 PM ]
Recommend resolving (works as designed). See above explanation.

Steve Breinberg - [11/05/07 10:27 AM ]
Resolving as Not a Bug, in light of Corey's explanation.

Scott Roberts - [02/19/09 11:40 AM ]
Bug.

OK, it's as designed. So, you could say not a bug. But let's instead question the design.

We have a real world need not being met - how can we meet it?

Peter on http://www.sephiroth.it/weblog/archives/2007/11/flex_canvas_bug_when_it_is_zoomed_in.php said it well, "[the issue] is not in the zooming or positioning of image on the canvas, but it is in maintaining the scroller positioning. The scrollers should be positioned at the center when you zoom in towards the center."

This would meet my needs.

Scott Roberts - [02/20/09 01:08 PM ]
Have not read it yet, but perhaps Flex 4 will help ...

http://opensource.adobe.com/wiki/display/flexsdk/Gumbo+Viewport

Hans Muller - [03/03/09 10:55 AM ]
Currently the Gumbo scrolling classes behave the same was as Halo did in this situation. However I've run into the same mismatch between intuition and implementation myself, and I think we could do better in Gumbo.

I think what people intuitively expect to be able to do in this case is to constrain the location of the viewport when it's smaller than the available space within the FxScroller. So if you've specified verticalCenter="0" what you mean is vertically center the viewport within the FxScroller until the viewport is consuming all of the available vertical space. Once it gets bigger than that, we show a vertical scrollbar and ignore the verticalCenter constraint.

Making FxScrollBarLayout respect left,right,top,bottom and vertical,horizontalCenter (for this case) wouldn't be too difficult.


Pedro Teixeira - [04/03/09 11:05 AM ]
This is a BUG... a desktop application should not behave like this period.

Here's a workaround I use (it basically binds it to the left as soon as it goes outside the screen and centers it when it fits the screen again):

// FOR HORIZONTAL
if(image.x < 0){
    holderBox.setStyle("horizontalAlign", "left");
}else if(image.width < holderBox.width){
    holderBox.setStyle("horizontalAlign", "center");
}

// FOR VERTICAL
if(image.y < 0){
    holderBox.setStyle("verticalAlign", "top");
}else if(image.height < holderBox.height){
    holderBox.setStyle("verticalAlign", "middle");
}

I hope this helps anyone...

Cheers,
Pedro