Skip to content

Home Information - Your home, your data, organized.

Python

Added editing help dialog

Anthony Cassandrad6d098dc6a22
diff --git a/src/hi/apps/edit/templates/edit/modals/help.html b/src/hi/apps/edit/templates/edit/modals/help.html
new file mode 100644
index 00000000..69ffd9ec
--- /dev/null
+++ b/src/hi/apps/edit/templates/edit/modals/help.html
@@ -0,0 +1,59 @@
+{% extends "modals/action_ok.html" %}
+
+{% block title_text %}
+Editing Help
+{% endblock %}
+
+{% block body %}
+
+<div class="h3">Moving</div>
+<p>
+ <ul>
+ <li>Left mouse click and drag</li>
+ <li>One finger drag</li>
+ </ul>
+</p>
+
+<div class="h3">Scaling</div>
+<p>
+ <ul>
+ <li>Mouse wheel</li>
+ <li>"+" key (zoom in)</li>
+ <li>"-" key (zoom out)</li>
+ <li>"s" key and drag</li>
+ <li>Two finger pinch/spread</li>
+ <li>"ESC" key to end</li>
+ </ul>
+</p>
+
+<div class="h3">Rotating</div>
+<p>
+ <ul>
+ <li>"r" key and drag</li>
+ <li>"r" key and mouse wheel</li>
+ <li>"r" then "+" key (rotate right)</li>
+ <li>"r" then "-" key (rotate left)</li>
+ <li>Two finger rotate</li>
+ <li>"ESC" key to end</li>
+ </ul>
+</p>
+
+<div class="h3">Path Editing</div>
+<p>
+ <ul>
+ <li>Click to select (area, node or edge)</li>
+ <li>"i" or "INSERT" key to insert path node </li>
+ <li>"x", "DEL" or "BACKSPACE" key to delete path node</li>
+ <li>"a" or "+" key - add new path node or path segment</li>
+ <li>"ESC" key to end path editing</li>
+ </ul>
+</p>
+
+<div class="h3">Notes</div>
+<p>
+ <ul>
+ <li>Background edits of view only saved when the "View" editing pane is showing.</li>
+ </ul>
+</p>
+
+{% endblock %}
diff --git a/src/hi/apps/edit/urls.py b/src/hi/apps/edit/urls.py
index 227594e3..9f710386 100644
--- a/src/hi/apps/edit/urls.py
+++ b/src/hi/apps/edit/urls.py
@@ -13,6 +13,10 @@ urlpatterns = [
views.EditEndView.as_view(),
name='edit_end' ),
+ re_path( r'^help$',
+ views.EditHelpView.as_view(),
+ name='edit_help' ),
+
re_path( r'^item/reorder$',
views.ReorderItemsView.as_view(),
name='edit_reorder_items' ),
diff --git a/src/hi/apps/edit/views.py b/src/hi/apps/edit/views.py
index da573056..9c3e2d79 100644
--- a/src/hi/apps/edit/views.py
+++ b/src/hi/apps/edit/views.py
@@ -23,7 +23,7 @@ from hi.apps.location.edit.views import (
from hi.decorators import edit_required
from hi.enums import ItemType, ViewMode
-from hi.hi_async_view import HiSideView
+from hi.hi_async_view import HiModalView, HiSideView
logger = logging.getLogger(__name__)
@@ -180,5 +180,14 @@ class EntityStateValueChoicesView( View ):
return HttpResponse( json.dumps( entity_state.choices() ),
content_type='application/json' )
-
+
+class EditHelpView( HiModalView ):
+
+ def get_template_name( self ) -> str:
+ return 'edit/modals/help.html'
+
+ def get( self, request, *args, **kwargs ):
+ context = {
+ }
+ return self.modal_response( request, context )
diff --git a/src/hi/static/js/svg-location.js b/src/hi/static/js/svg-location.js
index f363f179..fda4bb88 100644
--- a/src/hi/static/js/svg-location.js
+++ b/src/hi/static/js/svg-location.js
@@ -67,6 +67,7 @@
const KEYPRESS_ZOOM_SCALE_FACTOR_PERCENT = 10.0;
const KEYPRESS_ROTATE_DEGREES = 10.0;
const MOUSE_WHEEL_ZOOM_SCALE_FACTOR_PERCENT = 10.0;
+ const MOUSE_WHEEL_ROTATE_ANGLE = 3.0;
const SINGLE_POINTER_EVENTS_SCALE_FACTOR = 250.0;
const DOUBLE_POINTER_EVENTS_SCALE_FACTOR = 250.0;
const SINGLE_POINTER_EVENTS_ROTATE_FACTOR = 0.5;
@@ -207,9 +208,14 @@
function _handleMouseWheel( event ) {
if ( gSelectedLocationViewSvg && isEventInLocationArea( event )) {
- abortScale();
- abortRotation();
- zoomFromMouseWheel( event );
+ if ( gSvgTransformType == SvgTransformType.ROTATE ) {
+ rotateFromMouseWheel( event );
+
+ } else {
+ abortScale();
+ abortRotation();
+ zoomFromMouseWheel( event );
+ }
event.preventDefault();
event.stopImmediatePropagation();
return true;
@@ -501,6 +507,19 @@
rotate( deltaAngle );
saveSvgGeometryDebouncer();
}
+
+ function rotateFromMouseWheel( event ) {
+
+ const e = event.originalEvent;
+
+ // Immediately update the visual
+ let deltaAngle = MOUSE_WHEEL_ROTATE_ANGLE;
+ if ( e.deltaY > 0 ) {
+ deltaAngle *= -1.0;
+ }
+ rotate( deltaAngle );
+ saveSvgGeometryDebouncer();
+ }
function rotate( deltaAngle ) {
diff --git a/src/hi/templates/panes/bottom_buttons.html b/src/hi/templates/panes/bottom_buttons.html
index 7dc920d6..fac71dc5 100644
--- a/src/hi/templates/panes/bottom_buttons.html
+++ b/src/hi/templates/panes/bottom_buttons.html
@@ -2,6 +2,15 @@
<div class="d-flex justify-content-between">
{% include "collection/panes/collection_buttons.html" %}
<div class="d-flex justify-content-end">
+ {% if request.view_parameters.is_editing %}
+ <div class="mx-1">
+ <a href="{% url 'edit_help' %}"
+ class="btn btn-tertiary btn-control" role="button"
+ data-async="true" >
+ EDITING HELP
+ </a>
+ </div>
+ {% else %}
<div class="mx-1">
{% include "console/panes/audio_control.html" %}
</div>
@@ -18,6 +27,7 @@
SETTINGS
</a>
</div>
+ {% endif %}
</div>
</div>
</div>