Zoom scroller "to fit"?

I have a group component in a scroller.  My application will add children to this component.  The component's scale is set with a Spark HSlider.  Fine.
However, I'd like to provide a "zoom to fit" button.  I can get the size in pixels of all the children added, no problem. My question is how I can use this dimension to properly set the scaleX and scaleY so it fits in the viewport.
<s:Group id="clipWindow" width="720" height="480">
     <s:Scroller id="imgScroll" top="0" left="0" bottom="0" right="0">
          <s:Group id="bgimg" scaleX="{scaleSlider.value}" scaleY="{scaleSlider.value}">
               <com:WorkshopStage id="ws" />
          </s:Group>
     </s:Scroller>
</s:Group>

Basicly this is only math stuff. Here is what you will have to write inside your "Zoom To Fit" handler:
bgimg.scaleX = bgimg.scaleY = Math.min(clipWindow.width  / ws.width,
                                       clipWindow.height / ws.height,
                                       1);
Now this formula only scales down your bgimg if it (actually I use dimensions of ws but that does not matter here) is larger than the clipWindow. If it is smaller, scale will be 1: it won't scale up.
And as you can see there is no need for calculating the size of ws manually by somehow checking all children: flex does that for you when components are measured.
Michael

Similar Messages

  • Zoom grid to fit?

    Suppose I have a grid inside a scrollviewer. Is there a way to make the grid zoom to fit the height of the scrollviewer? If a scrollviewer shouldn't be used, what should I use to make this happen?
    What I'm trying to accomplish is have a grid or stack or usercontrol inside a container.  Then I can programmatically change the size of the container and I want the child inside to zoom to fit the height of the container.

    I'm talking about the zoom property of the scrollviewer.
    I've already built these usercontrols very precisely size-wise.  This is for an LOB.  I don't want to go back and change the sizes of the textboxes and other things in the dozens of usercontrols.
    Before, I fitted 2 of these in a single printout page.  Now, I want to fit 6.  And since I don't want to go through and change the fontsizes and all the other properties, putting them in scrollviewers and use the zoom property
    seems the logical choice.
    I've managed to scale the zoom perfectly to fit 6 usercontrols in a single page and still have very neatly printed out pages.  The guys in the office will like this when I send out the upgrade. 
    My next logical step is I want to give the user the ability to control the sizes of the usercontrols.  This is where my question comes in.  Is there a way to make the zoom auto-fit? 
    The point is not to have any scrolling going on for each usercontrol.  The entire page is scrollable, but my colleagues want to see what will print when they work with my app.  This is why each page is scrollable, but the usercontrols have to be zoomed
    to the sizes they want to give to the scrollviewers.  Make sense?

  • How can i disable the zoom scroll

    How can I disable the zoom scroll in places to copy map to pages????

    If you are trying to copy the world map from the main "Places" screen the only way I see is to do a screen shot and use it - I do not think there is a way to get a high res copy of that map
    Suggest to Apple - iPhoto menu ==> Provide iPhoto feedback
    LN

  • Source Monitor Zoom Scroll Bar Problem

    Hello!
    I am hoping there is a quick fix for this. After the update I noticed my source monitor zoom scroll bar resets it's bar length
    whenever I set an in or out point. This is driving me nuts since the bar usually resets to a size where I can't see
    my in and out points anymore.
    Any help would is much appreciated!

    Hi SongImageProdctions,
    Thanks for contacting Adobe Forums,
    please follow this thread : http://forums.adobe.com/thread/1276947?tstart=0
    Thanks,
    Sandeep

  • Zooming, scrolling and moving in large images

    I'd like to create a document viewer that works like Google Maps or Safari. Basically the "image" of the document is so big that I only want to load parts of it when the user actually goes over to that part of it.
    How can I enable zooming, scrolling and moving in "large" images like that?
    I looked for a tutorial or sample code, but I wasn't able to find anything.
    Any help would be appreciated,
    -Chris.

    I have 4 Gbyte of RAM. I tried to close every applications but the problem remains. You are right about Web Browser problems but unfortunately my problem is related with Finder windows too. I have 800 Mbyte of free RAM.
    Another fact I can say to you is that when I move Finder window (or other windows as I wrote before) the area outside the border of the window is repainted not well with puzzle effect. I think the problem is related to desktop refresh and repaint. It seems that graphic acceleration doesn't work for some window!!!!

  • Maps zoom/scroll with Magic Mouse

    Hi
    In Maps.app, scrolling over the map with magic mouse, moving the map instead of zooming, i need to press SHIFT when i need zoom in or out. Other apps (google maps in safari, or google earth.app) working with zoom set as default. 
    How can i change this behaviour?

    I second this. seems like an oversight. i can live it, i'll just screw up every time I try maps because at this point, google Maps is still better. so it'll be quite some time before i think of Maps first.
    I do feel like Maps is just a Beta right now. There are 0 preferences.
    I tried using Better Touch Tool but it doesn't seem to work... i could be doing something wrong though.
    If someone figures out a trick with the BTT, and Maps, please let us know.
    In the mean time, apple has it's work cut out for it. Maps has Millions of Miles that needs updating/correcting/ect. perhaps in one of it's many to roll outs, they'll give us some preferences.

  • Adf Dvt bar graph zoom/scrolling to given zoom level

    Hi,
    I am developing a dashboard, where I need a functionality with bar graph, that will zoom bar graph at particular zoom level while loading.
    Please help me, How can I pass zoom level to bar graph to zoom in at loading time?
    Thanks,
    Jassi

    Thanks Vlad for response,
    <dvt:barGraph id="barGraph" subType="BAR_VERT_STACK" shortDesc="Query Result Graph"
    tabularData="#{demo.graphTabularDate}" seriesRolloverBehavior="RB_HIGHLIGHT"
    animationOnDisplay="auto" animationOnDataChange="alphaFade"
    dynamicResize="DYNAMIC_SIZE" imageFormat="AUTO" visualEffects="AUTO"
    binding="#{demo.graph}">
    <dvt:o1Axis scrolling="on" /> <!-- *** Here I have implemented zoom to but here I want, when I have lots of bar in graph then my graph loads with some initial zoom level or with max zoom***-->
    <dvt:legendArea scrolling="asNeeded" automaticPlacement="AP_NEVER" position="LAP_RIGHT" />
    <dvt:o1TickLabel tickLabelSkipMode="TLS_AUTOMATIC"/>
    </dvt:barGraph>

  • Why does my Macbook Pro keep zooming, scrolling, clicking, highlighting, etc. without me doing anything?

    For the past three days my Macbook Pro has been acting like it has a mind of its own.  It will randomly highlight things, scroll up and down, switch to dashboard, zoom in on the webpage I'm looking at, and click on things.  It does it when my fingers are on the trackpad both stationary and moving around, but also when I stop touching the computer altogether.  I've tried restarting the computer and it stops freaking out for a little while, but then goes back to it.  I updated my Mac software last night to see if that would help and it's still doing it.  Any ideas?  Should I take it in to a Mac store to get checked out?

    See My mouse keeps moving around on its own, as if someone is remotely controlling my Mac!
    (Note that my pages contain links to other pages that promote my services, and this should not be taken as an endorsement of my services by Apple.)

  • Adobe's Pan|Zoom component not fitting the content area

    I'm calling centerView method on handleLoadComplete event (ImageViewer.as) so the image will be adjusted to fit the content area when load is complete, but I'm having problems when testing this on Internet Explorer. Using Firefox it works fine, but on IE it only works after pressing Ctrl + F5.
    Do you know how can I fix this?

    Hi.
    Making it zoom and pan was a bit tricky, but I had it done
    two months ago (in july). The integration of the pan zoom with
    callout ("kind of spots on the map", the other published FIG
    componet) repositioning was bit tricky.
    I solved it with pointTransformations, but it was too
    expansive, in terms of memory. In my first trial, theyre positions
    were recalcuted as you pan and zoom.
    Now, in the version I published here
    http://www.gabriela.trindade.nom.br/?p=61
    you dont hav smooth zooming, and the callouts only are
    repositioned after your drop the map.
    I am working now on it. Im probably going to make then blurry
    or transparent while panning, but as I got this message from the
    foruns and I had promissed another guy who contacted me a (working)
    version, I decided to publish it on my blog.
    Hope it will be usefull.
    Please, be aware that not really a small application: it has
    lots of classes. Please read it all before contacting me with any
    doubts.
    Best luck :0)

  • Need a scroll and fit to width in screen on presentation mode

    I am using wireframe presentation in indesign, in web page design some pages are height is going high length, that time presentation mode shrink the page, that one is not good. that time we need some customisation for particular page width need to fit screen, and rest of things need scroll down. This feature really important for web page designer.   

    You'll need to make a feature request here:
    Adobe - Feature Request/Bug Report Form
    Normally, Adobe product managers don't view the forums. This is a user forum. They do read feature requests.

  • Need help with Wacom Bamboo Splash Zoom/Scroll Function

    In photoshop, and other non-adobe programs, holding ALT and the scroll/pan button on my stylus works in the same way as holding Alt and scrolling using the mouse wheel. However, in Illustrator, the only way I have managed to zoom in and out is using Ctrl and the pan/scroll button, which brings up the zoom tool, which I find annoying to use regularily. Is there any way for me to change Illustrator's interaction mode to mimic this function in Photoshop, or is there some function in the stylus' setup which I can change?
    Thanks in advance.

    Have you read that?
    http://forum.wacom.eu/viewtopic.php?f=10&t=14722

  • New zoom-mode between 'fit' and 'fill' (or change 'fit')

    At the moment, when Lightroom shows a photo in zoom-mode 'fit', there is some unused space around the photo, which means I don't get the maximum magnification in this mode. I can tell Lightroom to use that free space by setting the zoom-mode to 'fill'. While the 'fill' mode is useful, it hides part of the picture, which I can understand, but most of the time this is not what I want.
    I would like to see a new mode implemented that uses as much screenspace as possible without hiding part of it. This would result in a 'fit'-like-view with borders at only two sides instead of four.
    Cheers,
    Alex

    That is why I would prefer to see a new mode or a switch to let you and me choose how we would like to see it. You should be able to see photos the way you want (with borders), but I should equally be able to see photos the way I want (without 2 borders).
    I think there is no right or wrong in this case, just an opportunity to give us more configurability...
    Cheers,
    Alex

  • Why's My Cursor a Zoom Tool In Fit Size?

    Why did my cursor turn into a zoom tool with a photo sized to Fit;  and how can I make it go back to a normal arrow?
    It is only happening when the photo is sized to Fit.   At other sizes, the cursor is normal.      This just started after I finished using the Adjustment Brush.   I had used Cntrl +  to zoom a photo while using the Adjustment Brush.

    Your system must be quite different from mine.  When I am in the "fit" mode in the develop module my cursor has always been the zoom cursor.  And to zoom or reposition while the adjustment brush is active I have always pressed the space bar.  So I don't know why yours has changed.

  • Missing zoom function - Zoom image to fit window size?

    Hi
    Can anyone tell me if it's possible to zoom the image so it fits the current document window size? (Not Fit-To-Screen, as this will change the doc window size)
    Thanks
    Steve

    I don't think there is a button per se for this like there is for Fit to Screen, but can use any of the numerous zoom functions to make the document fit inside the document window.

  • How to smooth out zooming/scrolling image that jerks (CS4)?

    Hi guys/girls,
    Is there any way that i can smooth out images that zoom in/out with normal classic tween. they are so jittery it looks terrible. I even have a little bit of easing and frames per second set to 30.
    any info much appreciated!
    Jeff

    Hi flashfever,
    thanks for responding. can you elaborate on how i can use that? is it AS for the 1st frame or on the movie clip itself? etc
    in this case, i have the image fading in and enlarging from 70% to 100% in the same tween. its very jerky.
    thanks for your help so far!
    Jeff

Maybe you are looking for

  • SPED Fiscal - Imposto de Importação (registro C190, campo VL_OPR)

    Colegas, A pouco tempo implementamos as notas para atendimento à NT 2011.004 da SEFAZ e dentre as modificações que ela implementa, como vocês devem saber, ela cria uma nova categoria de imposto para o Imposto de Importação (II01). Com esta nova categ

  • Follow up to HD crash - Install disk can't see new Hard Drive !!!

    I may have a bigger problem on my hands. I rebooted with my original install disk of OS X and when it gets to the "choose location" window, it does not see the new hard drive......???? I'm thinking about re-checking connections and/or possibly pull t

  • ICC profiles assigned to text?

    CS5 (patched to 7.03), Mac OS 10.6.7 Hi Everyone, My production coordinator made a PDF of my magazine for the printer yesterday and when he ran it through PitStop, several errors turned up to the effect of text having an ICC profile assigned to it. T

  • Fire Wire Connect

    I have an older iMac ( pod type ) without a wireless connection. I have a MAC Mini. I have a firewire connecting the two. I can't figure our how to access the iMac from the Mini. I've tried everything that I know but the iMac will not show up on the

  • A PO for 2015

    Dear Experts, Our new sister concern firm wants to make a PO where the delivery date is 4 years hence (2015). How can we achieve this when SAP will not allow me to go 1 yr forward or back. I have already tried OB52, SCAL ,FMMI and FMIR. Please advice