Skip to content

Commit 431cebe

Browse files
authored
Merge pull request #364 from chrisgoringe/dev
1.4
2 parents 03ef54b + b288e42 commit 431cebe

21 files changed

+758
-218
lines changed

__init__.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
VERSION = "1.3.1"
1+
VERSION = "1.4"
22
WEB_DIRECTORY = "./js"
33

44
NODE_CLASS_MAPPINGS= {}

js/constants.js

+9-8
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ export class SettingIds {
22
static KEYBOARD_TOGGLE = "Controller.options.keyboard"
33
static CONTROL_AFTER_GENERATE = "Controller.options.control_after_generate"
44
static SCROLL_MOVES_SLIDERS = "Controller.options.scroll_moves_slider"
5+
static SCROLL_REVERSED = "Controller.options.scroll_reversed_for_slider"
56
static EDIT_SLIDERS = "Controller.options.edit_slider"
67
static DEBUG_LEVEL = "Controller.debug.level"
78
static FONT_SIZE = "Controller.options.font_size"
@@ -21,24 +22,24 @@ export class InclusionOptions {
2122
}
2223

2324
export class Timings { // ms
24-
static RESIZE_DELAY_BEFORE_REDRAW = 200
25-
static SETTINGS_TRY_RELOAD = 1000
2625
static DRAG_PAUSE_OVER_BACKGROUND = 500
27-
static END_HEIGHT_CHANGE_PAUSE = 10
28-
static UPDATE_GENERAL_WAITTIME = 1234
26+
static SLIDER_ACTIVE_DELAY = 300
2927
static UPDATE_EXCEPTION_WAITTIME = 10000
30-
static GROUP_SELECT_NOSELECT_WAIT = 5000
3128
static PAUSE_STACK_WAIT = 101
32-
static HOLDER_RESIZED_WAIT = 2000
33-
34-
static ON_CHANGE = 200
29+
static ACTIVE_ELEMENT_DELAY = 234
30+
static ON_CHANGE_GAP = 200
3531
}
3632

3733
export class Colors {
3834
static DARK_BACKGROUND = '#222222'
3935
static MENU_HIGHLIGHT = '#C08080'
4036
}
4137

38+
export class Pixels {
39+
static BORDER_WIDTH = 4
40+
static FOOTER = 4
41+
}
42+
4243
export class Texts {
4344
static ALL_GROUPS = "All"
4445
static UNGROUPED = "Ungrouped"

js/controller.css

+63-18
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,14 @@
1212
border-radius: 6px;
1313
}
1414

15-
.showing {
15+
.controller_menu_button.litup {
1616
color: var(--p-button-text-primary-color);
1717
}
1818

19+
.hide .hideable {
20+
display: none;
21+
}
22+
1923
.controller {
2024
--font-size: 12px;
2125
--element_width: 100%;
@@ -25,42 +29,42 @@
2529
--muted-fore-color: #999999;
2630

2731
--deep-back-color: #000000;
28-
--main-back-color: #1c1c1cee;
32+
--main-back-color: #1c1c1cfa;
2933
--second-back-color: #222222;
3034
--third-back-color: #353535;
3135

3236
--overlay-background: #ffffff66;
3337
--overlay-foreground: #353535;
3438

35-
--mute-button-color:red;
39+
--mute-button-color:#ff6e6e;
3640
--bypass-button-color: #d179ff;
41+
--mixed-button-color:#99aa99;
3742

3843
--mute-overlay-color: #ffffff30;
3944
--bypass-overlay-color: #d179ff30;
4045

4146
--toggle-on: #8899aa;
4247
--toggle-off: #333333;
4348

44-
--main-border-color: rgb(83 83 83);
49+
--main-border-color: rgb(53 53 53);
4550

4651
--progress-color: green;
4752
--active-color: green;
48-
49-
5053

54+
--border_width: 4px;
55+
5156
font-size: var(--font-size);
5257
height:100%;
5358
min-height: 42px;
5459
background: var(--main-back-color);
55-
padding: 0 0 0 2px;
60+
padding: 0 4px 0 4px;
5661
position: absolute;
5762
min-width: 130px;
5863
overflow: clip scroll;
59-
border-width: 4px;
64+
border-width: var(--border_width);
6065
border-style: solid;
6166
border-color: var(--main-border-color);
6267
border-radius: 4px;
63-
resize: both;
6468
z-index:999;
6569
scrollbar-width: auto;
6670
scrollbar-color: var(--third-back-color) var(--main-back-color);
@@ -74,7 +78,6 @@
7478

7579
.controller.hide_scrollbars {
7680
scrollbar-width: none;
77-
padding-right: 2px;
7881
}
7982

8083
.controller.collapsed {
@@ -83,6 +86,22 @@
8386
padding: 0px;
8487
}
8588

89+
.gutter_overlay {
90+
position: absolute;
91+
background-color: transparent;
92+
width: 100%;
93+
height: 100%;
94+
pointer-events: none;
95+
z-index:999;
96+
}
97+
98+
.gutter_overlap {
99+
position:absolute;
100+
pointer-events: none;
101+
background-color: #999999;
102+
border-radius: 2px;
103+
}
104+
86105

87106
/* Header */
88107

@@ -94,7 +113,7 @@
94113
display: flex;
95114
width: var(--element_width);
96115
justify-content: space-between;
97-
margin: 0px;
116+
margin: 0px 0px 4px 0px;
98117
align-items: center;
99118
flex-wrap: wrap;
100119
z-index:1;
@@ -118,6 +137,7 @@
118137

119138
.subheader2 {
120139
padding-top:2px;
140+
margin-bottom:0px;
121141
}
122142

123143
.subheader .left {
@@ -193,6 +213,8 @@
193213
flex-shrink: 0;
194214
}
195215

216+
217+
196218
.header_button {
197219
cursor: pointer;
198220
font-size: 12pt;
@@ -227,6 +249,7 @@
227249
}
228250
.header_button.mode_9:before {
229251
content: "\e959";
252+
color: var(--mixed-button-color);
230253
}
231254

232255

@@ -263,7 +286,7 @@
263286
width: var(--element_width);
264287
min-height: 40px;
265288
display:block;
266-
padding-bottom: 4px;
289+
padding-bottom: 3px;
267290
border: 1px solid transparent;
268291
}
269292

@@ -287,7 +310,7 @@
287310
.nodeblock_titlebar {
288311
font-size: 80%;
289312
display: block;
290-
padding: 1px 3px 2px 2px;
313+
padding: 2px 3px 2px 2px;
291314
color: var(--mid-fore-color);
292315
display: flex;
293316
justify-content: space-between;
@@ -296,10 +319,13 @@
296319

297320
.nodeblock_titlebar_right .pi {
298321
font-size:1.25em;
322+
vertical-align: middle;
299323
}
300324

301325
.nodeblock_titlebar_left .pi {
302-
font-size:0.95em;
326+
font-size:1.05em;
327+
top: 0.05em;
328+
position: relative;
303329
}
304330

305331
.minimised .entry { display: none; }
@@ -335,7 +361,13 @@
335361
.nodeblock_title {
336362
text-align: left;
337363
pointer-events: none;
338-
padding-left: 3px;
364+
padding-left: 4px;
365+
position: relative;
366+
bottom: 1px;
367+
}
368+
.nodeblock_title::after {
369+
content: " ";
370+
font-size: 1.25em;
339371
}
340372

341373
.nodeblock_image_panel {
@@ -361,6 +393,8 @@
361393
height:0px !important;
362394
}
363395

396+
397+
364398
.nodeblock .mode_button:before {
365399
content: "\ea14";
366400
}
@@ -379,7 +413,7 @@
379413

380414
.entry {
381415
position: relative;
382-
padding:4px 4px 0px 4px;
416+
padding:4px 3px 0px 3px;
383417
}
384418

385419
.entry_label {
@@ -390,7 +424,7 @@
390424
background: var(--second-back-color);
391425
color: var(--mid-fore-color);
392426
text-align: left;
393-
left: 8px;
427+
left: 6px;
394428
font-size: 70%;
395429
pointer-events: none;
396430
width: calc(var(--element_width) - 40px);
@@ -435,6 +469,7 @@ textarea.input {
435469
font-size: 85%;
436470
text-align: left;
437471
margin-bottom: -4px;
472+
padding: 3px 4px 3px 4px;
438473
}
439474

440475
.input option {
@@ -580,4 +615,14 @@ i {
580615
/* Show the tooltip text when you mouse over the tooltip container */
581616
.tooltip:hover .tooltiptext {
582617
visibility: visible;
583-
}
618+
}
619+
620+
.read_only .mode_button {
621+
opacity: 0.5;
622+
cursor: unset;
623+
}
624+
625+
.read_only .header_button {
626+
opacity: 0.5;
627+
cursor: unset;
628+
}

js/controller.js

+22-9
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,9 @@ import { BASE_PATH } from "./constants.js"
1111
import { ImageManager } from "./image_manager.js"
1212
import { global_settings } from "./settings.js"
1313
import { NodeBlock } from "./nodeblock.js"
14+
import { FancySlider } from "./input_slider.js"
15+
import { SnapManager } from "./snap_manager.js"
16+
import { Highlighter } from "./highlighter.js"
1417

1518
const MINIMUM_UE = 500006
1619
async function check_ue() {
@@ -28,7 +31,8 @@ async function check_ue() {
2831
}
2932

3033
function on_setup() {
31-
UpdateController.setup(ControllerPanel.redraw, ControllerPanel.can_refresh, ControllerPanel.node_change)
34+
UpdateController.setup(ControllerPanel.redraw, ControllerPanel.can_refresh, ControllerPanel.node_change)
35+
SnapManager.setup()
3236
NodeInclusionManager.node_change_callback = UpdateController.make_request
3337
api.addEventListener('graphCleared', ControllerPanel.graph_cleared)
3438

@@ -41,8 +45,14 @@ function on_setup() {
4145
api.addEventListener('executing', ControllerPanel.on_executing)
4246

4347
window.addEventListener("resize", ControllerPanel.onWindowResize)
44-
window.addEventListener('mouseup', ControllerPanel.mouse_up_anywhere)
45-
window.addEventListener('mousemove', ControllerPanel.mouse_move_anywhere)
48+
window.addEventListener('mouseup', (e)=>{
49+
ControllerPanel.mouse_up_anywhere(e)
50+
FancySlider.handle_mouse_up(e)
51+
})
52+
window.addEventListener('mousemove', (e)=>{
53+
ControllerPanel.mouse_move_anywhere(e)
54+
FancySlider.handle_mouse_move(e)
55+
})
4656

4757

4858
const original_getCanvasMenuOptions = LGraphCanvas.prototype.getCanvasMenuOptions;
@@ -92,12 +102,12 @@ app.registerExtension({
92102
// Allow our elements to do any setup they want
93103
try {
94104
on_setup()
95-
} catch (e) { Debug.error("on setup");console.error(e) }
105+
} catch (e) { Debug.error("on setup", e) }
96106

97107
// add to the canvas menu, and keyboard shortcuts
98108
try {
99109
add_controls()
100-
} catch (e) { Debug.error("add controls");console.error(e) }
110+
} catch (e) { Debug.error("add controls", e) }
101111

102112
try {
103113
const on_change = app.graph.on_change
@@ -106,20 +116,23 @@ app.registerExtension({
106116
on_change?.apply(this,arguments)
107117
OnChangeController.on_change()
108118
} catch (e) {
109-
Debug.error("*** EXCEPTION HANDLING on_change")
110-
console.error(e)
119+
Debug.error("on==_change", e)
111120
}
112121
}
113122
Debug.trivia("*** in setup, ADDED on_change")
114123
} catch (e) {
115-
Debug.error("*** EXCEPTION ADDING on_change")
124+
Debug.error("ADDING on_change", e)
116125
console.error(e)
117126
}
118127

119128
const draw = app.canvas.onDrawForeground;
120129
app.canvas.onDrawForeground = function(ctx, visible) {
121130
draw?.apply(this,arguments);
122-
NodeBlock.on_draw(ctx);
131+
try {
132+
Highlighter.on_draw(ctx);
133+
} catch (e) {
134+
Debug.error('onDrawForeground', e)
135+
}
123136
}
124137

125138
/* look for dialog boxes appearing or disappearing */

js/controller_controls.js

+8
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,14 @@ export function add_controls() {
6767
defaultValue: "yes",
6868
})
6969

70+
app.ui.settings.addSetting({
71+
id: SettingIds.SCROLL_REVERSED,
72+
name: "Scrollwheel reversed for sliders",
73+
tooltip: "Scroll up to reduce value",
74+
type: "boolean",
75+
defaultValue: false
76+
})
77+
7078
app.ui.settings.addSetting({
7179
id: SettingIds.SHOW_SCROLLBARS,
7280
name: "Controller scrollbars",

0 commit comments

Comments
 (0)