Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[FEATURE REQUEST][BUG] Slider doesn't work with a non-integer step value #2748

Closed
jsychova opened this issue Apr 30, 2020 · 3 comments · Fixed by #3029
Closed

[FEATURE REQUEST][BUG] Slider doesn't work with a non-integer step value #2748

jsychova opened this issue Apr 30, 2020 · 3 comments · Fixed by #3029

Comments

@jsychova
Copy link

Default StyleManager property "slider" doesn't work with a non-integer step value.
GrapesJS version: 0.16.1

In many cases, it’s convenient to use a slider with a non-integer step value:
GrapesJS

seems that Grapesjs supports only integer and rounds non-integer values.

Steps to reproduce:
Add a property with type 'slider'

var property = styleManager.addProperty('mySector',{
   name: 'Opacity',
   type: 'slider',
   property: 'opacity',
   defaults: 1,
   step: 0.1,
   max: 1,
   min: 0,
   }, { at: 0 });
@adamwpe
Copy link

adamwpe commented Apr 30, 2020

Oddly enough - this works for me (I know I'm creating the sector at the same time):

        editor.StyleManager.addSector('General',{
            name: 'Extras',
            open: false,
            properties: [{
                property: 'opacity',
                type: 'slider',
                defaults: 1,
                step: 0.01,
                max: 1,
                min: 0
            }]
        }, { at: 9 });

Can you make a demo?

@jsychova
Copy link
Author

Yes of course.
I've created a sample with your snippet, but seems that it doesn't want to work with me.

https://codepen.io/sjul66/pen/VwvMwNY

Thanks!

@adamwpe
Copy link

adamwpe commented Apr 30, 2020

Ah, you mean the arrows - sorry, thought you meant in general that the slider doesn't work.

image

Never noticed that - always use the slider order the mouse dragging over the arrows.

I'll have a look at the view - not too sure where to start haha.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants