@cloud-app-dev/vidc 3.2.37 → 3.2.39
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.dumirc.ts +7 -11
- package/.fatherrc.ts +0 -1
- package/es/CheckGroupFixed/demo.js +2 -3
- package/es/CheckGroupFixed/index.js +4 -7
- package/es/Config/index.js +10 -9
- package/es/Config/interface.d.ts +2 -3
- package/es/CustomRenderSelect/index.js +2 -3
- package/es/DynamicList/demo.js +3 -4
- package/es/DynamicList/index.js +2 -3
- package/es/ErrorFallback/index.js +3 -6
- package/es/FrontendPlayer/index.d.ts +4 -2
- package/es/List/index.d.ts +0 -13
- package/es/List/index.js +1 -19
- package/es/LoaderScript/utils.d.ts +0 -1
- package/es/LoaderScript/utils.js +1 -36
- package/es/Map/FindPio/index.js +2 -3
- package/es/Map/LevelCenter/demo.js +2 -4
- package/es/Map/ResetTools/index.js +4 -5
- package/es/Picture/component/Tools/index.d.ts +1 -2
- package/es/Picture/component/Tools/index.js +7 -14
- package/es/Picture/demo.js +14 -28
- package/es/Picture/index.d.ts +1 -1
- package/es/Picture/index.js +91 -141
- package/es/Picture/index.less +7 -2
- package/es/Picture/utils.d.ts +6 -0
- package/es/Picture/utils.js +57 -2
- package/es/Player/api/index.js +2 -1
- package/es/Player/contraller_bar/volume.js +3 -6
- package/es/Player/demo.js +28 -58
- package/es/Player/frontend_timeline.js +1 -1
- package/es/Player/segment_timeline.js +3 -5
- package/es/Player/single_player.js +1 -1
- package/es/Player/util.d.ts +0 -1
- package/es/Player/util.js +2 -40
- package/es/PlayerExt/demo.js +12 -20
- package/es/Progress/index.js +4 -6
- package/es/RefDrawer/Footer.d.ts +9 -0
- package/es/{Drawer → RefDrawer}/Footer.js +3 -5
- package/es/{Drawer/Demo.d.ts → RefDrawer/demo.d.ts} +0 -0
- package/es/RefDrawer/demo.js +35 -0
- package/es/RefDrawer/index.d.ts +26 -0
- package/es/{Input → RefDrawer}/index.js +54 -58
- package/es/{Input → RefModal}/demo.d.ts +0 -0
- package/es/RefModal/demo.js +35 -0
- package/es/RefModal/index.d.ts +17 -0
- package/es/RefModal/index.js +71 -0
- package/es/ScreenPlayer/PlayerWithExt.js +1 -1
- package/es/ScreenPlayer/RatePick.js +8 -9
- package/es/ScreenPlayer/ScreenSelect.js +2 -3
- package/es/ScreenPlayer/SegmentTimeLine.js +3 -11
- package/es/ScreenPlayer/TimeMode.js +3 -4
- package/es/ScreenPlayer/TimeSelect.js +14 -39
- package/es/ScreenPlayer/demo.js +2 -3
- package/es/ScreenPlayer/demo2.js +8 -28
- package/es/ScreenPlayer/useTimeSlider.js +1 -1
- package/es/Service/http.js +6 -8
- package/es/TableLayout/index.d.ts +0 -3
- package/es/TableLayout/index.js +8 -10
- package/es/ThemeAntd/demo.js +21 -40
- package/es/ThemeAntd/index.js +16 -2
- package/es/ThemeAntd/index.less +0 -12
- package/es/Timeout/index.js +2 -2
- package/es/core.d.ts +0 -149
- package/es/index.d.ts +2 -6
- package/es/index.js +2 -6
- package/es/useDrawROI/index.js +4 -4
- package/es/utils.d.ts +1 -12
- package/es/utils.js +0 -56
- package/package.json +24 -24
- package/theme-config.ts +3 -1
- package/typings/global.d.ts +4 -4
- package/es/Api/index.d.ts +0 -12
- package/es/Api/index.js +0 -267
- package/es/Box/BetweenBox/index.d.ts +0 -12
- package/es/Box/BetweenBox/index.js +0 -31
- package/es/Box/BetweenBox/index.less +0 -5
- package/es/Box/InfoBox/index.d.ts +0 -12
- package/es/Box/InfoBox/index.js +0 -30
- package/es/Box/InfoBox/index.less +0 -24
- package/es/Box/TwoColumnBox/index.d.ts +0 -10
- package/es/Box/TwoColumnBox/index.js +0 -54
- package/es/Box/TwoColumnBox/index.less +0 -80
- package/es/Box/deps/content-grid.d.ts +0 -9
- package/es/Box/deps/content-grid.js +0 -9
- package/es/Box/deps/grid-factory.d.ts +0 -10
- package/es/Box/deps/grid-factory.js +0 -72
- package/es/Box/deps/simple-grid.d.ts +0 -9
- package/es/Box/deps/simple-grid.js +0 -8
- package/es/Box/index.d.ts +0 -14
- package/es/Box/index.js +0 -39
- package/es/Box/index.less +0 -10
- package/es/Drawer/Demo.js +0 -109
- package/es/Drawer/Footer.d.ts +0 -5
- package/es/Drawer/index.d.ts +0 -38
- package/es/Drawer/index.js +0 -207
- package/es/Drawer/index.less +0 -42
- package/es/Drawer/interface.d.ts +0 -22
- package/es/Input/demo.js +0 -16
- package/es/Input/index.d.ts +0 -19
- package/es/Input/index.less +0 -12
- package/es/Modal/demo.d.ts +0 -3
- package/es/Modal/demo.js +0 -106
- package/es/Modal/index.d.ts +0 -44
- package/es/Modal/index.js +0 -197
- package/es/Modal/index.less +0 -44
- package/es/Modal/interface.d.ts +0 -23
- package/es/Picture/dragBound.d.ts +0 -5
- package/es/Picture/dragBound.js +0 -77
- package/es/Service/fetch-adapter.d.ts +0 -12
- package/es/Service/fetch-adapter.js +0 -203
- package/es/ThemeAntd/style/button.less +0 -67
- package/es/ThemeAntd/style/checkbox.less +0 -72
- package/es/ThemeAntd/style/form.less +0 -12
- package/es/ThemeAntd/style/input.less +0 -83
- package/es/ThemeAntd/style/pagination.less +0 -96
- package/es/ThemeAntd/style/picker.less +0 -106
- package/es/ThemeAntd/style/popover.less +0 -5
- package/es/ThemeAntd/style/radio.less +0 -87
- package/es/ThemeAntd/style/scrollbar.less +0 -23
- package/es/ThemeAntd/style/select.less +0 -81
- package/es/ThemeAntd/style/table.less +0 -57
- package/es/ThemeAntd/style/tree.less +0 -18
- package/es/Tree/demo.d.ts +0 -3
- package/es/Tree/demo.js +0 -32
- package/es/Tree/index.d.ts +0 -24
- package/es/Tree/index.js +0 -100
- package/es/Tree/index.less +0 -60
package/es/Picture/index.js
CHANGED
|
@@ -1,21 +1,15 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
import _resizeObserver from "@cloud-app-dev/utils/es/resizeObserver";
|
|
1
|
+
import _useUpdateEffect from "ahooks/es/useUpdateEffect";
|
|
2
|
+
import _useUpdateLayoutEffect from "ahooks/es/useUpdateLayoutEffect";
|
|
4
3
|
import _useMemoizedFn from "ahooks/es/useMemoizedFn";
|
|
4
|
+
import _useSize from "ahooks/es/useSize";
|
|
5
5
|
var _excluded = ["className", "width", "height", "minHeight", "disabledDrag", "imagePath", "rects", "isOpenSelect", "disabledDrawMenu", "menus", "hasTool", "fullScreenEle"];
|
|
6
6
|
|
|
7
|
-
function _regeneratorRuntime() { "use strict"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return exports; }; var exports = {}, Op = Object.prototype, hasOwn = Op.hasOwnProperty, $Symbol = "function" == typeof Symbol ? Symbol : {}, iteratorSymbol = $Symbol.iterator || "@@iterator", asyncIteratorSymbol = $Symbol.asyncIterator || "@@asyncIterator", toStringTagSymbol = $Symbol.toStringTag || "@@toStringTag"; function define(obj, key, value) { return Object.defineProperty(obj, key, { value: value, enumerable: !0, configurable: !0, writable: !0 }), obj[key]; } try { define({}, ""); } catch (err) { define = function define(obj, key, value) { return obj[key] = value; }; } function wrap(innerFn, outerFn, self, tryLocsList) { var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator, generator = Object.create(protoGenerator.prototype), context = new Context(tryLocsList || []); return generator._invoke = function (innerFn, self, context) { var state = "suspendedStart"; return function (method, arg) { if ("executing" === state) throw new Error("Generator is already running"); if ("completed" === state) { if ("throw" === method) throw arg; return doneResult(); } for (context.method = method, context.arg = arg;;) { var delegate = context.delegate; if (delegate) { var delegateResult = maybeInvokeDelegate(delegate, context); if (delegateResult) { if (delegateResult === ContinueSentinel) continue; return delegateResult; } } if ("next" === context.method) context.sent = context._sent = context.arg;else if ("throw" === context.method) { if ("suspendedStart" === state) throw state = "completed", context.arg; context.dispatchException(context.arg); } else "return" === context.method && context.abrupt("return", context.arg); state = "executing"; var record = tryCatch(innerFn, self, context); if ("normal" === record.type) { if (state = context.done ? "completed" : "suspendedYield", record.arg === ContinueSentinel) continue; return { value: record.arg, done: context.done }; } "throw" === record.type && (state = "completed", context.method = "throw", context.arg = record.arg); } }; }(innerFn, self, context), generator; } function tryCatch(fn, obj, arg) { try { return { type: "normal", arg: fn.call(obj, arg) }; } catch (err) { return { type: "throw", arg: err }; } } exports.wrap = wrap; var ContinueSentinel = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var IteratorPrototype = {}; define(IteratorPrototype, iteratorSymbol, function () { return this; }); var getProto = Object.getPrototypeOf, NativeIteratorPrototype = getProto && getProto(getProto(values([]))); NativeIteratorPrototype && NativeIteratorPrototype !== Op && hasOwn.call(NativeIteratorPrototype, iteratorSymbol) && (IteratorPrototype = NativeIteratorPrototype); var Gp = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(IteratorPrototype); function defineIteratorMethods(prototype) { ["next", "throw", "return"].forEach(function (method) { define(prototype, method, function (arg) { return this._invoke(method, arg); }); }); } function AsyncIterator(generator, PromiseImpl) { function invoke(method, arg, resolve, reject) { var record = tryCatch(generator[method], generator, arg); if ("throw" !== record.type) { var result = record.arg, value = result.value; return value && "object" == _typeof(value) && hasOwn.call(value, "__await") ? PromiseImpl.resolve(value.__await).then(function (value) { invoke("next", value, resolve, reject); }, function (err) { invoke("throw", err, resolve, reject); }) : PromiseImpl.resolve(value).then(function (unwrapped) { result.value = unwrapped, resolve(result); }, function (error) { return invoke("throw", error, resolve, reject); }); } reject(record.arg); } var previousPromise; this._invoke = function (method, arg) { function callInvokeWithMethodAndArg() { return new PromiseImpl(function (resolve, reject) { invoke(method, arg, resolve, reject); }); } return previousPromise = previousPromise ? previousPromise.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); }; } function maybeInvokeDelegate(delegate, context) { var method = delegate.iterator[context.method]; if (undefined === method) { if (context.delegate = null, "throw" === context.method) { if (delegate.iterator.return && (context.method = "return", context.arg = undefined, maybeInvokeDelegate(delegate, context), "throw" === context.method)) return ContinueSentinel; context.method = "throw", context.arg = new TypeError("The iterator does not provide a 'throw' method"); } return ContinueSentinel; } var record = tryCatch(method, delegate.iterator, context.arg); if ("throw" === record.type) return context.method = "throw", context.arg = record.arg, context.delegate = null, ContinueSentinel; var info = record.arg; return info ? info.done ? (context[delegate.resultName] = info.value, context.next = delegate.nextLoc, "return" !== context.method && (context.method = "next", context.arg = undefined), context.delegate = null, ContinueSentinel) : info : (context.method = "throw", context.arg = new TypeError("iterator result is not an object"), context.delegate = null, ContinueSentinel); } function pushTryEntry(locs) { var entry = { tryLoc: locs[0] }; 1 in locs && (entry.catchLoc = locs[1]), 2 in locs && (entry.finallyLoc = locs[2], entry.afterLoc = locs[3]), this.tryEntries.push(entry); } function resetTryEntry(entry) { var record = entry.completion || {}; record.type = "normal", delete record.arg, entry.completion = record; } function Context(tryLocsList) { this.tryEntries = [{ tryLoc: "root" }], tryLocsList.forEach(pushTryEntry, this), this.reset(!0); } function values(iterable) { if (iterable) { var iteratorMethod = iterable[iteratorSymbol]; if (iteratorMethod) return iteratorMethod.call(iterable); if ("function" == typeof iterable.next) return iterable; if (!isNaN(iterable.length)) { var i = -1, next = function next() { for (; ++i < iterable.length;) { if (hasOwn.call(iterable, i)) return next.value = iterable[i], next.done = !1, next; } return next.value = undefined, next.done = !0, next; }; return next.next = next; } } return { next: doneResult }; } function doneResult() { return { value: undefined, done: !0 }; } return GeneratorFunction.prototype = GeneratorFunctionPrototype, define(Gp, "constructor", GeneratorFunctionPrototype), define(GeneratorFunctionPrototype, "constructor", GeneratorFunction), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, toStringTagSymbol, "GeneratorFunction"), exports.isGeneratorFunction = function (genFun) { var ctor = "function" == typeof genFun && genFun.constructor; return !!ctor && (ctor === GeneratorFunction || "GeneratorFunction" === (ctor.displayName || ctor.name)); }, exports.mark = function (genFun) { return Object.setPrototypeOf ? Object.setPrototypeOf(genFun, GeneratorFunctionPrototype) : (genFun.__proto__ = GeneratorFunctionPrototype, define(genFun, toStringTagSymbol, "GeneratorFunction")), genFun.prototype = Object.create(Gp), genFun; }, exports.awrap = function (arg) { return { __await: arg }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, asyncIteratorSymbol, function () { return this; }), exports.AsyncIterator = AsyncIterator, exports.async = function (innerFn, outerFn, self, tryLocsList, PromiseImpl) { void 0 === PromiseImpl && (PromiseImpl = Promise); var iter = new AsyncIterator(wrap(innerFn, outerFn, self, tryLocsList), PromiseImpl); return exports.isGeneratorFunction(outerFn) ? iter : iter.next().then(function (result) { return result.done ? result.value : iter.next(); }); }, defineIteratorMethods(Gp), define(Gp, toStringTagSymbol, "Generator"), define(Gp, iteratorSymbol, function () { return this; }), define(Gp, "toString", function () { return "[object Generator]"; }), exports.keys = function (object) { var keys = []; for (var key in object) { keys.push(key); } return keys.reverse(), function next() { for (; keys.length;) { var key = keys.pop(); if (key in object) return next.value = key, next.done = !1, next; } return next.done = !0, next; }; }, exports.values = values, Context.prototype = { constructor: Context, reset: function reset(skipTempReset) { if (this.prev = 0, this.next = 0, this.sent = this._sent = undefined, this.done = !1, this.delegate = null, this.method = "next", this.arg = undefined, this.tryEntries.forEach(resetTryEntry), !skipTempReset) for (var name in this) { "t" === name.charAt(0) && hasOwn.call(this, name) && !isNaN(+name.slice(1)) && (this[name] = undefined); } }, stop: function stop() { this.done = !0; var rootRecord = this.tryEntries[0].completion; if ("throw" === rootRecord.type) throw rootRecord.arg; return this.rval; }, dispatchException: function dispatchException(exception) { if (this.done) throw exception; var context = this; function handle(loc, caught) { return record.type = "throw", record.arg = exception, context.next = loc, caught && (context.method = "next", context.arg = undefined), !!caught; } for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i], record = entry.completion; if ("root" === entry.tryLoc) return handle("end"); if (entry.tryLoc <= this.prev) { var hasCatch = hasOwn.call(entry, "catchLoc"), hasFinally = hasOwn.call(entry, "finallyLoc"); if (hasCatch && hasFinally) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } else if (hasCatch) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); } else { if (!hasFinally) throw new Error("try statement without catch or finally"); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } } } }, abrupt: function abrupt(type, arg) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc <= this.prev && hasOwn.call(entry, "finallyLoc") && this.prev < entry.finallyLoc) { var finallyEntry = entry; break; } } finallyEntry && ("break" === type || "continue" === type) && finallyEntry.tryLoc <= arg && arg <= finallyEntry.finallyLoc && (finallyEntry = null); var record = finallyEntry ? finallyEntry.completion : {}; return record.type = type, record.arg = arg, finallyEntry ? (this.method = "next", this.next = finallyEntry.finallyLoc, ContinueSentinel) : this.complete(record); }, complete: function complete(record, afterLoc) { if ("throw" === record.type) throw record.arg; return "break" === record.type || "continue" === record.type ? this.next = record.arg : "return" === record.type ? (this.rval = this.arg = record.arg, this.method = "return", this.next = "end") : "normal" === record.type && afterLoc && (this.next = afterLoc), ContinueSentinel; }, finish: function finish(finallyLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.finallyLoc === finallyLoc) return this.complete(entry.completion, entry.afterLoc), resetTryEntry(entry), ContinueSentinel; } }, catch: function _catch(tryLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc === tryLoc) { var record = entry.completion; if ("throw" === record.type) { var thrown = record.arg; resetTryEntry(entry); } return thrown; } } throw new Error("illegal catch attempt"); }, delegateYield: function delegateYield(iterable, resultName, nextLoc) { return this.delegate = { iterator: values(iterable), resultName: resultName, nextLoc: nextLoc }, "next" === this.method && (this.arg = undefined), ContinueSentinel; } }, exports; }
|
|
8
|
-
|
|
9
7
|
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
10
8
|
|
|
11
9
|
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
12
10
|
|
|
13
11
|
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
14
12
|
|
|
15
|
-
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }
|
|
16
|
-
|
|
17
|
-
function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
|
|
18
|
-
|
|
19
13
|
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
20
14
|
|
|
21
15
|
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
@@ -32,18 +26,17 @@ function _objectWithoutProperties(source, excluded) { if (source == null) return
|
|
|
32
26
|
|
|
33
27
|
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
|
|
34
28
|
|
|
35
|
-
import React, {
|
|
29
|
+
import React, { useEffect, useMemo, useRef } from 'react';
|
|
36
30
|
import DomMove from "../DomMove";
|
|
37
31
|
import useSimpleState from "../useSimpleState";
|
|
38
32
|
import DefaultRects from "./component/DefaultRects";
|
|
39
33
|
import DrawRect from "./component/DrawRect";
|
|
40
34
|
import Tools from "./component/Tools";
|
|
41
35
|
import WheelScale from "./component/WheelScale";
|
|
42
|
-
import { computedBound } from "./dragBound";
|
|
43
|
-
import "./index.less";
|
|
44
36
|
import { getRectImagePath } from "./loadCaptureRectImage";
|
|
45
37
|
import useDraw from "./useDraw";
|
|
46
|
-
import { computedRectScale, customContextMenu } from "./utils";
|
|
38
|
+
import { computedRectScale, customContextMenu, getImgSize } from "./utils";
|
|
39
|
+
import "./index.less";
|
|
47
40
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
48
41
|
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
49
42
|
import { Fragment as _Fragment } from "react/jsx-runtime";
|
|
@@ -80,6 +73,7 @@ function Picture(_ref) {
|
|
|
80
73
|
scale: 1,
|
|
81
74
|
baseXOrY: 'x',
|
|
82
75
|
forceUpdateKey: Date.now(),
|
|
76
|
+
loadedTime: 0,
|
|
83
77
|
fullScreenStatus: false,
|
|
84
78
|
localUrl: '',
|
|
85
79
|
offset: [0, 0],
|
|
@@ -93,6 +87,9 @@ function Picture(_ref) {
|
|
|
93
87
|
var layoutRef = useRef(null);
|
|
94
88
|
var moveActionRef = useRef(null);
|
|
95
89
|
var domImgRef = useRef(null);
|
|
90
|
+
|
|
91
|
+
var size = _useSize(layoutRef);
|
|
92
|
+
|
|
96
93
|
useEffect(function () {
|
|
97
94
|
if (!imagePath) {
|
|
98
95
|
return undefined;
|
|
@@ -120,88 +117,46 @@ function Picture(_ref) {
|
|
|
120
117
|
isEnd = _useDraw2[1]; // init loaded
|
|
121
118
|
|
|
122
119
|
|
|
123
|
-
var loadImageSuccess = _useMemoizedFn(
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
size[1] = imgHeight;
|
|
164
|
-
}
|
|
165
|
-
} else {
|
|
166
|
-
if (naturalHeight < h) {
|
|
167
|
-
// 图片小于容器
|
|
168
|
-
size[0] = naturalWidth;
|
|
169
|
-
size[1] = naturalHeight;
|
|
170
|
-
x = Math.abs(w - naturalWidth) / 2;
|
|
171
|
-
y = (h - naturalHeight) / 2;
|
|
172
|
-
} else {
|
|
173
|
-
// 图片大于容器
|
|
174
|
-
_imagescale = h / naturalHeight;
|
|
175
|
-
imgWidth = _imagescale * naturalWidth;
|
|
176
|
-
x = Math.abs((imgWidth - w) / 2);
|
|
177
|
-
size[0] = imgWidth;
|
|
178
|
-
size[1] = h;
|
|
179
|
-
}
|
|
180
|
-
}
|
|
181
|
-
|
|
182
|
-
moveObj = moveActionRef.current;
|
|
183
|
-
moveObj.updatePosition({
|
|
184
|
-
x: x,
|
|
185
|
-
y: y
|
|
186
|
-
});
|
|
187
|
-
setState(function (old) {
|
|
188
|
-
return _objectSpread(_objectSpread({}, old), {}, {
|
|
189
|
-
x: x,
|
|
190
|
-
y: y,
|
|
191
|
-
offset: [x, y],
|
|
192
|
-
forceUpdateKey: Date.now(),
|
|
193
|
-
baseXOrY: baseXOrY,
|
|
194
|
-
size: size
|
|
195
|
-
});
|
|
196
|
-
});
|
|
197
|
-
|
|
198
|
-
case 15:
|
|
199
|
-
case "end":
|
|
200
|
-
return _context.stop();
|
|
201
|
-
}
|
|
202
|
-
}
|
|
203
|
-
}, _callee);
|
|
204
|
-
})));
|
|
120
|
+
var loadImageSuccess = _useMemoizedFn(function () {
|
|
121
|
+
if (!state.localUrl || !layoutRef.current || !domImgRef.current) {
|
|
122
|
+
return;
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
var _getImgSize = getImgSize(layoutRef.current, domImgRef.current),
|
|
126
|
+
x = _getImgSize.x,
|
|
127
|
+
y = _getImgSize.y,
|
|
128
|
+
size = _getImgSize.size,
|
|
129
|
+
baseXOrY = _getImgSize.baseXOrY;
|
|
130
|
+
|
|
131
|
+
var moveObj = moveActionRef.current;
|
|
132
|
+
moveObj.updatePosition({
|
|
133
|
+
x: x,
|
|
134
|
+
y: y
|
|
135
|
+
});
|
|
136
|
+
setState(function (old) {
|
|
137
|
+
return _objectSpread(_objectSpread({}, old), {}, {
|
|
138
|
+
x: x,
|
|
139
|
+
y: y,
|
|
140
|
+
offset: [x, y],
|
|
141
|
+
baseXOrY: baseXOrY,
|
|
142
|
+
size: size,
|
|
143
|
+
loadedTime: Date.now()
|
|
144
|
+
});
|
|
145
|
+
});
|
|
146
|
+
}); // 更新重绘
|
|
147
|
+
|
|
148
|
+
|
|
149
|
+
_useUpdateLayoutEffect(function () {
|
|
150
|
+
loadImageSuccess();
|
|
151
|
+
}, [size]); // 更新重绘
|
|
152
|
+
|
|
153
|
+
|
|
154
|
+
_useUpdateLayoutEffect(function () {
|
|
155
|
+
// Rects重新计算
|
|
156
|
+
updateState({
|
|
157
|
+
forceUpdateKey: Date.now()
|
|
158
|
+
});
|
|
159
|
+
}, [state.loadedTime]);
|
|
205
160
|
/**
|
|
206
161
|
* 设置图片缩放
|
|
207
162
|
*/
|
|
@@ -271,38 +226,49 @@ function Picture(_ref) {
|
|
|
271
226
|
*/
|
|
272
227
|
|
|
273
228
|
|
|
274
|
-
var onDragChange =
|
|
275
|
-
var x =
|
|
276
|
-
y =
|
|
229
|
+
var onDragChange = _useMemoizedFn(function (_ref2) {
|
|
230
|
+
var x = _ref2.x,
|
|
231
|
+
y = _ref2.y;
|
|
277
232
|
return setState(function (old) {
|
|
278
233
|
return _objectSpread(_objectSpread({}, old), {}, {
|
|
279
234
|
x: x,
|
|
280
235
|
y: y
|
|
281
236
|
});
|
|
282
237
|
});
|
|
283
|
-
}
|
|
238
|
+
});
|
|
284
239
|
/**
|
|
285
240
|
* 拖拽结束更新位置,计算边界
|
|
286
241
|
*/
|
|
287
242
|
|
|
288
|
-
var onDragEnd = _useMemoizedFn(function (_, currrentPosition) {
|
|
289
|
-
var scale = state.scale,
|
|
290
|
-
rotate = state.rotate;
|
|
291
243
|
|
|
292
|
-
|
|
244
|
+
var onDragEnd = _useMemoizedFn(function (_, currrentPosition) {
|
|
245
|
+
if (!layoutRef.current || !domImgRef.current) {
|
|
293
246
|
return undefined;
|
|
294
247
|
}
|
|
295
248
|
|
|
296
|
-
var
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
249
|
+
var _ref3 = size || {
|
|
250
|
+
width: 0,
|
|
251
|
+
height: 0
|
|
252
|
+
},
|
|
253
|
+
width = _ref3.width,
|
|
254
|
+
height = _ref3.height;
|
|
255
|
+
|
|
256
|
+
var imgw = domImgRef.current.width * state.scale;
|
|
257
|
+
var imgh = domImgRef.current.height * state.scale;
|
|
258
|
+
var scaleW = imgw - domImgRef.current.width;
|
|
259
|
+
var scaleH = imgh - domImgRef.current.height; // 校验x,y范围,超出回弹
|
|
260
|
+
|
|
261
|
+
var maxX = imgw < width ? width - imgw + scaleW / 2 : scaleW / 2;
|
|
262
|
+
var maxY = imgh < height ? height - imgh + scaleH / 2 : scaleH / 2;
|
|
263
|
+
var minX = imgw < width ? scaleW / 2 : -(imgw - width) / 2 + state.offset[0];
|
|
264
|
+
var minY = imgh < height ? scaleH / 2 : -(imgh - height) / 2 + state.offset[1];
|
|
265
|
+
var x = currrentPosition.x > maxX ? maxX : currrentPosition.x < minX ? minX : currrentPosition.x;
|
|
266
|
+
var y = currrentPosition.y > maxY ? maxY : currrentPosition.y < minY ? minY : currrentPosition.y;
|
|
267
|
+
var moveObj = moveActionRef.current;
|
|
268
|
+
moveObj.updatePosition({
|
|
269
|
+
x: x,
|
|
270
|
+
y: y
|
|
271
|
+
});
|
|
306
272
|
});
|
|
307
273
|
/**
|
|
308
274
|
* 获取结构化的小图(base64)
|
|
@@ -311,30 +277,8 @@ function Picture(_ref) {
|
|
|
311
277
|
|
|
312
278
|
var getRectImage = _useMemoizedFn(function (rect) {
|
|
313
279
|
return getRectImagePath(domImgRef.current, rect);
|
|
314
|
-
});
|
|
280
|
+
}); // eslint-disable-next-line react-hooks/exhaustive-deps
|
|
315
281
|
|
|
316
|
-
useEffect(function () {
|
|
317
|
-
var timer;
|
|
318
|
-
|
|
319
|
-
var fn = function fn() {
|
|
320
|
-
clearTimeout(timer);
|
|
321
|
-
timer = setTimeout(function () {
|
|
322
|
-
setState(function (old) {
|
|
323
|
-
return _objectSpread(_objectSpread({}, old), {}, {
|
|
324
|
-
forceUpdateKey: Date.now()
|
|
325
|
-
});
|
|
326
|
-
});
|
|
327
|
-
}, 200);
|
|
328
|
-
};
|
|
329
|
-
|
|
330
|
-
var dom = layoutRef.current;
|
|
331
|
-
|
|
332
|
-
_resizeObserver.createResizeObserver(dom, fn);
|
|
333
|
-
|
|
334
|
-
return function () {
|
|
335
|
-
_resizeObserver.unResizeObserver(dom, fn);
|
|
336
|
-
};
|
|
337
|
-
}, []); // eslint-disable-next-line react-hooks/exhaustive-deps
|
|
338
282
|
|
|
339
283
|
var scaleRects = useMemo(function () {
|
|
340
284
|
return computedRectScale({
|
|
@@ -352,8 +296,14 @@ function Picture(_ref) {
|
|
|
352
296
|
getRectImage: getRectImage,
|
|
353
297
|
containerEle: layoutRef.current
|
|
354
298
|
};
|
|
355
|
-
|
|
356
|
-
|
|
299
|
+
|
|
300
|
+
_useUpdateEffect(function () {
|
|
301
|
+
if (isOpenSelect) {
|
|
302
|
+
var moveObj = moveActionRef.current;
|
|
303
|
+
moveObj.updatePosition({
|
|
304
|
+
x: state.offset[0],
|
|
305
|
+
y: state.offset[1]
|
|
306
|
+
});
|
|
357
307
|
updateState({
|
|
358
308
|
scale: 1,
|
|
359
309
|
rotate: 0,
|
|
@@ -361,7 +311,8 @@ function Picture(_ref) {
|
|
|
361
311
|
y: state.offset[1]
|
|
362
312
|
});
|
|
363
313
|
}
|
|
364
|
-
}, [isOpenSelect
|
|
314
|
+
}, [isOpenSelect]);
|
|
315
|
+
|
|
365
316
|
return /*#__PURE__*/_jsxs(_Fragment, {
|
|
366
317
|
children: [/*#__PURE__*/_jsxs("div", {
|
|
367
318
|
className: "picture-view-layout ".concat(className),
|
|
@@ -413,8 +364,7 @@ function Picture(_ref) {
|
|
|
413
364
|
scale: state.scale,
|
|
414
365
|
containerEle: fullScreenEle !== null && fullScreenEle !== void 0 ? fullScreenEle : layoutRef.current,
|
|
415
366
|
resetPicture: resetPicture,
|
|
416
|
-
imgDownload: imgDownload
|
|
417
|
-
fullScreenChange: loadImageSuccess
|
|
367
|
+
imgDownload: imgDownload
|
|
418
368
|
}), /*#__PURE__*/_jsx(WheelScale, {
|
|
419
369
|
setScale: setScale,
|
|
420
370
|
dom: layoutRef.current
|
package/es/Picture/index.less
CHANGED
package/es/Picture/utils.d.ts
CHANGED
|
@@ -18,3 +18,9 @@ export declare function computedRectScale({ domImg, rects }: {
|
|
|
18
18
|
lowQuality?: boolean | undefined;
|
|
19
19
|
base64?: string | undefined;
|
|
20
20
|
}[];
|
|
21
|
+
export declare function getImgSize(dom: HTMLDivElement, img: HTMLImageElement): {
|
|
22
|
+
x: number;
|
|
23
|
+
y: number;
|
|
24
|
+
size: (string | number)[];
|
|
25
|
+
baseXOrY: string;
|
|
26
|
+
};
|
package/es/Picture/utils.js
CHANGED
|
@@ -77,8 +77,10 @@ export function computedRectScale(_ref) {
|
|
|
77
77
|
return [];
|
|
78
78
|
}
|
|
79
79
|
|
|
80
|
-
var
|
|
81
|
-
|
|
80
|
+
var _domImg$getBoundingCl = domImg.getBoundingClientRect(),
|
|
81
|
+
width = _domImg$getBoundingCl.width,
|
|
82
|
+
height = _domImg$getBoundingCl.height;
|
|
83
|
+
|
|
82
84
|
var scaleOptions = {
|
|
83
85
|
scaleX: (_ref2 = width / domImg.naturalWidth) !== null && _ref2 !== void 0 ? _ref2 : 1,
|
|
84
86
|
scaleY: (_ref3 = height / domImg.naturalHeight) !== null && _ref3 !== void 0 ? _ref3 : 1
|
|
@@ -99,4 +101,57 @@ export function computedRectScale(_ref) {
|
|
|
99
101
|
rect: rect
|
|
100
102
|
});
|
|
101
103
|
});
|
|
104
|
+
}
|
|
105
|
+
export function getImgSize(dom, img) {
|
|
106
|
+
var _layoutRect$width, _layoutRect$height;
|
|
107
|
+
|
|
108
|
+
var naturalWidth = img.naturalWidth,
|
|
109
|
+
naturalHeight = img.naturalHeight;
|
|
110
|
+
var layoutRect = dom.getBoundingClientRect();
|
|
111
|
+
var w = (_layoutRect$width = layoutRect === null || layoutRect === void 0 ? void 0 : layoutRect.width) !== null && _layoutRect$width !== void 0 ? _layoutRect$width : 0;
|
|
112
|
+
var h = (_layoutRect$height = layoutRect === null || layoutRect === void 0 ? void 0 : layoutRect.height) !== null && _layoutRect$height !== void 0 ? _layoutRect$height : 0;
|
|
113
|
+
var baseXOrY = naturalWidth > naturalHeight ? 'x' : 'y';
|
|
114
|
+
var x = 0;
|
|
115
|
+
var y = 0;
|
|
116
|
+
var size = []; // 横图
|
|
117
|
+
|
|
118
|
+
if (baseXOrY === 'x') {
|
|
119
|
+
if (naturalWidth < w) {
|
|
120
|
+
// 图片小于容器
|
|
121
|
+
size[0] = naturalWidth;
|
|
122
|
+
size[1] = naturalHeight;
|
|
123
|
+
x = (w - naturalWidth) / 2;
|
|
124
|
+
y = Math.abs((h - naturalHeight) / 2);
|
|
125
|
+
} else {
|
|
126
|
+
// 图片大于容器
|
|
127
|
+
var imagescale = w / naturalWidth;
|
|
128
|
+
var imgHeight = imagescale * naturalHeight;
|
|
129
|
+
y = Math.abs((imgHeight - h) / 2);
|
|
130
|
+
size[0] = w;
|
|
131
|
+
size[1] = imgHeight;
|
|
132
|
+
}
|
|
133
|
+
} else {
|
|
134
|
+
if (naturalHeight < h) {
|
|
135
|
+
// 图片小于容器
|
|
136
|
+
size[0] = naturalWidth;
|
|
137
|
+
size[1] = naturalHeight;
|
|
138
|
+
x = Math.abs(w - naturalWidth) / 2;
|
|
139
|
+
y = (h - naturalHeight) / 2;
|
|
140
|
+
} else {
|
|
141
|
+
// 图片大于容器
|
|
142
|
+
var _imagescale = h / naturalHeight;
|
|
143
|
+
|
|
144
|
+
var imgWidth = _imagescale * naturalWidth;
|
|
145
|
+
x = Math.abs((imgWidth - w) / 2);
|
|
146
|
+
size[0] = imgWidth;
|
|
147
|
+
size[1] = h;
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
return {
|
|
152
|
+
x: x,
|
|
153
|
+
y: y,
|
|
154
|
+
size: size,
|
|
155
|
+
baseXOrY: baseXOrY
|
|
156
|
+
};
|
|
102
157
|
}
|
package/es/Player/api/index.js
CHANGED
|
@@ -21,7 +21,8 @@ function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _d
|
|
|
21
21
|
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
22
22
|
|
|
23
23
|
import { useEffect, useState } from 'react';
|
|
24
|
-
import {
|
|
24
|
+
import { tryCatch } from "../../utils";
|
|
25
|
+
import { createFlvPlayer, createHlsPlayer } from "../util";
|
|
25
26
|
|
|
26
27
|
var Api = /*#__PURE__*/function () {
|
|
27
28
|
function Api(container) {
|
|
@@ -1,7 +1,3 @@
|
|
|
1
|
-
import "antd/lib/tooltip/style";
|
|
2
|
-
import _Tooltip from "antd/lib/tooltip";
|
|
3
|
-
import "antd/lib/slider/style";
|
|
4
|
-
import _Slider from "antd/lib/slider";
|
|
5
1
|
import _useUpdateEffect from "ahooks/es/useUpdateEffect";
|
|
6
2
|
import _useUpdate from "ahooks/es/useUpdate";
|
|
7
3
|
|
|
@@ -17,6 +13,7 @@ function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Sy
|
|
|
17
13
|
|
|
18
14
|
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
19
15
|
|
|
16
|
+
import { Slider, Tooltip } from 'antd';
|
|
20
17
|
import React, { useMemo, useState } from 'react';
|
|
21
18
|
import IconFont from "../iconfont";
|
|
22
19
|
import "../style/volume.less";
|
|
@@ -69,10 +66,10 @@ function Volume(_ref) {
|
|
|
69
66
|
return api === null || api === void 0 ? void 0 : api.setVolume(val / 100);
|
|
70
67
|
}, [val]);
|
|
71
68
|
|
|
72
|
-
return /*#__PURE__*/_jsx(
|
|
69
|
+
return /*#__PURE__*/_jsx(Tooltip, {
|
|
73
70
|
showArrow: false,
|
|
74
71
|
overlayClassName: "lm-player-volume-popup",
|
|
75
|
-
title: /*#__PURE__*/_jsx(
|
|
72
|
+
title: /*#__PURE__*/_jsx(Slider, {
|
|
76
73
|
onChange: onChange,
|
|
77
74
|
vertical: true,
|
|
78
75
|
value: val
|