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

Dev #4

Merged
merged 120 commits into from
Dec 18, 2022
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
120 commits
Select commit Hold shift + click to select a range
ff40697
feat(build): build for universlide
Dushusir Nov 21, 2022
30799fa
feat(formula): add FormulaActionExtension execute
Dushusir Nov 22, 2022
962dcb0
fix(style): modal show
Nov 23, 2022
2bec218
feat(formula): formula action extension add formulaData actoin
Dushusir Nov 23, 2022
c518783
Merge branch 'dev' of https://github.com/dream-num/univer into dev
Dushusir Nov 23, 2022
47579b2
fix(richtext): fix richtext editor formula input
Dushusir Nov 24, 2022
de90d6b
fix(base-sheets): setcolumnwidth
Nov 24, 2022
38b37de
Merge branch 'dev' of https://github.com/dream-num/univer into dev
Dushusir Nov 25, 2022
6227490
fix: changeToolBar bug
jerry-TangHao Nov 25, 2022
083be98
Merge remote-tracking branch 'origin/dev' into dev
jerry-TangHao Nov 25, 2022
f5e5395
fix(formula): formula help and search modal move to formula plugn
Dushusir Nov 25, 2022
4625bc7
Merge branch 'dev' of https://github.com/dream-num/univer into dev
Dushusir Nov 25, 2022
57678bc
fix: changeToolBar bug
jerry-TangHao Nov 28, 2022
bedbb70
Merge remote-tracking branch 'origin/dev' into dev
jerry-TangHao Nov 28, 2022
4f64e15
fix: changeToolBar bug
jerry-TangHao Nov 28, 2022
f889bbf
fix(sheets): fix selection change
Dushusir Nov 28, 2022
16b96e9
Merge branch 'dev' of https://github.com/dream-num/univer into dev
Dushusir Nov 28, 2022
12ecd0b
fix: changeToolBar bug
jerry-TangHao Nov 28, 2022
936f63b
fix: objectarray bug
jerry-TangHao Nov 28, 2022
dba1fec
fix: objectmatrix bug
jerry-TangHao Nov 28, 2022
db2ecb9
fix(base-sheets): drag line
Nov 28, 2022
150d94f
Merge branch 'dev' of https://github.com/dream-num/univer into dev
Nov 28, 2022
8c4486b
fix: objectmatrix bug
jerry-TangHao Nov 28, 2022
c1d4baa
feat(sheets): named range
Dushusir Nov 28, 2022
a87c4a9
Merge branch 'dev' of https://github.com/dream-num/univer into dev
Dushusir Nov 28, 2022
7f07ede
feat(sheet): doc editor dev
Nov 28, 2022
d896aca
Merge branch 'dev' of https://github.com/dream-num/univer into dev
Nov 28, 2022
f480ca6
fix(core): Object Matrix forEach error
Dushusir Nov 29, 2022
7e468e9
fix: numfmt bug
jerry-TangHao Nov 29, 2022
ce57805
fix: numfmt bug
jerry-TangHao Nov 29, 2022
77f471b
feat(sheets): update namedrange obs
Dushusir Nov 29, 2022
46f68fc
Merge branch 'dev' of https://github.com/dream-num/univer into dev
Dushusir Nov 29, 2022
0c1170f
fix: toolbar bug
jerry-TangHao Nov 30, 2022
e41a40c
Merge remote-tracking branch 'origin/dev' into dev
jerry-TangHao Nov 30, 2022
5403c2c
feat(sheets-plugin): add import xlsx plugin template
Dushusir Nov 30, 2022
694a4c3
Merge branch 'dev' of https://github.com/dream-num/univer into dev
Dushusir Nov 30, 2022
4c1dc51
chore(cli): add docs-plugin and slides-plugin template
Dushusir Dec 1, 2022
db33bba
feat(import-xlsx): 1.support import xlsx 2. render supprt inline style
Dushusir Dec 1, 2022
eda1102
fix(base-sheets): set column width
Dec 1, 2022
e6bf16b
Merge branch 'dev' of https://github.com/dream-num/univer into dev
Dec 1, 2022
8986025
feat(build): build umd
Dushusir Dec 1, 2022
5f0a709
feat(sheet): editor dev
Dec 2, 2022
7d3e533
Merge branch 'dev' of https://github.com/dream-num/univer into dev
Dec 2, 2022
165cc0d
Merge branch 'dev' of https://github.com/dream-num/univer into dev
Dec 2, 2022
9e2acfc
fix(base-sheets): copy/paste
Dec 2, 2022
4e32094
Merge branch 'dev' of https://github.com/dream-num/univer into dev
Dec 2, 2022
b917389
xiugai
Dec 2, 2022
1d87389
feat(register): add common plugin register
Dushusir Dec 2, 2022
a7d83dc
Merge branch 'dev' of https://github.com/dream-num/univer into dev
Dushusir Dec 2, 2022
a341315
feat(register)
Dushusir Dec 2, 2022
d6cbf33
add: add doc init
jerry-TangHao Dec 3, 2022
9d4cf38
Merge remote-tracking branch 'origin/dev' into dev
jerry-TangHao Dec 3, 2022
95b046c
fix(sheet): editor dev
Dec 3, 2022
a76ad45
Merge branch 'dev' of https://github.com/dream-num/univer into dev
Dec 3, 2022
87b862f
feat(keyboard): add keyboardManager
Dushusir Dec 3, 2022
3304b17
Merge branch 'dev' of https://github.com/dream-num/univer into dev
Dushusir Dec 3, 2022
febf5dc
add: add univer init
jerry-TangHao Dec 3, 2022
1ba42de
fix(clipboard): cell edit handle paste event
Dushusir Dec 3, 2022
5cdcd40
Merge branch 'dev' of https://github.com/dream-num/univer into dev
Dushusir Dec 3, 2022
2f73e6b
feat(build): build custom
Dushusir Dec 3, 2022
a465be7
fix(sheets): 1. right click cell edit 2. formula open
Dushusir Dec 5, 2022
84d12d7
fix(formula): add getStyleByCell for formula get style from cell or s…
Dushusir Dec 5, 2022
19ae9a5
feat(sheets): add set selection type by data
Dushusir Dec 5, 2022
138ef19
fix(sheet): support =A3*B4 reference formula
DR-Univer Dec 5, 2022
1c32456
Merge branch 'dev' of https://github.com/dream-num/univer into dev
DR-Univer Dec 5, 2022
5d820ee
fix(sheet): formula dependency
DR-Univer Dec 5, 2022
1fcea70
chore(plugin): move clipboard extension manager to base-component, me…
Dushusir Dec 6, 2022
4654186
Merge branch 'dev' of https://github.com/dream-num/univer into dev
Dushusir Dec 6, 2022
b46079d
chore(core): remove rangeData in setRangeData
Dushusir Dec 6, 2022
7329595
chore(example): run d locale english error
Dushusir Dec 7, 2022
e9914d0
feat(doc): selection develop
DR-Univer Dec 7, 2022
4f25902
Merge branch 'dev' of https://github.com/dream-num/univer into dev
DR-Univer Dec 7, 2022
80c03a1
fix(sheet): dependency include self
DR-Univer Dec 7, 2022
9d37b9e
chore(core): ActionExtension handle actionDataList
Dushusir Dec 7, 2022
a890f8b
fix(formula): 1. prompt serach list positon 2. cursor position
Dushusir Dec 7, 2022
69c8003
add: add univer init
jerry-TangHao Dec 8, 2022
20b0c8c
Merge remote-tracking branch 'origin/dev' into dev
jerry-TangHao Dec 8, 2022
a862dd3
add: add univer init
jerry-TangHao Dec 8, 2022
71c3bd2
fix(demo)
Dec 8, 2022
c723d3a
Merge branch 'dev' of https://github.com/dream-num/univer into dev
Dec 8, 2022
013de26
feat(base-component): drag and drop event support
Dushusir Dec 8, 2022
7d71875
build(demo): 1. support npm run dev:demo, npm run build:demo
Dushusir Dec 8, 2022
8b22b3b
feat(base-component): 1. drap and drop 2.import xlsx plugin support d…
Dushusir Dec 9, 2022
ab71785
build(demo): build no legacy
Dushusir Dec 9, 2022
3f3255b
xiugai
Dec 10, 2022
4ff1e40
feat(doc): doc editor
DR-Univer Dec 10, 2022
eb6fd5a
Merge branch 'dev' of https://github.com/dream-num/univer into dev
DR-Univer Dec 10, 2022
e7e7459
feat(demo): demo data
Dushusir Dec 10, 2022
4600d63
Merge branch 'dev' of https://github.com/dream-num/univer into dev
Dushusir Dec 10, 2022
a47363b
feat(doc): editor and float sheet
DR-Univer Dec 11, 2022
83fe052
Merge branch 'dev' of https://github.com/dream-num/univer into dev
DR-Univer Dec 11, 2022
fd3a915
fix(base-sheets): 1. canvas resize listener 2. remove vite plugin legacy
Dushusir Dec 12, 2022
f6ff421
fix(base-docs,base-slides): resize bug
Dushusir Dec 12, 2022
ced1543
feat(slide): define snapshot
DR-Univer Dec 12, 2022
0d7ab0a
Merge branch 'dev' of https://github.com/dream-num/univer into dev
DR-Univer Dec 12, 2022
42d91e6
fix(base-sheets): 1. border setting by toolbar 2. border disapper by …
Dushusir Dec 13, 2022
dbd2ad3
fix(base-sheets): edit merged cell to save
Dushusir Dec 13, 2022
0ca9d44
feat(slide): dev
DR-Univer Dec 14, 2022
3781dd1
Merge branch 'dev' of https://github.com/dream-num/univer into dev
DR-Univer Dec 14, 2022
5f0b5ef
fix(formula) calculate number cell
Dushusir Dec 14, 2022
9a3060f
chore(core): remove useless code
Dushusir Dec 14, 2022
ed6e34a
xiugai
Dec 14, 2022
887c3ef
Merge branch 'dev' of https://github.com/dream-num/univer into dev
Dec 14, 2022
4b44684
feat(collaboration): add simle collaboration
Dushusir Dec 15, 2022
541548c
fix(core): 1. styles.getStyleByCell 2. collaboration url example
Dushusir Dec 16, 2022
394d7a5
feat(demo): add doc and slide demo project
Dushusir Dec 16, 2022
7b27f1d
fix(demo): demo formula
Dushusir Dec 16, 2022
5c0d031
feat(slide): dev
DR-Univer Dec 16, 2022
2d7c6a2
Merge branch 'dev' of https://github.com/dream-num/univer into dev
DR-Univer Dec 16, 2022
19ad0a1
fix(base-sheets): cell input handle
Dushusir Dec 16, 2022
2187e48
Merge branch 'dev' of https://github.com/dream-num/univer into dev
Dushusir Dec 16, 2022
2978de1
chore(demo): demo build script
Dushusir Dec 16, 2022
eac1f8c
fix(sheet): formula dependency fix
DR-Univer Dec 16, 2022
625bb1f
Merge branch 'dev' of https://github.com/dream-num/univer into dev
DR-Univer Dec 16, 2022
17593cd
feat(slide): base feature dev
DR-Univer Dec 17, 2022
7d9259f
feat(slide): doc and slide demo done
DR-Univer Dec 18, 2022
4a0b7ea
fix(base-sheets): 1. toolbar merge cell 2.refreshWorkbook in main.tsx…
Dushusir Dec 18, 2022
f1bf593
fix(sheet): doc in slide center fix
DR-Univer Dec 18, 2022
bd02e17
Merge branch 'dev' of https://github.com/dream-num/univer into dev
DR-Univer Dec 18, 2022
5f7b98d
chore(demo): collaboration demo
Dushusir Dec 18, 2022
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
feat(slide): dev
  • Loading branch information
DR-Univer committed Dec 16, 2022
commit 5c0d03179704765bbc52722462db409090472bcb
9 changes: 9 additions & 0 deletions packages/base-render/src/BaseObject.ts
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,8 @@ export abstract class BaseObject {

private _isTransformer = false;

private _forceRender = false;

groupKey?: string;

isInGroup: boolean = false;
Expand Down Expand Up @@ -265,6 +267,13 @@ export abstract class BaseObject {
return this;
}

isRender(bounds?: IBoundRect) {
if (this._forceRender) {
return false;
}
return bounds && !this.isInGroup;
}

private _makeDirtyMix() {
if (this.debounceParentDirty) {
this.makeDirty(true);
Expand Down
49 changes: 19 additions & 30 deletions packages/base-render/src/Basics/Interfaces.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,17 @@
import { BooleanNumber, GridType, IDocStyleBase, IDocumentLayout, IParagraphStyle, IReferenceSource, ISectionBreakBase, ITextStyle } from '@univer/core';
import {
BooleanNumber,
GridType,
IDocStyleBase,
IDocumentLayout,
IOffset,
IParagraphStyle,
IReferenceSource,
IScale,
ISectionBreakBase,
ISize,
ITextStyle,
ITransformState,
} from '@univer/core';
import { TextSelection } from '../Component/Docs/Common/TextSelection';
import { Documents } from '../Component/Docs/Document';
import {
Expand All @@ -11,41 +24,17 @@ import {
} from './IDocumentSkeletonCached';
import { Vector2 } from './Vector2';

export interface ISize {
width?: number;
height?: number;
}

export interface IScale {
scaleX?: number;
scaleY?: number;
}

export interface IOffset {
left?: number;
top?: number;
export interface IObjectFullState extends ITransformState {
strokeWidth?: number;
zIndex?: number;
isTransformer?: boolean;
forceRender?: boolean;
}

export interface IRect extends ISize, IOffset {
points: Vector2[];
}

export interface ITransformState extends IOffset {
scaleX?: number;
scaleY?: number;
angle?: number;
skewX?: number;
skewY?: number;
flipX?: boolean;
flipY?: boolean;
}

export interface IObjectFullState extends ITransformState, ISize {
strokeWidth?: number;
zIndex?: number;
isTransformer?: boolean;
}

export interface ISceneTransformState extends ISize, IScale {}

export enum TRANSFORM_CHANGE_OBSERVABLE_TYPE {
Expand Down
21 changes: 19 additions & 2 deletions packages/base-render/src/Basics/Tools.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { FontStyleType, ICellInfo, ISelection, IStyleBase, Nullable, ObjectMatrix, Tools, IRangeData, BaselineOffset } from '@univer/core';
import { FontStyleType, ICellInfo, ISelection, IStyleBase, Nullable, ObjectMatrix, Tools, IRangeData, BaselineOffset, IScale } from '@univer/core';
import { DEFAULT_FONTFACE_PLANE } from './Const';
import { IBoundRectNoAngle } from './Vector2';
import { IFontLocale, IScale } from './Interfaces';
import { IFontLocale } from './Interfaces';
import { FontCache } from './FontCache';

const OBJECT_ARRAY = '[object Array]';
Expand Down Expand Up @@ -596,3 +596,20 @@ export function checkStyle(content: string) {
}
return false;
}

export function pxToNum(unit: string) {
return Number(unit.replace(/px/gi, ''));
}

export function getSizeForDom(dom: HTMLElement) {
const style = getComputedStyle(dom);
const { borderTopWidth, borderLeftWidth, borderRightWidth, borderBottomWidth, width, height } = style;
return {
top: pxToNum(borderTopWidth),
left: pxToNum(borderLeftWidth),
right: pxToNum(borderRightWidth),
bottom: pxToNum(borderBottomWidth),
width: pxToNum(width),
height: pxToNum(height),
};
}
5 changes: 5 additions & 0 deletions packages/base-render/src/Canvas.ts
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,11 @@ export class Canvas {
this.setSize(this._width, this._height, pixelRatio);
}

dispose() {
this.clear();
this._canvasEle.remove();
}

clear() {
const ctx = this.getContext();
ctx.clearRect(0, 0, this._width * this._pixelRatio, this._height * this._pixelRatio);
Expand Down
68 changes: 54 additions & 14 deletions packages/base-render/src/Engine.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { Observable } from '@univer/core';
import { DeviceType, IEvent, IKeyboardEvent, IPointerEvent, PointerInput } from './Basics/IEvents';

import { getPointerPrefix, IsSafari, requestNewFrame } from './Basics/Tools';
import { getSizeForDom, getPointerPrefix, IsSafari, requestNewFrame } from './Basics/Tools';

import { ITransformChangeState, TRANSFORM_CHANGE_OBSERVABLE_TYPE } from './Basics/Interfaces';

Expand Down Expand Up @@ -46,6 +46,16 @@ export class Engine {

private _performanceMonitor = new PerformanceMonitor();

private _pointerMoveEvent: (evt: any) => void;

private _pointerDownEvent: (evt: any) => void;

private _pointerUpEvent: (evt: any) => void;

private _pointerBlurEvent: (evt: any) => void;

private _pointerWheelEvent: (evt: any) => void;

/**
* Observable raised when the engine begins a new frame
*/
Expand Down Expand Up @@ -112,7 +122,7 @@ export class Engine {
}

hasActiveScene(): boolean {
return !!this._activeScene;
return this._activeScene != null;
}

get activeScene() {
Expand All @@ -130,8 +140,9 @@ export class Engine {
return;
}

const { offsetWidth, offsetHeight } = this._container;
this.resizeBySize(offsetWidth, offsetHeight);
// const { offsetWidth, offsetHeight } = this._container;
const { width, height } = getSizeForDom(this._container);
this.resizeBySize(width, height);
}

resizeBySize(width: number, height: number) {
Expand All @@ -151,6 +162,35 @@ export class Engine {
});
}

dispose() {
const scenes = this.getScenes();
const sceneKeys = Object.keys(scenes);
sceneKeys.forEach((key) => {
scenes[key].dispose();
});
const eventPrefix = getPointerPrefix();
this._canvasEle.removeEventListener(`${eventPrefix}move`, this._pointerMoveEvent);
this._canvasEle.removeEventListener(`${eventPrefix}down`, this._pointerDownEvent);
this._canvasEle.removeEventListener(`${eventPrefix}up`, this._pointerUpEvent);
this._canvasEle.removeEventListener('blur', this._pointerBlurEvent);
this._canvasEle.removeEventListener(this._getWheelEventName(), this._pointerWheelEvent);

this._activeRenderLoops = [];
this._canvas.dispose();
this.onBeginFrameObservable.clear();
this.onEndFrameObservable.clear();
this.onTransformChangeObservable.clear();
}

remainScene(key: string) {
const scenes = this.getScenes();
if (scenes[key]) {
const scene = scenes[key];
delete scenes[key];
return scene;
}
}

/**
* Register and execute a render loop. The engine can have more than one render function
* @param renderFunction defines the function to continuously execute
Expand Down Expand Up @@ -284,7 +324,7 @@ export class Engine {
private _handlePointerAction() {
const eventPrefix = getPointerPrefix();

const pointerMoveEvent = (evt: any) => {
this._pointerMoveEvent = (evt: any) => {
const deviceType = this.__getPointerType(evt);
// Store previous values for event
const previousHorizontal = this.__pointer[PointerInput.Horizontal];
Expand Down Expand Up @@ -339,7 +379,7 @@ export class Engine {
}
};

const pointerDownEvent = (evt: any) => {
this._pointerDownEvent = (evt: any) => {
const deviceType = this.__getPointerType(evt);
const previousHorizontal = this.__pointer[PointerInput.Horizontal];
const previousVertical = this.__pointer[PointerInput.Vertical];
Expand Down Expand Up @@ -397,7 +437,7 @@ export class Engine {
// console.log('pointerDownEvent_2', previousHorizontal, evt.clientX, previousVertical, evt.clientY, this.__pointer);
};

const pointerUpEvent = (evt: any) => {
this._pointerUpEvent = (evt: any) => {
const deviceType = this.__getPointerType(evt);
const previousHorizontal = this.__pointer[PointerInput.Horizontal];
const previousVertical = this.__pointer[PointerInput.Vertical];
Expand Down Expand Up @@ -443,7 +483,7 @@ export class Engine {
}
};

const pointerBlurEvent = (evt: any) => {
this._pointerBlurEvent = (evt: any) => {
if (this.__mouseId >= 0 && this._canvasEle.hasPointerCapture(this.__mouseId)) {
this._canvasEle.releasePointerCapture(this.__mouseId);
this.__mouseId = -1;
Expand All @@ -452,7 +492,7 @@ export class Engine {
this.__pointer = {};
};

const pointerWheelEvent = (evt: any) => {
this._pointerWheelEvent = (evt: any) => {
const deviceType = DeviceType.Mouse;
// Store previous values for event
let previousWheelScrollX = this.__pointer[PointerInput.MouseWheelX];
Expand Down Expand Up @@ -486,11 +526,11 @@ export class Engine {
}
};

this._canvasEle.addEventListener(`${eventPrefix}move`, pointerMoveEvent);
this._canvasEle.addEventListener(`${eventPrefix}down`, pointerDownEvent);
this._canvasEle.addEventListener(`${eventPrefix}up`, pointerUpEvent);
this._canvasEle.addEventListener('blur', pointerBlurEvent);
this._canvasEle.addEventListener(this._getWheelEventName(), pointerWheelEvent, this._getPassive() ? { passive: false } : false);
this._canvasEle.addEventListener(`${eventPrefix}move`, this._pointerMoveEvent);
this._canvasEle.addEventListener(`${eventPrefix}down`, this._pointerDownEvent);
this._canvasEle.addEventListener(`${eventPrefix}up`, this._pointerUpEvent);
this._canvasEle.addEventListener('blur', this._pointerBlurEvent);
this._canvasEle.addEventListener(this._getWheelEventName(), this._pointerWheelEvent, this._getPassive() ? { passive: false } : false);
}

private _getWheelEventName(): string {
Expand Down
11 changes: 11 additions & 0 deletions packages/base-render/src/Layer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -96,4 +96,15 @@ export class Layer {
});
return this;
}

clear() {
this._objects = [];
}

dispose() {
this.getObjects().forEach((o) => {
o.dispose();
});
this.clear();
}
}
Loading