adamwulf / JotUI

OpenGL based drawing view built for and used by Loose Leaf for iPad
http://getlooseleaf.com/opensource/
MIT License
268 stars 28 forks source link

<addElements:withTexture:> rendered two results #36

Open CoderMaurice opened 5 years ago

CoderMaurice commented 5 years ago

I made some changes to the demo, when I paint on the bottom, the same strokes appear on the top.(use addElements:withTexture:) Marker and Highlighter seem to have a problem with addElements. Any advice?

wx20181227-122015 2x
adamwulf commented 5 years ago

Between calls to JotView addElements:withTexture:, call the state's method finishCurrentStroke.

I should probably update the JotView method to call this automatically in the finishCurrentStroke: method. I think this'll fix it for you.

CoderMaurice commented 5 years ago

I call the state's method finishCurrentStrok: before every addElements:withTexture:. But the upper part no longer shows anything.

In fact, I have called finishCurrentStroke: in the didEndStrokeWithCoalescedTouch: delegate to make the front and back strokes not connected.

Here is my modified example: (ฅ′ω`ฅ)

CoderMaurice commented 5 years ago

another problem : There are some elements that will not be added to the upper part by addElements:withTexture:. Usually the last few elements of a stroke and especially when I write a little faster.

img_1224