Skip to content

Commit

Permalink
warning cleanup 6
Browse files Browse the repository at this point in the history
  • Loading branch information
minimapletinytools committed Dec 10, 2023
1 parent d22dd37 commit 326c558
Show file tree
Hide file tree
Showing 7 changed files with 10 additions and 18 deletions.
6 changes: 3 additions & 3 deletions TODO.txt
Original file line number Diff line number Diff line change
Expand Up @@ -270,14 +270,14 @@ DONE-handlers should return preview action


:: RELEASE TODO ::
-warning cleanup
-get it working on breew
-make a video
-update tutorial file?
-should be more intuitive to get a 1 sided line
-opening file with hidden elements does not hide stuff..


::NEWEST TODO::
-opening file with hidden elements does not hide stuff..
-layers improvements
-shift select in layers please ;__;
-selecting multiple items and hitting new folder should put those items in folder maybe
Expand Down Expand Up @@ -414,7 +414,7 @@ DONE-handlers should return preview action
-insert vs overwrite option for freeform text
-you need some kind of options object to go along side of _setPotatoDefaultParameters_sBoxType


DONE-warning cleanup
DONE-hide stuff
-moving an element into a hidden folder does not hide it right away (ignore this for release)
-this is becaues it gets added to superowlchanges
Expand Down
4 changes: 2 additions & 2 deletions src/Potato/Flow/Llama.hs
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ doCmdState cmd s = r where
else Left $ ApplyLLamaError_Soft $ "Invalid canvas size operation " <> show x

r = case r' of
Right (newState, changes) -> assert (owlPFState_isValid newState) r'
Right (newState, _) -> assert (owlPFState_isValid newState) r'
Left e -> Left e

undoCmdState :: OwlPFCmd -> OwlPFState -> Either ApplyLlamaError (OwlPFState, SuperOwlChanges)
Expand All @@ -90,7 +90,7 @@ undoCmdState cmd s = r where
else Left $ ApplyLLamaError_Soft $ "Invalid canvas size operation " <> show x

r = case r' of
Right (newState, changes) -> assert (owlPFState_isValid newState) r'
Right (newState, _) -> assert (owlPFState_isValid newState) r'
Left e -> Left e


Expand Down
4 changes: 2 additions & 2 deletions src/Potato/Flow/Methods/LineDrawer.hs
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ lineAnchorsForRender_reverse lafr@LineAnchorsForRender {..} = r where
revgo acc ((cd,d,False):[]) = (flipCartDir cd,d,True):acc
revgo _ ((_,_,True):[]) = error "unexpected subsegment starting anchor at end"
revgo acc ((cd,d,False):xs) = revgo ((flipCartDir cd, d, False):acc) xs
revgo _ ((_,_,True):xs) = error "TODO this does not handle midpoint subsegment starting anchors correctly (not that it needs to right now)"
revgo _ ((_,_,True):_) = error "TODO this does not handle midpoint subsegment starting anchors correctly (not that it needs to right now)"
revgostart [] = []
revgostart ((cd,d,True):xs) = revgo [(flipCartDir cd,d,False)] xs
revgostart _ = error "unexpected non-subsegment starting anchor at start"
Expand Down Expand Up @@ -674,7 +674,7 @@ internal_getSAutoLineLabelPosition_walk lar targetd = r where
walk (x@(cd,d,_):rest) curbegin traveld = r2 where
nextbegin = curbegin + cartDirWithDistanceToV2 x
r2 = if traveld + d >= targetd
then curbegin + cartDirWithDistanceToV2 (cd, targetd - traveld, undefined)
then curbegin + cartDirWithDistanceToV2 (cd, targetd - traveld, undefined) -- why undefined -__- lol
else walk rest nextbegin (traveld + d)
r = walk (_lineAnchorsForRender_rest lar) (_lineAnchorsForRender_start lar) 0

Expand Down
4 changes: 2 additions & 2 deletions src/Potato/Flow/Owl.hs
Original file line number Diff line number Diff line change
Expand Up @@ -983,13 +983,13 @@ internal_owlTree_recalculateChildrenDepths_recursive ot rid = r_0 where
sowl = owlTree_mustFindSuperOwl ot rid
adjustdepthfn (oem, oitem) = (,oitem) $ oem { _owlItemMeta_depth = _owlItemMeta_depth (_superOwl_meta sowl) + 1 }
r_0 = case _superOwl_elt sowl of
OwlItem oinfo (OwlSubItemFolder kiddos) -> r_1 where
OwlItem _ (OwlSubItemFolder kiddos) -> r_1 where
-- update the depth of all its kiddos
omwithadjusteddepth = foldr (\kid om -> IM.adjust adjustdepthfn kid om) (_owlTree_mapping ot) kiddos
newot_0 = ot {_owlTree_mapping = omwithadjusteddepth}
-- recurse
r_1 = foldl (internal_owlTree_recalculateChildrenDepths_recursive) newot_0 kiddos
x -> ot
_ -> ot

-- parents allowed ONLY if all the children already exist in the tree (as orphans) or it will crash
-- returns the added element for convenience but NOT its children
Expand Down
4 changes: 1 addition & 3 deletions src/Potato/Flow/OwlState.hs
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,6 @@ import qualified Data.IntMap.Strict as IM
import Data.List.Ordered (isSortedBy)
import Data.Maybe
import qualified Data.Text as T
import qualified Data.Sequence as Seq



-- prob not the best place for these...
Expand Down Expand Up @@ -115,7 +113,7 @@ owlPFState_fromCanvasCoordinates OwlPFState {..} (V2 x y) = V2 (x+sx) (y+sy) whe
owlPFState_to_SuperOwlParliament :: OwlPFState -> SuperOwlParliament
owlPFState_to_SuperOwlParliament OwlPFState {..} = owlParliament_toSuperOwlParliament _owlPFState_owlTree $ OwlParliament $ _owlTree_topOwls _owlPFState_owlTree

do_newElts :: (HasCallStack) => [(REltId, OwlSpot, OwlItem)] -> OwlPFState -> (OwlPFState, SuperOwlChanges)
do_newElts :: [(REltId, OwlSpot, OwlItem)] -> OwlPFState -> (OwlPFState, SuperOwlChanges)
do_newElts seltls pfs@OwlPFState {..} = r where

-- notably, passing in a list here rather than SuperOwlParialment allows us to add parents with children so long as everything is sorted from left to right (such that the parent/sibling exist when the child gets added)
Expand Down
5 changes: 0 additions & 5 deletions src/Potato/Flow/OwlWorkspace.hs
Original file line number Diff line number Diff line change
Expand Up @@ -18,18 +18,13 @@ module Potato.Flow.OwlWorkspace (
import Relude

import Potato.Flow.Llama
import Potato.Flow.Math
import Potato.Flow.Owl
import Potato.Flow.OwlItem
import Potato.Flow.OwlState
import Potato.Flow.Serialization.Snake
import Potato.Flow.Types
import Potato.Flow.Preview

import Control.Exception (assert)
import qualified Data.IntMap.Strict as IM
import qualified Data.IntSet as IS
import qualified Data.Sequence as Seq

-- TODO get rid of this, now needed
data OwlPFWorkspace = OwlPFWorkspace {
Expand Down
1 change: 0 additions & 1 deletion src/Potato/Flow/RenderCache.hs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ import Potato.Flow.Methods.LineTypes


import qualified Data.IntMap as IM
import qualified Data.Text.IO as T
import qualified Data.Vector.Unboxed as V
import Control.Exception (assert)

Expand Down

0 comments on commit 326c558

Please sign in to comment.