0 Replies Latest reply on Nov 23, 2014 10:56 PM by busyspin

    Want to programmatically set zoom on yworks GraphCanvasComponent with ActionScript

    busyspin Level 1

      I am using flex 3.6 for Java and yworks version 2.8.

       

      I am having trouble manually setting the zoom on a GraphCanvasComponent in my mxml actionscript code.  The zoom property is bound to a slider.  Here is an except of the binding:

       

              <yworks:GraphCanvasComponent

              id="graphCanvas"

                  width="100%"

                  height="100%"

                  minZoom="0.25"

                  maxZoom="8"

                  mouseWheelZoomFactor="1.02">

       

       

             <mx:HSlider

                id="zoomSlider"

                  width="150"

                  showDataTip="false"

                  change="{graphCanvas.zoom=Math.pow(2,event.value)}"

                  liveDragging="true"

                  tickInterval="1.0"

                  value="{Math.log(graphCanvas.zoom)/Math.log(2)}"

                  labels="{[graphCanvas.minZoom, graphCanvas.maxZoom]}"

                  minimum="{Math.log(graphCanvas.minZoom)/Math.log(2)}"

                  maximum="{Math.log(graphCanvas.maxZoom)/Math.log(2)}"/>

                  <!-- the slider's minimum, maximum and value are bound

                    to the corresponding properties on graphCanvas -->

       

       

      However, when I manually set the zoom property on the GraphCanvasComponent in action script, it appears to get set but the actual graph does not zoom and the slider does not move to reflect the new value.

       

      Here is my action script code.  It is a callback from a RoundtripHandler event in case that matters.

       

        private function onNetworkTopologyUpdateComplete(

         event:RoundtripEvent):void

        {

             graphCanvas.zoom = 4.0;

          }

       

      Please let me know how I can make a programmatic change to the zoom on my component.  Thanks!