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

feat(Canvas): provide correctly named canvas pointer methods. BREAKING: rm _normalizePointer, restorePointerVpt #9175

Merged
merged 34 commits into from
Nov 4, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
34 commits
Select commit Hold shift + click to select a range
ccf1e5a
patch(Canvas): rm `_normalizePointer`, `restorePointerVpt`
ShaMan123 Aug 25, 2023
23d3ec4
update CHANGELOG.md
github-actions[bot] Aug 25, 2023
017beb3
very weird comment
ShaMan123 Aug 25, 2023
7824e2f
fix dramatic bug
ShaMan123 Aug 25, 2023
7de49ff
update CHANGELOG.md
github-actions[bot] Aug 25, 2023
2636773
revert
ShaMan123 Aug 25, 2023
3731da4
Merge branch 'rm-vpt-methods' of https://github.com/fabricjs/fabric.j…
ShaMan123 Aug 25, 2023
d201b34
comment
ShaMan123 Aug 25, 2023
e567b27
cleanup
ShaMan123 Aug 25, 2023
ab38a5d
tests
ShaMan123 Aug 25, 2023
0b47e20
fix mouseup test
ShaMan123 Aug 25, 2023
1dfcefc
Update eventData.test.ts
ShaMan123 Aug 26, 2023
be1dfd0
fix round snapshots
ShaMan123 Aug 29, 2023
19fab4e
dep
ShaMan123 Aug 29, 2023
c5c5d38
Merge branch 'master' into rm-vpt-methods
ShaMan123 Aug 29, 2023
71d898d
fix jest.extend
ShaMan123 Aug 29, 2023
1894bc9
Merge branch 'fix-getPointer-usages' into rm-vpt-methods
ShaMan123 Aug 30, 2023
8eed9fb
Merge branch 'master' into rm-vpt-methods
asturur Aug 30, 2023
971f6dd
Update dom_misc.ts
asturur Aug 30, 2023
be66636
snapshots from master
asturur Aug 30, 2023
3405f6a
no empty changes
asturur Aug 30, 2023
d34b62c
rm `transformPointRelativeToCanvas`
ShaMan123 Sep 23, 2023
747965e
Merge branch 'master' into rm-vpt-methods
ShaMan123 Sep 23, 2023
b74e593
rename
ShaMan123 Sep 23, 2023
be60b9b
add a weird test
ShaMan123 Sep 23, 2023
8c6bdce
Merge branch 'master' into rm-vpt-methods
ShaMan123 Sep 27, 2023
b88a731
jsdoc
ShaMan123 Sep 27, 2023
d2e54be
rename
ShaMan123 Nov 3, 2023
fdb1f0e
Merge branch 'master' into rm-vpt-methods
ShaMan123 Nov 3, 2023
6e3a2b5
rename 2
ShaMan123 Nov 3, 2023
251a2de
fix - from merge conflict
ShaMan123 Nov 3, 2023
a2ab0dc
just the rename and grouping
asturur Nov 3, 2023
e33548b
this test is not great
asturur Nov 4, 2023
10d462f
Update CHANGELOG.md
asturur Nov 4, 2023
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
Merge branch 'master' into rm-vpt-methods
  • Loading branch information
ShaMan123 committed Sep 27, 2023
commit 8c6bdcea397957567ae586077e4bd2b3ed2db29a
12 changes: 12 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,18 @@
## [next]

- fix(Canvas): `getPointer` bug, rm `_normalizePointer`, `restorePointerVpt` [#9175](https://github.com/fabricjs/fabric.js/pull/9175)
- Breaking: Remove node 14 [#9383](https://github.com/fabricjs/fabric.js/pull/9383)
- chore(): Rename exports that conflicts with JS/WEB api ( Object, Text, Image ). Kept backward compatibility with deprecation notice [#9172](https://github.com/fabricjs/fabric.js/pull/9172)
- fix(Geometry): `containsPoint` [#9372](https://github.com/fabricjs/fabric.js/pull/9372)
**BREAKING**:
- `Canvas#_checkTarget(point, object, pointFromViewport)` => `Canvas#_checkTarget(object, pointFromViewport)`
- fix(Canvas): avoid firing event twice when working with nested objects [#9329](https://github.com/fabricjs/fabric.js/pull/9329)
- fix(Control): `calcCornerCoords` angle + calculation [#9377](https://github.com/fabricjs/fabric.js/pull/9377)
- patch(): dep findCrossPoints in favor of `isPointInPolygon` [#9374](https://github.com/fabricjs/fabric.js/pull/9374)
- docs() enable typedocs to run again [#9356](https://github.com/fabricjs/fabric.js/pull/9356)
- chore(): cleanup logs and error messages [#9369](https://github.com/fabricjs/fabric.js/pull/9369)
- feature(Object) BREAKING: Remove lines parameter from object.containsPoint [#9375](https://github.com/fabricjs/fabric.js/pull/9375)
- patch(Control): move hit detection to shouldActivate [#9374](https://github.com/fabricjs/fabric.js/pull/9374)
- fix(StaticCanvas): disposing animations [#9361](https://github.com/fabricjs/fabric.js/pull/9361)
- fix(IText): cursor width under group [#9341](https://github.com/fabricjs/fabric.js/pull/9341)
- TS(Canvas): constructor optional el [#9348](https://github.com/fabricjs/fabric.js/pull/9348)
Expand Down
30 changes: 12 additions & 18 deletions src/canvas/SelectableCanvas.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ import type { BaseBrush } from '../brushes/BaseBrush';
import { pick } from '../util/misc/pick';
import { sendPointToPlane } from '../util/misc/planeChange';
import { ActiveSelection } from '../shapes/ActiveSelection';
import { createCanvasElement, invertTransform } from '../util';
import { createCanvasElement } from '../util';
import { CanvasDOMManager } from './DOMManagers/CanvasDOMManager';
import { BOTTOM, CENTER, LEFT, RIGHT, TOP } from '../constants';
import type { CanvasOptions, TCanvasOptions } from './CanvasOptions';
Expand Down Expand Up @@ -754,12 +754,15 @@ export class SelectableCanvas<EventSpec extends CanvasEvents = CanvasEvents>
* @return {Boolean} true if point is contained within an area of given object
* @private
*/
_checkTarget(
pointer: Point,
obj: FabricObject,
globalPointer: Point
): boolean {
if (obj && obj.visible && obj.evented && obj.containsPoint(pointer)) {
_checkTarget(obj: FabricObject, pointer: Point): boolean {
if (
obj &&
obj.visible &&
obj.evented &&
obj.containsPoint(
sendPointToPlane(pointer, undefined, this.viewportTransform)
)
) {
if (
(this.perPixelTargetFind || obj.perPixelTargetFind) &&
!(obj as unknown as IText).isEditing
Expand Down Expand Up @@ -790,17 +793,8 @@ export class SelectableCanvas<EventSpec extends CanvasEvents = CanvasEvents>
// Do not check for currently grouped objects, since we check the parent group itself.
// until we call this function specifically to search inside the activeGroup
while (i--) {
const objToCheck = objects[i];
// this strange logic indicates a severe bug in containsPoint
const pointerToUse = objToCheck.group
? sendPointToPlane(
pointer,
invertTransform(this.viewportTransform),
objToCheck.group.calcTransformMatrix()
)
: pointer;
if (this._checkTarget(pointerToUse, objToCheck, pointer)) {
target = objects[i];
const target = objects[i];
if (this._checkTarget(target, pointer)) {
if (isCollection(target) && target.subTargetCheck) {
const subTarget = this._searchPossibleTargets(
target._objects as FabricObject[],
Expand Down
1 change: 0 additions & 1 deletion src/util/misc/planeChange.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import type { FabricObject } from '../../shapes/Object/Object';
import type { TMat2D } from '../../typedefs';
import { invertTransform, multiplyTransformMatrices } from './matrix';
import { applyTransformToObject } from './objectTransforms';
import { FabricError } from '../internals/console';

/**
* We are actually looking for the transformation from the destination plane to the source plane (change of basis matrix)\
Expand Down
You are viewing a condensed version of this merge commit. You can view the full changes here.