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

Where is the auto-scroll feature? #181

Closed
chenenpei opened this issue May 11, 2018 · 17 comments · Fixed by #580
Closed

Where is the auto-scroll feature? #181

chenenpei opened this issue May 11, 2018 · 17 comments · Fixed by #580

Comments

@chenenpei
Copy link

Hi there,

I see your demo have a feature that the page can scroll down (or up) automatically when the grid-item is dragged to the bottom (or top) of the page. While it doesn't show in my local branch which is cloned from your master.

And I find a few lines of commented codes about 'autoScroll' in the output script. Does it mean that this feature has been moved out for some reasons? Will it be added back in the future, or can I do something to implement it in my project?

By the way, thank you for your amazing work!

@freeman983
Copy link

+1

@gmsa
Copy link
Contributor

gmsa commented Jun 8, 2018

Sorry, don't really know what auto-scroll you are talking about...the only autoScroll option I see is from interact.js, wich is a dependency

@chenenpei
Copy link
Author

@gmsa Oh, thanks! I will check it out and put my feedback here later.
BTW, I think the autoScroll feature is quite useful especially when you want to move one item from one row to another.

@chenenpei
Copy link
Author

chenenpei commented Jun 15, 2018

@gmsa I check the doc interact.js in which it gives an api like this:

interact(element)
  .draggable({
    autoScroll: true,
  });
  .resizable({
    autoScroll: {
      container: document.body,
      margin: 50,
      distance: 5,
      interval: 10
    }
  });

So I try to played around the GridItem.vue and modified two watchers which are 'draggable' and 'resizeable':

draggable: function() {
            var self = this;
            if (this.interactObj === null || this.interactObj === undefined) {
                this.interactObj = interact(this.$refs.item);
            }
            if (this.draggable) {
                var opts = {
                    autoScroll: true,
                    ignoreFrom: this.dragIgnoreFrom,
                    allowFrom: this.dragAllowFrom,
                };
                this.interactObj.draggable(opts);
                /*this.interactObj.draggable({allowFrom: '.vue-draggable-handle'});*/
                if (!this.dragEventSet) {
                    this.dragEventSet = true;
                    this.interactObj.on("dragstart dragmove dragend", function(event) {
                        self.handleDrag(event);
                    });
                }
            } else {
                this.interactObj.draggable({
                    enabled: false,
                });
            }
        },
resizable: function() {
            var self = this;
            if (this.interactObj === null || this.interactObj === undefined) {
                this.interactObj = interact(this.$refs.item);
            }
            if (this.resizable) {
                var opts = {
                    autoScroll: {
                        container: this.$parent.$el,
                        margin: 50,
                        distance: 5,
                        interval: 10
                    },
                    preserveAspectRatio: false,
                    edges: { left: false, right: true, bottom: true, top: false },
                    ignoreFrom: this.resizeIgnoreFrom,
                };

                this.interactObj.resizable(opts);
                if (!this.resizeEventSet) {
                    this.resizeEventSet = true;
                    this.interactObj.on("resizestart resizemove resizeend", function(event) {
                        self.handleResize(event);
                    });
                }
            } else {
                this.interactObj.resizable({
                    enabled: false,
                });
            }
        },

While after these works I still can't get the autoScroll feature in the grid-layout. Did I misunderstand the api or just changed in wrong place?

Look forward to your reply, thanks!

@gmsa
Copy link
Contributor

gmsa commented Jun 15, 2018

I don't think that autoScroll option on interact.js has anything to do with what you are looking for. If you say it's working on one of the demos, I never set any autoScroll anywhere, probably is something else.

@chenenpei
Copy link
Author

Actually, all of online demos have this feature, while it does not appear in those examples contained in the source code.
Would you mind checking the differences among them? Or could you give some suggestions about how to implement this feature?

@LavrovE
Copy link

LavrovE commented Feb 10, 2021

same problem here.

@llezenelrahc
Copy link
Contributor

#580
@chenenpei

@llezenelrahc
Copy link
Contributor

i try to fix this by add a feature of passing through option from itemConfig to the watcher init the internal interactjs instance config obj......

@llezenelrahc
Copy link
Contributor

and the official doc is so misleading...
actually both drag and resize share same config ,but official set the option in drag to be autoScroll:true which is so misleading one

@inesskeeled
Copy link

Hello! Is there any update about the auto-scroll option or is there any plans to integrate this in the future?

Thanks

@chaoukibenfradj
Copy link

Hi,
Is there any updates ?

Thank you

@ginkosen
Copy link

auto-scroll feature need official version support too .

@gmsa gmsa closed this as completed in #580 Jul 28, 2022
@gmsa
Copy link
Contributor

gmsa commented Aug 3, 2022

merged and included on release 2.4.0

@chaoukibenfradj
Copy link

@gmsa Sounds promising, thank you so much 😊

@songispm
Copy link

songispm commented Oct 4, 2022

Can you merge the recent new features (like this) to vue3 and release a new vue3.0 beta? Thanks a lot. @gmsa

@NikitaRomanov1
Copy link

Hi, still don't work auto scroll event. Can you explain, how to use it in right way? I've got obj in data:
resizeOptions: { autoScroll: { container: document.getElementById('dashboard-grid'), margin: 50, distance: 5, interval: 10, }, },
and :resize-option="resizeOptions" in grid-item

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