SOURCE CODE: Zoom and Pan
VIEW EXAMPLE

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
  <title>Zoom and Pan | JavaScript Examples | UIZE JavaScript Framework</title>
  <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
  <meta name="keywords" content="widget zoom Uize.Widget.ImagePort.Draggable"/>
  <meta name="description" content="See how a draggable image port lets you control zoom for an image in a view port by ctrl-clicking and dragging, or pan by just clicking and dragging."/>
  <link rel="alternate" type="application/rss+xml" title="UIZE JavaScript Framework - Latest News" href="http://www.uize.com/latest-news.rss"/>
  <link rel="stylesheet" href="../css/page.css"/>
  <link rel="stylesheet" href="../css/page.example.css"/>
</head>

<body>

<script type="text/javascript" src="../js/Uize.js"></script>

<h1 class="header">
  <a id="page-homeLink" href="../index.html" title="UIZE JavaScript Framework home"></a>
  <a href="../index.html" class="homeLinkText" title="UIZE JavaScript Framework home">UIZE JavaScript Framework</a>
</h1>

<div class="main">
  <h1 class="document-title">
    <a href="../javascript-examples.html" class="breadcrumb breadcrumbWithArrow">JAVASCRIPT EXAMPLES</a>
    Zoom and Pan
    <div class="pageActionsShell">
      <div id="page-actions" class="pageActions"><a href="source-code/image-port-zoom-and-pan.html" class="buttonLink">SOURCE</a></div>
    </div>
  </h1>

  <!-- explanation copy -->

  <div class="explanation">
    <p>In this example, an instance of the <a href="../reference/Uize.Widget.ImagePort.Draggable.html"><code>Uize.Widget.ImagePort.Draggable</code></a> class is created to display a large image inside a small image port and then to allow the user to zoom and pan the image inside the port using the mouse. To pan, simply click-and-drag inside the image port. The change zoom level, use the ctrl modifier key: ctrl-drag-up zooms in, and ctrl-drag-down zooms out.</p>
  </div>

  <div id="page_imagePort" style="position:relative; width:700px; height:380px; overflow:hidden; background:#000; margin:auto; border:1px solid #555;">
    <img id="page_imagePort-image" src="http://upload.wikimedia.org/wikipedia/commons/9/9c/Aldrin_Apollo_11.jpg" style="width:2700px; height:2700px; position:absolute;" alt=""/>
  </div>
</div>

<!-- JavaScript code to activate the image port functionality -->

<script type="text/javascript">

Uize.require (
  [
    'UizeSite.Page.Example.library',
    'UizeSite.Page.Example',
    'Uize.Widget.ImagePort.Draggable'
  ],
  function () {
    'use strict';

    /*** create the example page widget ***/
      var page = window.page = UizeSite.Page.Example ();

    /*** add the draggable image port child widget ***/
      page.addChild (
        'imagePort',
        Uize.Widget.ImagePort.Draggable,
        {
          maxSizingValue:10,
          minSizingValue:1,
          sizingLowerBound:'0',
          sizingUpperBound:'fill',
          sizingValue:1,
          alignX:.5,
          alignY:.5
        }
      );

    /*** wire up the page widget ***/
      page.wireUi ();
  }
);

</script>

</body>
</html>