Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
小 白蛋
Scope
Commits
297e21d4
Commit
297e21d4
authored
7 years ago
by
Filip Barl
Browse files
Options
Download
Email Patches
Plain Diff
Removed d3-zoom reference in package.json.
parent
a185ae4e
master
3810-cordon-control
Remove-stale-external-collaborators
add-weave-cloud
aliyun-sls-master
better-nat
bia-layout-prototype
bump-alpine
check-blank-id
consul-cleanup
container-netns
count-real-hosts
cri-container-state
delete-data
dependabot/go_modules/github.com/weaveworks/weave-2.6.3incompatible
docker-os
dont-stream-children
feature/read-password-from-file
feature/read-password-from-file-faq
fewer-closed-connections
filter-pseudo-pseudo-adjacencies
fix-build
fix-process-containername
fix-show-in
gh-pages
go-1-17-8
golangci-lint
hier-s3-key
less-quay
limit-parallel-decoding
lower-sirupsen-clean-approach-with-gvt
map-container-to-pod-ip
more-renderers-b
no-hex-hostnames
no-latest-timestamp
node-unsafe-merge
pod-name-promql
popup-terminal-delete-pipe
release-1.11
release-1.7
release-1.8
release-1.9
remove-endpoint-benchmark
remove-proxima
s390x-support
scan-data
scope_s390x
sets-sorted-slice
simplify-load-report
sliced-maps2
streamline-withparents
test-marshall-backwards
troubleshoot-consul
unsafe-merge-nodes
update-aws-sdk
update-common-lower-sirupsen
update-lodash
update-node-deps
update-opentracing
update-ugorji
wheel-event
wip-aws-timestamp
wip-child-ids
wip-drop-map-image
wip-render-docs
wip-simplify-connection-join
withlatests-slice
1.13.0
v1.13.2
v1.13.1
v1.12.0
v1.11.6
v1.11.5
v1.11.4
v1.11.3
v1.11.2
v1.11.1
v1.11.0
v1.10.2
v1.10.1
v1.10.0
v1.9.1
v1.9.0
v1.8.1
v1.8.0
v1.7.3
v1.7.2
v1.7.1
v1.7.0
v1.6.7
v1.6.6
v1.6.5
v1.6.4
v1.6.3
latest_release
No related merge requests found
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
client/app/scripts/components/zoomable-canvas.js
+10
-19
client/app/scripts/components/zoomable-canvas.js
client/app/scripts/utils/transform-utils.js
+15
-1
client/app/scripts/utils/transform-utils.js
client/app/styles/_base.scss
+11
-13
client/app/styles/_base.scss
client/package.json
+0
-2
client/package.json
with
36 additions
and
35 deletions
+36
-35
client/app/scripts/components/zoomable-canvas.js
+
10
-
19
View file @
297e21d4
...
...
@@ -11,6 +11,7 @@ import Logo from '../components/logo';
import
ZoomControl
from
'
../components/zoom-control
'
;
import
{
cacheZoomState
}
from
'
../actions/app-actions
'
;
import
{
zoomFactor
}
from
'
../utils/zoom-utils
'
;
import
{
applyTransform
,
inverseTransform
}
from
'
../utils/transform-utils
'
;
import
{
activeTopologyZoomCacheKeyPathSelector
}
from
'
../selectors/zooming
'
;
import
{
canvasMarginsSelector
,
...
...
@@ -20,15 +21,6 @@ import {
import
{
ZOOM_CACHE_DEBOUNCE_INTERVAL
}
from
'
../constants/timer
'
;
const
transformF
=
({
x
,
y
},
t
)
=>
({
x
:
t
.
translateX
+
(
t
.
scaleX
*
x
),
y
:
t
.
translateY
+
(
t
.
scaleY
*
y
),
});
const
inverseTransform
=
({
x
,
y
},
t
)
=>
({
x
:
(
x
-
t
.
translateX
)
/
t
.
scaleX
,
y
:
(
y
-
t
.
translateY
)
/
t
.
scaleY
,
});
class
ZoomableCanvas
extends
React
.
Component
{
constructor
(
props
,
context
)
{
...
...
@@ -188,20 +180,19 @@ class ZoomableCanvas extends React.Component {
}
clampedTranslation
(
state
)
{
const
{
width
,
height
,
canvasMargins
,
bounded
}
=
this
.
props
;
const
{
maxTranslateX
,
minTranslateX
,
maxTranslateY
,
minTranslateY
}
=
this
.
props
.
layoutZoomLimits
.
toJS
();
const
{
width
,
height
,
canvasMargins
,
bounded
,
layoutZoomLimits
}
=
this
.
props
;
const
{
maxTranslateX
,
minTranslateX
,
maxTranslateY
,
minTranslateY
}
=
layoutZoomLimits
.
toJS
();
if
(
bounded
)
{
const
m
inPoint
=
t
ransform
F
({
x
:
minTranslateX
,
y
:
minTranslateY
}
,
state
);
const
m
axPoint
=
t
ransform
F
({
x
:
maxTranslateX
,
y
:
maxTranslateY
}
,
state
);
const
contentM
inPoint
=
applyT
ransform
(
state
,
{
x
:
minTranslateX
,
y
:
minTranslateY
});
const
contentM
axPoint
=
applyT
ransform
(
state
,
{
x
:
maxTranslateX
,
y
:
maxTranslateY
});
const
viewportMinPoint
=
{
x
:
canvasMargins
.
left
,
y
:
canvasMargins
.
top
};
const
viewportMaxPoint
=
{
x
:
canvasMargins
.
left
+
width
,
y
:
canvasMargins
.
top
+
height
};
state
.
translateX
+=
Math
.
max
(
0
,
viewportMaxPoint
.
x
-
m
axPoint
.
x
);
state
.
translateX
+=
Math
.
min
(
0
,
viewportMinPoint
.
x
-
m
inPoint
.
x
);
state
.
translateY
+=
Math
.
max
(
0
,
viewportMaxPoint
.
y
-
m
axPoint
.
y
);
state
.
translateY
+=
Math
.
min
(
0
,
viewportMinPoint
.
y
-
m
inPoint
.
y
);
state
.
translateX
+=
Math
.
max
(
0
,
viewportMaxPoint
.
x
-
contentM
axPoint
.
x
);
state
.
translateX
+=
Math
.
min
(
0
,
viewportMinPoint
.
x
-
contentM
inPoint
.
x
);
state
.
translateY
+=
Math
.
max
(
0
,
viewportMaxPoint
.
y
-
contentM
axPoint
.
y
);
state
.
translateY
+=
Math
.
min
(
0
,
viewportMinPoint
.
y
-
contentM
inPoint
.
y
);
}
return
state
;
...
...
@@ -213,7 +204,7 @@ class ZoomableCanvas extends React.Component {
const
scaleY
=
clamp
(
this
.
state
.
scaleY
*
factor
,
minScale
,
maxScale
);
let
state
=
{
...
this
.
state
,
scaleX
,
scaleY
};
const
inversePosition
=
inverseTransform
(
position
,
this
.
state
);
const
inversePosition
=
inverseTransform
(
this
.
state
,
position
);
state
=
this
.
clampedTranslation
({
...
state
,
translateX
:
position
.
x
-
(
inversePosition
.
x
*
scaleX
),
translateY
:
position
.
y
-
(
inversePosition
.
y
*
scaleY
),
...
...
This diff is collapsed.
Click to expand it.
client/app/scripts/utils/transform-utils.js
+
15
-
1
View file @
297e21d4
...
...
@@ -4,13 +4,27 @@ const applyTranslateY = ({ scaleY = 1, translateY = 0 }, y) => (y * scaleY) + tr
const
applyScaleX
=
({
scaleX
=
1
},
width
)
=>
width
*
scaleX
;
const
applyScaleY
=
({
scaleY
=
1
},
height
)
=>
height
*
scaleY
;
export
const
applyTransform
=
(
transform
,
{
width
,
height
,
x
,
y
})
=>
({
export
const
applyTransform
=
(
transform
,
{
width
=
0
,
height
=
0
,
x
,
y
})
=>
({
x
:
applyTranslateX
(
transform
,
x
),
y
:
applyTranslateY
(
transform
,
y
),
width
:
applyScaleX
(
transform
,
width
),
height
:
applyScaleY
(
transform
,
height
),
});
const
inverseTranslateX
=
({
scaleX
=
1
,
translateX
=
0
},
x
)
=>
(
x
-
translateX
)
/
scaleX
;
const
inverseTranslateY
=
({
scaleY
=
1
,
translateY
=
0
},
y
)
=>
(
y
-
translateY
)
/
scaleY
;
const
inverseScaleX
=
({
scaleX
=
1
},
width
)
=>
width
/
scaleX
;
const
inverseScaleY
=
({
scaleY
=
1
},
height
)
=>
height
/
scaleY
;
export
const
inverseTransform
=
(
transform
,
{
width
=
0
,
height
=
0
,
x
,
y
})
=>
({
x
:
inverseTranslateX
(
transform
,
x
),
y
:
inverseTranslateY
(
transform
,
y
),
width
:
inverseScaleX
(
transform
,
width
),
height
:
inverseScaleY
(
transform
,
height
),
});
export
const
transformToString
=
({
translateX
=
0
,
translateY
=
0
,
scaleX
=
1
,
scaleY
=
1
})
=>
(
`translate(
${
translateX
}
,
${
translateY
}
) scale(
${
scaleX
}
,
${
scaleY
}
)`
);
This diff is collapsed.
Click to expand it.
client/app/styles/_base.scss
+
11
-
13
View file @
297e21d4
...
...
@@ -63,6 +63,14 @@ a {
cursor
:
-
webkit-grabbing
;
}
.fully-pannable
{
width
:
100%
;
height
:
100%
;
@extend
.grabbable
;
&
.panning
{
@extend
.grabbing
;
}
}
.shadow-2
{
box-shadow
:
0
3px
10px
rgba
(
0
,
0
,
0
,
0
.16
)
,
0
3px
10px
rgba
(
0
,
0
,
0
,
0
.23
);
}
...
...
@@ -284,15 +292,11 @@ a {
height
:
$timeline-height
;
svg
{
@extend
.
grabb
able
;
@extend
.
fully-pann
able
;
background-color
:
rgba
(
255
,
255
,
255
,
0
.85
);
box-shadow
:
inset
0
0
7px
#aaa
;
pointer-events
:
all
;
margin
:
0
7px
;
width
:
100%
;
height
:
100%
;
&
.panning
{
@extend
.grabbing
;
}
.available-range
{
fill
:
#888
;
...
...
@@ -358,14 +362,8 @@ a {
}
}
.zoomable-canvas
{
svg
{
@extend
.grabbable
;
width
:
100%
;
height
:
100%
;
&
.panning
{
@extend
.grabbing
;
}
}
.zoomable-canvas
svg
{
@extend
.fully-pannable
;
}
.topologies
{
...
...
This diff is collapsed.
Click to expand it.
client/package.json
+
0
-
2
View file @
297e21d4
...
...
@@ -18,8 +18,6 @@
"d3-selection"
:
"1.0.5"
,
"d3-shape"
:
"1.0.6"
,
"d3-time-format"
:
"2.0.5"
,
"d3-transition"
:
"1.0.4"
,
"d3-zoom"
:
"1.1.4"
,
"dagre"
:
"0.7.4"
,
"debug"
:
"2.6.6"
,
"filesize"
:
"3.5.9"
,
...
...
This diff is collapsed.
Click to expand it.
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment
Menu
Projects
Groups
Snippets
Help