@univerjs/sheets-drawing-ui v0.5.4
Class: FOverGridImage
Defined in: sheets-drawing-ui/src/facade/f-over-grid-image.ts:490
FBase
is a base class for all facade classes.
It provides a way to extend classes with static and instance methods.
The _initialize
as a special method that will be called after the constructor. You should never call it directly.
Extends
Constructors
new FOverGridImage()
new FOverGridImage(
_image,
_commandService,
_injector): FOverGridImage
Defined in: sheets-drawing-ui/src/facade/f-over-grid-image.ts:491
Parameters
Parameter | Type |
---|---|
_image | ISheetImage |
_commandService | ICommandService |
_injector | Injector |
Returns
Overrides
Properties
Property | Modifier | Type | Default value | Inherited from | Defined in |
---|---|---|---|---|---|
_commandService | readonly | ICommandService | undefined | - | sheets-drawing-ui/src/facade/f-over-grid-image.ts:493 |
_disposed | protected | boolean | false | FBase ._disposed | core/src/shared/lifecycle.ts:96 |
_injector | readonly | Injector | undefined | - | sheets-drawing-ui/src/facade/f-over-grid-image.ts:494 |
Methods
dispose()
dispose(): void
Defined in: core/src/shared/lifecycle.ts:109
Returns
void
Inherited from
disposeWithMe()
disposeWithMe(disposable): IDisposable
Defined in: core/src/shared/lifecycle.ts:99
Parameters
Parameter | Type |
---|---|
disposable | DisposableLike |
Returns
Inherited from
ensureNotDisposed()
protected ensureNotDisposed(): void
Defined in: core/src/shared/lifecycle.ts:103
Returns
void
Inherited from
getId()
getId(): string
Defined in: sheets-drawing-ui/src/facade/f-over-grid-image.ts:499
Returns
string
getType()
getType(): DrawingTypeEnum
Defined in: sheets-drawing-ui/src/facade/f-over-grid-image.ts:503
Returns
remove()
remove(): boolean
Defined in: sheets-drawing-ui/src/facade/f-over-grid-image.ts:519
Remove the image from the sheet
Returns
boolean
success or not
Example
// remove the image from the sheet
const activeSpreadsheet = univerAPI.getActiveWorkbook();
const activeSheet = activeSpreadsheet.getActiveSheet();
const image = activeSheet.getImages()[0];
console.log('Delete state is ', image?.remove());
setBack()
setBack(): boolean
Defined in: sheets-drawing-ui/src/facade/f-over-grid-image.ts:759
Move the image layer to the back
Returns
boolean
success or not
Example
// move the image to the back
const activeSpreadsheet = univerAPI.getActiveWorkbook();
const activeSheet = activeSpreadsheet.getActiveSheet();
const image = activeSheet.getImages()[0];
console.log('Move back state is ', image.setBack());
setBackward()
setBackward(): boolean
Defined in: sheets-drawing-ui/src/facade/f-over-grid-image.ts:738
Move the image layer backward by one level
Returns
boolean
success or not
Example
// move the image backward
const activeSpreadsheet = univerAPI.getActiveWorkbook();
const activeSheet = activeSpreadsheet.getActiveSheet();
const image = activeSheet.getImages()[0];
console.log('Move backward state is ', image.setBackward());
setCrop()
setCrop(
top?,
left?,
bottom?,
right?): boolean
Defined in: sheets-drawing-ui/src/facade/f-over-grid-image.ts:653
Set the cropping region of the image by defining the top, bottom, left, and right edges, thereby displaying the specific part of the image you want.
Parameters
Parameter | Type | Description |
---|---|---|
top ? | number | The number of pixels to crop from the top of the image. |
left ? | number | The number of pixels to crop from the left side of the image. |
bottom ? | number | The number of pixels to crop from the bottom of the image. |
right ? | number | The number of pixels to crop from the right side of the image. |
Returns
boolean
success or not
Example
// set the crop of the image
const activeSpreadsheet = univerAPI.getActiveWorkbook();
const activeSheet = activeSpreadsheet.getActiveSheet();
const image = activeSheet.getImages()[0];
console.log('Set crop state is ', image.setCrop(10, 10, 10, 10));
setForward()
setForward(): boolean
Defined in: sheets-drawing-ui/src/facade/f-over-grid-image.ts:717
Move the image layer forward by one level
Returns
boolean
success or not
Example
// move the image forward
const activeSpreadsheet = univerAPI.getActiveWorkbook();
const activeSheet = activeSpreadsheet.getActiveSheet();
const image = activeSheet.getImages()[0];
console.log('Move forward state is ', image.setForward());
setFront()
setFront(): boolean
Defined in: sheets-drawing-ui/src/facade/f-over-grid-image.ts:780
Move the image layer to the front
Returns
boolean
success or not
Example
// move the image to the front
const activeSpreadsheet = univerAPI.getActiveWorkbook();
const activeSheet = activeSpreadsheet.getActiveSheet();
const image = activeSheet.getImages()[0];
console.log('Move front state is ', image.setFront());
setPositionAsync()
Call Signature
setPositionAsync(row, column): Promise<boolean>
Defined in: sheets-drawing-ui/src/facade/f-over-grid-image.ts:584
Set the position of the image
Parameters
Parameter | Type | Description |
---|---|---|
row | number | The sheet start row of the image |
column | number | The sheet start column of the image |
Returns
Promise
<boolean
>
success or not
Example
// set the position of the image
const activeSpreadsheet = univerAPI.getActiveWorkbook();
const activeSheet = activeSpreadsheet.getActiveSheet();
const image = activeSheet.getImages()[0];
console.log('Set position state is ', image.setPosition(5, 5));
Call Signature
setPositionAsync(
row,
column,
rowOffset?,
columnOffset?): Promise<boolean>
Defined in: sheets-drawing-ui/src/facade/f-over-grid-image.ts:601
Parameters
Parameter | Type | Description |
---|---|---|
row | number | The sheet start row of the image |
column | number | The sheet start column of the image |
rowOffset ? | number | The offset of the start row |
columnOffset ? | number | The offset of the start column |
Returns
Promise
<boolean
>
success or not
Example
// set the position of the image
const activeSpreadsheet = univerAPI.getActiveWorkbook();
const activeSheet = activeSpreadsheet.getActiveSheet();
const image = activeSheet.getImages()[0];
console.log('Set position state is ', image.setPosition(5, 5, 10, 10));
setRotate()
setRotate(angle): boolean
Defined in: sheets-drawing-ui/src/facade/f-over-grid-image.ts:700
Set the rotation angle of the image
Parameters
Parameter | Type | Description |
---|---|---|
angle | number | Degree of rotation of the image, for example, 90, 180, 270, etc. |
Returns
boolean
success or not
Example
// set the rotation angle of the image
const activeSpreadsheet = univerAPI.getActiveWorkbook();
const activeSheet = activeSpreadsheet.getActiveSheet();
const image = activeSheet.getImages()[0];
console.log('Set rotate state is ', image.setRotate(90));
setSizeAsync()
setSizeAsync(width, height): Promise<boolean>
Defined in: sheets-drawing-ui/src/facade/f-over-grid-image.ts:629
Set the size of the image
Parameters
Parameter | Type | Description |
---|---|---|
width | number | The width of the image |
height | number | The height of the image |
Returns
Promise
<boolean
>
success or not
Example
// set the size of the image
const activeSpreadsheet = univerAPI.getActiveWorkbook();
const activeSheet = activeSpreadsheet.getActiveSheet();
const image = activeSheet.getImages()[0];
console.log('Set size state is ', image.setSize(50, 120));
***
### setSource()
#### Call Signature
```ts
setSource(source): boolean
Defined in: sheets-drawing-ui/src/facade/f-over-grid-image.ts:555
Set the source of the image
Parameters
Parameter | Type | Description |
---|---|---|
source | string | The source of the image |
Returns
boolean
success or not
Example
// set the source of the image
const activeSpreadsheet = univerAPI.getActiveWorkbook();
const activeSheet = activeSpreadsheet.getActiveSheet();
const image = activeSheet.getImages()[0];
console.log('Set source state is ', image.setSource('https://avatars.githubusercontent.com/u/61444807?s=48&v=4'));
#### Call Signature
```ts
setSource(source, sourceType?): boolean
Defined in: sheets-drawing-ui/src/facade/f-over-grid-image.ts:562
Set the source of the image, change image display.
Parameters
Parameter | Type | Description |
---|---|---|
source | string | The source of the image |
sourceType ? | ImageSourceType | The source type of the image, ImageSourceType |
Returns
boolean
success or not
toBuilder()
toBuilder(): FOverGridImageBuilder
Defined in: sheets-drawing-ui/src/facade/f-over-grid-image.ts:537
Convert the image to a FOverGridImageBuilder
Returns
The builder FOverGridImageBuilder
Example
// convert the image to a builder
const activeSpreadsheet = univerAPI.getActiveWorkbook();
const activeSheet = activeSpreadsheet.getActiveSheet();
const image = activeSheet.getImages()[0];
const builder = image.toBuilder();
const param = await builder.setSource('https://avatars.githubusercontent.com/u/61444807?s=48&v=4').setColumn(5).setRow(5).buildAsync();
activeSheet.updateImages([param]);
extend()
static extend(source): void
Defined in: core/src/facade/f-base.ts:26
Parameters
Parameter | Type |
---|---|
source | any |
Returns
void