-
Notifications
You must be signed in to change notification settings - Fork 41
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Example application that uses Skia/Canvaskit to render/draw (#234)
* updating jsaddle * fiddling with skia * more rendering stuff + hookign into JS more * drawing from haskell * buttons + more acutal skia canvas loading * refactoring the canvaskit stuff into its own module * rendering points seems to work (but still rendered on the wrong pos) * SkiaCanvas rendering :) * cleaning + drawing polylines * colors * cleaning a bit * css fiddling * refactoring/cleaning * modes + buttons * fiddling with layers * fiddling with colors * colors * polylines * splitting into multiple files * some more refactoring * refactoring * more drawing stuff / more work on plyline mode * bunch of refactoring to have common miso helpers in a separate public hgeometry library * dealing with a modal * color modal editing * some small fixes to the panel * we can draw rectangles as well now :) * an add layer button * automatically close the color modal after doing something * a bunch of refactoring to support more selctMode stuff * completing selection (and rendering it somehow) * progress on computing selections * some refactoring * even more refactoring * storing more refs * mostly getting rid of useless imports * fiddling with storing/rendering pictures. Does not really work yet * fixed the bug I've been looking for all afternoon... * rendering (now with some caching :)) * common stuff about zooming * fixing some warnings + removed duplicate module * starting with polygon mode * some refactoring * drawing simple polygons :) * drawing polygons :)
- Loading branch information
Showing
46 changed files
with
3,603 additions
and
71 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
:set -fno-break-on-exception | ||
:def! reload (const $ return "::reload\nMiso.Bulma.JSAddle.debug 8080 mainJSM") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
module Action | ||
( Action(..) | ||
, ColorAction(..) | ||
) where | ||
|
||
import Color | ||
import Control.Lens hiding (view, element) | ||
import HGeometry.Miso.OrphanInstances () | ||
import Layers | ||
import Miso.String (MisoString) | ||
import Model | ||
import Modes | ||
import RectangleMode (Rectangle') | ||
import qualified SkiaCanvas | ||
import SkiaCanvas.CanvasKit hiding (Style(..)) | ||
|
||
-------------------------------------------------------------------------------- | ||
|
||
data Action = Id | ||
| OnLoad | ||
| CanvasKitAction InitializeSkCanvasAction | ||
| CanvasResizeAction SkiaCanvas.CanvasResizeAction | ||
| CanvasAction SkiaCanvas.InternalCanvasAction | ||
| CanvasClicked | ||
| CanvasRightClicked | ||
-- | AddPoint | ||
| Draw | ||
|
||
| ReDraw | ||
| StoreCached {-# UNPACK #-}!SkPictureRef | ||
|
||
-- | SetStrokeColor (Maybe Color) | ||
-- | SetFillColor (Maybe Color) | ||
| NotifyError !MisoString | ||
| SwitchMode !Mode | ||
| ToggleLayerStatus !(Index Layers) | ||
|
||
| StrokeAction !ColorAction | ||
| FillAction !ColorAction | ||
|
||
| AddLayer | ||
|
||
|
||
| ComputeSelection (Rectangle' R) | ||
|
||
| SaveSkpFile | ||
| LoadSkpFile | ||
|
||
|
||
|
||
-- | Actions one can do with the stroke or fill color | ||
data ColorAction = ToggleModal | ||
| ToggleColor | ||
| SetColor !Color | ||
deriving (Show,Eq) |
Oops, something went wrong.