Skip to content

Home Information - Your home, your data, organized.

Python

Fixed bug in SVG path editing.

Anthony Cassandra0c17633156d8
diff --git a/src/hi/static/js/svg-icon.js b/src/hi/static/js/svg-icon.js
index 64b62aa7..57ab8799 100644
--- a/src/hi/static/js/svg-icon.js
+++ b/src/hi/static/js/svg-icon.js
@@ -71,9 +71,9 @@
const POINTER_EVENTS_SCALE_FACTOR = 250.0;
const POINTER_EVENTS_ROTATE_FACTOR = 0.1;
+ const POINTER_MOVE_ZOOM_SCALE_FACTOR = 175.0; // Number of pixels moved to double or halve size
const KEYPRESS_ZOOM_SCALE_FACTOR_PERCENT = 10.0;
const MOUSE_WHEEL_ZOOM_SCALE_FACTOR_PERCENT = 10.0;
- const MOUSE_MOVE_ZOOM_SCALE_FACTOR = 175.0; // Number of pixels moved to double or halve size
const MOUSE_WHEEL_ROTATE_DEGREES = 10.0;
const KEYPRESS_ROTATE_DEGREES = 10.0;
const POSITION_API_CALL_DEBOUNCE_MS = 400;
@@ -92,7 +92,7 @@
let gSvgIconActionEditData = null; // For scale and rotate actions
let gLastPointerPosition = { x: 0, y: 0 };
- let gIgnoreCLick = false; // Set by mouseup handling when no click handling should be done
+ let gIgnoreCLick = false; // Set by pointer event handling when no click handling should be done
let positionApiCallDebounceTimer = null;
let lastPositionApiCallTime = 0;
@@ -199,8 +199,6 @@
gSvgIconDragData = null;
return true;
}
-
- if ( Hi.DEBUG ) { console.log( `Pointer end skipped [${MODULE_NAME}]` ); }
return false;
}
@@ -529,9 +527,9 @@
let scaleMultiplier = 1.0;
if ( endDistance > startDistance ) {
- scaleMultiplier = 2 ** ( moveDistance / MOUSE_MOVE_ZOOM_SCALE_FACTOR );
+ scaleMultiplier = 2 ** ( moveDistance / POINTER_MOVE_ZOOM_SCALE_FACTOR );
} else {
- scaleMultiplier = 2 ** ( -1.0 * moveDistance / MOUSE_MOVE_ZOOM_SCALE_FACTOR );
+ scaleMultiplier = 2 ** ( -1.0 * moveDistance / POINTER_MOVE_ZOOM_SCALE_FACTOR );
}
if ( Hi.DEBUG ) {
diff --git a/src/hi/static/js/svg-location.js b/src/hi/static/js/svg-location.js
index 0f6ee9a0..5b622b37 100644
--- a/src/hi/static/js/svg-location.js
+++ b/src/hi/static/js/svg-location.js
@@ -85,7 +85,7 @@
let gSelectedLocationViewSvg = null;
let gSvgTransformData = null;
let gLastPointerPosition = { x: 0, y: 0 };
- let gIgnoreCLick = false; // Set by mouseup handling when no click handling should be done
+ let gIgnoreCLick = false; // Set by pointer event handling when no click handling should be done
let zoomApiCallDebounceTimer = null;
let lastZoomApiCallTime = 0;
@@ -106,7 +106,7 @@
}
}
- if ( Hi.DEBUG ) { console.log( `Mouse down skipped [${MODULE_NAME}]` ); }
+ if ( Hi.DEBUG ) { console.log( `Pointer down skipped: [${MODULE_NAME}]` ); }
return false;
}
@@ -124,9 +124,9 @@
gSvgTransformData.isDragging = true;
if ( gSvgTransformType == SvgTransformType.SCALE ) {
- updateScaleFromMouseMove( event );
+ updateScaleFromPointerMove( event );
} else if( gSvgTransformType == SvgTransformType.ROTATE ) {
- updateRotationFromMouseMove( event );
+ updateRotationFromPointerMove( event );
} else {
updateDrag(event);
}
@@ -159,11 +159,11 @@
clearTransformData();
if ( eventWasHandled ) {
- if ( Hi.DEBUG ) { console.log( `Pointer up event [${MODULE_NAME}]`, event ); }
+ if ( Hi.DEBUG ) { console.log( `Pointer end: [${MODULE_NAME}]`, event ); }
gIgnoreCLick = true;
} else {
- if ( Hi.DEBUG ) { console.log( `Pointer up skipped [${MODULE_NAME}]` ); }
+ if ( Hi.DEBUG ) { console.log( `Pointer env skipped: [${MODULE_NAME}]` ); }
}
return eventWasHandled;
}
@@ -427,7 +427,7 @@
$(gSelectedLocationViewSvg).attr( Hi.SVG_ACTION_STATE_ATTR_NAME, gSvgTransformType );
}
- function updateScaleFromMouseMove( event ) {
+ function updateScaleFromPointerMove( event ) {
if ( Hi.DEBUG ) { console.log( `updateScale [${MODULE_NAME}]` ); }
if ( gSvgTransformData == null ) {
@@ -481,8 +481,8 @@
$(gSelectedLocationViewSvg).attr( Hi.SVG_ACTION_STATE_ATTR_NAME, gSvgTransformType );
}
- function updateRotationFromMouseMove( event ) {
- if ( Hi.DEBUG ) { console.log( `updateRotationFromMouseMove [${MODULE_NAME}]` ); }
+ function updateRotationFromPointerMove( event ) {
+ if ( Hi.DEBUG ) { console.log( `updateRotationFromPointerMove [${MODULE_NAME}]` ); }
let screenCenter = Hi.getScreenCenterPoint( gSelectedLocationViewSvg );
diff --git a/src/hi/static/js/svg-path.js b/src/hi/static/js/svg-path.js
index d8aaca56..5e6870b1 100644
--- a/src/hi/static/js/svg-path.js
+++ b/src/hi/static/js/svg-path.js
@@ -121,8 +121,7 @@
handled = true;
}
}
-
- if ( gSelectedPathSvgGroup ) {
+ if ( ! handled && gSelectedPathSvgGroup ) {
const enclosingSvg = $(event.target).closest('svg');
if ( $(enclosingSvg).hasClass( Hi.LOCATION_VIEW_SVG_CLASS ) ) {
handleProxyPathClick( event );