Skip to content

Commit c1af26c

Browse files
Update README.md
1 parent 91e18dc commit c1af26c

File tree

5 files changed

+15
-7
lines changed

5 files changed

+15
-7
lines changed

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -126,6 +126,8 @@ using previous searches using a database, domain with ViewModel.
126126
| | |
127127
|<h3>6-4-2 Drawing App</h3><br/>Draw to canvas using touch down, move and up events using array of paths to have erase, undo, redo actions and set properties for each path separately.<br><br>• Canvas<br>• DrawScope<br>• Path<br>• AwaitPointerEventScope<br>• PointerInputChange<br>• BlendMode<br>|<img src ="/./screenshots/tutorial6_4_2.gif" width=320> |
128128
| | |
129+
|<h3>6-5 Color Picker</h3><br/>Color Picker that calculates angle from center and gets a color using hue and returns a color as in HSL or RGB color model.<br><br>• Canvas<br>• DrawScope<br>• Path<br>• AwaitPointerEventScope<br>• PointerInputChange<br>• BlendMode<br>|<img src ="/./screenshots/tutorial6_5.gif" width=320> |
130+
| | |
129131

130132
### Resources and References
131133
[Codelab Jetpack Compose Basics](https://developer.android.com/codelabs/jetpack-compose-basics)

Tutorial1-1Basics/src/main/java/com/smarttoolfactory/tutorial1_1basics/MainScreen.kt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,11 @@ package com.smarttoolfactory.tutorial1_1basics
33
import androidx.compose.animation.ExperimentalAnimationApi
44
import androidx.compose.foundation.ExperimentalFoundationApi
55
import androidx.compose.foundation.layout.PaddingValues
6-
import androidx.compose.foundation.layout.padding
76
import androidx.compose.material.ExperimentalMaterialApi
87
import androidx.compose.material.Scaffold
98
import androidx.compose.runtime.Composable
109
import androidx.compose.ui.ExperimentalComposeUiApi
11-
import androidx.compose.ui.Modifier
10+
import com.smarttoolfactory.tutorial1_1basics.chapter6_graphics.Tutorial6_5Screen
1211

1312
@ExperimentalMaterialApi
1413
@ExperimentalAnimationApi
@@ -17,6 +16,7 @@ import androidx.compose.ui.Modifier
1716
@Composable
1817
fun MainScreen() {
1918
Scaffold { paddingValues: PaddingValues ->
20-
TutorialNavGraph(modifier = Modifier.padding(paddingValues))
19+
// TutorialNavGraph(modifier = Modifier.padding(paddingValues))
20+
Tutorial6_5Screen()
2121
}
2222
}

Tutorial1-1Basics/src/main/java/com/smarttoolfactory/tutorial1_1basics/chapter6_graphics/colorpicker/SaturationRhombus.kt

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ fun SaturationRhombus(
5858
* Width and height of the rhombus is geometrically equal so it's sufficient to
5959
* use either width or height to have a length parameter
6060
*/
61-
val length = maxWidth.value* density
61+
val length = maxWidth.value * density
6262

6363
/**
6464
* This is list of points with changing [saturation] up while going from left to right
@@ -104,8 +104,15 @@ fun SaturationRhombus(
104104

105105
// Horizontal range for keeping x position in rhombus bounds
106106
val range = getBoundsInLength(length, posY)
107+
val start = range.start - selectorRadius
108+
val end = range.endInclusive + selectorRadius
107109

108-
isTouched = range.contains(posX)
110+
isTouched = posX in start..end
111+
112+
println("🔥 onDown()\n" +
113+
" posX: $posX, posY: $posY\n" +
114+
"range: $range\n" +
115+
"start: $start, end: $end, isTouched: $isTouched")
109116

110117
if (isTouched) {
111118

@@ -195,7 +202,6 @@ private fun setSelectorPositionFromColorParams(
195202
return Offset(horizontalPositionOnRhombus, verticalPositionOnRhombus)
196203
}
197204

198-
199205
/**
200206
* Get range that this position can be. This is for limiting touch position inside rhombus.
201207
* For instance if y position is 10, then x should either be center - 10 or center + 10 to maintain

Tutorial1-1Basics/src/main/java/com/smarttoolfactory/tutorial1_1basics/tutorial_list/TutorialList.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1219,7 +1219,7 @@ fun createGraphicsTutorialList(): List<TutorialSectionModel> {
12191219
val tutorial6_5 = TutorialSectionModel(
12201220
title = "6-5 Color Picker",
12211221
description = "Color Picker that calculates angle from center and gets a color " +
1222-
"using hue and returns a color as in HSV or RGB color model.",
1222+
"using hue and returns a color as in HSL or RGB color model.",
12231223
action = {
12241224
Tutorial6_5Screen()
12251225
},

screenshots/tutorial6_5.gif

1.15 MB
Loading

0 commit comments

Comments
 (0)