Can I add a scroll bar to the text mode of the EditorView? Like the scrollbar on the right side of the listview
If you can, please tell me to achieve this.
Best Answer
O
Olivier @MyScript
said
almost 2 years ago
Dear 龚 文益,
may be we were not clear enough: -First, as you have noticed, calling the "contentPart.getViewBox();" returns with a rectangle, which contains the x, y, width and height of your content part. -When the content part is empty, height is zero. => The idea is to monitor the content part, and when height becomes higher than the screen height, you set the editor view size (height in particular if you only want a vertical scroll) to the height of the content part (`Editor::setViewSize` function should be set each time part height increases).
Based on this, you normally have your scrollable view on top of the EditorView.
Then, as said above, in UI Reference Implementation `LayerView::onDraw()`, crop the invalidation extents to the scrollable view position (edited).
Could you please indicate on which platform you would like to do this?
Best regards,
Gwenaëlle
龚
龚 文益
said
almost 2 years ago
On the Android platform
O
Olivier @MyScript
said
almost 2 years ago
Dear 龚 文益,
thank you for the update.
Currently, this is not straightforward and will need significant development from you.
We came with an idea that may be a possible solution, as follows: you imagine you have a very huge screen, corresponding to your text document, and in a scrollable view, you display a part of this screen.
The implementation could be as follows: -In the EditorView, set the Editor view size (`Editor::setViewSize` function) to the full size of your ContentPart (retrieve the size in mm via `ContentPart::getViewBox()` and convert it to screen coordinates with the view transform) -You then create a smaller, scrollable view on top of the EditorView (depending on your use case, a NestedScrollView may be what you're looking for) -In UI Reference Implementation `LayerView::onDraw()`, crop the invalidation extents to the scrollable view position (edited)
Best regards,
Olivier
龚
龚 文益
said
almost 2 years ago
Thank you, I will try
龚
龚 文益
said
almost 2 years ago
Does nebo do the same?
O
Olivier @MyScript
said
almost 2 years ago
Dear 龚 文益,
Nebo is currently a special development, which is not using the EditorView.
Of course, we do not provide with the Nebo source code.
Best regards,
Olivier
龚
龚 文益
said
almost 2 years ago
I want to get the maximum length of the artboard. After I write at the bottom, the length of the artboard is automatically lengthened. I tried all the following methods.
But only get the initial length of the artboard, please tell me to do this, thank you
龚
龚 文益
said
almost 2 years ago
但只得到画板的初始长度,请告诉我该怎么做,谢谢
O
Olivier @MyScript
said
almost 2 years ago
Answer
Dear 龚 文益,
may be we were not clear enough: -First, as you have noticed, calling the "contentPart.getViewBox();" returns with a rectangle, which contains the x, y, width and height of your content part. -When the content part is empty, height is zero. => The idea is to monitor the content part, and when height becomes higher than the screen height, you set the editor view size (height in particular if you only want a vertical scroll) to the height of the content part (`Editor::setViewSize` function should be set each time part height increases).
Based on this, you normally have your scrollable view on top of the EditorView.
Then, as said above, in UI Reference Implementation `LayerView::onDraw()`, crop the invalidation extents to the scrollable view position (edited).
龚 文益
Can I add a scroll bar to the text mode of the EditorView? Like the scrollbar on the right side of the listview
If you can, please tell me to achieve this.
Dear 龚 文益,
may be we were not clear enough:
-First, as you have noticed, calling the "contentPart.getViewBox();" returns with a rectangle, which contains the x, y, width and height of your content part.
-When the content part is empty, height is zero.
=> The idea is to monitor the content part, and when height becomes higher than the screen height, you set the editor view size (height in particular if you only want a vertical scroll) to the height of the content part (`Editor::setViewSize` function should be set each time part height increases).
Based on this, you normally have your scrollable view on top of the EditorView.
Then, as said above, in UI Reference Implementation `LayerView::onDraw()`, crop the invalidation extents to the scrollable view position (edited).
We are aware this is not easy to implement.
Best regards,
Olivier
- Oldest First
- Popular
- Newest First
Sorted by Oldest FirstGwenaelle @MyScript
Dear 龚 文益,
Thank you for your question.
Could you please indicate on which platform you would like to do this?
Best regards,
Gwenaëlle
龚 文益
On the Android platform
Olivier @MyScript
Dear 龚 文益,
thank you for the update.
Currently, this is not straightforward and will need significant development from you.
We came with an idea that may be a possible solution, as follows: you imagine you have a very huge screen, corresponding to your text document, and in a scrollable view, you display a part of this screen.
The implementation could be as follows:
-In the EditorView, set the Editor view size (`Editor::setViewSize` function) to the full size of your ContentPart (retrieve the size in mm via `ContentPart::getViewBox()` and convert it to screen coordinates with the view transform)
-You then create a smaller, scrollable view on top of the EditorView (depending on your use case, a NestedScrollView may be what you're looking for)
-In UI Reference Implementation `LayerView::onDraw()`, crop the invalidation extents to the scrollable view position (edited)
Best regards,
Olivier
龚 文益
Thank you, I will try
龚 文益
Does nebo do the same?
Olivier @MyScript
Dear 龚 文益,
Nebo is currently a special development, which is not using the EditorView.
Of course, we do not provide with the Nebo source code.
Best regards,
Olivier
龚 文益
I want to get the maximum length of the artboard. After I write at the bottom, the length of the artboard is automatically lengthened. I tried all the following methods.
Editor editor = editorView.getEditor();
Renderer renderer = editor.getRenderer();
ImageLoader imageLoader = editorView.getImageLoader();
editorView.getEditor();
float viewScale = renderer.getViewScale();
float pixelSize = renderer.getPixelSize();
IRenderTarget renderTarget = renderer.getRenderTarget();
Transform viewTransform = renderer.getViewTransform();
ContentBlock rootBlock = editorView.getEditor().getRootBlock();
Rectangle rootBlockBox = rootBlock.getBox();
float y = rootBlockBox.y;
float height = rootBlockBox.height;
ContentPart contentPart = mMyScriptScrvice.getContentPart();
Rectangle viewBox = contentPart.getViewBox();
float height1 = viewBox.height;
Point apply = viewTransform.apply(rootBlockBox.width, rootBlockBox.height);
Point apply1 = viewTransform.apply(rootBlockBox.x, rootBlockBox.y);
LayerView mLayerView = editorView.findViewById(R.id.layer_background);
Bitmap bitmap = mLayerView.getBitmap();
if(bitmap!=null){
MyLog.log( "bitmap --" + bitmap.getHeight());
}else {
MyLog.log("bitmap==null");
}
int viewHeight = editor.getViewHeight();
But only get the initial length of the artboard, please tell me to do this, thank you
龚 文益
但只得到画板的初始长度,请告诉我该怎么做,谢谢
Olivier @MyScript
Dear 龚 文益,
may be we were not clear enough:
-First, as you have noticed, calling the "contentPart.getViewBox();" returns with a rectangle, which contains the x, y, width and height of your content part.
-When the content part is empty, height is zero.
=> The idea is to monitor the content part, and when height becomes higher than the screen height, you set the editor view size (height in particular if you only want a vertical scroll) to the height of the content part (`Editor::setViewSize` function should be set each time part height increases).
Based on this, you normally have your scrollable view on top of the EditorView.
Then, as said above, in UI Reference Implementation `LayerView::onDraw()`, crop the invalidation extents to the scrollable view position (edited).
We are aware this is not easy to implement.
Best regards,
Olivier