Leaflet Draw - Selecting 1 Draw Option then another causes Drawing to drag map instead of shape - leaflet

When attempting to draw, if you first select Draw Circle then select Draw Rectangle then go to click on the map, instead of beginning the drawing and dragging the shape out, the shape gets an initial placement and the map drags instead. You can do the opposite as well (select Rectangle then Circle then click/drag).
You can see this behavior here: http://leaflet.github.io/Leaflet.draw/docs/examples/full.html
Draw Circle the click/drag works Fine. Draw Rectangle then click/drag works fine. Draw Circle then Draw Rectangle then click/drag causes map to begin dragging instead of shape.
This does not seem to be an issue when going between Circle-Polygon or Rectangle-Polygon, only Circle-Rectangle.
I tried debugging to see if any errors or weird events were being thrown but no such luck.

Related

How to make inner edge shader in unity shader graph?

I want to create a wall shader that looks like this:
Image
The inner part is already done (diagonal lines) and works fine, but I can't do the inner edge around the shape correctly. It has to lign-up properly and react to object scales and probably position
I only managed to make it work with rectangle objects any other shapes break the effect of continuity. The problem lies in the edge outline which doesn't work with such custom shapes.
I tried to do this with the Rectangle node but I could apply object scale tilling to it so I did the outline another way but as I said it's totally broken with complex shapes
Here are the results:
Image
The white on the right shape is this broken edge outline. So if someone can create an inner edge outline I would be glad to learn it!

MetalKit - How to fade pixels within a single render pass

I have a Metal based rendering pipeline that renders a few overlapping squares. It loops over all the squares and draws them to the screen starting from the one furthest to the back and ending with the one closest to the front (painter's algorithm).
However, I need some squares in the middle to hide the contents of the squares underneath them slightly. I'm rendering all of the squares in the same render pass, so the fragment shader has read/sample access to the color that was put down by the square drawn before it. But a later square does not have write access to the color that was already drawn to the screen. At the same time, an earlier draw call does not have access to the pixels that will be drawn using future draw calls.
Is there a way for a later draw call to override a color that was placed using an earlier draw call (i.e. tile shading, multiple render passes, etc.)?

Inner Shadow Effect for line drawn to screen?

I've made an iOS program that allows the user to draw a line on the screen with their finger. I used the touchesBegan, touchesMoved, and touchesEnded methods, along with creating a CGContext and drawing my line that way. I want the line to look as though it is beveled into the screen, almost as if it was carved. How would this be possible?
You can achieve a simple bevel by stroking your lines three times:
first, with a color brighter than the background at points p(x-1, y-1) relative to the actual line
then, your line color at the actual line position, points p(x, y)
then, brighter than the line color, but darker than the background at p(x+1, y+1)
You can think of this as a light shining onto your lines from above and to the left, making the lower coordinates brighter, passing over the bevel and having a little shadow cast on the higher coordinates.
Once you get the hang of thinking through the pseudo-3D geometry this way, you can create prettier bevels, including details inside the line. Those will take more strokes.

CGPath masked off CGPoints

I'm trying to build this:
Where the white background is in fact transparent. I know how to clip a CGPath to a set region, but this seems to be to other way around, since I need to substract regions from a filled CGPath.
I guess the right way to go would be to substract the whole outer-circles from the CGPath and then to draw smaller circles at my CGPoints, but I'm not sure how to execute the former. Can anyone point me in the right direction?
That's what I would do :
1) Draw your general line
2) CGContextSetBlendMode(context, kCGBlendModeClear) to "clear the context" when you draw.
3) Draw you bigger circles
4) CGContextSetBlendMode(context, kCGBlendModeNormal) to return to normal drawing
5) Draw your little circles.
You could instead start a transparency layer, draw the lines, then draw the larger transparent circles using the clear color, then draw the smaller black circles. Then when you finish the transparency layer, it will composite exactly what you want back onto the context.

GL_POINTS + glDrawArrays doesn't draw all points unless I flip after each "tile" / OpenGL ES with Retained Backing

Does anyone know why this may happen:
I draw to a 2D screen using glDrawArrays with GL_POINTS (interleaved array). If I flip the buffers (presentRenderbuffer) after ever call to glDrawArrays -- so after each "tile" is drawn -- everything works fine.
This is, of course, inefficient.. so if I move the presentRenderBuffer outside of the draw loop, I get the errors. Basically parts of the screen just don't draw, and it's always in the same place (the middle of the screen, horizontally).
I'm using retainedbacking (as I update only tiles that changed) so I need to rely on the frame buffer staying the same between draws so I can draw over it.
Any ideas why presentRenderBuffer after each tile works fine, while one final presenRenderBuffer after all of the draws wouldn't?
EDIT: Also, adding glFlush() in the tile draw loop, and moving presentRenderBuffer outside the loop produces the correct image as well.