Changeset 84 in tmcsimulator-scriptbuilder for trunk/src/scriptbuilder/gui/drawers/RangeSlider.java


Ignore:
Timestamp:
08/26/2017 03:46:13 PM (9 years ago)
Author:
jdalbey
Message:

RangeSlider?: Fix defect that was allowing slider thumb to be dragged too far right.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/scriptbuilder/gui/drawers/RangeSlider.java

    r27 r84  
    102102        // Compute new value and extent to maintain upper value. 
    103103        int oldExtent = getExtent(); 
    104         int newValue = Math.min(Math.max(getMinimum(), value), oldValue + oldExtent); 
     104        // Ensure value is greater than minimum allowed 
     105        int lower = Math.max(getMinimum(), value); 
     106        // Ensure value is less than maximum allowed 
     107        // Fix defect that was letting lower thumb go to far right. 
     108        // Note this still allows the mouse to drag it beyond limit, 
     109        // but when released it returns to proper place. 
     110//        int newValue = Math.min(lower, oldValue + oldExtent); 
     111        int newValue = Math.min(lower, getMaximum() - oldExtent); 
    105112        // Hacked to not change the extent (move the entire slider) 
    106113        //int newExtent = oldExtent + oldValue - newValue; 
Note: See TracChangeset for help on using the changeset viewer.