Menu

Zoom to 100% as a menu pick

Bal Simon
2017-06-23
2017-09-08
  • Bal Simon

    Bal Simon - 2017-06-23

    The toolbar provides a way to zoom to 100%. But this is not available from the menu. Which means I can't set a hotkey for it. If it's at all possible, I'd very much like to be able to have this choice as a menu pick.

    Thoughts?

    Thanks.
    - Bal

     
  • Ken Hill

    Ken Hill - 2017-06-23

    +1 I could use that, too. I suspect there is a one-line script for this.

     
  • Luigi Kang

    Luigi Kang - 2017-06-24

    This is the (suspected) one-line script. :p

    c.setZoom(1)
    

    Once the script is loaded and appears in the file menu, you can assign a hotkey to it.

     
  • Bal Simon

    Bal Simon - 2017-06-24

    Works great - and hotkey assigned!
    However, I didn't find it in under the File menu. Rather I found it
    under the Scripts submenu, under the Tools menu.

    Thank you very much, Luigi. :)
    - Bal

     

    Last edit: Bal Simon 2017-06-24
    • Luigi Kang

      Luigi Kang - 2017-06-26

      I meant file menu as in menu bar, sorry for my poor choice of words, and I'm glad you found it under Tools -> Scripts -> (script name here).

       
  • Ken Hill

    Ken Hill - 2017-06-24

    Luigi,

    c.setZoom(1)

    Thanks. Do you know - if Zoom(1) = 100% , what are other options?

    [edit] after a little experimentation, .5 = 50% ; 2.5 = 250% ; etc

     

    Last edit: Ken Hill 2017-06-24
    • Luigi Kang

      Luigi Kang - 2017-06-26

      Yes, that's correct inference.

      If you''d like a input box where you can type in the percentage of your desired zoom level, similar to the one you'd get by pressing ctrl+y when using Adobe Acrobat Reader, you can use the following script.

      def percent = javax.swing.JOptionPane.&showInputDialog 'Zoom To (%)' toInteger()
      c.setZoom(percent/100)
      
       
  • Cadux

    Cadux - 2017-09-08

    Thanks for the script!
    I'd also suggest zoom to 100% be added in the default toolbar, in order less experienced users can take advantage of the feature too.

     
  • Cadux

    Cadux - 2017-09-08

    Hi.
    Is it possible to add the command "center selected node" to the script?
    The idea is to zoom to 100% then "center selected node" in same script.
    Thanks!

     
    • Luigi Kang

      Luigi Kang - 2017-09-09

      Here's a script that also centers the selected node.

      String percent = ui.showInputDialog(node.delegate, 'Zoom To Magnification (%)', '100')
      if (percent?.isInteger()) {
      c.setZoom(percent.toInteger()/100)
      c.centerOnNode(node)
      }
      else
      c.statusInfo = 'Please provide a valid number.'
      

      Cadux, have you checked out the script, MapInsight? It has a connection manager tool that you wanted.

       
  • Cadux

    Cadux - 2017-09-09

    Many thanks for the script Luigi Kang!

     
  • sfpcom

    sfpcom - 2017-09-10

    Thank you Luigi, nice script, I find it very useful.
    Sfpc