Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.javascript > #28469
| From | Thomas 'PointedEars' Lahn <PointedEars@web.de> |
|---|---|
| Newsgroups | comp.lang.javascript |
| Subject | Re: Move a div with mouse |
| Date | 2015-07-25 20:54 +0200 |
| Organization | PointedEars Software (PES) |
| Message-ID | <2686661.kNTyxH5vvL@PointedEars.de> (permalink) |
| References | <mola7b$fmu$1@dont-email.me> <24793803.Cl0v73UULg@PointedEars.de> <mou5ap$180$1@dont-email.me> <13075758.S88mDJZToQ@PointedEars.de> <mp0i2h$aq4$1@dont-email.me> |
danca (Daniele Campagna) wrote: > Il 07/25/2015 02:07 PM, Thomas 'PointedEars' Lahn ha scritto: >> danca (Daniele Campagna) wrote: >>> Il 07/24/2015 08:36 PM, Thomas 'PointedEars' Lahn ha scritto: >>>> danca (Daniele Campagna) wrote: >>> […] >>> I TRIED to copy-and-paste and then to adjust the [horrible] result. >> I think you know what to do now. > > Apart from putting comments between /*..*/ I am not sure about the 72 > columns limit - I often read messages not wrapped at all, and I must > explicitly word wrap them (CTRL-R in Thunderbird). But no clues about > the messages I write. The feature is called “format=flowed”. Messages appear as if they were not word-wrapped properly by the sender because the text is reformatted at the receiver’s for display so as to be wrapped within the viewport (in Thunderbird: the Message Pane). You can disable this feature, both for sending (that is, for other newsreaders that support this feature for display) and reading, if it causes you problems. Word-wrapping at column 72 is the default setting in Thunderbird, so I do not see why you did not see that your code would break if posted as is. That said, I thought it would be obvious to you by now that you need to format your code properly in the first place – not just for posting. Employing an easily readable code style, including shorter lines, not only helps with code reviews by others, but helps to avoid bugs in the first place. (I am having a /déjà vu/ here.) >> You are defining and _undefining_ event listeners here. It makes no >> sense to define/*overwrite* an event listener for an event, that may not >> have been defined in the first place, just to undefine it when the event >> is fired. > > The onmousedown activates the onmousemove and the onmouseup. The latter > in turn when fired cancels the onmousemove and itself - so it is fired > only one time and only if it has been defined by onmousedown. Yes; your code was hard to read, so easy to misread. You should use flags instead of creating Function instances repeatedly. That aside: Your code most certainly does not work in Chrome because you are assigning to .onmousemove after you called .addEventListener() for the same target, which adds *two* event listeners for the same event and target: the listener added with .addEventListener() is added after the one assigned to .onmousemove. (As I showed earlier this year.) And it probably does not work in Chrome because your feature test is wrong again, a faulty inference: you are testing “window.event” but access “e.clientX”, and you are testing “event”, but you are accessing “event.pageX”. Debugging should show the underlying assumptions to be wrong in the offending runtime environments. I am not willing to dig deeper before you have posted a readable version of your code along with reports from further debugging. BTW, there are drag-and-drop event types now. -- PointedEars FAQ: <http://PointedEars.de/faq> | SVN: <http://PointedEars.de/wsvn/> Twitter: @PointedEars2 | ES Matrix: <http://PointedEars.de/es-matrix> Please do not cc me. / Bitte keine Kopien per E-Mail.
Back to comp.lang.javascript | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
Move a div with mouse "danca (Daniele Campagna)" <cyberdanny@tiscalinet.it> - 2015-07-21 13:26 +0200
Re: Move a div with mouse Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2015-07-24 20:36 +0200
Re: Move a div with mouse "danca (Daniele Campagna)" <cyberdanny@tiscalinet.it> - 2015-07-24 21:58 +0200
Re: Move a div with mouse Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2015-07-25 14:07 +0200
Re: Move a div with mouse "danca (Daniele Campagna)" <cyberdanny@tiscalinet.it> - 2015-07-25 19:47 +0200
Re: Move a div with mouse Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2015-07-25 20:54 +0200
Re: Move a div with mouse "danca (Daniele Campagna)" <cyberdanny@tiscalinet.it> - 2015-07-26 12:54 +0200
Re: Move a div with mouse Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2015-07-26 13:36 +0200
csiph-web