While dragging, increase the "range" of the auto-scrolling
Question
Is it possible to increase the "range" of the vertical auto-scrolling.
Already, when a user is in the top x% of the window (while dragging) the editor will scroll up. The same is true for scrolling down of course.
What I'm curious about, is where this is controlled? I'm not sure what to search besides "scroll" or potentially "scrolltop". Both of which didn't help me find what I'm looking for.
Does anyone know on what lines the code for this is on?
Answers (2)
I was able to accomplish this by changing the value of the variable limitTop.
e.preventDefault();
if (this.dragging) {
var frameWindow = this.getFrameEl().contentWindow;
var actualTop = frameWindow.document.body.scrollTop;
var nextTop = actualTop;
var clientY = e.clientY;
var limitTop = 150;
var limitBottom = frameRect.height - limitTop;
if (clientY < limitTop) {
nextTop -= limitTop - clientY;
}
if (clientY > limitBottom) {
nextTop += clientY - limitBottom;
}
//console.log(`actualTop: ${actualTop} clientY: ${clientY} nextTop: ${nextTop} frameHeigh: ${frameRect.height}`);
frameWindow.scrollTo(0, nextTop);
}
},```
This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.
Related Questions and Answers
Continue research with similar issue discussions.
Issue #1762
image not change while we fetch html using editor.getHtml()
Hello @artf I am using grapes.js for my website-builder tool into my website. While i double click on any image the asset-manager will open...
Issue #2081
Changing Traits Dynamically
Is it possible to change traits default selection?? For example when dragging a video, I wish that the default trait selection will be yout...
Issue #1092
[BUG]traits and storage trigger
Hey, maybe it's not bug, i'm not sure. I have traits with changeProp: true field. When I change the value of trait by UI, model is changed...
Issue #1985
[BUG] Autosave with remote storage doesn't send network requests
OS: Windows 10 Browser: Chrome 73 GrapesJS version: 0.14.57 I have remote storage configured using this call to grapesjs.init(): While I se...
Paid Plugins That Match This Issue
Curated by issue keywords and label relevance to help you ship faster.
Loading paid plugin recommendations...
Browse Plugin Categories
Jump directly to plugin category pages on the marketplace.