The Moth
Developer, Former MVP, now at Microsoft - Best of
2004
,
2005
,
2006
,
2007
,
2008
,
2009
« MIX08 Keynote Announcements
|
Home
|
Session 0 Isolation »
MultiScaleImage with mouse support-ish
Thu, March 6, 2008, 07:13 AM under
Silverlight
One of the demos that captures people's attention with some Silverlight 2 demos is the
Seadragon
-based technology that in Silverlight is called "DeepZoom". To see a good example of that in action look at the
Hard Rock Memorabilia site
or visit the
Vertigo site
(the guys that built the HR experience). The control behind all that is the
MultiScaleImage control
. You need to point the
Source property
of that to the output you get when you use the
DeepZoomComposer tool
. The tool basically takes an image and chops it up to more download-friendly bits that it distributes to folders.
My colleague MikeT had a play with it all and has a
quickstart on his blog
. One of the downsides of that approach is that it uses the keyboard for panning around and zooming. I thought I'd take that and try to offer navigation (left/up/right/down) via dragging the mouse and also zooming in by clicking the mouse. To zoom out, I had to keep with using the keyboard (Spacebar was my choice). Assuming that you have the Silverlight 2 runtime installed, the
results are here
. The source is work in progress but should anyone care about it too much I can share.
It was actually more work than I anticipated. Detecting mouse movement is easy, but making it scroll half-sensibly dependent on how zoomed in or out it is, and also to vary the drag speed dependent on how aggressively the mouse is moved was not as straightforward (to me). My example also doesn't really make as a good sample because I used an image that isn't sufficiently large or deep. To truly experience the beauty of the control, please visit the links at the top.
If you visit the links at the top you will also find that scrolling is much more natural because in addition to mouse clicking for zooming in, the mouse wheel is also used. Mouse wheel events are not directly supported in managed code and require javascript assistance. There is a sample that shows you how to do that on
mharsh's blog
(but it doesn't include the panning and zooming on click).
So if you aggregate all the sources of information I list above, you can come up with the complete sample
.
Comments [3]
|
Permalink
Friday, March 07, 2008 11:44:00 PM (Pacific Standard Time, UTC-08:00)
Very true, every example seemed to offer a part of the puzzle. I've written up my post here with my sample from thailand and full source code:
http://www.soulsolutions.com.au/Blog/tabid/73/EntryID/394/Default.aspx
John.
John
Sunday, March 09, 2008 7:42:00 AM (Pacific Standard Time, UTC-08:00)
Daniel - have you tried this in Firefox? It doesn't work for me (I don't see your app at all). I see what I was doing wrong with the HTML bridge but it doesn't help very much as the managed handler doesn't get the wheel data from FireFox from the "detail" property - it's always 0 for me. A pity as it's much neater than the JS solution. Mike
MikeO
Sunday, March 09, 2008 9:52:07 AM (Pacific Standard Time, UTC-08:00)
John: I have updated my solution to do everything I state above plus mouse wheel support without having to drop to JavaScript at all. Credit for the mouse wheel support goes to Pete:
http://blois.us/blog/2008/03/ive-heard-number-of-people-wondering.html
Mike: Thanks for reporting it not working on FireFox – indeed it didn't render at all. However, it had nothing to do with the mousewheel and all to do with my HTML which had no styles that FF apparently requires. Added those and now it all works fine. Thanks again to you, and big boo to all my other readers for not reporting this (or big cheer for using IE like me :-p)
Daniel Moth
Comments are closed.
About
My team's page on MSDN
Subscribe
Contact Form
My screencasts on channel9
Tags
AboutPresenting (5)
Blogging (7)
Career (5)
Communication (5)
dotNET (120)
Events (93)
GPGPU (2)
HPC (6)
IE7 RSS (6)
Links (129)
LINQ (23)
MobileAndEmbedded (148)
Orcas (128)
ParallelComputing (63)
Personal (32)
Random (42)
SideShow (12)
Silverlight (17)
SoftwareProcess (3)
UAC (14)
UserInterfaceDesign (5)
Vista (84)
VisualStudio (112)
Whidbey (31)
Windows (90)
WindowsServer2008 (3)
Latest Posts
Parallel Computing Platform Developer Lab
Slides and code for MPI Cluster Debugger
DirectCompute
GPGPU
Code for Parallelism Features Tour
Managed code and the Shell – Do?
Dev Lead Job opening on my team
Best of "The Moth" 2009
Bug Triage
Parallel Computing Features Tour in VS2010
MPI Cluster Debugger launch integration in VS2010
Parallel Debugging
"Parallel Programming Talk" show
Message Passing Interface (MPI)
Windows HPC Server links
Extension Manager in Visual Studio 2010
Core debugger enhancements in VS2010
Dump debugging with Parallel Stacks
Slides for Parallel Debugging windows
MPI Project Template for VS2010
Archives
March, 2010 (2)
February, 2010 (3)
January, 2010 (3)
December, 2009 (1)
November, 2009 (11)
October, 2009 (12)
September, 2009 (1)
August, 2009 (6)
July, 2009 (5)
June, 2009 (3)
May, 2009 (7)
April, 2009 (5)
March, 2009 (3)
February, 2009 (4)
January, 2009 (6)
December, 2008 (3)
November, 2008 (12)
October, 2008 (6)
September, 2008 (9)
August, 2008 (5)
July, 2008 (5)
June, 2008 (8)
May, 2008 (18)
April, 2008 (11)
March, 2008 (13)
February, 2008 (17)
January, 2008 (15)
December, 2007 (20)
November, 2007 (25)
October, 2007 (19)
September, 2007 (11)
August, 2007 (31)
July, 2007 (24)
June, 2007 (19)
May, 2007 (24)
April, 2007 (18)
March, 2007 (35)
February, 2007 (34)
January, 2007 (17)
December, 2006 (18)
November, 2006 (17)
October, 2006 (23)
September, 2006 (22)
August, 2006 (15)
July, 2006 (15)
June, 2006 (13)
May, 2006 (10)
April, 2006 (5)
March, 2006 (1)
February, 2006 (1)
January, 2006 (2)
December, 2005 (5)
November, 2005 (4)
October, 2005 (3)
September, 2005 (8)
August, 2005 (17)
July, 2005 (11)
June, 2005 (7)
May, 2005 (24)
April, 2005 (15)
March, 2005 (15)
February, 2005 (18)
January, 2005 (23)
December, 2004 (24)
November, 2004 (25)
October, 2004 (10)
September, 2004 (23)
August, 2004 (12)
July, 2004 (1)