diff --git a/build_system.d b/build_system.d
index 5b1afca..7c18975 100755
--- a/build_system.d
+++ b/build_system.d
@@ -32,6 +32,8 @@ const LOG_DIR = "./log";
const API_LOG = LOG_DIR ~ "/api_build.txt";
const APP_LOG = LOG_DIR ~ "/app_build.txt";
+const GITHUB_PROPS_FILE = "github_token.properties";
+
int main(string[] args) {
string ver = getVersion();
if (ver is null) {
@@ -135,7 +137,7 @@ void createRelease(string ver, string description) {
data.object["generate_release_notes"] = JSONValue(false);
auto rq = Request();
- auto props = Properties("github_token.properties");
+ auto props = Properties(GITHUB_PROPS_FILE);
string username = props["username"];
string token = props["token"];
rq.authenticator = new BasicAuthentication(username, token);
@@ -148,13 +150,21 @@ void createRelease(string ver, string description) {
string responseBody = cast(string) response.responseBody;
JSONValue responseData = parseJSON(responseBody);
print("Created release %s", responseData["url"].str);
- // Use the "upload-asset.sh" script to upload the asset, since internal requests api is broken.
- string command = format!"./upload-asset.sh github_api_token=%s owner=andrewlalis repo=RailSignalAPI tag=v%s filename=%s"(
- token,
- ver,
- "./target/rail-signal-" ~ ver ~ ".jar"
+ long releaseId = responseData["id"].integer;
+ string uploadUrl = format!"https://uploads.github.com/repos/andrewlalis/RailSignalAPI/releases/%d/assets?name=%s"(
+ releaseId,
+ "rail-signal-" ~ ver ~ ".jar"
);
- runOrQuit(command);
+ print("Uploading JAR file to %s", uploadUrl);
+ auto f = File("./target/rail-signal-" ~ ver ~ ".jar", "rb");
+ ulong assetSize = f.size();
+ rq.addHeaders(["Content-Length": format!"%d"(assetSize)]);
+ auto assetResponse = rq.post(uploadUrl, f.byChunk(4096));
+ if (assetResponse.code == 201) {
+ print("JAR file uploaded successfully.");
+ } else {
+ error("An error occurred while uploading the JAR file.");
+ }
} else {
error("An error occurred while creating the release.");
writeln(response.responseBody);
diff --git a/pom.xml b/pom.xml
index 58d76f3..3810cf2 100644
--- a/pom.xml
+++ b/pom.xml
@@ -10,7 +10,7 @@
nl.andrewl
rail-signal-api
- 2.2.1
+ 2.3.0
rail-signal-api
A simple API for tracking rail traffic in signalled blocks.
diff --git a/quasar-app/src/map/mapEventListener.js b/quasar-app/src/map/mapEventListener.js
index 25098d0..41be1d6 100644
--- a/quasar-app/src/map/mapEventListener.js
+++ b/quasar-app/src/map/mapEventListener.js
@@ -14,6 +14,9 @@ const HOVER_RADIUS = 10;
export let LAST_MOUSE_POINT = null;
+const SELECTION_MODE_NORMAL = 1;
+const SELECTION_MODE_CHOOSE = 2;
+let selectionMode = SELECTION_MODE_NORMAL;
const componentSelectionListeners = new Map();
/**
@@ -72,8 +75,18 @@ function onMouseDown(event) {
* @param {MouseEvent} event
*/
function onMouseUp(event) {
- const finishingDrag = camPanNonzero();
+ if (selectionMode === SELECTION_MODE_NORMAL) {
+ handleNormalSelectionMouseUp(event);
+ }
camPanFinish();
+}
+
+/**
+ * Handles the mouse up event in normal selection mode. This means changing the
+ * set of selected components.
+ * @param {MouseEvent} event
+ */
+function handleNormalSelectionMouseUp(event) {
if (MAP_COMPONENTS_HOVERED.length > 0) {
if (!event.shiftKey) {// If the user isn't holding SHIFT, clear the set of selected components first.
MAP_RAIL_SYSTEM.selectedComponents.length = 0;
@@ -89,7 +102,7 @@ function onMouseUp(event) {
}
}
componentSelectionListeners.forEach(callback => callback(MAP_RAIL_SYSTEM.selectedComponents));
- } else if (!finishingDrag) {
+ } else if (!camPanNonzero()) {
MAP_RAIL_SYSTEM.selectedComponents.length = 0;
}
}