diff options
author | Sven Göthel <[email protected]> | 2024-01-07 04:51:17 +0100 |
---|---|---|
committer | Sven Göthel <[email protected]> | 2024-01-07 04:51:17 +0100 |
commit | cf0c60eaabd7334c0ae2099a1f999032cddf14dd (patch) | |
tree | 5b1cada8596d14fef90715405daa64a36812b129 /src/graphui/classes/com | |
parent | e9e1732dc6691cb72920f25b1fb8431e94c7b561 (diff) |
GraphUI RangeSlider.addMark(): Return the mark-shape and use double itemLen (in sliding direction) for better visibility
Diffstat (limited to 'src/graphui/classes/com')
-rw-r--r-- | src/graphui/classes/com/jogamp/graph/ui/widgets/RangeSlider.java | 31 |
1 files changed, 21 insertions, 10 deletions
diff --git a/src/graphui/classes/com/jogamp/graph/ui/widgets/RangeSlider.java b/src/graphui/classes/com/jogamp/graph/ui/widgets/RangeSlider.java index 4c608128e..1573c8fb1 100644 --- a/src/graphui/classes/com/jogamp/graph/ui/widgets/RangeSlider.java +++ b/src/graphui/classes/com/jogamp/graph/ui/widgets/RangeSlider.java @@ -1,5 +1,5 @@ /** - * Copyright 2010-2023 JogAmp Community. All rights reserved. + * Copyright 2010-2024 JogAmp Community. All rights reserved. * * Redistribution and use in source and binary forms, with or without modification, are * permitted provided that the following conditions are met: @@ -355,15 +355,26 @@ public final class RangeSlider extends Widget { public GraphShape getKnob() { return knob; } public Group getMarks() { return marks; } public RangeSlider clearMarks(final GL2ES2 gl, final RegionRenderer renderer) { marks.clear(gl, renderer); return this; } - public RangeSlider addMark(final float value, final Vec4f color) { - final float sizexy = horizontal ? size.y() : size.x(); - final GraphShape item = new Rectangle(knob.getRenderModes(), sizexy, sizexy, 0); - final Vec2f pos = getItemValuePos(new Vec2f(), value, sizexy, sizexy); - item.setInteractive(false).setToggleable(false).setDraggable(false).setResizable(false); - item.setColor(color); - item.moveTo(pos.x(), pos.y(), 0); - marks.addShape(item); - return this; + public Shape addMark(final float value, final Vec4f color) { + final float sizex, sizey, itemLen, itemHeight; + if( horizontal ) { + sizey = size.y(); + sizex = 2*sizey; + itemLen = sizex; + itemHeight = sizey; + } else { + sizex = size.x(); + sizey = 2*sizex; + itemLen = sizey; + itemHeight = sizex; + } + final GraphShape mark = new Rectangle(knob.getRenderModes(), sizex, sizey, 0); + final Vec2f pos = getItemValuePos(new Vec2f(), value, itemLen, itemHeight); + mark.setInteractive(true).setToggleable(false).setDraggable(false).setResizable(false); + mark.setColor(color); + mark.moveTo(pos.x(), pos.y(), 0); + marks.addShape(mark); + return mark; } public final Vec2f getSize() { return size; } |