Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.javascript > #32863
| Newsgroups | comp.lang.javascript |
|---|---|
| Date | 2017-03-30 03:30 -0700 |
| Message-ID | <6dff6107-c9bf-4aea-9853-50f5ed150fc2@googlegroups.com> (permalink) |
| Subject | Javascript separate redraw of objects from logic? |
| From | jonas.thornvall@gmail.com |
I do not get howto do this in general and not in javascript. If you have a number of objects/layers you want your redraw routine to put out dependent upon user choices. How can this be achieved without making hardcoded permutations of the choices available? Routine A. Lay out text B. Lay out Node rectangles nodes C. Lay out Links Here i can actually do the cases but there can be many more choices, like dependent if a curve is bezier or a line i must of course treat it different? And i do not want that decision within the actual redraw routine? Somehow it seem to me that the things/routines/objects/functions to draw should somehow be arguments to redraw? But that does not seem possible with my limited knowledge/understanding. At least not without hardcoding possible permutation of choices? The thing that is wrong with my approach right now is that when i redraw things ever x millisec, i have to look what actually should be drawn out. That just seem wrong to me, and it probably is. Question: is it the language, the fact that drawing close to metal, or my limited knowledge that prevent me from doing it the correct way. Right now it seem to me, that to do what i want i have to make cases before redraw, and ideally every case would be its own drawing routine. But that really can't be how one would expect it to be done. "I have a hunch about how they probably do it, they rewrite the whole thing to a single object before redraw", and then put it out. Maybe just a cordinate space, but then the whole idea with drawing to canvas seem futile.
Back to comp.lang.javascript | Previous | Next | Find similar | Unroll thread
Javascript separate redraw of objects from logic? jonas.thornvall@gmail.com - 2017-03-30 03:30 -0700
csiph-web