lexgui 0.2.0 → 0.4.0

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.
@@ -142,6 +142,13 @@ class Timeline {
142
142
  this.resizeCanvas( [ bounding.width, bounding.height + this.header_offset ] );
143
143
  }
144
144
  this.resize(this.size);
145
+
146
+ // update color theme
147
+ this.updateTheme();
148
+ LX.addSignal( "@on_new_color_scheme", (el, value) => {
149
+ // Retrieve again the color using LX.getThemeColor, which checks the applied theme
150
+ this.updateTheme();
151
+ } )
145
152
  }
146
153
 
147
154
  /**
@@ -507,7 +514,7 @@ class Timeline {
507
514
 
508
515
  // Begin drawing
509
516
  ctx.beginPath();
510
- ctx.fillStyle = Timeline.FONT_COLOR//"#888";
517
+ ctx.fillStyle = Timeline.FONT_COLOR;
511
518
  ctx.globalAlpha = this.opacity;
512
519
 
513
520
  for( let x = startx; x <= endx; x += tickX )
@@ -550,8 +557,8 @@ class Timeline {
550
557
  let max_tracks = Math.ceil( (h - timeline_height + this.currentScrollInPixels) / line_height );
551
558
 
552
559
  ctx.save();
553
- ctx.fillStyle = "#f0f0f003"//Timeline.TRACK_COLOR_SECONDARY;
554
- ctx.globalAlpha = 1;
560
+ ctx.fillStyle = Timeline.TRACK_COLOR_SECONDARY;
561
+ ctx.globalAlpha = 0.3 * this.opacity;
555
562
  for(let i = 0; i <= max_tracks; i+=2)
556
563
  {
557
564
  ctx.fillRect(0, timeline_height + i * line_height - this.currentScrollInPixels, w, line_height );
@@ -559,7 +566,7 @@ class Timeline {
559
566
  ctx.globalAlpha = this.opacity;
560
567
 
561
568
  //bg lines
562
- ctx.strokeStyle = "#444";
569
+ ctx.strokeStyle = Timeline.TRACK_COLOR_TERCIARY;
563
570
  ctx.beginPath();
564
571
 
565
572
  let pos = this.timeToX( 0 );
@@ -670,15 +677,15 @@ class Timeline {
670
677
  ctx.font = "11px " + Timeline.FONT;//"11px Calibri";
671
678
  ctx.textAlign = "center";
672
679
  //ctx.textBaseline = "middle";
673
- ctx.fillStyle = Timeline.COLOR_INACTIVE//"#888";
680
+ ctx.fillStyle = Timeline.COLOR_INACTIVE;
674
681
  ctx.fillText( (Math.floor(this.currentTime*10)*0.1).toFixed(1), posx, this.topMargin * 0.6 );
675
682
 
676
683
  // Selections
677
684
  ctx.strokeStyle = ctx.fillStyle = Timeline.FONT_COLOR;
678
685
  ctx.translate( this.position[0], this.position[1] + this.topMargin )
679
686
  if(this.boxSelection) {
680
- ctx.globalAlpha = 0.15;
681
- ctx.fillStyle = "#AAA";
687
+ ctx.globalAlpha = 0.15 * this.opacity;
688
+ ctx.fillStyle = Timeline.BOX_SELECTION_COLOR;
682
689
  ctx.strokeRect( this.boxSelectionStart[0], this.boxSelectionStart[1], this.boxSelectionEnd[0] - this.boxSelectionStart[0], this.boxSelectionEnd[1] - this.boxSelectionStart[1]);
683
690
  ctx.fillRect( this.boxSelectionStart[0], this.boxSelectionStart[1], this.boxSelectionEnd[0] - this.boxSelectionStart[0], this.boxSelectionEnd[1] - this.boxSelectionStart[1]);
684
691
  ctx.stroke();
@@ -1077,16 +1084,16 @@ class Timeline {
1077
1084
  let selectedClipArea = null;
1078
1085
 
1079
1086
  if(track.enabled === false) {
1080
- ctx.globalAlpha = 0.4;
1087
+ ctx.globalAlpha = 0.4 * this.opacity;
1081
1088
  }
1082
1089
  else {
1083
- ctx.globalAlpha = 0.2;
1090
+ ctx.globalAlpha = 0.2 * this.opacity;
1084
1091
  }
1085
1092
 
1086
1093
  ctx.font = Math.floor( trackHeight * 0.8) + "px" + Timeline.FONT;
1087
1094
  ctx.textAlign = "left";
1088
1095
  ctx.textBaseline = "middle";
1089
- ctx.fillStyle = Timeline.TRACK_SELECTED_LIGHT//"#2c303570";
1096
+ ctx.fillStyle = Timeline.TRACK_SELECTED_LIGHT;
1090
1097
 
1091
1098
  // Fill track background if it's selected
1092
1099
  if(track.isSelected) {
@@ -1094,7 +1101,7 @@ class Timeline {
1094
1101
  }
1095
1102
 
1096
1103
  let clips = track.clips;
1097
- let trackAlpha = 1;
1104
+ let trackAlpha = this.opacity;
1098
1105
 
1099
1106
  if(!clips) {
1100
1107
  return;
@@ -1137,7 +1144,7 @@ class Timeline {
1137
1144
  ctx.fillStyle = 'rgba(' + color.join(',') + ', 0.8)';
1138
1145
  }
1139
1146
  else {
1140
- ctx.globalAlpha = 0.8;
1147
+ ctx.globalAlpha = 0.8 * this.opacity;
1141
1148
  }
1142
1149
 
1143
1150
  // Draw fade-in and fade-out
@@ -1304,22 +1311,37 @@ class Timeline {
1304
1311
  this.updateLeftPanel();
1305
1312
  this.resize();
1306
1313
  }
1314
+
1315
+ /**
1316
+ * updates theme (light - dark) based on LX's current theme
1317
+ */
1318
+ updateTheme( ){
1319
+ Timeline.BACKGROUND_COLOR = LX.getThemeColor("global-blur-background");
1320
+ Timeline.TRACK_COLOR_PRIMARY = LX.getThemeColor("global-color-primary");
1321
+ Timeline.TRACK_COLOR_SECONDARY = LX.getThemeColor("global-color-secondary");
1322
+ Timeline.TRACK_COLOR_TERCIARY = LX.getThemeColor("global-color-terciary");
1323
+ Timeline.TRACK_COLOR_QUATERNARY = LX.getThemeColor("global-color-quaternary");
1324
+ Timeline.FONT = LX.getThemeColor("global-font");
1325
+ Timeline.FONT_COLOR = LX.getThemeColor("global-text-primary");
1326
+ }
1307
1327
  };
1308
1328
 
1309
- Timeline.BACKGROUND_COLOR = LX.getThemeColor("global-color-primary");
1310
- Timeline.TRACK_COLOR_PRIMARY = LX.getThemeColor("global-blur-background");
1311
- Timeline.TRACK_COLOR_SECONDARY = LX.getThemeColor("global-color-terciary");
1329
+ Timeline.BACKGROUND_COLOR = LX.getThemeColor("global-blur-background");
1330
+ Timeline.TRACK_COLOR_PRIMARY = LX.getThemeColor("global-color-primary");
1331
+ Timeline.TRACK_COLOR_SECONDARY = LX.getThemeColor("global-color-secondary");
1332
+ Timeline.TRACK_COLOR_TERCIARY = LX.getThemeColor("global-color-terciary");
1333
+ Timeline.TRACK_COLOR_QUATERNARY = LX.getThemeColor("global-color-quaternary");
1312
1334
  Timeline.TRACK_SELECTED = LX.getThemeColor("global-selected");
1313
1335
  Timeline.TRACK_SELECTED_LIGHT = LX.getThemeColor("global-selected-light");
1314
1336
  Timeline.FONT = LX.getThemeColor("global-font");
1315
- Timeline.FONT_COLOR = LX.getThemeColor("global-text");
1316
- Timeline.COLOR = LX.getThemeColor("global-selected-dark");//"#5e9fdd";
1337
+ Timeline.FONT_COLOR = LX.getThemeColor("global-text-primary");
1338
+ Timeline.COLOR = LX.getThemeColor("global-selected-dark");
1317
1339
  Timeline.COLOR_SELECTED = Timeline.COLOR_HOVERED = "rgba(250,250,20,1)";///"rgba(250,250,20,1)";
1318
1340
  // Timeline.COLOR_HOVERED = LX.getThemeColor("global-selected");
1319
1341
  Timeline.COLOR_INACTIVE = "rgba(250,250,250,0.7)";
1320
1342
  Timeline.COLOR_LOCK = "rgba(255,125,125,0.7)";
1321
1343
  Timeline.COLOR_EDITED = "rgba(20,230,20,0.7)"//"rgba(125,250,250, 1)";
1322
-
1344
+ Timeline.BOX_SELECTION_COLOR = "#AAA";
1323
1345
  LX.Timeline = Timeline;
1324
1346
 
1325
1347
  /**
@@ -1651,13 +1673,13 @@ class KeyFramesTimeline extends Timeline {
1651
1673
 
1652
1674
 
1653
1675
  if(track.isSelected) {
1654
- ctx.globalAlpha = 0.2;
1655
- ctx.fillStyle = Timeline.TRACK_SELECTED;//"#2c303570";
1676
+ ctx.globalAlpha = 0.2 * this.opacity;
1677
+ ctx.fillStyle = Timeline.TRACK_SELECTED;
1656
1678
  ctx.fillRect(0, 0, ctx.canvas.width, trackHeight );
1657
1679
  }
1658
1680
 
1659
- ctx.fillStyle = Timeline.COLOR;//"#2c303570";
1660
- ctx.globalAlpha = 1;
1681
+ ctx.fillStyle = Timeline.COLOR;
1682
+ ctx.globalAlpha = this.opacity;
1661
1683
 
1662
1684
  let keyframes = track.times;
1663
1685
 
@@ -4247,12 +4269,12 @@ class CurvesTimeline extends Timeline {
4247
4269
 
4248
4270
  if(keyframes) {
4249
4271
  if(track.isSelected){
4250
- ctx.globalAlpha = 0.2;
4251
- ctx.fillStyle = Timeline.TRACK_SELECTED_LIGHT//"#2c303570";
4272
+ ctx.globalAlpha = 0.2 * this.opacity;
4273
+ ctx.fillStyle = Timeline.TRACK_SELECTED_LIGHT;
4252
4274
  ctx.fillRect(0, 0, ctx.canvas.width, trackHeight );
4253
4275
  }
4254
4276
 
4255
- ctx.globalAlpha = 1;
4277
+ ctx.globalAlpha = this.opacity;
4256
4278
 
4257
4279
  //draw lines
4258
4280
  ctx.strokeStyle = "white";