node-renderer.css 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483
  1. /* ========== 公共节点样式(所有节点都会继承) ========== */
  2. /* 所有节点的基础交互和事件处理 */
  3. .Blueprint-node,
  4. .Blueprint-variable-node,
  5. .Blueprint-variable-set-node,
  6. .Blueprint-begin-node,
  7. .Blueprint-set-node,
  8. .Blueprint-get-node,
  9. .Blueprint-echo-node,
  10. .Blueprint-func-node,
  11. .Blueprint-schedule-node,
  12. .Blueprint-while-node,
  13. .Blueprint-if-node,
  14. .Blueprint-delay-node {
  15. /* 基础定位和尺寸 */
  16. position: absolute;
  17. width: fit-content;
  18. overflow: visible;
  19. /* 事件处理(公共逻辑) */
  20. pointer-events: auto; /* 节点本身可以接收事件 */
  21. user-select: none; /* 防止文本被选中 */
  22. cursor: move; /* 鼠标悬停显示可拖动 */
  23. z-index: 10; /* 确保节点在连线之上 */
  24. }
  25. /* 所有节点的子元素(header、body、execution等)默认不拦截事件 */
  26. .Blueprint-node > *:not(.Blueprint-node-port),
  27. .Blueprint-variable-node > *:not(.Blueprint-node-port),
  28. .Blueprint-variable-set-node > *:not(.Blueprint-node-port),
  29. .Blueprint-begin-node > *:not(.Blueprint-node-port),
  30. .Blueprint-set-node > *:not(.Blueprint-node-port),
  31. .Blueprint-get-node > *:not(.Blueprint-node-port),
  32. .Blueprint-echo-node > *:not(.Blueprint-node-port),
  33. .Blueprint-func-node > *:not(.Blueprint-node-port),
  34. .Blueprint-schedule-node > *:not(.Blueprint-node-port),
  35. .Blueprint-while-node > *:not(.Blueprint-node-port),
  36. .Blueprint-if-node > *:not(.Blueprint-node-port),
  37. .Blueprint-delay-node > *:not(.Blueprint-node-port) {
  38. pointer-events: none; /* 让事件传递到父节点 */
  39. user-select: none; /* 防止文本被选中 */
  40. }
  41. /* 所有端口可以接收事件(用于连线) */
  42. .Blueprint-node-port {
  43. pointer-events: auto !important; /* 端口可以接收事件 */
  44. }
  45. /* 流程节点样式 */
  46. .Blueprint-node {
  47. min-width: 180px;
  48. background: #2d2d30;
  49. border: 2px solid #007acc;
  50. border-radius: 4px;
  51. box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
  52. display: flex;
  53. flex-direction: column;
  54. align-items: stretch;
  55. }
  56. .Blueprint-node.selected {
  57. border-color: #ffa500;
  58. box-shadow: 0 0 0 2px rgba(255, 165, 0, 0.3);
  59. }
  60. /* 变量节点样式(圆角矩形,蓝色发光轮廓,扁平设计) */
  61. .Blueprint-variable-node {
  62. min-width: 140px;
  63. height: 40px; /* 固定高度,更扁平 */
  64. background: #2d2d30;
  65. border: 2px solid #2196f3;
  66. border-radius: 12px; /* 圆角矩形 */
  67. box-shadow: 0 0 8px rgba(33, 150, 243, 0.4), 0 2px 8px rgba(0, 0, 0, 0.3); /* 蓝色发光效果 */
  68. padding: 0 12px; /* 左右padding让内容有间距 */
  69. display: flex;
  70. flex-direction: row;
  71. align-items: center;
  72. justify-content: center;
  73. }
  74. .Blueprint-variable-node.selected {
  75. border-color: #ffa500;
  76. box-shadow: 0 0 0 2px rgba(255, 165, 0, 0.3), 0 0 8px rgba(33, 150, 243, 0.4);
  77. }
  78. /* SET 变量节点样式(类似流程节点,但更紧凑) */
  79. .Blueprint-variable-set-node {
  80. min-width: 160px;
  81. background: #2d2d30;
  82. border: 2px solid #2196f3;
  83. border-radius: 8px;
  84. box-shadow: 0 0 8px rgba(33, 150, 243, 0.4), 0 2px 8px rgba(0, 0, 0, 0.3);
  85. display: flex;
  86. flex-direction: column;
  87. align-items: stretch;
  88. }
  89. .Blueprint-variable-set-node.selected {
  90. border-color: #ffa500;
  91. box-shadow: 0 0 0 2px rgba(255, 165, 0, 0.3), 0 0 8px rgba(33, 150, 243, 0.4);
  92. }
  93. /* SET 节点标题 */
  94. .Blueprint-variable-set-header {
  95. background: linear-gradient(135deg, #424242 0%, #303030 100%);
  96. color: #fff;
  97. padding: 8px 16px;
  98. font-size: 14px;
  99. font-weight: 600;
  100. text-align: center;
  101. border-radius: 6px 6px 0 0;
  102. letter-spacing: 1px;
  103. }
  104. /* SET 节点执行箭头区域 */
  105. .Blueprint-variable-set-execution {
  106. height: 32px;
  107. display: flex;
  108. flex-direction: row;
  109. justify-content: space-between;
  110. align-items: center;
  111. position: relative;
  112. overflow: visible;
  113. padding: 0 8px;
  114. }
  115. .Blueprint-variable-set-execution .Blueprint-node-port {
  116. position: relative;
  117. }
  118. .Blueprint-variable-set-execution .Blueprint-node-port.input.port-execution {
  119. left: auto;
  120. top: auto;
  121. }
  122. .Blueprint-variable-set-execution .Blueprint-node-port.output.port-execution {
  123. right: auto;
  124. top: auto;
  125. margin-left: auto;
  126. }
  127. /* SET 节点数据端口区域 */
  128. .Blueprint-variable-set-data {
  129. padding: 8px 16px;
  130. overflow: visible;
  131. display: flex;
  132. flex-direction: column;
  133. gap: 4px;
  134. position: relative;
  135. min-height: 28px;
  136. }
  137. .Blueprint-variable-set-data .Blueprint-node-port {
  138. position: relative;
  139. left: auto;
  140. right: auto;
  141. }
  142. .Blueprint-variable-set-data .Blueprint-node-port.input {
  143. flex-direction: row;
  144. align-items: center;
  145. gap: 6px;
  146. }
  147. .Blueprint-variable-node-label {
  148. color: #fff;
  149. font-size: 13px;
  150. font-weight: 500;
  151. text-align: center;
  152. padding: 0 12px;
  153. flex: 1;
  154. display: flex;
  155. align-items: center;
  156. justify-content: center;
  157. }
  158. .Blueprint-node-header {
  159. background: #007acc;
  160. color: #fff;
  161. padding: 12px 16px;
  162. font-size: 13px;
  163. font-weight: 500;
  164. border-radius: 2px 2px 0 0;
  165. display: flex;
  166. align-items: center;
  167. justify-content: center;
  168. }
  169. /* 区域2:执行箭头区域(固定高度) */
  170. .Blueprint-node-execution {
  171. height: 40px; /* 固定高度 */
  172. display: flex;
  173. flex-direction: row;
  174. justify-content: space-between; /* 输入在左,输出在右 */
  175. align-items: center; /* 纵向居中 */
  176. position: relative;
  177. overflow: visible;
  178. padding: 0 8px;
  179. }
  180. /* 区域3:参数区域 */
  181. .Blueprint-node-params {
  182. padding: 12px 16px;
  183. overflow: visible;
  184. display: flex;
  185. flex-direction: column;
  186. gap: 8px; /* 参数之间的间距 */
  187. position: relative;
  188. min-height: 20px;
  189. }
  190. .Blueprint-variable-node-body {
  191. width: 100%;
  192. height: 100%;
  193. padding: 0 8px;
  194. overflow: visible;
  195. display: flex;
  196. align-items: center;
  197. justify-content: space-between;
  198. }
  199. /* 变量节点的端口样式调整 */
  200. .Blueprint-variable-node .Blueprint-node-port {
  201. position: absolute;
  202. top: 50%;
  203. transform: translateY(-50%);
  204. display: flex;
  205. align-items: center;
  206. justify-content: center;
  207. }
  208. .Blueprint-variable-node .Blueprint-node-port.input {
  209. left: -8px;
  210. }
  211. .Blueprint-variable-node .Blueprint-node-port.output {
  212. right: -8px;
  213. }
  214. .Blueprint-node-port {
  215. position: absolute; /* 端口位置需要根据计算值定位,保留绝对定位 */
  216. cursor: crosshair;
  217. z-index: 10;
  218. display: flex;
  219. align-items: center;
  220. overflow: visible; /* 确保箭头不被裁剪 */
  221. min-width: 16px;
  222. min-height: 16px;
  223. }
  224. /* 执行端口的容器,确保箭头可以伸出 */
  225. .Blueprint-node-port.port-execution {
  226. width: 20px;
  227. height: 12px;
  228. }
  229. /* 数据端口在节点内部,稍微靠近边缘 */
  230. .Blueprint-node-port.input:not(.port-execution) {
  231. left: 8px;
  232. flex-direction: row;
  233. align-items: center;
  234. gap: 4px;
  235. width: auto; /* 允许端口容器根据内容扩展 */
  236. max-width: calc(100% - 16px); /* 确保不超过节点宽度 */
  237. }
  238. .Blueprint-node-port.output:not(.port-execution) {
  239. right: 8px;
  240. flex-direction: row-reverse; /* 圆点在左,标签在右 */
  241. align-items: center;
  242. gap: 4px;
  243. width: auto; /* 允许端口容器根据内容扩展 */
  244. max-width: calc(100% - 16px); /* 确保不超过节点宽度 */
  245. }
  246. /* 执行区域内的端口样式 */
  247. .Blueprint-node-execution .Blueprint-node-port {
  248. position: relative; /* 相对定位,参与 flex 布局 */
  249. }
  250. .Blueprint-node-execution .Blueprint-node-port.input.port-execution {
  251. left: auto;
  252. top: auto;
  253. }
  254. .Blueprint-node-execution .Blueprint-node-port.output.port-execution {
  255. right: auto;
  256. top: auto;
  257. margin-left: auto; /* 当只有输出端口时,推到右边 */
  258. }
  259. /* 参数区域内的端口样式 */
  260. .Blueprint-node-params .Blueprint-node-port {
  261. position: relative; /* 相对定位,参与 flex 布局 */
  262. }
  263. .Blueprint-node-params .Blueprint-node-port.input:not(.port-execution) {
  264. left: auto;
  265. }
  266. .Blueprint-node-params .Blueprint-node-port.output:not(.port-execution) {
  267. right: auto;
  268. align-self: flex-end; /* 输出端口靠右 */
  269. }
  270. /* 执行端口箭头样式 - 参考虚幻5蓝图风格 */
  271. .Blueprint-node-port-arrow {
  272. width: 0;
  273. height: 0;
  274. border-style: solid;
  275. display: flex;
  276. flex-shrink: 0;
  277. pointer-events: none; /* 箭头不拦截事件,让父元素(端口)处理 */
  278. }
  279. /* 执行输入端口箭头(在左侧,指向右,进入节点) */
  280. .Blueprint-node-port-arrow.execution-input {
  281. border-width: 6px 0 6px 10px;
  282. border-color: transparent transparent transparent #fff;
  283. margin-left: 5%; /* 箭头向右移动,使用百分比 */
  284. overflow: visible;
  285. order: 0;
  286. }
  287. .Blueprint-node-port.input.port-execution:hover .Blueprint-node-port-arrow.execution-input {
  288. border-left-color: #ccc;
  289. }
  290. /* 执行输出端口箭头(在右侧,指向右,离开节点) */
  291. .Blueprint-node-port-arrow.execution-output {
  292. border-width: 6px 0 6px 10px;
  293. border-color: transparent transparent transparent #fff;
  294. margin-right: -8px; /* 箭头从节点边缘伸出 */
  295. overflow: visible;
  296. order: 0;
  297. }
  298. .Blueprint-node-port.output.port-execution:hover .Blueprint-node-port-arrow.execution-output {
  299. border-left-color: #ccc;
  300. }
  301. /* 参数端口圆点样式 */
  302. .Blueprint-node-port-dot {
  303. width: 12px;
  304. height: 12px;
  305. border-radius: 50%;
  306. border: 2px solid #fff;
  307. cursor: pointer;
  308. flex-shrink: 0;
  309. display: flex;
  310. align-items: center;
  311. justify-content: center;
  312. pointer-events: none; /* 圆点不拦截事件,让父元素(端口)处理 */
  313. }
  314. /* 实心端口(已连接) */
  315. .Blueprint-node-port-dot.solid {
  316. background: #007acc;
  317. border: 2px solid #fff;
  318. }
  319. /* 空心端口(未连接) */
  320. .Blueprint-node-port-dot.hollow {
  321. background: transparent;
  322. border: 2px solid #007acc;
  323. }
  324. /* number 类型端口 - 实心(绿色) */
  325. .Blueprint-node-port.port-number .Blueprint-node-port-dot.solid {
  326. background: #4caf50;
  327. border-color: #fff;
  328. }
  329. /* number 类型端口 - 空心(绿色边框) */
  330. .Blueprint-node-port.port-number .Blueprint-node-port-dot.hollow {
  331. background: transparent;
  332. border-color: #4caf50;
  333. }
  334. .Blueprint-node-port.port-number:hover .Blueprint-node-port-dot {
  335. transform: scale(1.2);
  336. }
  337. .Blueprint-node-port.port-number:hover .Blueprint-node-port-dot.solid {
  338. background: #66bb6a;
  339. }
  340. /* string 类型端口 - 实心(蓝色) */
  341. .Blueprint-node-port.port-string .Blueprint-node-port-dot.solid {
  342. background: #2196f3;
  343. border-color: #fff;
  344. }
  345. /* string 类型端口 - 空心(蓝色边框) */
  346. .Blueprint-node-port.port-string .Blueprint-node-port-dot.hollow {
  347. background: transparent;
  348. border-color: #2196f3;
  349. }
  350. .Blueprint-node-port.port-string:hover .Blueprint-node-port-dot {
  351. transform: scale(1.2);
  352. }
  353. .Blueprint-node-port.port-string:hover .Blueprint-node-port-dot.solid {
  354. background: #42a5f5;
  355. }
  356. /* bool 类型端口 - 实心(红色) */
  357. .Blueprint-node-port.port-bool .Blueprint-node-port-dot.solid {
  358. background: #ff4444;
  359. border-color: #fff;
  360. }
  361. /* bool 类型端口 - 空心(红色边框) */
  362. .Blueprint-node-port.port-bool .Blueprint-node-port-dot.hollow {
  363. background: transparent;
  364. border-color: #ff4444;
  365. }
  366. .Blueprint-node-port.port-bool:hover .Blueprint-node-port-dot {
  367. transform: scale(1.2);
  368. }
  369. .Blueprint-node-port.port-bool:hover .Blueprint-node-port-dot.solid {
  370. background: #ff6666;
  371. }
  372. /* 端口输入框 - 在节点内部 */
  373. .Blueprint-node-port-input {
  374. flex: 0 1 auto; /* 不自动扩展,但可以收缩 */
  375. min-width: 60px;
  376. max-width: 120px;
  377. width: auto; /* 根据内容自动调整 */
  378. height: 20px;
  379. padding: 2px 6px;
  380. margin-left: 4px; /* 标签和输入框之间的间距 */
  381. background: #1e1e1e;
  382. border: 1px solid #3e3e3e;
  383. border-radius: 3px;
  384. color: #fff;
  385. font-size: 11px;
  386. font-family: inherit;
  387. outline: none;
  388. order: 2; /* 输入框在标签之后 */
  389. }
  390. .Blueprint-node-port-input:focus {
  391. border-color: #007acc;
  392. background: #252525;
  393. }
  394. .Blueprint-node-port-input::placeholder {
  395. color: #666;
  396. }
  397. .Blueprint-node-port:hover {
  398. transform: scale(1.1);
  399. }
  400. .Blueprint-node-port-label {
  401. font-size: 11px;
  402. color: #ccc;
  403. white-space: nowrap;
  404. display: flex;
  405. align-items: center;
  406. flex-shrink: 0;
  407. }
  408. /* 数据端口的标签在节点内部 - 使用 flex 布局 */
  409. .Blueprint-node-port.input:not(.port-execution) .Blueprint-node-port-label {
  410. margin-left: 4px;
  411. order: 1; /* 标签在圆点之后,输入框之前 */
  412. }
  413. .Blueprint-node-port.output:not(.port-execution) .Blueprint-node-port-label {
  414. margin-left: 4px;
  415. order: 0; /* 圆点在左,标签在右 */
  416. }
  417. /* 执行端口的标签(如果需要) */
  418. .Blueprint-node-port.port-execution .Blueprint-node-port-label {
  419. display: none; /* 执行端口通常不显示标签 */
  420. }