hokusai-zero 0.2.6.pre.android → 0.2.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +1 -1
- data/ast/src/core/util.c +23 -23
- data/ast/src/core/util.h +7 -7
- data/ext/extconf.rb +3 -3
- data/hokusai.gemspec +1 -1
- data/ui/lib/lib_hokusai.rb +7 -7
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c28ec9cbfb0ad097992724a26e9304ff581f2becdb0c3edae24b953fecf6f69c
|
4
|
+
data.tar.gz: 7d78d50e110f70dd8af7095df76bd5b039d13c205336c31f42d58c9d503cceb5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e4c92faf605ff7a6b4f9e0c3489327a01886ee18b2a2700a502b10b984fabf49e365986fb17c37c24d7f474fa7689e36761709bc1e59fcc0cd238ccf29ca8011
|
7
|
+
data.tar.gz: a2b09402e3f899644cb30e398130111e2afd40542763e6e9377f9777b6c5facf56f54465451b26ee2296d3834cc3be1aed640c7856bb2a7839801c260f7ad9ac
|
data/README.md
CHANGED
data/ast/src/core/util.c
CHANGED
@@ -3,33 +3,33 @@
|
|
3
3
|
|
4
4
|
#include "util.h"
|
5
5
|
|
6
|
-
bool hoku_rect_includes_y(hoku_rect
|
6
|
+
bool hoku_rect_includes_y(hoku_rect rect, float y)
|
7
7
|
{
|
8
|
-
return y > rect
|
8
|
+
return y > rect.y && y <= (rect.y + rect.h);
|
9
9
|
}
|
10
10
|
|
11
|
-
bool hoku_rect_includes_x(hoku_rect
|
11
|
+
bool hoku_rect_includes_x(hoku_rect rect, float x)
|
12
12
|
{
|
13
|
-
return x > rect
|
13
|
+
return x > rect.x && x <= (rect.x + rect.w);
|
14
14
|
}
|
15
15
|
|
16
|
-
float hoku_rect_x_left(hoku_rect
|
16
|
+
float hoku_rect_x_left(hoku_rect rect, int times)
|
17
17
|
{
|
18
|
-
return (rect
|
18
|
+
return (rect.x - ((rect.w / 2) * times));
|
19
19
|
}
|
20
|
-
float hoku_rect_x_right(hoku_rect
|
20
|
+
float hoku_rect_x_right(hoku_rect rect, int times)
|
21
21
|
{
|
22
|
-
return (rect
|
22
|
+
return (rect.x + ((rect.w / 2) * times));
|
23
23
|
}
|
24
24
|
|
25
|
-
float hoku_rect_y_up(hoku_rect
|
25
|
+
float hoku_rect_y_up(hoku_rect rect, int times)
|
26
26
|
{
|
27
|
-
return (rect
|
27
|
+
return (rect.y - ((rect.h / 2) * times));
|
28
28
|
}
|
29
29
|
|
30
|
-
float hoku_rect_y_down(hoku_rect
|
30
|
+
float hoku_rect_y_down(hoku_rect rect, int times)
|
31
31
|
{
|
32
|
-
return (rect
|
32
|
+
return (rect.y + ((rect.h / 2) * times));
|
33
33
|
}
|
34
34
|
|
35
35
|
int hoku_selection_init(hoku_selection** selection)
|
@@ -68,28 +68,28 @@ bool hoku_selection_selected(hoku_selection* selection, float x, float y, float
|
|
68
68
|
bool right = selection->start_x <= selection->stop_x;
|
69
69
|
|
70
70
|
hoku_rect hit_box = (hoku_rect){.x=x, .y=y, .w=width, .h=height};
|
71
|
-
float x_shifted_right = hoku_rect_x_right(
|
72
|
-
float y_shifted_up = hoku_rect_y_up(
|
73
|
-
float y_shifted_down = hoku_rect_y_down(
|
71
|
+
float x_shifted_right = hoku_rect_x_right(hit_box, 1);
|
72
|
+
float y_shifted_up = hoku_rect_y_up(hit_box, 2);
|
73
|
+
float y_shifted_down = hoku_rect_y_down(hit_box, 2);
|
74
74
|
float end_y = y + height;
|
75
75
|
|
76
76
|
return (
|
77
77
|
(down &&
|
78
78
|
// first line of multiline selection
|
79
|
-
((x_shifted_right > sx && end_y < ey && hoku_rect_includes_y(
|
79
|
+
((x_shifted_right > sx && end_y < ey && hoku_rect_includes_y(hit_box, sy)) ||
|
80
80
|
// last line of multiline selection
|
81
81
|
(x_shifted_right <= ex && y_shifted_up + hit_box.h < ey && hit_box.y > sy) ||
|
82
82
|
// middle line (all selected)
|
83
83
|
(hit_box.y > sy && end_y < ey))) ||
|
84
84
|
(up &&
|
85
85
|
// first line of multiline selection
|
86
|
-
((x_shifted_right <= sx && hit_box.y > ey && hoku_rect_includes_y(
|
86
|
+
((x_shifted_right <= sx && hit_box.y > ey && hoku_rect_includes_y(hit_box, sy)) ||
|
87
87
|
// last line of multiline selection
|
88
88
|
(x_shifted_right >= ex && y_shifted_down > ey && end_y < sy) ||
|
89
89
|
// middle line (all selected)
|
90
90
|
(hit_box.y > ey && hit_box.y + hit_box.h < sy))) ||
|
91
91
|
// single line selection
|
92
|
-
((hoku_rect_includes_y(
|
92
|
+
((hoku_rect_includes_y(hit_box, sy) && hoku_rect_includes_y(hit_box, ey)) &&
|
93
93
|
((left && x_shifted_right < sx && x_shifted_right > ex) || (right && x_shifted_right > sx && x_shifted_right < ex)))
|
94
94
|
);
|
95
95
|
}
|
@@ -108,7 +108,7 @@ hoku_cursor_position hoku_selection_cursor_get(hoku_selection* selection)
|
|
108
108
|
return pos;
|
109
109
|
}
|
110
110
|
|
111
|
-
int hoku_selection_cursor_set(hoku_selection* selection, hoku_cursor_position
|
111
|
+
int hoku_selection_cursor_set(hoku_selection* selection, hoku_cursor_position cursor)
|
112
112
|
{
|
113
113
|
if (selection->cursor == NULL)
|
114
114
|
{
|
@@ -117,10 +117,10 @@ int hoku_selection_cursor_set(hoku_selection* selection, hoku_cursor_position* c
|
|
117
117
|
if (selection->cursor == NULL) return -1;
|
118
118
|
}
|
119
119
|
|
120
|
-
selection->cursor->x = cursor
|
121
|
-
selection->cursor->y = cursor
|
122
|
-
selection->cursor->w = cursor
|
123
|
-
selection->cursor->h = cursor
|
120
|
+
selection->cursor->x = cursor.x;
|
121
|
+
selection->cursor->y = cursor.y;
|
122
|
+
selection->cursor->w = cursor.w;
|
123
|
+
selection->cursor->h = cursor.h;
|
124
124
|
|
125
125
|
return 0;
|
126
126
|
}
|
data/ast/src/core/util.h
CHANGED
@@ -30,16 +30,16 @@ typedef struct HokuSelection
|
|
30
30
|
hoku_cursor_position* cursor;
|
31
31
|
} hoku_selection;
|
32
32
|
|
33
|
-
bool hoku_rect_includes_y(hoku_rect
|
34
|
-
bool hoku_rect_includes_x(hoku_rect
|
35
|
-
float hoku_rect_x_left(hoku_rect
|
36
|
-
float hoku_rect_x_right(hoku_rect
|
37
|
-
float hoku_rect_y_up(hoku_rect
|
38
|
-
float hoku_rect_y_down(hoku_rect
|
33
|
+
bool hoku_rect_includes_y(hoku_rect rect, float y);
|
34
|
+
bool hoku_rect_includes_x(hoku_rect rect, float x);
|
35
|
+
float hoku_rect_x_left(hoku_rect rect, int times);
|
36
|
+
float hoku_rect_x_right(hoku_rect rect, int times);
|
37
|
+
float hoku_rect_y_up(hoku_rect rect, int times);
|
38
|
+
float hoku_rect_y_down(hoku_rect rect, int times);
|
39
39
|
|
40
40
|
int hoku_selection_init(hoku_selection** selection);
|
41
41
|
bool hoku_selection_selected(hoku_selection* selection, float x, float y, float width, float height);
|
42
|
-
int hoku_selection_cursor_set(hoku_selection* selection, hoku_cursor_position
|
42
|
+
int hoku_selection_cursor_set(hoku_selection* selection, hoku_cursor_position cursor);
|
43
43
|
void hoku_selection_cursor_free(hoku_selection* selection);
|
44
44
|
void hoku_selection_free(hoku_selection* selection);
|
45
45
|
|
data/ext/extconf.rb
CHANGED
@@ -9,7 +9,7 @@ if MiniPortile.darwin?
|
|
9
9
|
elsif MiniPortile.linux?
|
10
10
|
suffix = "so"
|
11
11
|
ext = "tar.gz"
|
12
|
-
md4cext = "
|
12
|
+
md4cext = "so"
|
13
13
|
MDFLAGS = "-DCMAKE_POSITION_INDEPENDENT_CODE=ON"
|
14
14
|
elsif MiniPortile.windows?
|
15
15
|
suffix = "dll"
|
@@ -45,7 +45,7 @@ md4c = MiniPortileCMake.new("md4c", "0.5.2")
|
|
45
45
|
md4c.files = ["https://github.com/mity/md4c/archive/refs/tags/release-0.5.2.#{ext}"]
|
46
46
|
|
47
47
|
def md4c.cmake_compile_flags
|
48
|
-
[*super, "-DBUILD_SHARED_LIBS=OFF
|
48
|
+
[*super, "-DBUILD_SHARED_LIBS=OFF #{MDFLAGS}"]
|
49
49
|
end
|
50
50
|
|
51
51
|
md4c.cook
|
@@ -89,4 +89,4 @@ File.open("Makefile", "w") do |io|
|
|
89
89
|
#{"\t"}rm -f #{File.expand_path("vendor/lib/libhokusai.*")}
|
90
90
|
#{"\t"}rm -f #{File.expand_path("vendor/lib/libmd4c.*")}
|
91
91
|
EOF
|
92
|
-
end
|
92
|
+
end
|
data/hokusai.gemspec
CHANGED
data/ui/lib/lib_hokusai.rb
CHANGED
@@ -352,16 +352,16 @@ module LibHokusai
|
|
352
352
|
|
353
353
|
attach_function :hoku_selection_init, [:pointer], :int
|
354
354
|
attach_function :hoku_selection_selected, [HokuSelection.by_ref, :float, :float, :float, :float], :bool
|
355
|
-
attach_function :hoku_selection_cursor_set, [HokuSelection.by_ref, HokuCursorPosition.
|
355
|
+
attach_function :hoku_selection_cursor_set, [HokuSelection.by_ref, HokuCursorPosition.by_value], :int
|
356
356
|
attach_function :hoku_selection_cursor_free, [HokuSelection.by_ref], :void
|
357
357
|
attach_function :hoku_selection_free, [HokuSelection.by_ref], :void
|
358
358
|
|
359
|
-
attach_function :hoku_rect_includes_y, [HmlRect.
|
360
|
-
attach_function :hoku_rect_includes_x, [HmlRect.
|
361
|
-
attach_function :hoku_rect_x_left, [HmlRect.
|
362
|
-
attach_function :hoku_rect_x_right, [HmlRect.
|
363
|
-
attach_function :hoku_rect_y_up, [HmlRect.
|
364
|
-
attach_function :hoku_rect_y_down, [HmlRect.
|
359
|
+
attach_function :hoku_rect_includes_y, [HmlRect.by_value, :float], :bool
|
360
|
+
attach_function :hoku_rect_includes_x, [HmlRect.by_value, :float], :bool
|
361
|
+
attach_function :hoku_rect_x_left, [HmlRect.by_value, :int], :float
|
362
|
+
attach_function :hoku_rect_x_right, [HmlRect.by_value, :int], :float
|
363
|
+
attach_function :hoku_rect_y_up, [HmlRect.by_value, :int], :float
|
364
|
+
attach_function :hoku_rect_y_down, [HmlRect.by_value, :int], :float
|
365
365
|
|
366
366
|
class HokuChar < FFI::Struct
|
367
367
|
layout :offset, :int,
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: hokusai-zero
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.6
|
4
|
+
version: 0.2.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- skinnyjames
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2025-06-
|
11
|
+
date: 2025-06-24 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: ffi
|