Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.javascript > #37946
| Newsgroups | comp.lang.javascript |
|---|---|
| Date | 2019-12-09 00:26 -0800 |
| References | <5753bf40-6ff1-4609-802c-5036f9a93d64@googlegroups.com> <ad89089e-519e-4b05-9a3b-b3f36cad7f49@googlegroups.com> |
| Message-ID | <15419caa-ae4e-4912-baf8-cbe68ed7fc77@googlegroups.com> (permalink) |
| Subject | Re: My flaky math |
| From | Jonas Thörnvall <jonas.thornvall@gmail.com> |
Den lördag 7 december 2019 kl. 20:43:23 UTC+1 skrev Jonas Thörnvall:
> Den lördag 7 december 2019 kl. 19:44:08 UTC+1 skrev Jonas Thörnvall:
> > When i move selection to middle and then move the start point the selection start to drift within timeframe, should i calcMarking another way?
> >
> > There must be a logical error because as i see it left and right are percentages of the total time that is the length of the bar so i do not think i move it relative a static target just timespann. And the marking shrink and expand with the timetotal, but it drifts? "When you change startpoint relative the marking".
> >
> > https://midisequenser.000webhostapp.com/
> >
> > function calcMarking(){
> > //Do calculation
> > var LeftTime=parseInt(document.getElementById("recstart").value);
> > var RightTime=parseInt(document.getElementById("recend").value);
> > var TimeSPos=document.getElementById("EditStart").value;
> > var TimeEPos=document.getElementById("EditEnd").value;
> > var distanceTotal=Mwidth-50;
> > var TimeTotal=TimeEPos-TimeSPos;
> > console.log("TimeEPos="+TimeEPos+" TimeSPos="+TimeSPos+" Timetotal="+TimeTotal);
> > var RightPercent=RightTime/TimeTotal;
> > var LeftPercent=LeftTime/TimeTotal;
> > zz=50+(RightPercent*distanceTotal);
> > yy=50+(LeftPercent*distanceTotal);
> > }
> >
> >
> > // This below is just the drawout and i don't think it is anything there
> > // I think there is flaky math or flaky logic above.
> > // It has no real importance for the functionality, but should look nice i guess
> >
> > function drawMarked() {
> > var LeftTime=parseInt(document.getElementById("recstart").value);
> > var RightTime=parseInt(document.getElementById("recend").value);
> > var TimeSPos=document.getElementById("EditStart").value;
> > var TimeEPos=document.getElementById("EditEnd").value;
> > if(LeftTime>=TimeSPos && RightTime<=TimeEPos && mode=="Listen") {
> > calcMarking();
> > drawOutMark();
> > leftMarker();
> > rightMarker();
> > }
> > }
> >
> >
> >
> > function drawOutMark(){
> > ctm.fillStyle ="#661313";
> > ctm.fillRect(yy, 25,zz-yy,Mheight);
> > }
> >
> > function leftMarker(){
> > ctm.fillStyle = "orange";
> > ctm.beginPath();
> > ctm.moveTo(yy-10, 15);
> > ctm.lineTo(yy+10, 15);
> > ctm.lineTo(yy, 25);
> > ctm.fill();
> > }
> >
> > function rightMarker(){
> > ctm.fillStyle = "orange";
> > ctm.beginPath();
> > ctm.moveTo(zz-10, 15);
> > ctm.lineTo(zz+10, 15);
> > ctm.lineTo(zz, 25);
> > ctm.lineWidth = 2;
> > ctm.fill();
> > }
>
> ehrm no still there, but now one can see it seem to use same original value each time, because the difference for some reason is the one bar that is removed.
Well if someone can't show what goes wrong, "i have a sneaky suspiscion" that righttime and lefttime somehow fractions dependent on timetotal. But i will just start add the missing lengths. Because for some reason it seem to be one.
Back to comp.lang.javascript | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
My flaky math Jonas Thörnvall <jonas.thornvall@gmail.com> - 2019-12-07 10:44 -0800
Re: My flaky math Jonas Thörnvall <jonas.thornvall@gmail.com> - 2019-12-07 11:24 -0800
Re: My flaky math Jonas Thörnvall <jonas.thornvall@gmail.com> - 2019-12-07 11:43 -0800
Re: My flaky math Jonas Thörnvall <jonas.thornvall@gmail.com> - 2019-12-09 00:26 -0800
Re: My flaky math Jonas Thörnvall <jonas.thornvall@gmail.com> - 2019-12-09 00:33 -0800
Re: My flaky math Jonas Thörnvall <jonas.thornvall@gmail.com> - 2019-12-09 00:35 -0800
Re: My flaky math Jonas Thörnvall <jonas.thornvall@gmail.com> - 2019-12-09 00:51 -0800
Re: My flaky math Jonas Thörnvall <jonas.thornvall@gmail.com> - 2019-12-09 00:59 -0800
Re: My flaky math Jonas Thörnvall <jonas.thornvall@gmail.com> - 2019-12-09 03:03 -0800
Re: My flaky math Jonas Thörnvall <jonas.thornvall@gmail.com> - 2019-12-09 04:12 -0800
csiph-web