I wrote to you about creating a dot while typing with the pen and mousedown. Previously, it wasn't possible to create a dot with the mousedown. Now it is. However, you have to hold down the dot for a while. When typing naturally, the dot sometimes works, sometimes it doesn't. I think you have to hold down the mousedown and wait a bit. I think it's related to the time function. Can this be fixed? Can a dot be created immediately after tapping?
The dot happens on mouseup not mousedown.
And for us, it happens all the time and you don't have to hold down for a while - just down-up. Test here and see what you think now that you know it is on mouseup.
We can see if we can change it to mousedown - but the code is complex.
The example you sent actually works. My code is below, and I think there's no problem with it.
The problem is this: if the finger or mouse moves slightly during a touch, the dot isn't created. According to the current code, there won't be any sliding at all during a touch to create a dot.
Or, there will be a long slide for the dot to appear. So, the code doesn't show a problem. But sometimes there's a slight sliding during a touch. That is, the finger slips. In the example you sent, if the mouse or finger moves slightly, the dot isn't created.
pen1 = new Pen({
color:color,
penType:"line",
size:kalem_size,
spread:{min:5, max:7},
move:false, // not dragging - will not matter that much as we dispose each line we draw - but not needed
cache:false // handling the cache with blitting - so no point in doing it for each pen stroke
}).addTo();
pen1.end="round"
cizim_yeri1 = new Container();
cizim_yeri1.cache(200,0,1240,2000,1); // Cache it.
stage.addChild(cizim_yeri1)
cizim_yeri1.addChild(pen1.paper)
controller1 = new MotionController({
target:pen1,
type:"pressmove",
mousedownIncludes:[cizim_yeri1,silgiCursor], // so we can mousedown on drawing and the motioncontroller will still work
speed:70,
});
pen1.on("drawing", ()=>{
cizim_yeri1.updateCache(erase?"destination-out":"source-over");
//pen1.paper.updateCache(erase?"destination-out":"source-over");
});
pen1.on("start", ()=>{
cizim_yeri1.updateCache(erase?"destination-out":"source-over");
//pen1.paper.updateCache(erase?"destination-out":"source-over");
});
pen1.on("stop", ()=>{
if(erase==false){
cizim_yeri1.updateCache(erase?"destination-out":"source-over");
}
//cizim_yeri1.updateCache(erase?"destination-out":"source-over");
pen1.lastSegment.dispose(); // get rid of the last drawn line in the paper
});
I see. Perhaps we can look at making it work on a mousedown - running into busy times but will have a look next week. I can imagine it would be frustrating if the dot is not made.
OK. I'm temporarily using both ZIM.pen and createjs to create the point. I used createjs for the pen in the past. I'm only using the mousedown part of it with ZIM.pen. It's a temporary solution for now. I hope the problem will be resolved in the future. Would you like me to remind you in the future?
Just looking at it now. We had added the following code to the MotionController:
Where zpenX and zpenY are the original mousedown x and y. The Pen does not seem to draw on mousedown - it must draw on pressmove. So we probably should look at the Pen itself to draw on mousedown. We will look there now.
But we could also adjust the range so that it accommodates for finger or press slip.
Thank you very much
Okay... added a penDown parameter to MotionController(). This draws a dot on mousedown but it has to be shifted at least 2 pixels which sort of shows the shift if a line is drawn. We also decreased the sensitivity on the mouseup - so that will probably draw a dot every time. You can use whichever you prefer.
Here is a screenshot of some lines drawn with the penDown:true - it does not show unless the lines are more vertical.
So use:
const pen = new Pen({size:5}).addTo();
new MotionController({target:pen, type:"pressmove", penDown:true});
Here are the lines when just using the MotionController without the penDown:true and the dots are coming in very easily on mouseup.
If I set penDown to true, it draws the point on the next click. In other words, I clicked but did not draw. I clicked somewhere else. The point at the previous click position appears on the screen.
Strange - sounds like a S.update issue - we will make sure the mousedown updates the stage, not sure why it works for us without it - it was a basic test.
Okay - added the stage update. Try ZIM - Pen Dot on Mousedown - Code Creativity for instance. Make sure to refresh cache.