Skip to content

Commit f3e8908

Browse files
committed
fix: auto delete url in options when use fromUrl
1 parent 6d196e0 commit f3e8908

File tree

4 files changed

+51
-38
lines changed

4 files changed

+51
-38
lines changed
Lines changed: 33 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -1,33 +1,33 @@
1-
import { Tooltip as SemiTooltip } from '@douyinfe/semi-ui';
2-
import { useToggle } from '@/hooks/use-toggle';
3-
import React from 'react';
4-
import { Position } from '@douyinfe/semi-ui/lib/es/tooltip';
5-
6-
interface IProps {
7-
content: React.ReactNode;
8-
hideOnClick?: boolean;
9-
position?: Position;
10-
children?: React.ReactNode;
11-
}
12-
13-
export const Tooltip: React.FC<IProps> = ({ content, hideOnClick = false, position = 'top', children }) => {
14-
const [visible, toggleVisible] = useToggle(false);
15-
16-
return (
17-
<SemiTooltip visible={visible} content={content} zIndex={10000} trigger={'custom'} position={position} >
18-
<span
19-
onMouseEnter={() => {
20-
toggleVisible(true);
21-
}}
22-
onMouseLeave={() => {
23-
toggleVisible(false);
24-
}}
25-
onMouseDown={() => {
26-
hideOnClick && toggleVisible(false);
27-
}}
28-
>
29-
{children}
30-
</span>
31-
</SemiTooltip>
32-
);
33-
};
1+
import { Tooltip as SemiTooltip } from '@douyinfe/semi-ui';
2+
import { useToggle } from '@/hooks/use-toggle';
3+
import React from 'react';
4+
import { Position } from '@douyinfe/semi-ui/lib/es/tooltip';
5+
6+
interface IProps {
7+
content: React.ReactNode;
8+
hideOnClick?: boolean;
9+
position?: Position;
10+
children?: React.ReactNode;
11+
}
12+
13+
export const Tooltip: React.FC<IProps> = ({ content, hideOnClick = false, position = 'top', children }) => {
14+
const [visible, toggleVisible] = useToggle(false);
15+
16+
return (
17+
<SemiTooltip visible={visible} content={content} zIndex={10000} trigger={'custom'} position={position} >
18+
<span
19+
onMouseEnter={() => {
20+
toggleVisible(true);
21+
}}
22+
onMouseLeave={() => {
23+
toggleVisible(false);
24+
}}
25+
onMouseDown={() => {
26+
hideOnClick && toggleVisible(false);
27+
}}
28+
>
29+
{children}
30+
</span>
31+
</SemiTooltip>
32+
);
33+
};

packages/TIFFImageryProvider/README.md

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,12 @@ class TIFFImageryProvider {
101101
max: number;
102102
}>;
103103
constructor(options: TIFFImageryProviderOptions & {
104-
/** Deprecated */
104+
/**
105+
* @deprecated
106+
* Deprecated after [email protected]+, you can use fromUrl instead
107+
* @example
108+
* const provider = await TIFFImageryProvider.fromUrl(url)
109+
*/
105110
url?: string | File | Blob;
106111
});
107112

packages/TIFFImageryProvider/README_CN.md

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,12 @@ class TIFFImageryProvider {
100100
max: number;
101101
}>;
102102
constructor(options: TIFFImageryProviderOptions & {
103-
/** 已弃用 */
103+
/**
104+
* @deprecated
105+
* [email protected]+ 后弃用,你可以使用 fromUrl 替代
106+
* @example
107+
* const provider = await TIFFImageryProvider.fromUrl(url)
108+
*/
104109
url?: string | File | Blob;
105110
});
106111

packages/TIFFImageryProvider/src/TIFFImageryProvider.ts

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -189,9 +189,9 @@ export class TIFFImageryProvider {
189189
};
190190

191191
constructor(private readonly options: TIFFImageryProviderOptions & {
192-
/**
193-
* @deprecated
194-
* You can use fromUrl instead
192+
/**
193+
* @deprecated
194+
* Deprecated after [email protected]+, you can use fromUrl instead
195195
* @example
196196
* const provider = await TIFFImageryProvider.fromUrl(url)
197197
*/
@@ -393,6 +393,8 @@ export class TIFFImageryProvider {
393393

394394
static async fromUrl(url: string | File | Blob, options: TIFFImageryProviderOptions = {}) {
395395
const provider = new TIFFImageryProvider(options as any);
396+
if ((options as any).url) delete (options as any).url;
397+
396398
await provider._build(url, options)
397399

398400
return provider;
@@ -661,6 +663,7 @@ export class TIFFImageryProvider {
661663

662664
destroy() {
663665
this._images = undefined;
666+
this._source = undefined;
664667
this._imagesCache = undefined;
665668
this._generateImageworkerFarm?.destory();
666669
this.plot?.destroy();

0 commit comments

Comments
 (0)