Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8940633
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T11:05:06+00:00 2026-06-15T11:05:06+00:00

I am doing zooming tool and have some problem with Sprite.setAttributes({scale: {…}); Centered by

  • 0

I am doing zooming tool and have some problem with Sprite.setAttributes({scale: {…});
Centered by center of canvas…

http://teempla.com/sites/all/themes/teamplan/d2d/ – here is it.

Try to draw two or more lines with pencil and press Zoom + you will see that there are floating. It’s Wrong. And strange, ‘corse they position relative center.

pice of click-event code:

click: function( e, t, eOpts ){
   d2dModel.set('zoom',d2dModel.get('zoom')+0.1);
  var draw = Ext.ComponentManager.get(Ext.select('.d2d-draw-panel',true).elements[0].id);
  for (var i in draw.surface.items.map){
     draw.surface.items.map[i].setAttributes({
        scale: {
           cx: d2dModel.get('width')/2,
           cy: d2dModel.get('height')/2,
           x: d2dModel.get('zoom'),
           y: d2dModel.get('zoom')
        }
     }, true);
 }
}

In Raphael.JS i made it with

el.transform('s'+zoom+','+zoom+','+w/2+','+h/2); 

And it works fine.

Thank’s for any ideas!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-15T11:05:08+00:00Added an answer on June 15, 2026 at 11:05 am

    Try zooming on your surface by using setViewBox

    http://docs.sencha.com/ext-js/4-1/source/Surface.html#Ext-draw-Surface-method-setViewBox

    What I did in my project was this:

        var bbox = draw.surface.items.getBBox();
        draw.surface.setViewBox(bbox.x, bbox.y, draw.getSize().width / zoomValue, draw.getSize().height / zoomValue);
    

    Note that this was during ext 4 beta, but it should be almost the same now.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have customized a canvas to support the zooming. I am doing this by
Doing some jquery animation. I have certain divs set up with an attribute of
Doing a request for the data on an individual video such as: http://gdata.youtube.com/feeds/api/videos/K-YBQ_at_qU?v=2&alt=jsonc Used
I have been doing Mandelbrot set and trying to zoom but zooming patters gets
I have a Problem with a UIScrollView CATiledLAyer stucture. What I'm doing is showing
For an art project, one of the things I'll be doing is zooming in
Doing the below will reproduce my problem: New WPF Project Add ListView Name the
Doing some homework here (second assignment, still extremely green...). The object is to read
I have a UIImageView inside of a UIScrollView. The parent scroll view allows zooming
Doing some project clean up, and rather than just relying on my human eyes

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.