rename app to editor (#1503)
This PR renames `App`, `app` and all appy names to `Editor`, `editor`, and editorry names. ### Change Type - [x] `major` — Breaking Change ### Release Notes - Rename `App` to `Editor` and many other things that reference `app` to `editor`.
This commit is contained in:
parent
640bc9de24
commit
735f1c41b7
311 changed files with 8365 additions and 8209 deletions
|
@ -2,10 +2,10 @@ import React, { useMemo } from 'react'
|
|||
import { createShapesFromFiles } from '../utils/assets'
|
||||
import { preventDefault, releasePointerCapture, setPointerCapture } from '../utils/dom'
|
||||
import { getPointerInfo } from '../utils/svg'
|
||||
import { useApp } from './useApp'
|
||||
import { useEditor } from './useEditor'
|
||||
|
||||
export function useCanvasEvents() {
|
||||
const app = useApp()
|
||||
const editor = useEditor()
|
||||
|
||||
const events = useMemo(
|
||||
function canvasEvents() {
|
||||
|
@ -18,11 +18,11 @@ export function useCanvasEvents() {
|
|||
|
||||
setPointerCapture(e.currentTarget, e)
|
||||
|
||||
app.dispatch({
|
||||
editor.dispatch({
|
||||
type: 'pointer',
|
||||
target: 'canvas',
|
||||
name: 'pointer_down',
|
||||
...getPointerInfo(e, app.getContainer()),
|
||||
...getPointerInfo(e, editor.getContainer()),
|
||||
})
|
||||
}
|
||||
|
||||
|
@ -33,11 +33,11 @@ export function useCanvasEvents() {
|
|||
lastX = e.clientX
|
||||
lastY = e.clientY
|
||||
|
||||
app.dispatch({
|
||||
editor.dispatch({
|
||||
type: 'pointer',
|
||||
target: 'canvas',
|
||||
name: 'pointer_move',
|
||||
...getPointerInfo(e, app.getContainer()),
|
||||
...getPointerInfo(e, editor.getContainer()),
|
||||
})
|
||||
}
|
||||
|
||||
|
@ -49,33 +49,33 @@ export function useCanvasEvents() {
|
|||
|
||||
releasePointerCapture(e.currentTarget, e)
|
||||
|
||||
app.dispatch({
|
||||
editor.dispatch({
|
||||
type: 'pointer',
|
||||
target: 'canvas',
|
||||
name: 'pointer_up',
|
||||
...getPointerInfo(e, app.getContainer()),
|
||||
...getPointerInfo(e, editor.getContainer()),
|
||||
})
|
||||
}
|
||||
|
||||
function onPointerEnter(e: React.PointerEvent) {
|
||||
if ((e as any).isKilled) return
|
||||
|
||||
app.dispatch({
|
||||
editor.dispatch({
|
||||
type: 'pointer',
|
||||
target: 'canvas',
|
||||
name: 'pointer_enter',
|
||||
...getPointerInfo(e, app.getContainer()),
|
||||
...getPointerInfo(e, editor.getContainer()),
|
||||
})
|
||||
}
|
||||
|
||||
function onPointerLeave(e: React.PointerEvent) {
|
||||
if ((e as any).isKilled) return
|
||||
|
||||
app.dispatch({
|
||||
editor.dispatch({
|
||||
type: 'pointer',
|
||||
target: 'canvas',
|
||||
name: 'pointer_leave',
|
||||
...getPointerInfo(e, app.getContainer()),
|
||||
...getPointerInfo(e, editor.getContainer()),
|
||||
})
|
||||
}
|
||||
|
||||
|
@ -107,7 +107,7 @@ export function useCanvasEvents() {
|
|||
(file) => !file.name.endsWith('.tldr')
|
||||
)
|
||||
|
||||
await createShapesFromFiles(app, files, app.screenToPage(e.clientX, e.clientY), false)
|
||||
await createShapesFromFiles(editor, files, editor.screenToPage(e.clientX, e.clientY), false)
|
||||
}
|
||||
|
||||
return {
|
||||
|
@ -122,7 +122,7 @@ export function useCanvasEvents() {
|
|||
onTouchEnd,
|
||||
}
|
||||
},
|
||||
[app]
|
||||
[editor]
|
||||
)
|
||||
|
||||
return events
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue