From 1ec39b0316ea5a09d067ee9838d68ee31dc190fc Mon Sep 17 00:00:00 2001 From: Shawn Yama Date: Wed, 26 Apr 2023 13:23:58 -0400 Subject: [PATCH 01/12] setup props --- .../src/temp/tera-infinite-canvas.vue | 92 ++++++++++++------- .../src/temp/tera-simulation-workflow.vue | 6 +- 2 files changed, 64 insertions(+), 34 deletions(-) diff --git a/packages/client/hmi-client/src/temp/tera-infinite-canvas.vue b/packages/client/hmi-client/src/temp/tera-infinite-canvas.vue index 2802692222..c1486a2db8 100644 --- a/packages/client/hmi-client/src/temp/tera-infinite-canvas.vue +++ b/packages/client/hmi-client/src/temp/tera-infinite-canvas.vue @@ -6,21 +6,35 @@
- + @@ -103,15 +125,19 @@ main { height: 100%; } -svg { +.data-layer { + position: absolute; +} + +.background-layer { border: 1px solid blue; cursor: grab; width: 100%; height: 100%; } -.data-layer { - position: absolute; +.background-layer:deep(.tick line) { + opacity: 0.2; } svg:active { diff --git a/packages/client/hmi-client/src/temp/tera-simulation-workflow.vue b/packages/client/hmi-client/src/temp/tera-simulation-workflow.vue index ee295f7ffc..e4313709b0 100644 --- a/packages/client/hmi-client/src/temp/tera-simulation-workflow.vue +++ b/packages/client/hmi-client/src/temp/tera-simulation-workflow.vue @@ -1,5 +1,5 @@
This is a DataLayer DIV
@@ -9,4 +9,8 @@ From c98ba9fb60dc83c6c005227477227d6f1dd694ae Mon Sep 17 00:00:00 2001 From: Shawn Yama Date: Wed, 26 Apr 2023 13:54:22 -0400 Subject: [PATCH 02/12] resize improve --- .../hmi-client/src/page/project/tera-project.vue | 8 ++++---- .../hmi-client/src/temp/tera-infinite-canvas.vue | 11 ++++++----- 2 files changed, 10 insertions(+), 9 deletions(-) diff --git a/packages/client/hmi-client/src/page/project/tera-project.vue b/packages/client/hmi-client/src/page/project/tera-project.vue index 6101f3f3bc..23215c2388 100644 --- a/packages/client/hmi-client/src/page/project/tera-project.vue +++ b/packages/client/hmi-client/src/page/project/tera-project.vue @@ -82,12 +82,12 @@ /> - -
+ +
, y: d3.ScaleLinear; let xAxis: d3.Axis, yAxis: d3.Axis; -let gX: d3.Selection; -let gY: d3.Selection; +let gX: d3.Selection, gY: d3.Selection; + let currentTransform = props.lastTransform; const width = ref(0); @@ -91,6 +91,8 @@ function updateDimensions() { } } +const resizeObserver = new ResizeObserver(() => updateDimensions()); + onMounted(() => { const svg = d3.select(backgroundLayerRef.value as SVGGElement); @@ -106,7 +108,7 @@ onMounted(() => { container.append('circle').attr('cx', 400).attr('cy', 300).attr('r', 20).attr('fill', 'red'); updateDimensions(); - window.addEventListener('resize', () => updateDimensions()); + if (canvasRef.value) resizeObserver.observe(canvasRef.value); if (props.debugMode) { gX = svg.append('g').attr('class', 'axis axis--x').call(xAxis); @@ -130,14 +132,13 @@ main { } .background-layer { - border: 1px solid blue; cursor: grab; width: 100%; height: 100%; } .background-layer:deep(.tick line) { - opacity: 0.2; + color: var(--surface-border); } svg:active { From bd7f8e6e03ca5ae354c326864c7809883461773f Mon Sep 17 00:00:00 2001 From: Shawn Yama Date: Wed, 26 Apr 2023 14:32:36 -0400 Subject: [PATCH 03/12] try to init transform --- .../hmi-client/src/temp/tera-infinite-canvas.vue | 3 ++- .../hmi-client/src/temp/tera-simulation-workflow.vue | 11 ++++++++++- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/packages/client/hmi-client/src/temp/tera-infinite-canvas.vue b/packages/client/hmi-client/src/temp/tera-infinite-canvas.vue index 124784665a..e773290268 100644 --- a/packages/client/hmi-client/src/temp/tera-infinite-canvas.vue +++ b/packages/client/hmi-client/src/temp/tera-infinite-canvas.vue @@ -24,7 +24,8 @@ const props = withDefaults( }>(), { debugMode: false, - scaleExtent: () => [0.1, 10] + scaleExtent: () => [0.1, 10], + lastTransform: undefined // d3.zoomIdentity } ); diff --git a/packages/client/hmi-client/src/temp/tera-simulation-workflow.vue b/packages/client/hmi-client/src/temp/tera-simulation-workflow.vue index e4313709b0..10e5121579 100644 --- a/packages/client/hmi-client/src/temp/tera-simulation-workflow.vue +++ b/packages/client/hmi-client/src/temp/tera-simulation-workflow.vue @@ -1,5 +1,5 @@