General questions

Add scroll bar

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 龚 文益,

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

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?

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

但只得到画板的初始长度,请告诉我该怎么做,谢谢

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

Login or Signup to post a comment