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 7978619
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T09:32:24+00:00 2026-06-04T09:32:24+00:00

I have a (2D) computational geometry library I’m working on, and I’d like to

  • 0

I have a (2D) computational geometry library I’m working on, and I’d like to be able to spit out pictures to help debug. The primitives I want are points, line segments, and text. But I don’t know before hand what scale I’ll be interested in looking at (maybe only a small part of the polygon isn’t working right), so I need to be able to zoom and pan around the image as well.

I hooked up SVGPan to pan and zoom in my generated images when I view them in Chrome, but (understandably) all the primitives are scaling with the zoom, since SVGPan works just by using a scaling transform. So zooming in doesn’t help figure out what’s going on in very small feature regions.

I found the vector-effect property, which fixes the line segments quite nicely by letting me specify a width in pixels. But it doesn’t help me manage the text. Ideally it’d be 12 pt no matter how large the transform scale is.

And I’m also still at a loss about drawing points. I thought I could use circles, but the radius also scales, so if you zoom in too far it just looks like a bunch of circles instead of points. If I use the vector-effect property, the stroke width of the circle won’t scale anymore, but the radius of the circle still does. So I end up with large circles with thin outlines, instead of a small circle a pixel or two in radius.

Is there a way to only scale positions for elements, maybe? I really always want the lines, points, and text to appear the same size regardless of scale, and only have their positions scale. My SVG files are all machine generated and strictly to help me coding, so I don’t mind odd hacks, if anyone has any ideas. Or if there’s another technology instead of SVG that would make more sense for this use case.

  • 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-04T09:32:25+00:00Added an answer on June 4, 2026 at 9:32 am

    I’ve answered this question more in-depth in these questions:

    • How to draw non-scalable circle in SVG with Javascript
    • Preserve descendant elements' size while scaling the parent element

    In short, you want to (a) use transform="translate(…,…) to position the unscaling elements and (b) each time you adjust the transform on some wrapper (like SVGPan does) pass each element you want to not scale to this function:

    // Copyright 2012 © Gavin Kistner, !@phrogz.net
    // License: http://phrogz.net/JS/_ReuseLicense.txt
    
    // Counteracts all transforms applied above an element.
    // Apply a translation to the element to have it remain at a local position
    function unscale(el){
      var svg = el.ownerSVGElement;
      var xf = el.scaleIndependentXForm;
      if (!xf){
        // Keep a single transform matrix in the stack for fighting transformations
        xf = el.scaleIndependentXForm = svg.createSVGTransform();
        // Be sure to apply this transform after existing transforms (translate)
        el.transform.baseVal.appendItem(xf);
      }
      var m = svg.getTransformToElement(el.parentNode);
      m.e = m.f = 0; // Ignore (preserve) any translations done up to this point
      xf.setMatrix(m);
    }
    

    The answer to the first question above also describes a helper method designed to work directly with SVGPan so all you have to do is include my library (two functions), add a noscale class to each marker and then write something like:

    unscaleEach('#viewport .noscale');
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a computational geometry problem that I feel should have a relatively simple
I have a nested, mutual recursive data structure , and want to associate computational
I have a computationally expensive task in perl, and would like to inform the
Have a SomeLib.pro file that contains: CONFIG += debug TEMPLATE = lib TARGET =
Have someone tried out DeCAL in Delphi 2009? I'm thinking about upgrading from 2007,
I have a computational intensive project that is highly parallelizable: basically, I have a
I have a C# application which sometimes cost the CPU very high. I want
I have a computational process that takes quite a bit of time to perform
I have to do a final project for my computational linguistics class. We've been
I have an x86-64 computer running Linux that I would like to supplement with

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.