On 2010-11-10 19:15, Olivier Croquette wrote:
I would like to commit the patch below to increase the precision of
the PicLayer rotation and scaling.
Since i have a SVN account, I can technically just do it, but what's
the process to do so ? Is there a review ? A defined process ?

the process is easy: just submit the patch to the issue tracker [1], with the subject starting with "[PATCH]" [2] - and it will be reviewed. also make sure there doesn't exist a similar issue yet by using a custom query against the piclayer component [3]. note that it might take a while to get some feedback [4].

[1] http://josm.openstreetmap.de/ > New Ticket
[2] http://www.mail-archive.com/[email protected]/msg03922.html
[3] http://josm.openstreetmap.de/query?status=assigned&status=closed&status=needinfo&status=new&status=reopened&component=Plugin+piclayer&groupdesc=1&group=status&col=id&col=summary&col=status&col=owner&col=type&col=priority&col=component&order=priority
[4] http://josm.openstreetmap.de/ticket/2961#comment:7

re: your patch: i also needed better precision of scaling a while ago. what i did was to patch the module to use a custom property (piclayer.scalefactor) instead of a hardcoded value (see attached patch). that way, i can adapt the scaling to my need: use the default most of the times, but get more precise scaling (by changing the property in the preferences) when needed.

even better would be if this property wouldn't have to be set by hand but by some keyboard shortcut. eg. shift-up: increase precision, shift-down: decrease precision. and another one to reset it to default. maybe even show the current scalefactor in the status bar or somewhere. just some ideas :)

ax

svn diff
Index: 
src/org/openstreetmap/josm/plugins/piclayer/ScalePictureActionAbstract.java
===================================================================
--- src/org/openstreetmap/josm/plugins/piclayer/ScalePictureActionAbstract.java 
(revision 24177)
+++ src/org/openstreetmap/josm/plugins/piclayer/ScalePictureActionAbstract.java 
(working copy)
@@ -82,9 +82,13 @@

      @Override
      public void mouseDragged(MouseEvent e) {
          // Scale the picture
+        double multiplier = 1.0;
+        if ( ( e.getModifiersEx()&  e.SHIFT_DOWN_MASK ) != 0 )
+            multiplier = 0.2;
          if(mb_dragging) {
-            doTheScale( ( e.getY() - m_prevY ) / 500.0 );
+            doTheScale( multiplier * ( e.getY() - m_prevY ) / 500.0 );
              m_prevY = e.getY();
              Main.map.mapView.repaint();
          }
Index: src/org/openstreetmap/josm/plugins/piclayer/RotatePictureAction.java
===================================================================
--- src/org/openstreetmap/josm/plugins/piclayer/RotatePictureAction.java        
(revision 24177)
+++ src/org/openstreetmap/josm/plugins/piclayer/RotatePictureAction.java        
(working copy)
@@ -84,10 +84,14 @@

      @Override
      public void mouseDragged(MouseEvent e) {
          // Rotate the picture
+        double multiplier = 1.0;
+        if ( ( e.getModifiersEx()&  e.SHIFT_DOWN_MASK ) != 0 )
+            multiplier = 0.2;
          if(mb_dragging) {
              // TODO: Magic number
-            m_currentLayer.rotatePictureBy( ( e.getY() - m_prevY ) / 10.0 );
+            m_currentLayer.rotatePictureBy( multiplier * ( e.getY() - m_prevY 
) / 10.0 );
              m_prevY = e.getY();
              Main.map.mapView.repaint();
          }
--- ScalePictureActionAbstract.java.orig        2010-09-01 02:12:14.015625000 
+0800
+++ ScalePictureActionAbstract.java     2010-09-01 02:47:44.140625000 +0800
@@ -84,7 +84,7 @@
     public void mouseDragged(MouseEvent e) {
        // Scale the picture
         if(mb_dragging) {
-            doTheScale( ( e.getY() - m_prevY ) / 500.0 );
+            doTheScale( ( e.getY() - m_prevY ) / 
Main.pref.getDouble("piclayer.scalefactor", 500));
             m_prevY = e.getY();
             Main.map.mapView.repaint();
         }
_______________________________________________
josm-dev mailing list
[email protected]
http://lists.openstreetmap.org/listinfo/josm-dev

Reply via email to