viscenter / layered-viewer

(Archive Repository) Registered image viewer based on OpenSeadragon
https://gitlab.com/educelab/vislayers
Other
6 stars 1 forks source link

When switching from circle to square with 'c' make it instant #19

Closed stephenrparsons closed 9 years ago

stephenrparsons commented 9 years ago

Right now it does not change the shape until the mouse is moved. The switch does call drawopacity() so I am not sure why the update is not instant.

johnwalker commented 9 years ago

that is because drawopacity doesnt really draw anything. it returns a function that draws something. rename drawopacity to makedrawfn or something less confusing, and in this case use it like:

mydrawfn = makedrawfn(true, true);
addEventListener("foobar", mydrawfn);
stephenrparsons commented 9 years ago

What would be the best approach to have a draw() function that could be called anywhere and would do what we expect? That would be quite handy.

johnwalker commented 9 years ago

can you be more specific about what you expect?

johnwalker commented 9 years ago

the point of manufacturing the function like this is that the drawfn will vary (slightly) depending on whether you want to redraw the primary canvas and whether it should (can) update the last known position of the mouse.

johnwalker commented 9 years ago

Check if my last commit fixed it.

stephenrparsons commented 9 years ago

Yeah, that makes more sense to me now. Silly me hadn't registered that it was returning a function, which is clear, I just wasn't paying attention. Thanks for comments too, cleared it up significantly for me.

On Sun, Apr 12, 2015, 6:45 PM john walker notifications@github.com wrote:

Check if my last commit fixed it.

— Reply to this email directly or view it on GitHub https://github.com/viscenter/layered-viewer/issues/19#issuecomment-92146050 .

johnwalker commented 9 years ago

ok cool. if you think there is a descriptive function name in particular that you want, i'm totally open to not doing things like makedrawfn(true,true)({}) or whatever. it's just that the names i could think of were things like

forceredrawandupdatemouseposanddrawthingy(e)
dontforceredrawandupdatemouseposanddrawthingy(e)
.
.
.