[Yt-svn] yt: Adding set_width to vm_panner
hg at spacepope.org
hg at spacepope.org
Wed Jul 7 21:16:13 PDT 2010
hg Repository: yt
details: yt/rev/8c4c5f4ea326
changeset: 1878:8c4c5f4ea326
user: Matthew Turk <matthewturk at gmail.com>
date:
Wed Jul 07 21:15:54 2010 -0700
description:
Adding set_width to vm_panner
diffstat:
yt/extensions/image_panner/vm_panner.py | 15 +++++++++++++++
1 files changed, 15 insertions(+), 0 deletions(-)
diffs (32 lines):
diff -r 39fb3196b524 -r 8c4c5f4ea326 yt/extensions/image_panner/vm_panner.py
--- a/yt/extensions/image_panner/vm_panner.py Wed Jul 07 17:26:23 2010 -0700
+++ b/yt/extensions/image_panner/vm_panner.py Wed Jul 07 21:15:54 2010 -0700
@@ -26,6 +26,7 @@
from yt.raven import FixedResolutionBuffer, ObliqueFixedResolutionBuffer
from yt.lagos import data_object_registry, AMRProjBase, AMRSliceBase, \
x_dict, y_dict
+from yt.funcs import *
class VariableMeshPanner(object):
_buffer = None
@@ -161,6 +162,20 @@
self.ylim = (low[1], high[1])
return na.log10(self.buffer)
+ def set_width(self, width):
+ """
+ This sets the width based on the current center.
+ """
+ if not iterable(width): width = (width, width)
+ Wx, Wy = self.width
+ centerx = self.xlim[0] + Wx*0.5
+ centery = self.ylim[0] + Wy*0.5
+ self.xlim = (centerx - width[0]/2.0,
+ centerx + width[0]/2.0)
+ self.ylim = (centery - width[1]/2.0,
+ centery + width[1]/2.0)
+ self._run_callbacks()
+
def set_limits(self, xlim, ylim):
"""
This accepts a new *xlim* and *ylim*.
More information about the yt-svn
mailing list