@@ -853,8 +853,8 @@ class Model extends FileView {
853853
854854 function getLodRatioFromIdx (idx : Int ) {
855855 var lodConfig = hmd .getLodConfig ();
856- if (idx = = 0 ) return 1. ;
857- if (idx == hmd . lodCount () ) return lodConfig [ lodConfig . length - 1 ] ;
856+ if (idx < = 0 ) return 1. ;
857+ if (idx > lodConfig . length ) return 0. ;
858858 if (idx >= hmd .lodCount () + 1 ) return 0. ;
859859 return lodConfig [idx - 1 ];
860860 }
@@ -865,12 +865,9 @@ class Model extends FileView {
865865 }
866866
867867 function getLodRatioPowedFromIdx (idx : Int ) {
868- var lodConfig = hmd .getLodConfig ();
869- var prev = idx == 0 ? 1 : hxd. Math .pow (lodConfig [idx - 1 ] , lodPow );
870- if ( idx == hmd .lodCount () ) prev = lodConfig [lodConfig .length - 1 ];
871- var c = lodConfig [idx ] == null ? 0 : lodConfig [idx ];
872- if ( idx + 1 == hmd .lodCount () ) c = lodConfig [lodConfig .length - 1 ];
873- return (Math .abs (prev - hxd. Math .pow (c , lodPow )));
868+ var prev = hxd. Math .pow (getLodRatioFromIdx (idx ) , lodPow );
869+ var current = hxd. Math .pow (getLodRatioFromIdx (idx + 1 ), lodPow );
870+ return Math .abs (prev - current );
874871 }
875872
876873 function startDrag (onMove : js.jquery. Event -> Void , onStop : js.jquery. Event -> Void ) {
@@ -891,6 +888,7 @@ class Model extends FileView {
891888 var idx = 0 ;
892889 for (area in areas ) {
893890 var areaEl = new Element (area );
891+ trace (idx , getLodRatioFromIdx (idx ));
894892 areaEl .css ({ width : ' ${lineEl .width () * getLodRatioPowedFromIdx (idx )}px' });
895893
896894
@@ -960,10 +958,12 @@ class Model extends FileView {
960958 var prevConfig = @:privateAccess hmd .lodConfig ?. copy ();
961959 var newConfig = hmd .getLodConfig ()?. copy ();
962960 var limits = [ getLodRatioFromIdx (currIdx + 2 ), getLodRatioFromIdx (currIdx )];
963-
961+ trace ( limits );
964962 startDrag (function (e ) {
965963 var newRatio = getLodRatioFromPx (e .clientX - lodsLine .offset ().left );
964+ trace (newRatio );
966965 newRatio = hxd. Math .clamp (newRatio , limits [0 ], limits [1 ]);
966+ trace (" clamp => " , newRatio );
967967 newConfig [currIdx ] = newRatio ;
968968 @:privateAccess hmd .lodConfig = newConfig ;
969969 refreshLodLine ();
0 commit comments