Skip to content

Commit f6547f2

Browse files
committed
comments updated.
1 parent 48a5e9b commit f6547f2

File tree

6 files changed

+11
-13
lines changed

6 files changed

+11
-13
lines changed

library/src/debug/java/io/syslogic/colorpicker/compose/ColorPickerPreview.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ import androidx.compose.ui.tooling.preview.Preview
1818
fun ColorPickerPreview() {
1919
MaterialTheme {
2020
ColorPickerComponent(
21-
initialColor = Color.DarkGray,
21+
initialColor = Color(0xD31A3D9A),
2222
onColorChanged = null,
2323
showAlpha = true,
2424
showARGB = true,

library/src/main/java/io/syslogic/colorpicker/compose/AlphaPainter.kt

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -25,17 +25,15 @@ class AlphaPainter(intrinsicSize: Size) : BasePainter(intrinsicSize) {
2525
* This is invoked internally within [draw] after the positioning and configuring the [Painter].
2626
*/
2727
override fun DrawScope.onDraw() {
28-
2928
setCanvas(drawContext, density)
30-
3129
drawRect(
3230
size = size,
3331
brush = Brush.linearGradient(
3432
colors = listOf(Color.Transparent, Color.Black)
3533
)
3634
).also {
3735

38-
/* Borderline */
36+
/* Border */
3937
drawRect(
4038
size = size,
4139
color = Color(borderStrokeColor),
@@ -47,11 +45,10 @@ class AlphaPainter(intrinsicSize: Size) : BasePainter(intrinsicSize) {
4745

4846
/* Horizontal Tracker */
4947
val p: Point = alphaToPoint(value)
50-
val offset = Offset(p.x - (alphaTrackerWidth / 2), rect.top)
5148
drawRoundRect(
5249
color = Color(trackerStrokeColor),
5350
size = Size(alphaTrackerWidth, rect.height()),
54-
topLeft = offset,
51+
topLeft = Offset(p.x - (alphaTrackerWidth / 2), rect.top),
5552
style = Stroke(width = trackerStrokeWidth,
5653
pathEffect = PathEffect.cornerPathEffect(trackerCornerRadius)
5754
)

library/src/main/java/io/syslogic/colorpicker/compose/ColorPainter.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ class ColorPainter(intrinsicSize: Size) : BasePainter(intrinsicSize) {
2828
color = value
2929
).also {
3030

31-
/* Borderline */
31+
/* Border */
3232
drawRect(
3333
size = size,
3434
color = Color(borderStrokeColor),

library/src/main/java/io/syslogic/colorpicker/compose/ColorPickerComponent.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ import io.syslogic.colorpicker.compose.LayoutId.*
4040
*/
4141
@Composable
4242
fun ColorPickerComponent(
43-
initialColor: Color = Color.Transparent,
43+
initialColor: Color = Color.Unspecified,
4444
onColorChanged: OnColorChangedListener?,
4545
showAlpha: Boolean = true,
4646
showHSV: Boolean = true,

library/src/main/java/io/syslogic/colorpicker/compose/HuePainter.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ class HuePainter(intrinsicSize: Size) : BasePainter(intrinsicSize) {
3333
)
3434
).also {
3535

36-
/* Borderline */
36+
/* Border */
3737
drawRect(
3838
size = size,
3939
color = Color(borderStrokeColor),

library/src/main/java/io/syslogic/colorpicker/compose/SatValPainter.kt

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@ class SatValPainter(intrinsicSize: Size) : BasePainter(intrinsicSize) {
2525
* This is invoked internally within [draw] after the positioning and configuring the [Painter].
2626
*/
2727
override fun DrawScope.onDraw() {
28-
2928
setCanvas(drawContext, density)
3029

3130
/* Saturation Shader with Alpha */
@@ -51,7 +50,7 @@ class SatValPainter(intrinsicSize: Size) : BasePainter(intrinsicSize) {
5150
composition.shader = ComposeShader(mContrastShader, mSaturationShader, PorterDuff.Mode.MULTIPLY)
5251
canvas.drawRect(rect, composition)
5352

54-
/* Borderline */
53+
/* Border */
5554
val border = Paint()
5655
border.style = Paint.Style.STROKE
5756
border.strokeWidth = borderStrokeWidth
@@ -65,15 +64,16 @@ class SatValPainter(intrinsicSize: Size) : BasePainter(intrinsicSize) {
6564
tracker.strokeWidth = trackerStrokeWidth
6665
tracker.isAntiAlias = true
6766

68-
/* Outer circle */
67+
/* Outer circle (dark) */
6968
tracker.color = trackerStrokeColor
7069
canvas.drawCircle(p.x.toFloat(), p.y.toFloat(), satValTrackerRadius1, tracker)
7170

72-
/* Inner circle */
71+
/* Inner circle (light) */
7372
tracker.color = Color.White.hashCode()
7473
canvas.drawCircle(p.x.toFloat(), p.y.toFloat(), satValTrackerRadius2, tracker)
7574
}
7675

76+
/** Getters */
7777
private fun getAlpha() : Float {
7878
return this.value[0]
7979
}
@@ -87,6 +87,7 @@ class SatValPainter(intrinsicSize: Size) : BasePainter(intrinsicSize) {
8787
return this.value[3]
8888
}
8989

90+
/** Setters */
9091
fun setAlpha(value: Float) {
9192
this.value[0] = value
9293
}

0 commit comments

Comments
 (0)