diff --git a/dotscape b/dotscape index 1ed7fc2..21000d6 100755 Binary files a/dotscape and b/dotscape differ diff --git a/fcore/app-with.sml b/fcore/app-with.sml index e4435e3..48037df 100644 --- a/fcore/app-with.sml +++ b/fcore/app-with.sml @@ -860,13 +860,14 @@ struct } = app val squares = changeSquaresSize (squares, newCanvasWidth, canvasHeight) + val arrowX = Int.min (arrowX, newCanvasWidth) in { mode = mode , canvasWidth = newCanvasWidth + , arrowX = arrowX , mouseX = mouseX , mouseY = mouseY , squares = squares - , arrowX = arrowX , arrowY = arrowY , canvasHeight = canvasHeight , windowWidth = windowWidth diff --git a/fcore/normal-mode.sml b/fcore/normal-mode.sml index 0f5cbca..9fbb1b1 100644 --- a/fcore/normal-mode.sml +++ b/fcore/normal-mode.sml @@ -154,9 +154,6 @@ struct val dotVec = getDotVecFromIndices (model, hIdx, vIdx) - val halfWidth = Real32.fromInt (windowWidth div 2) - val halfHeight = Real32.fromInt (windowHeight div 2) - val maxSide = Int.max (canvasWidth, canvasHeight) val squares = CollisionTree.toTriangles ( windowWidth @@ -248,13 +245,55 @@ struct end fun updateNum (model: app_type, newNum) = - (AppWith.modalNum (model, newNum), []) + (AppWith.modalNum (model, newNum), []) fun updateRed model = (AppWith.r model, []) fun updateGreen model = (AppWith.g model, []) fun updateBlue model = (AppWith.b model, []) fun updateAlpha model = (AppWith.a model, []) + fun updateCanvasWidth (model, newCanvasWidth) = + let + val model = AppWith.canvasWidth (model, newCanvasWidth) + + val + { arrowX + , arrowY + , windowWidth + , windowHeight + , squares + , canvasWidth + , canvasHeight + , xClickPoints + , yClickPoints + , showGraph + , ... + } = model + + val dotVec = getDotVecFromIndices (model, #arrowX model, #arrowY model) + val graphLines = + if showGraph then GraphLines.generate model else Vector.fromList [] + + val maxSide = Int.max (canvasWidth, canvasHeight) + val squares = CollisionTree.toTriangles + ( windowWidth + , windowHeight + , squares + , maxSide + , canvasWidth + , canvasHeight + , xClickPoints + , yClickPoints + ) + + val msg = + RESIZE_SQUARES_DOTS_AND_GRAPH + {squares = squares, dots = dotVec, graphLines = graphLines} + in + (model, [DRAW msg]) + end + + fun enterBrowseMode model = let val model = AppWith.mode (model, AppType.BROWSE_MODE) @@ -283,6 +322,7 @@ struct | KEY_G => updateGreen model | KEY_B => updateBlue model | KEY_A => updateAlpha model + | KEY_W newCanvasWidth => updateCanvasWidth (model, newCanvasWidth) | RESIZE_WINDOW {width, height} => resizeWindow (model, width, height) | UNDO_ACTION => undoAction model | REDO_ACTION => redoAction model diff --git a/message-types/input-msg.sml b/message-types/input-msg.sml index 53cc378..283b710 100644 --- a/message-types/input-msg.sml +++ b/message-types/input-msg.sml @@ -12,6 +12,7 @@ struct | KEY_B | KEY_T | KEY_A + | KEY_W of int | KEY_CTRL_S | KEY_CTRL_L | KEY_CTRL_E