Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

🔥 Performance improvements #382

Draft
wants to merge 13 commits into
base: main
Choose a base branch
from
Prev Previous commit
Next Next commit
convert everything
argyleink committed Sep 2, 2019

Unverified

This user has not yet uploaded their public signing key.
commit 352635621a3b1e6ee28f383ec26fa57dc7845b47
2 changes: 1 addition & 1 deletion app/components/selection/handles.element.js
Original file line number Diff line number Diff line change
@@ -33,7 +33,7 @@ export class Handles extends HTMLElement {
}

set position({el, node_label_id}) {
this.$shadow.innerHTML = this.render(el.getBoundingClientRect(), node_label_id)
this.$shadow.innerHTML = this.render(el['vis-box'], node_label_id)

if (this._backdrop) {
this.backdrop = {
2 changes: 1 addition & 1 deletion app/components/selection/label.element.js
Original file line number Diff line number Diff line change
@@ -28,7 +28,7 @@ export class Label extends HTMLElement {

this.position = {
node_label_id,
boundingRect: source_el.getBoundingClientRect(),
boundingRect: source_el['vis-box'],
}
})
}
2 changes: 1 addition & 1 deletion app/features/imageswap.js
Original file line number Diff line number Diff line change
@@ -178,7 +178,7 @@ const getPictureSourcesToUpdate = img =>
const showOverlay = (node, i) => {
if (!state.watching) return

const rect = node.getBoundingClientRect()
const rect = node['vis-box']
const overlay = overlays[i]

if (overlay) {
2 changes: 1 addition & 1 deletion app/features/margin.js
Original file line number Diff line number Diff line change
@@ -89,7 +89,7 @@ function removeBackgrounds(els) {
}

export function createMarginVisual(el, hover = false) {
const bounds = el.getBoundingClientRect()
const bounds = el['vis-box']
const styleOM = el.computedStyleMap()
const calculatedStyle = getStyle(el, 'margin')
const boxdisplay = document.createElement('visbug-boxmodel')
4 changes: 2 additions & 2 deletions app/features/measurements.js
Original file line number Diff line number Diff line change
@@ -11,8 +11,8 @@ export function createMeasurements({$anchor, $target}) {

if (state.distances.length) clearMeasurements()

const anchorBounds = $anchor.getBoundingClientRect()
const targetBounds = $target.getBoundingClientRect()
const anchorBounds = $anchor['vis-box']
const targetBounds = $target['vis-box']

const measurements = []

2 changes: 1 addition & 1 deletion app/features/metatip.js
Original file line number Diff line number Diff line change
@@ -130,7 +130,7 @@ export function removeAll() {
}

const render = (el, tip = document.createElement('visbug-metatip')) => {
const { width, height } = el.getBoundingClientRect()
const { width, height } = el['vis-box']
const colormode = $('vis-bug')[0].colorMode

const styles = getStyles(el)
2 changes: 1 addition & 1 deletion app/features/padding.js
Original file line number Diff line number Diff line change
@@ -89,7 +89,7 @@ function removeBackgrounds(els) {
}

export function createPaddingVisual(el, hover = false) {
const bounds = el.getBoundingClientRect()
const bounds = el['vis-box']
const styleOM = el.computedStyleMap()
const calculatedStyle = getStyle(el, 'padding')
const boxdisplay = document.createElement('visbug-boxmodel')
8 changes: 4 additions & 4 deletions app/features/selectable.js
Original file line number Diff line number Diff line change
@@ -419,14 +419,14 @@ export function Selectable(visbug) {
el.setAttribute('data-label-id', id)

clearHover()
await setVisbox([el])

overlayMetaUI({
el,
id,
no_label: tool !== 'inspector' && tool !== 'accessibility',
})

await setVisbox([el])
selected.unshift(el)
tellWatchers()
}
@@ -578,15 +578,15 @@ export function Selectable(visbug) {
}

const setLabel = (el, label) =>
label.update = el.getBoundingClientRect()
label.update = el['vis-box']

const createLabel = ({el, id, template}) => {
if (!labels[id]) {
const label = document.createElement('visbug-label')

label.text = template
label.position = {
boundingRect: el.getBoundingClientRect(),
boundingRect: el['vis-box'],
node_label_id: id,
}

@@ -654,7 +654,7 @@ export function Selectable(visbug) {

hover_state.label.text = text
hover_state.label.position = {
boundingRect: el.getBoundingClientRect(),
boundingRect: el['vis-box'],
node_label_id: 'hover',
}