wuepgg3-track 1.0.2
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/dist/CanvasPool-BD4ZA6VU.mjs +46 -0
- package/dist/SharedSystems-BNa57PRW.mjs +2521 -0
- package/dist/WebGLRenderer-DWCYIsx2.mjs +2624 -0
- package/dist/WebGPURenderer-BxRqKjyD.mjs +1613 -0
- package/dist/browserAll-CQks4WgI.mjs +2134 -0
- package/dist/colorToUniform-BcHZBaJ_.mjs +218 -0
- package/dist/components/GenomeView/GenomeRoot.d.ts +5 -0
- package/dist/components/GenomeView/ToolComponents/HighlightMenu.d.ts +20 -0
- package/dist/components/GenomeView/ToolComponents/MetadataHeader.d.ts +9 -0
- package/dist/components/GenomeView/ToolComponents/MetadataSelectionMenu.d.ts +10 -0
- package/dist/components/GenomeView/ToolComponents/Tools.d.ts +32 -0
- package/dist/components/GenomeView/TrackComponents/3dmol/ArrowList.d.ts +9 -0
- package/dist/components/GenomeView/TrackComponents/3dmol/BigwigSource.d.ts +7 -0
- package/dist/components/GenomeView/TrackComponents/3dmol/CategoryLegend.d.ts +7 -0
- package/dist/components/GenomeView/TrackComponents/3dmol/ColorPicker.d.ts +12 -0
- package/dist/components/GenomeView/TrackComponents/3dmol/FrameListMenu.d.ts +6 -0
- package/dist/components/GenomeView/TrackComponents/3dmol/HoverInfo.d.ts +20 -0
- package/dist/components/GenomeView/TrackComponents/3dmol/Legend.d.ts +6 -0
- package/dist/components/GenomeView/TrackComponents/3dmol/ModelListMenu.d.ts +7 -0
- package/dist/components/GenomeView/TrackComponents/3dmol/OpacityThickness.d.ts +4 -0
- package/dist/components/GenomeView/TrackComponents/3dmol/ResolutionList.d.ts +8 -0
- package/dist/components/GenomeView/TrackComponents/3dmol/ShapeList.d.ts +10 -0
- package/dist/components/GenomeView/TrackComponents/3dmol/StaticLegend.d.ts +6 -0
- package/dist/components/GenomeView/TrackComponents/3dmol/ThreedmolContainer.d.ts +261 -0
- package/dist/components/GenomeView/TrackComponents/3dmol/binning.d.ts +36 -0
- package/dist/components/GenomeView/TrackComponents/3dmol/helpers-3dmol.d.ts +68 -0
- package/dist/components/GenomeView/TrackComponents/BamComponents/BamAnnotation.d.ts +45 -0
- package/dist/components/GenomeView/TrackComponents/CategoricalComponents/CategoricalAnnotation.d.ts +48 -0
- package/dist/components/GenomeView/TrackComponents/CommonTrackStateChangeFunctions.tsx/cacheFetchedData.d.ts +23 -0
- package/dist/components/GenomeView/TrackComponents/CommonTrackStateChangeFunctions.tsx/getDataAfterConfigChange.d.ts +11 -0
- package/dist/components/GenomeView/TrackComponents/CommonTrackStateChangeFunctions.tsx/getTrackPixelXOffset.d.ts +3 -0
- package/dist/components/GenomeView/TrackComponents/CommonTrackStateChangeFunctions.tsx/trackGlobalState.d.ts +6 -0
- package/dist/components/GenomeView/TrackComponents/DynseqComponents/DynseqTrackComponents.d.ts +80 -0
- package/dist/components/GenomeView/TrackComponents/GenomeAlignComponents/AlignmentCoordinate.d.ts +19 -0
- package/dist/components/GenomeView/TrackComponents/GenomeAlignComponents/GenomeAlignComponents.d.ts +45 -0
- package/dist/components/GenomeView/TrackComponents/GenomeAlignComponents/HorizontalFragment.d.ts +20 -0
- package/dist/components/GenomeView/TrackComponents/GenomeAlignComponents/MultiAlignmentViewCalculator.d.ts +112 -0
- package/dist/components/GenomeView/TrackComponents/GenomeAlignComponents/Sequence.d.ts +39 -0
- package/dist/components/GenomeView/TrackComponents/GroupedTrackManager.d.ts +54 -0
- package/dist/components/GenomeView/TrackComponents/InteractionComponents/ArcDisplay.d.ts +37 -0
- package/dist/components/GenomeView/TrackComponents/InteractionComponents/CubicCurveDisplay.d.ts +22 -0
- package/dist/components/GenomeView/TrackComponents/InteractionComponents/Heatmap.d.ts +40 -0
- package/dist/components/GenomeView/TrackComponents/InteractionComponents/InteractionTrackComponent.d.ts +74 -0
- package/dist/components/GenomeView/TrackComponents/InteractionComponents/PixiArc.d.ts +60 -0
- package/dist/components/GenomeView/TrackComponents/InteractionComponents/PixiHeatmap.d.ts +78 -0
- package/dist/components/GenomeView/TrackComponents/InteractionComponents/SquareDisplay.d.ts +32 -0
- package/dist/components/GenomeView/TrackComponents/MethylcComponents/MethylCTrackComputation.d.ts +71 -0
- package/dist/components/GenomeView/TrackComponents/QBedComponents/QBedTrackComponents.d.ts +74 -0
- package/dist/components/GenomeView/TrackComponents/RulerComponents/Ruler.d.ts +17 -0
- package/dist/components/GenomeView/TrackComponents/RulerComponents/RulerComponent.d.ts +19 -0
- package/dist/components/GenomeView/TrackComponents/SnpComponents/SnpAnnotation.d.ts +17 -0
- package/dist/components/GenomeView/TrackComponents/SnpComponents/SnpDetail.d.ts +7 -0
- package/dist/components/GenomeView/TrackComponents/TrackFactory.d.ts +4 -0
- package/dist/components/GenomeView/TrackComponents/VcfComponents/Vcf.d.ts +22 -0
- package/dist/components/GenomeView/TrackComponents/VcfComponents/VcfAnnotation.d.ts +41 -0
- package/dist/components/GenomeView/TrackComponents/VcfComponents/VcfDetail.d.ts +14 -0
- package/dist/components/GenomeView/TrackComponents/VcfComponents/VcfTrack.d.ts +69 -0
- package/dist/components/GenomeView/TrackComponents/bedComponents/BedAnnotation.d.ts +33 -0
- package/dist/components/GenomeView/TrackComponents/bedComponents/Bedcolor.d.ts +13 -0
- package/dist/components/GenomeView/TrackComponents/bedComponents/BedcolorTrack.d.ts +6 -0
- package/dist/components/GenomeView/TrackComponents/bedComponents/DynamicBedTrackComponents.d.ts +28 -0
- package/dist/components/GenomeView/TrackComponents/bedComponents/FiberAnnotation.d.ts +33 -0
- package/dist/components/GenomeView/TrackComponents/bedComponents/FiberTrackComponent.d.ts +90 -0
- package/dist/components/GenomeView/TrackComponents/commonComponents/CopyToClipboard.d.ts +11 -0
- package/dist/components/GenomeView/TrackComponents/commonComponents/HoverToolTips/GenomicCoordinates.d.ts +23 -0
- package/dist/components/GenomeView/TrackComponents/commonComponents/HoverToolTips/HoverToolTip.d.ts +89 -0
- package/dist/components/GenomeView/TrackComponents/commonComponents/MetadataIndicator.d.ts +11 -0
- package/dist/components/GenomeView/TrackComponents/commonComponents/OutsideClickDetector.d.ts +8 -0
- package/dist/components/GenomeView/TrackComponents/commonComponents/Resize.d.ts +6 -0
- package/dist/components/GenomeView/TrackComponents/commonComponents/TrackLegend.d.ts +39 -0
- package/dist/components/GenomeView/TrackComponents/commonComponents/TrackMessage.d.ts +33 -0
- package/dist/components/GenomeView/TrackComponents/commonComponents/annotation/AnnotationArrows.d.ts +28 -0
- package/dist/components/GenomeView/TrackComponents/commonComponents/annotation/AnnotationTrack.d.ts +25 -0
- package/dist/components/GenomeView/TrackComponents/commonComponents/annotation/FeatureDetail.d.ts +20 -0
- package/dist/components/GenomeView/TrackComponents/commonComponents/annotation/FullDisplayMode.d.ts +45 -0
- package/dist/components/GenomeView/TrackComponents/commonComponents/annotation/JasparDetail.d.ts +12 -0
- package/dist/components/GenomeView/TrackComponents/commonComponents/annotation/PixiAnnotation.d.ts +67 -0
- package/dist/components/GenomeView/TrackComponents/commonComponents/art/DesignRenderer.d.ts +30 -0
- package/dist/components/GenomeView/TrackComponents/commonComponents/art/RulerDesigner.d.ts +102 -0
- package/dist/components/GenomeView/TrackComponents/commonComponents/check-obj-dupe.d.ts +8 -0
- package/dist/components/GenomeView/TrackComponents/commonComponents/chr-order/SortableItem.d.ts +11 -0
- package/dist/components/GenomeView/TrackComponents/commonComponents/chr-order/SortableTrack.d.ts +17 -0
- package/dist/components/GenomeView/TrackComponents/commonComponents/numerical/DynamicNumericalTrack.d.ts +37 -0
- package/dist/components/GenomeView/TrackComponents/commonComponents/numerical/DynamicplotTrackComponent.d.ts +80 -0
- package/dist/components/GenomeView/TrackComponents/commonComponents/numerical/GenomicCoordinates.d.ts +23 -0
- package/dist/components/GenomeView/TrackComponents/commonComponents/numerical/MatplotTrackComponent.d.ts +65 -0
- package/dist/components/GenomeView/TrackComponents/commonComponents/numerical/NumericalAggregator.d.ts +5 -0
- package/dist/components/GenomeView/TrackComponents/commonComponents/numerical/NumericalTrack.d.ts +39 -0
- package/dist/components/GenomeView/TrackComponents/commonComponents/numerical/PixiScene.d.ts +66 -0
- package/dist/components/GenomeView/TrackComponents/commonComponents/stats/BoxplotTrackComponents.d.ts +106 -0
- package/dist/components/GenomeView/TrackComponents/defaultOptionsMap.d.ts +3 -0
- package/dist/components/GenomeView/TrackComponents/displayModeComponentMap.d.ts +9 -0
- package/dist/components/GenomeView/TrackComponents/geneAnnotationTrackComponents/BackgroundedText.d.ts +50 -0
- package/dist/components/GenomeView/TrackComponents/geneAnnotationTrackComponents/GeneAnnotation.d.ts +33 -0
- package/dist/components/GenomeView/TrackComponents/geneAnnotationTrackComponents/GeneAnnotationScaffold.d.ts +26 -0
- package/dist/components/GenomeView/TrackComponents/geneAnnotationTrackComponents/GeneDetail.d.ts +19 -0
- package/dist/components/GenomeView/TrackComponents/geneAnnotationTrackComponents/TranslatableG.d.ts +15 -0
- package/dist/components/GenomeView/TrackComponents/imageTrackComponents/OmeroHtmlVisualizer.d.ts +41 -0
- package/dist/components/GenomeView/TrackComponents/imageTrackComponents/OmeroSvgVisualizer.d.ts +35 -0
- package/dist/components/GenomeView/TrackComponents/imageTrackComponents/OmeroTrackComponents.d.ts +33 -0
- package/dist/components/GenomeView/TrackManager.d.ts +31 -0
- package/dist/components/GenomeView/genomeNavigator/Chromosomes.d.ts +94 -0
- package/dist/components/GenomeView/genomeNavigator/DragAcrossDiv.d.ts +71 -0
- package/dist/components/GenomeView/genomeNavigator/GeneSearchBox.d.ts +15 -0
- package/dist/components/GenomeView/genomeNavigator/GeneSearchBox3D.d.ts +22 -0
- package/dist/components/GenomeView/genomeNavigator/GeneSearchBoxBase.d.ts +18 -0
- package/dist/components/GenomeView/genomeNavigator/GenomeNavigator.d.ts +87 -0
- package/dist/components/GenomeView/genomeNavigator/IsoformSelection.d.ts +11 -0
- package/dist/components/GenomeView/genomeNavigator/MainPane.d.ts +68 -0
- package/dist/components/GenomeView/genomeNavigator/Ruler.d.ts +23 -0
- package/dist/components/GenomeView/genomeNavigator/SelectableGenomeArea.d.ts +34 -0
- package/dist/components/GenomeView/genomeNavigator/SelectedRegionBox.d.ts +48 -0
- package/dist/components/GenomeView/genomeNavigator/SnpSearchBox.d.ts +14 -0
- package/dist/components/GenomeView/genomeNavigator/TrackRegionController.d.ts +19 -0
- package/dist/genome-hub/GenomeHubManager.d.ts +15 -0
- package/dist/genome-hub/GenomeSerializer.d.ts +13 -0
- package/dist/genome-hub/LocalGenomeRepository.d.ts +15 -0
- package/dist/genome-hub/genome-schema.d.ts +198 -0
- package/dist/genome-hub/index.d.ts +3 -0
- package/dist/getLocalData/BedTextSource.d.ts +22 -0
- package/dist/getLocalData/LocalBigSourceGmod.d.ts +28 -0
- package/dist/getLocalData/LongrangeAndreaTextSource.d.ts +11 -0
- package/dist/getLocalData/localFetchData.d.ts +6 -0
- package/dist/getLocalData/localTabixSource.d.ts +50 -0
- package/dist/getLocalData/localTextSource.d.ts +13 -0
- package/dist/getRemoteData/BamSource.d.ts +10 -0
- package/dist/getRemoteData/BigSourceWorker.d.ts +47 -0
- package/dist/getRemoteData/BigSourceWorkerGmod.d.ts +25 -0
- package/dist/getRemoteData/GenomeInteraction.d.ts +20 -0
- package/dist/getRemoteData/HicDataModes.d.ts +19 -0
- package/dist/getRemoteData/JasparSource.d.ts +8 -0
- package/dist/getRemoteData/RepeatSource.d.ts +8 -0
- package/dist/getRemoteData/TwoBitSource.d.ts +31 -0
- package/dist/getRemoteData/VcfSource.d.ts +10 -0
- package/dist/getRemoteData/fetchDataWorker.d.ts +61 -0
- package/dist/getRemoteData/fetchGenomeAlignWorker.d.ts +64 -0
- package/dist/getRemoteData/fetchTrackData.d.ts +4 -0
- package/dist/getRemoteData/g3dFileV2.d.ts +15 -0
- package/dist/getRemoteData/hicSource.d.ts +83 -0
- package/dist/getRemoteData/io/browserLocalFile.d.ts +6 -0
- package/dist/getRemoteData/io/remoteFile.d.ts +7 -0
- package/dist/getRemoteData/tabixSource.d.ts +46 -0
- package/dist/getRemoteData/vendor/bbi-js/main/bigwig.d.ts +1 -0
- package/dist/getRemoteData/vendor/bbi-js/utils/bin.d.ts +1 -0
- package/dist/getRemoteData/vendor/bbi-js/utils/das.d.ts +6 -0
- package/dist/getRemoteData/vendor/bbi-js/utils/jszlib.d.ts +1 -0
- package/dist/getRemoteData/vendor/bbi-js/utils/sha1.d.ts +1 -0
- package/dist/getRemoteData/vendor/bbi-js/utils/spans.d.ts +13 -0
- package/dist/index-Cs2whU2f.mjs +417589 -0
- package/dist/index.d.ts +5 -0
- package/dist/index.es.js +68 -0
- package/dist/index.umd.js +1644 -0
- package/dist/init-Afno6ASC.mjs +2871 -0
- package/dist/models/AlignmentRecord.d.ts +20 -0
- package/dist/models/AlignmentSegment.d.ts +51 -0
- package/dist/models/AlignmentStringUtils.d.ts +73 -0
- package/dist/models/AppSaveLoad.d.ts +76 -0
- package/dist/models/BamAlignment.d.ts +81 -0
- package/dist/models/BamRecord.d.ts +96 -0
- package/dist/models/BedRecord.d.ts +13 -0
- package/dist/models/BinIndexer.d.ts +28 -0
- package/dist/models/Chromosome.d.ts +24 -0
- package/dist/models/ChromosomeInterval.d.ts +107 -0
- package/dist/models/DataHubParser.d.ts +4 -0
- package/dist/models/DisplayedRegionModel.d.ts +114 -0
- package/dist/models/DownsamplingChoices.d.ts +4 -0
- package/dist/models/Feature.d.ts +156 -0
- package/dist/models/FeatureAggregator.d.ts +67 -0
- package/dist/models/FeatureArranger.d.ts +48 -0
- package/dist/models/FeatureSegment.d.ts +63 -0
- package/dist/models/FlankingStrategy.d.ts +72 -0
- package/dist/models/Gene.d.ts +56 -0
- package/dist/models/Genome.d.ts +48 -0
- package/dist/models/GraphNode.d.ts +46 -0
- package/dist/models/ImageRecord.d.ts +12 -0
- package/dist/models/Json5Fetcher.d.ts +10 -0
- package/dist/models/LinearDrawingModel.d.ts +75 -0
- package/dist/models/LogChoices.d.ts +4 -0
- package/dist/models/MethylCRecord.d.ts +41 -0
- package/dist/models/NavContextBuilder.d.ts +17 -0
- package/dist/models/NavigationContext.d.ts +168 -0
- package/dist/models/OpenInterval.d.ts +57 -0
- package/dist/models/QBed.d.ts +15 -0
- package/dist/models/RegionExpander.d.ts +51 -0
- package/dist/models/RegionSet.d.ts +85 -0
- package/dist/models/RepeatMaskerFeature.d.ts +61 -0
- package/dist/models/ScaleChoices.d.ts +4 -0
- package/dist/models/SequenceData.d.ts +6 -0
- package/dist/models/Snp.d.ts +34 -0
- package/dist/models/SortItemsOptions.d.ts +6 -0
- package/dist/models/TrackModel.d.ts +142 -0
- package/dist/models/binning.d.ts +29 -0
- package/dist/models/genomes/Creinhardtii506/Creinhardtii506.d.ts +18 -0
- package/dist/models/genomes/CytobandTypes.d.ts +17 -0
- package/dist/models/genomes/GRCg7b/GRCg7b.d.ts +17 -0
- package/dist/models/genomes/GRCg7w/GRCg7w.d.ts +17 -0
- package/dist/models/genomes/GenomeConfig.d.ts +16 -0
- package/dist/models/genomes/allGenomes.d.ts +201 -0
- package/dist/models/genomes/aplCal3/aplCal3.d.ts +18 -0
- package/dist/models/genomes/araTha1/araTha1.d.ts +18 -0
- package/dist/models/genomes/bosTau8/bosTau8.d.ts +18 -0
- package/dist/models/genomes/brapa/brara_chiifu_v3.0.d.ts +17 -0
- package/dist/models/genomes/calJac3/calJac3.d.ts +17 -0
- package/dist/models/genomes/calJac4/calJac4.d.ts +18 -0
- package/dist/models/genomes/canFam2/canFam2.d.ts +16 -0
- package/dist/models/genomes/canFam3/canFam3.d.ts +18 -0
- package/dist/models/genomes/canFam6/canFam6.d.ts +18 -0
- package/dist/models/genomes/ce11/ce11.d.ts +18 -0
- package/dist/models/genomes/danRer10/danRer10.d.ts +17 -0
- package/dist/models/genomes/danRer10/scaffolds.d.ts +3 -0
- package/dist/models/genomes/danRer11/danRer11.d.ts +35 -0
- package/dist/models/genomes/danRer7/danRer7.d.ts +18 -0
- package/dist/models/genomes/dm6/dm6.d.ts +35 -0
- package/dist/models/genomes/galGal5/galGal5.d.ts +35 -0
- package/dist/models/genomes/galGal6/galGal6.d.ts +18 -0
- package/dist/models/genomes/gorGor3/gorGor3.d.ts +17 -0
- package/dist/models/genomes/gorGor4/gorGor4.d.ts +18 -0
- package/dist/models/genomes/hg19/hg19.d.ts +65 -0
- package/dist/models/genomes/hg38/hg38.d.ts +103 -0
- package/dist/models/genomes/lepOcu1/lepOcu1.d.ts +17 -0
- package/dist/models/genomes/mm10/mm10.d.ts +94 -0
- package/dist/models/genomes/mm39/mm39.d.ts +27 -0
- package/dist/models/genomes/mm9/mm9.d.ts +18 -0
- package/dist/models/genomes/monDom5/monDom5.d.ts +18 -0
- package/dist/models/genomes/nomLeu3/nomLeu3.d.ts +17 -0
- package/dist/models/genomes/oryCun2/oryCun2.d.ts +18 -0
- package/dist/models/genomes/oviAri4/oviAri4.d.ts +18 -0
- package/dist/models/genomes/panTro4/panTro4.d.ts +17 -0
- package/dist/models/genomes/panTro5/panTro5.d.ts +18 -0
- package/dist/models/genomes/panTro6/panTro6.d.ts +18 -0
- package/dist/models/genomes/papAnu2/papAnu2.d.ts +17 -0
- package/dist/models/genomes/pfal3d7/pfal3d7.d.ts +39 -0
- package/dist/models/genomes/phaw5/phaw5.d.ts +17 -0
- package/dist/models/genomes/rheMac10/rheMac10.d.ts +18 -0
- package/dist/models/genomes/rheMac2/rheMac2.d.ts +17 -0
- package/dist/models/genomes/rheMac3/rheMac3.d.ts +17 -0
- package/dist/models/genomes/rheMac8/rheMac8.d.ts +18 -0
- package/dist/models/genomes/rn4/rn4.d.ts +18 -0
- package/dist/models/genomes/rn6/rn6.d.ts +18 -0
- package/dist/models/genomes/rn7/rn7.d.ts +18 -0
- package/dist/models/genomes/sacCer3/sacCer3.d.ts +30 -0
- package/dist/models/genomes/susScr11/susScr11.d.ts +18 -0
- package/dist/models/genomes/susScr3/susScr3.d.ts +18 -0
- package/dist/models/genomes/t2t-chm13-v1.1/chm13.d.ts +17 -0
- package/dist/models/genomes/t2t-chm13-v2.0/chm13v2.d.ts +18 -0
- package/dist/models/genomes/trypanosome/TbruceiLister427.d.ts +32 -0
- package/dist/models/genomes/trypanosome/TbruceiTREU927.d.ts +32 -0
- package/dist/models/genomes/virus/ebola.d.ts +47 -0
- package/dist/models/genomes/virus/hpv16.d.ts +28 -0
- package/dist/models/genomes/virus/mers.d.ts +54 -0
- package/dist/models/genomes/virus/nCoV2019.d.ts +382 -0
- package/dist/models/genomes/virus/sars.d.ts +53 -0
- package/dist/models/genomes/xenTro10/xenTro10.d.ts +18 -0
- package/dist/models/getXSpan/FeaturePlacer.d.ts +86 -0
- package/dist/models/index.d.ts +28 -0
- package/dist/models/layoutUtils.d.ts +39 -0
- package/dist/models/trackModels/trackProps.d.ts +40 -0
- package/dist/models/util.d.ts +102 -0
- package/dist/style.css +1 -0
- package/dist/track-container/index.d.ts +9 -0
- package/dist/trackConfigs/config-menu-components.tsx/AlwaysDrawLabelConfig.d.ts +8 -0
- package/dist/trackConfigs/config-menu-components.tsx/ArrayAggregateConfig.d.ts +6 -0
- package/dist/trackConfigs/config-menu-components.tsx/BothAnchorsInViewConfig.d.ts +8 -0
- package/dist/trackConfigs/config-menu-components.tsx/CategoryColorConfig.d.ts +15 -0
- package/dist/trackConfigs/config-menu-components.tsx/ClampHeightConfig.d.ts +8 -0
- package/dist/trackConfigs/config-menu-components.tsx/Collapsible.d.ts +7 -0
- package/dist/trackConfigs/config-menu-components.tsx/ColorConfig.d.ts +102 -0
- package/dist/trackConfigs/config-menu-components.tsx/ColorPicker.d.ts +9 -0
- package/dist/trackConfigs/config-menu-components.tsx/CombineStrandConfig.d.ts +8 -0
- package/dist/trackConfigs/config-menu-components.tsx/DisplayModeConfig.d.ts +21 -0
- package/dist/trackConfigs/config-menu-components.tsx/EnsemblStyleConfig.d.ts +8 -0
- package/dist/trackConfigs/config-menu-components.tsx/FetchViewWindowConfig.d.ts +8 -0
- package/dist/trackConfigs/config-menu-components.tsx/HeightConfig.d.ts +8 -0
- package/dist/trackConfigs/config-menu-components.tsx/HicDataConfig.d.ts +14 -0
- package/dist/trackConfigs/config-menu-components.tsx/HiddenPixelsConfig.d.ts +8 -0
- package/dist/trackConfigs/config-menu-components.tsx/HideMinimalItemsConfig.d.ts +8 -0
- package/dist/trackConfigs/config-menu-components.tsx/HorizontalLineValueConfig.d.ts +8 -0
- package/dist/trackConfigs/config-menu-components.tsx/ItalicizeTextConfig.d.ts +8 -0
- package/dist/trackConfigs/config-menu-components.tsx/LabelConfig.d.ts +7 -0
- package/dist/trackConfigs/config-menu-components.tsx/LineWidthConfig.d.ts +8 -0
- package/dist/trackConfigs/config-menu-components.tsx/LogScaleConfig.d.ts +8 -0
- package/dist/trackConfigs/config-menu-components.tsx/MarkerSizeConfig.d.ts +8 -0
- package/dist/trackConfigs/config-menu-components.tsx/MaxMethylAndDepthFilterConfig.d.ts +8 -0
- package/dist/trackConfigs/config-menu-components.tsx/MaxRowsConfig.d.ts +8 -0
- package/dist/trackConfigs/config-menu-components.tsx/MaxValueFilterConfig.d.ts +8 -0
- package/dist/trackConfigs/config-menu-components.tsx/MethylColorConfig.d.ts +16 -0
- package/dist/trackConfigs/config-menu-components.tsx/MinValueFilterConfig.d.ts +8 -0
- package/dist/trackConfigs/config-menu-components.tsx/NumberConfig.d.ts +43 -0
- package/dist/trackConfigs/config-menu-components.tsx/OmeroImageHeightConfig.d.ts +8 -0
- package/dist/trackConfigs/config-menu-components.tsx/OpacitySilderConfig.d.ts +8 -0
- package/dist/trackConfigs/config-menu-components.tsx/PixelsPaddingConfig.d.ts +8 -0
- package/dist/trackConfigs/config-menu-components.tsx/PlayingConfig.d.ts +8 -0
- package/dist/trackConfigs/config-menu-components.tsx/RowHeightConfig.d.ts +8 -0
- package/dist/trackConfigs/config-menu-components.tsx/ScalePercentileConfig.d.ts +8 -0
- package/dist/trackConfigs/config-menu-components.tsx/ScoreConfig.d.ts +8 -0
- package/dist/trackConfigs/config-menu-components.tsx/SelectConfig.d.ts +11 -0
- package/dist/trackConfigs/config-menu-components.tsx/ShowHorizontalLineConfig.d.ts +8 -0
- package/dist/trackConfigs/config-menu-components.tsx/SingleInputConfig.d.ts +14 -0
- package/dist/trackConfigs/config-menu-components.tsx/SliderConfig.d.ts +51 -0
- package/dist/trackConfigs/config-menu-components.tsx/SmoothConfig.d.ts +8 -0
- package/dist/trackConfigs/config-menu-components.tsx/SortItemsConfig.d.ts +2 -0
- package/dist/trackConfigs/config-menu-components.tsx/SpeedConfig.d.ts +8 -0
- package/dist/trackConfigs/config-menu-components.tsx/TrackConfigMenu.d.ts +2 -0
- package/dist/trackConfigs/config-menu-components.tsx/TrackContextMenu.d.ts +6 -0
- package/dist/trackConfigs/config-menu-components.tsx/UseDynamicColorsConfig.d.ts +8 -0
- package/dist/trackConfigs/config-menu-components.tsx/WindowSizeConfig.d.ts +8 -0
- package/dist/trackConfigs/config-menu-components.tsx/YscaleConfig.d.ts +8 -0
- package/dist/trackConfigs/config-menu-models.tsx/AggregateConfig.d.ts +6 -0
- package/dist/trackConfigs/config-menu-models.tsx/AnnotationTrackConfig.d.ts +16 -0
- package/dist/trackConfigs/config-menu-models.tsx/BamTrackConfig.d.ts +6 -0
- package/dist/trackConfigs/config-menu-models.tsx/BedGraphTrackConfig.d.ts +3 -0
- package/dist/trackConfigs/config-menu-models.tsx/BedTrackConfig.d.ts +10 -0
- package/dist/trackConfigs/config-menu-models.tsx/BedcolorTrackConfig.d.ts +4 -0
- package/dist/trackConfigs/config-menu-models.tsx/BigBedTrackConfig.d.ts +4 -0
- package/dist/trackConfigs/config-menu-models.tsx/BigInteractTrackConfig.d.ts +12 -0
- package/dist/trackConfigs/config-menu-models.tsx/BigWigTrackConfig.d.ts +7 -0
- package/dist/trackConfigs/config-menu-models.tsx/BoxplotTrackConfig.d.ts +8 -0
- package/dist/trackConfigs/config-menu-models.tsx/CategoricalTrackConfig.d.ts +12 -0
- package/dist/trackConfigs/config-menu-models.tsx/DisplayModes.d.ts +49 -0
- package/dist/trackConfigs/config-menu-models.tsx/DynamicBedGraphTrackConfig.d.ts +5 -0
- package/dist/trackConfigs/config-menu-models.tsx/DynamicBedTrackConfig.d.ts +5 -0
- package/dist/trackConfigs/config-menu-models.tsx/DynamicHicTrackConfig.d.ts +5 -0
- package/dist/trackConfigs/config-menu-models.tsx/DynamicLongrangeTrackConfig.d.ts +5 -0
- package/dist/trackConfigs/config-menu-models.tsx/DynamicplotTrackConfig.d.ts +4 -0
- package/dist/trackConfigs/config-menu-models.tsx/DynseqTrackConfig.d.ts +7 -0
- package/dist/trackConfigs/config-menu-models.tsx/FiberTrackConfig.d.ts +4 -0
- package/dist/trackConfigs/config-menu-models.tsx/GeneAnnotationTrackConfig.d.ts +4 -0
- package/dist/trackConfigs/config-menu-models.tsx/GenomeAlignTrackConfig.d.ts +4 -0
- package/dist/trackConfigs/config-menu-models.tsx/HicTrackConfig.d.ts +7 -0
- package/dist/trackConfigs/config-menu-models.tsx/JasparTrackConfig.d.ts +4 -0
- package/dist/trackConfigs/config-menu-models.tsx/LongRangeTrackConfig.d.ts +6 -0
- package/dist/trackConfigs/config-menu-models.tsx/MatplotTrackConfig.d.ts +4 -0
- package/dist/trackConfigs/config-menu-models.tsx/MethylCTrackConfig.d.ts +4 -0
- package/dist/trackConfigs/config-menu-models.tsx/NumericalTrackConfig.d.ts +4 -0
- package/dist/trackConfigs/config-menu-models.tsx/OmeroTrackConfig.d.ts +5 -0
- package/dist/trackConfigs/config-menu-models.tsx/OmeroidrTrackConfig.d.ts +5 -0
- package/dist/trackConfigs/config-menu-models.tsx/QBedTrackConfig.d.ts +4 -0
- package/dist/trackConfigs/config-menu-models.tsx/RefBedTrackConfig.d.ts +4 -0
- package/dist/trackConfigs/config-menu-models.tsx/RepeatMaskerTrackConfig.d.ts +4 -0
- package/dist/trackConfigs/config-menu-models.tsx/RulerTrackConfig.d.ts +4 -0
- package/dist/trackConfigs/config-menu-models.tsx/SnpTrackConfig.d.ts +4 -0
- package/dist/trackConfigs/config-menu-models.tsx/TrackConfig.d.ts +11 -0
- package/dist/trackConfigs/config-menu-models.tsx/VcfTrackConfig.d.ts +5 -0
- package/dist/trackConfigs/config-menu-models.tsx/aggregateOptions.d.ts +12 -0
- package/dist/trackConfigs/config-menu-models.tsx/getTrackConfig.d.ts +76 -0
- package/dist/types/genome-hub.d.ts +24 -0
- package/dist/types/index.d.ts +2 -0
- package/dist/types/track-container.d.ts +99 -0
- package/dist/webworkerAll-CTtTToDi.mjs +2 -0
- package/package.json +104 -0
|
@@ -0,0 +1,2134 @@
|
|
|
1
|
+
import { P as g, r as Q, E as b, T as C, U as ee, a as te, w as y, e as w, C as Z } from "./index-Cs2whU2f.mjs";
|
|
2
|
+
import "./init-Afno6ASC.mjs";
|
|
3
|
+
class M {
|
|
4
|
+
/**
|
|
5
|
+
* @param manager - The event boundary which manages this event. Propagation can only occur
|
|
6
|
+
* within the boundary's jurisdiction.
|
|
7
|
+
*/
|
|
8
|
+
constructor(e) {
|
|
9
|
+
this.bubbles = !0, this.cancelBubble = !0, this.cancelable = !1, this.composed = !1, this.defaultPrevented = !1, this.eventPhase = M.prototype.NONE, this.propagationStopped = !1, this.propagationImmediatelyStopped = !1, this.layer = new g(), this.page = new g(), this.NONE = 0, this.CAPTURING_PHASE = 1, this.AT_TARGET = 2, this.BUBBLING_PHASE = 3, this.manager = e;
|
|
10
|
+
}
|
|
11
|
+
/** @readonly */
|
|
12
|
+
get layerX() {
|
|
13
|
+
return this.layer.x;
|
|
14
|
+
}
|
|
15
|
+
/** @readonly */
|
|
16
|
+
get layerY() {
|
|
17
|
+
return this.layer.y;
|
|
18
|
+
}
|
|
19
|
+
/** @readonly */
|
|
20
|
+
get pageX() {
|
|
21
|
+
return this.page.x;
|
|
22
|
+
}
|
|
23
|
+
/** @readonly */
|
|
24
|
+
get pageY() {
|
|
25
|
+
return this.page.y;
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* Fallback for the deprecated @code{InteractionEvent.data}.
|
|
29
|
+
* @deprecated since 7.0.0
|
|
30
|
+
*/
|
|
31
|
+
get data() {
|
|
32
|
+
return this;
|
|
33
|
+
}
|
|
34
|
+
/** The propagation path for this event. Alias for {@link EventBoundary.propagationPath}. */
|
|
35
|
+
composedPath() {
|
|
36
|
+
return this.manager && (!this.path || this.path[this.path.length - 1] !== this.target) && (this.path = this.target ? this.manager.propagationPath(this.target) : []), this.path;
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* Unimplemented method included for implementing the DOM interface {@code Event}. It will throw an {@code Error}.
|
|
40
|
+
* @deprecated
|
|
41
|
+
* @param _type
|
|
42
|
+
* @param _bubbles
|
|
43
|
+
* @param _cancelable
|
|
44
|
+
*/
|
|
45
|
+
initEvent(e, t, i) {
|
|
46
|
+
throw new Error("initEvent() is a legacy DOM API. It is not implemented in the Federated Events API.");
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* Unimplemented method included for implementing the DOM interface {@code UIEvent}. It will throw an {@code Error}.
|
|
50
|
+
* @deprecated
|
|
51
|
+
* @param _typeArg
|
|
52
|
+
* @param _bubblesArg
|
|
53
|
+
* @param _cancelableArg
|
|
54
|
+
* @param _viewArg
|
|
55
|
+
* @param _detailArg
|
|
56
|
+
*/
|
|
57
|
+
initUIEvent(e, t, i, n, s) {
|
|
58
|
+
throw new Error("initUIEvent() is a legacy DOM API. It is not implemented in the Federated Events API.");
|
|
59
|
+
}
|
|
60
|
+
/** Prevent default behavior of PixiJS and the user agent. */
|
|
61
|
+
preventDefault() {
|
|
62
|
+
this.nativeEvent instanceof Event && this.nativeEvent.cancelable && this.nativeEvent.preventDefault(), this.defaultPrevented = !0;
|
|
63
|
+
}
|
|
64
|
+
/**
|
|
65
|
+
* Stop this event from propagating to any addition listeners, including on the
|
|
66
|
+
* {@link FederatedEventTarget.currentTarget currentTarget} and also the following
|
|
67
|
+
* event targets on the propagation path.
|
|
68
|
+
*/
|
|
69
|
+
stopImmediatePropagation() {
|
|
70
|
+
this.propagationImmediatelyStopped = !0;
|
|
71
|
+
}
|
|
72
|
+
/**
|
|
73
|
+
* Stop this event from propagating to the next {@link FederatedEventTarget}. The rest of the listeners
|
|
74
|
+
* on the {@link FederatedEventTarget.currentTarget currentTarget} will still be notified.
|
|
75
|
+
*/
|
|
76
|
+
stopPropagation() {
|
|
77
|
+
this.propagationStopped = !0;
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
var I = /iPhone/i, S = /iPod/i, U = /iPad/i, R = /\biOS-universal(?:.+)Mac\b/i, x = /\bAndroid(?:.+)Mobile\b/i, $ = /Android/i, E = /(?:SD4930UR|\bSilk(?:.+)Mobile\b)/i, A = /Silk/i, m = /Windows Phone/i, X = /\bWindows(?:.+)ARM\b/i, N = /BlackBerry/i, F = /BB10/i, Y = /Opera Mini/i, H = /\b(CriOS|Chrome)(?:.+)Mobile/i, K = /Mobile(?:.+)Firefox\b/i, j = function(a) {
|
|
81
|
+
return typeof a < "u" && a.platform === "MacIntel" && typeof a.maxTouchPoints == "number" && a.maxTouchPoints > 1 && typeof MSStream > "u";
|
|
82
|
+
};
|
|
83
|
+
function ie(a) {
|
|
84
|
+
return function(e) {
|
|
85
|
+
return e.test(a);
|
|
86
|
+
};
|
|
87
|
+
}
|
|
88
|
+
function G(a) {
|
|
89
|
+
var e = {
|
|
90
|
+
userAgent: "",
|
|
91
|
+
platform: "",
|
|
92
|
+
maxTouchPoints: 0
|
|
93
|
+
};
|
|
94
|
+
!a && typeof navigator < "u" ? e = {
|
|
95
|
+
userAgent: navigator.userAgent,
|
|
96
|
+
platform: navigator.platform,
|
|
97
|
+
maxTouchPoints: navigator.maxTouchPoints || 0
|
|
98
|
+
} : typeof a == "string" ? e.userAgent = a : a && a.userAgent && (e = {
|
|
99
|
+
userAgent: a.userAgent,
|
|
100
|
+
platform: a.platform,
|
|
101
|
+
maxTouchPoints: a.maxTouchPoints || 0
|
|
102
|
+
});
|
|
103
|
+
var t = e.userAgent, i = t.split("[FBAN");
|
|
104
|
+
typeof i[1] < "u" && (t = i[0]), i = t.split("Twitter"), typeof i[1] < "u" && (t = i[0]);
|
|
105
|
+
var n = ie(t), s = {
|
|
106
|
+
apple: {
|
|
107
|
+
phone: n(I) && !n(m),
|
|
108
|
+
ipod: n(S),
|
|
109
|
+
tablet: !n(I) && (n(U) || j(e)) && !n(m),
|
|
110
|
+
universal: n(R),
|
|
111
|
+
device: (n(I) || n(S) || n(U) || n(R) || j(e)) && !n(m)
|
|
112
|
+
},
|
|
113
|
+
amazon: {
|
|
114
|
+
phone: n(E),
|
|
115
|
+
tablet: !n(E) && n(A),
|
|
116
|
+
device: n(E) || n(A)
|
|
117
|
+
},
|
|
118
|
+
android: {
|
|
119
|
+
phone: !n(m) && n(E) || !n(m) && n(x),
|
|
120
|
+
tablet: !n(m) && !n(E) && !n(x) && (n(A) || n($)),
|
|
121
|
+
device: !n(m) && (n(E) || n(A) || n(x) || n($)) || n(/\bokhttp\b/i)
|
|
122
|
+
},
|
|
123
|
+
windows: {
|
|
124
|
+
phone: n(m),
|
|
125
|
+
tablet: n(X),
|
|
126
|
+
device: n(m) || n(X)
|
|
127
|
+
},
|
|
128
|
+
other: {
|
|
129
|
+
blackberry: n(N),
|
|
130
|
+
blackberry10: n(F),
|
|
131
|
+
opera: n(Y),
|
|
132
|
+
firefox: n(K),
|
|
133
|
+
chrome: n(H),
|
|
134
|
+
device: n(N) || n(F) || n(Y) || n(K) || n(H)
|
|
135
|
+
},
|
|
136
|
+
any: !1,
|
|
137
|
+
phone: !1,
|
|
138
|
+
tablet: !1
|
|
139
|
+
};
|
|
140
|
+
return s.any = s.apple.device || s.android.device || s.windows.device || s.other.device, s.phone = s.apple.phone || s.android.phone || s.windows.phone, s.tablet = s.apple.tablet || s.android.tablet || s.windows.tablet, s;
|
|
141
|
+
}
|
|
142
|
+
const ne = G.default ?? G, se = ne(globalThis.navigator), oe = 9, D = 100, re = 0, ae = 0, W = 2, z = 1, le = -1e3, he = -1e3, de = 2, B = class V {
|
|
143
|
+
// 2fps
|
|
144
|
+
// eslint-disable-next-line jsdoc/require-param
|
|
145
|
+
/**
|
|
146
|
+
* @param {WebGLRenderer|WebGPURenderer} renderer - A reference to the current renderer
|
|
147
|
+
*/
|
|
148
|
+
constructor(e, t = se) {
|
|
149
|
+
this._mobileInfo = t, this.debug = !1, this._activateOnTab = !0, this._deactivateOnMouseMove = !0, this._isActive = !1, this._isMobileAccessibility = !1, this._div = null, this._pool = [], this._renderId = 0, this._children = [], this._androidUpdateCount = 0, this._androidUpdateFrequency = 500, this._hookDiv = null, (t.tablet || t.phone) && this._createTouchHook(), this._renderer = e;
|
|
150
|
+
}
|
|
151
|
+
/**
|
|
152
|
+
* Value of `true` if accessibility is currently active and accessibility layers are showing.
|
|
153
|
+
* @member {boolean}
|
|
154
|
+
* @readonly
|
|
155
|
+
*/
|
|
156
|
+
get isActive() {
|
|
157
|
+
return this._isActive;
|
|
158
|
+
}
|
|
159
|
+
/**
|
|
160
|
+
* Value of `true` if accessibility is enabled for touch devices.
|
|
161
|
+
* @member {boolean}
|
|
162
|
+
* @readonly
|
|
163
|
+
*/
|
|
164
|
+
get isMobileAccessibility() {
|
|
165
|
+
return this._isMobileAccessibility;
|
|
166
|
+
}
|
|
167
|
+
get hookDiv() {
|
|
168
|
+
return this._hookDiv;
|
|
169
|
+
}
|
|
170
|
+
/**
|
|
171
|
+
* Creates the touch hooks.
|
|
172
|
+
* @private
|
|
173
|
+
*/
|
|
174
|
+
_createTouchHook() {
|
|
175
|
+
const e = document.createElement("button");
|
|
176
|
+
e.style.width = `${z}px`, e.style.height = `${z}px`, e.style.position = "absolute", e.style.top = `${le}px`, e.style.left = `${he}px`, e.style.zIndex = de.toString(), e.style.backgroundColor = "#FF0000", e.title = "select to enable accessibility for this content", e.addEventListener("focus", () => {
|
|
177
|
+
this._isMobileAccessibility = !0, this._activate(), this._destroyTouchHook();
|
|
178
|
+
}), document.body.appendChild(e), this._hookDiv = e;
|
|
179
|
+
}
|
|
180
|
+
/**
|
|
181
|
+
* Destroys the touch hooks.
|
|
182
|
+
* @private
|
|
183
|
+
*/
|
|
184
|
+
_destroyTouchHook() {
|
|
185
|
+
this._hookDiv && (document.body.removeChild(this._hookDiv), this._hookDiv = null);
|
|
186
|
+
}
|
|
187
|
+
/**
|
|
188
|
+
* Activating will cause the Accessibility layer to be shown.
|
|
189
|
+
* This is called when a user presses the tab key.
|
|
190
|
+
* @private
|
|
191
|
+
*/
|
|
192
|
+
_activate() {
|
|
193
|
+
if (this._isActive)
|
|
194
|
+
return;
|
|
195
|
+
this._isActive = !0, this._div || (this._div = document.createElement("div"), this._div.style.width = `${D}px`, this._div.style.height = `${D}px`, this._div.style.position = "absolute", this._div.style.top = `${re}px`, this._div.style.left = `${ae}px`, this._div.style.zIndex = W.toString(), this._div.style.pointerEvents = "none"), this._activateOnTab && (this._onKeyDown = this._onKeyDown.bind(this), globalThis.addEventListener("keydown", this._onKeyDown, !1)), this._deactivateOnMouseMove && (this._onMouseMove = this._onMouseMove.bind(this), globalThis.document.addEventListener("mousemove", this._onMouseMove, !0));
|
|
196
|
+
const e = this._renderer.view.canvas;
|
|
197
|
+
if (e.parentNode)
|
|
198
|
+
e.parentNode.appendChild(this._div), this._initAccessibilitySetup();
|
|
199
|
+
else {
|
|
200
|
+
const t = new MutationObserver(() => {
|
|
201
|
+
e.parentNode && (e.parentNode.appendChild(this._div), t.disconnect(), this._initAccessibilitySetup());
|
|
202
|
+
});
|
|
203
|
+
t.observe(document.body, { childList: !0, subtree: !0 });
|
|
204
|
+
}
|
|
205
|
+
}
|
|
206
|
+
// New method to handle initialization after div is ready
|
|
207
|
+
_initAccessibilitySetup() {
|
|
208
|
+
this._renderer.runners.postrender.add(this), this._renderer.lastObjectRendered && this._updateAccessibleObjects(this._renderer.lastObjectRendered);
|
|
209
|
+
}
|
|
210
|
+
/**
|
|
211
|
+
* Deactivates the accessibility system. Removes listeners and accessibility elements.
|
|
212
|
+
* @private
|
|
213
|
+
*/
|
|
214
|
+
_deactivate() {
|
|
215
|
+
if (!(!this._isActive || this._isMobileAccessibility)) {
|
|
216
|
+
this._isActive = !1, globalThis.document.removeEventListener("mousemove", this._onMouseMove, !0), this._activateOnTab && globalThis.addEventListener("keydown", this._onKeyDown, !1), this._renderer.runners.postrender.remove(this);
|
|
217
|
+
for (const e of this._children)
|
|
218
|
+
e._accessibleDiv && e._accessibleDiv.parentNode && (e._accessibleDiv.parentNode.removeChild(e._accessibleDiv), e._accessibleDiv = null), e._accessibleActive = !1;
|
|
219
|
+
this._pool.forEach((e) => {
|
|
220
|
+
e.parentNode && e.parentNode.removeChild(e);
|
|
221
|
+
}), this._div && this._div.parentNode && this._div.parentNode.removeChild(this._div), this._pool = [], this._children = [];
|
|
222
|
+
}
|
|
223
|
+
}
|
|
224
|
+
/**
|
|
225
|
+
* This recursive function will run through the scene graph and add any new accessible objects to the DOM layer.
|
|
226
|
+
* @private
|
|
227
|
+
* @param {Container} container - The Container to check.
|
|
228
|
+
*/
|
|
229
|
+
_updateAccessibleObjects(e) {
|
|
230
|
+
if (!e.visible || !e.accessibleChildren)
|
|
231
|
+
return;
|
|
232
|
+
e.accessible && (e._accessibleActive || this._addChild(e), e._renderId = this._renderId);
|
|
233
|
+
const t = e.children;
|
|
234
|
+
if (t)
|
|
235
|
+
for (let i = 0; i < t.length; i++)
|
|
236
|
+
this._updateAccessibleObjects(t[i]);
|
|
237
|
+
}
|
|
238
|
+
/**
|
|
239
|
+
* Runner init called, view is available at this point.
|
|
240
|
+
* @ignore
|
|
241
|
+
*/
|
|
242
|
+
init(e) {
|
|
243
|
+
const i = {
|
|
244
|
+
accessibilityOptions: {
|
|
245
|
+
...V.defaultOptions,
|
|
246
|
+
...(e == null ? void 0 : e.accessibilityOptions) || {}
|
|
247
|
+
}
|
|
248
|
+
};
|
|
249
|
+
this.debug = i.accessibilityOptions.debug, this._activateOnTab = i.accessibilityOptions.activateOnTab, this._deactivateOnMouseMove = i.accessibilityOptions.deactivateOnMouseMove, i.accessibilityOptions.enabledByDefault ? this._activate() : this._activateOnTab && (this._onKeyDown = this._onKeyDown.bind(this), globalThis.addEventListener("keydown", this._onKeyDown, !1)), this._renderer.runners.postrender.remove(this);
|
|
250
|
+
}
|
|
251
|
+
/**
|
|
252
|
+
* Updates the accessibility layer during rendering.
|
|
253
|
+
* - Removes divs for containers no longer in the scene
|
|
254
|
+
* - Updates the position and dimensions of the root div
|
|
255
|
+
* - Updates positions of active accessibility divs
|
|
256
|
+
* Only fires while the accessibility system is active.
|
|
257
|
+
* @ignore
|
|
258
|
+
*/
|
|
259
|
+
postrender() {
|
|
260
|
+
const e = performance.now();
|
|
261
|
+
if (this._mobileInfo.android.device && e < this._androidUpdateCount || (this._androidUpdateCount = e + this._androidUpdateFrequency, !this._renderer.renderingToScreen || !this._renderer.view.canvas))
|
|
262
|
+
return;
|
|
263
|
+
const t = /* @__PURE__ */ new Set();
|
|
264
|
+
if (this._renderer.lastObjectRendered) {
|
|
265
|
+
this._updateAccessibleObjects(this._renderer.lastObjectRendered);
|
|
266
|
+
for (const i of this._children)
|
|
267
|
+
i._renderId === this._renderId && t.add(this._children.indexOf(i));
|
|
268
|
+
}
|
|
269
|
+
for (let i = this._children.length - 1; i >= 0; i--) {
|
|
270
|
+
const n = this._children[i];
|
|
271
|
+
t.has(i) || (n._accessibleDiv && n._accessibleDiv.parentNode && (n._accessibleDiv.parentNode.removeChild(n._accessibleDiv), this._pool.push(n._accessibleDiv), n._accessibleDiv = null), n._accessibleActive = !1, Q(this._children, i, 1));
|
|
272
|
+
}
|
|
273
|
+
if (this._renderer.renderingToScreen) {
|
|
274
|
+
const { x: i, y: n, width: s, height: o } = this._renderer.screen, r = this._div;
|
|
275
|
+
r.style.left = `${i}px`, r.style.top = `${n}px`, r.style.width = `${s}px`, r.style.height = `${o}px`;
|
|
276
|
+
}
|
|
277
|
+
for (let i = 0; i < this._children.length; i++) {
|
|
278
|
+
const n = this._children[i];
|
|
279
|
+
if (!n._accessibleActive || !n._accessibleDiv)
|
|
280
|
+
continue;
|
|
281
|
+
const s = n._accessibleDiv, o = n.hitArea || n.getBounds().rectangle;
|
|
282
|
+
if (n.hitArea) {
|
|
283
|
+
const r = n.worldTransform, l = this._renderer.resolution, d = this._renderer.resolution;
|
|
284
|
+
s.style.left = `${(r.tx + o.x * r.a) * l}px`, s.style.top = `${(r.ty + o.y * r.d) * d}px`, s.style.width = `${o.width * r.a * l}px`, s.style.height = `${o.height * r.d * d}px`;
|
|
285
|
+
} else {
|
|
286
|
+
this._capHitArea(o);
|
|
287
|
+
const r = this._renderer.resolution, l = this._renderer.resolution;
|
|
288
|
+
s.style.left = `${o.x * r}px`, s.style.top = `${o.y * l}px`, s.style.width = `${o.width * r}px`, s.style.height = `${o.height * l}px`;
|
|
289
|
+
}
|
|
290
|
+
}
|
|
291
|
+
this._renderId++;
|
|
292
|
+
}
|
|
293
|
+
/**
|
|
294
|
+
* private function that will visually add the information to the
|
|
295
|
+
* accessibility div
|
|
296
|
+
* @param {HTMLElement} div -
|
|
297
|
+
*/
|
|
298
|
+
_updateDebugHTML(e) {
|
|
299
|
+
e.innerHTML = `type: ${e.type}</br> title : ${e.title}</br> tabIndex: ${e.tabIndex}`;
|
|
300
|
+
}
|
|
301
|
+
/**
|
|
302
|
+
* Adjust the hit area based on the bounds of a display object
|
|
303
|
+
* @param {Rectangle} hitArea - Bounds of the child
|
|
304
|
+
*/
|
|
305
|
+
_capHitArea(e) {
|
|
306
|
+
e.x < 0 && (e.width += e.x, e.x = 0), e.y < 0 && (e.height += e.y, e.y = 0);
|
|
307
|
+
const { width: t, height: i } = this._renderer;
|
|
308
|
+
e.x + e.width > t && (e.width = t - e.x), e.y + e.height > i && (e.height = i - e.y);
|
|
309
|
+
}
|
|
310
|
+
/**
|
|
311
|
+
* Creates or reuses a div element for a Container and adds it to the accessibility layer.
|
|
312
|
+
* Sets up ARIA attributes, event listeners, and positioning based on the container's properties.
|
|
313
|
+
* @private
|
|
314
|
+
* @param {Container} container - The child to make accessible.
|
|
315
|
+
*/
|
|
316
|
+
_addChild(e) {
|
|
317
|
+
let t = this._pool.pop();
|
|
318
|
+
t || (e.accessibleType === "button" ? t = document.createElement("button") : (t = document.createElement(e.accessibleType), t.style.cssText = `
|
|
319
|
+
color: transparent;
|
|
320
|
+
pointer-events: none;
|
|
321
|
+
padding: 0;
|
|
322
|
+
margin: 0;
|
|
323
|
+
border: 0;
|
|
324
|
+
outline: 0;
|
|
325
|
+
background: transparent;
|
|
326
|
+
box-sizing: border-box;
|
|
327
|
+
user-select: none;
|
|
328
|
+
-webkit-user-select: none;
|
|
329
|
+
-moz-user-select: none;
|
|
330
|
+
-ms-user-select: none;
|
|
331
|
+
`, e.accessibleText && (t.innerText = e.accessibleText)), t.style.width = `${D}px`, t.style.height = `${D}px`, t.style.backgroundColor = this.debug ? "rgba(255,255,255,0.5)" : "transparent", t.style.position = "absolute", t.style.zIndex = W.toString(), t.style.borderStyle = "none", navigator.userAgent.toLowerCase().includes("chrome") ? t.setAttribute("aria-live", "off") : t.setAttribute("aria-live", "polite"), navigator.userAgent.match(/rv:.*Gecko\//) ? t.setAttribute("aria-relevant", "additions") : t.setAttribute("aria-relevant", "text"), t.addEventListener("click", this._onClick.bind(this)), t.addEventListener("focus", this._onFocus.bind(this)), t.addEventListener("focusout", this._onFocusOut.bind(this))), t.style.pointerEvents = e.accessiblePointerEvents, t.type = e.accessibleType, e.accessibleTitle && e.accessibleTitle !== null ? t.title = e.accessibleTitle : (!e.accessibleHint || e.accessibleHint === null) && (t.title = `container ${e.tabIndex}`), e.accessibleHint && e.accessibleHint !== null && t.setAttribute("aria-label", e.accessibleHint), this.debug && this._updateDebugHTML(t), e._accessibleActive = !0, e._accessibleDiv = t, t.container = e, this._children.push(e), this._div.appendChild(e._accessibleDiv), e.interactive && (e._accessibleDiv.tabIndex = e.tabIndex);
|
|
332
|
+
}
|
|
333
|
+
/**
|
|
334
|
+
* Dispatch events with the EventSystem.
|
|
335
|
+
* @param e
|
|
336
|
+
* @param type
|
|
337
|
+
* @private
|
|
338
|
+
*/
|
|
339
|
+
_dispatchEvent(e, t) {
|
|
340
|
+
const { container: i } = e.target, n = this._renderer.events.rootBoundary, s = Object.assign(new M(n), { target: i });
|
|
341
|
+
n.rootTarget = this._renderer.lastObjectRendered, t.forEach((o) => n.dispatchEvent(s, o));
|
|
342
|
+
}
|
|
343
|
+
/**
|
|
344
|
+
* Maps the div button press to pixi's EventSystem (click)
|
|
345
|
+
* @private
|
|
346
|
+
* @param {MouseEvent} e - The click event.
|
|
347
|
+
*/
|
|
348
|
+
_onClick(e) {
|
|
349
|
+
this._dispatchEvent(e, ["click", "pointertap", "tap"]);
|
|
350
|
+
}
|
|
351
|
+
/**
|
|
352
|
+
* Maps the div focus events to pixi's EventSystem (mouseover)
|
|
353
|
+
* @private
|
|
354
|
+
* @param {FocusEvent} e - The focus event.
|
|
355
|
+
*/
|
|
356
|
+
_onFocus(e) {
|
|
357
|
+
e.target.getAttribute("aria-live") || e.target.setAttribute("aria-live", "assertive"), this._dispatchEvent(e, ["mouseover"]);
|
|
358
|
+
}
|
|
359
|
+
/**
|
|
360
|
+
* Maps the div focus events to pixi's EventSystem (mouseout)
|
|
361
|
+
* @private
|
|
362
|
+
* @param {FocusEvent} e - The focusout event.
|
|
363
|
+
*/
|
|
364
|
+
_onFocusOut(e) {
|
|
365
|
+
e.target.getAttribute("aria-live") || e.target.setAttribute("aria-live", "polite"), this._dispatchEvent(e, ["mouseout"]);
|
|
366
|
+
}
|
|
367
|
+
/**
|
|
368
|
+
* Is called when a key is pressed
|
|
369
|
+
* @private
|
|
370
|
+
* @param {KeyboardEvent} e - The keydown event.
|
|
371
|
+
*/
|
|
372
|
+
_onKeyDown(e) {
|
|
373
|
+
e.keyCode !== oe || !this._activateOnTab || this._activate();
|
|
374
|
+
}
|
|
375
|
+
/**
|
|
376
|
+
* Is called when the mouse moves across the renderer element
|
|
377
|
+
* @private
|
|
378
|
+
* @param {MouseEvent} e - The mouse event.
|
|
379
|
+
*/
|
|
380
|
+
_onMouseMove(e) {
|
|
381
|
+
e.movementX === 0 && e.movementY === 0 || this._deactivate();
|
|
382
|
+
}
|
|
383
|
+
/** Destroys the accessibility system. Removes all elements and listeners. */
|
|
384
|
+
destroy() {
|
|
385
|
+
this._deactivate(), this._destroyTouchHook(), this._div = null, this._pool = null, this._children = null, this._renderer = null, this._activateOnTab && globalThis.removeEventListener("keydown", this._onKeyDown);
|
|
386
|
+
}
|
|
387
|
+
/**
|
|
388
|
+
* Enables or disables the accessibility system.
|
|
389
|
+
* @param enabled - Whether to enable or disable accessibility.
|
|
390
|
+
*/
|
|
391
|
+
setAccessibilityEnabled(e) {
|
|
392
|
+
e ? this._activate() : this._deactivate();
|
|
393
|
+
}
|
|
394
|
+
};
|
|
395
|
+
B.extension = {
|
|
396
|
+
type: [
|
|
397
|
+
b.WebGLSystem,
|
|
398
|
+
b.WebGPUSystem
|
|
399
|
+
],
|
|
400
|
+
name: "accessibility"
|
|
401
|
+
};
|
|
402
|
+
B.defaultOptions = {
|
|
403
|
+
/**
|
|
404
|
+
* Whether to enable accessibility features on initialization
|
|
405
|
+
* @default false
|
|
406
|
+
*/
|
|
407
|
+
enabledByDefault: !1,
|
|
408
|
+
/**
|
|
409
|
+
* Whether to visually show the accessibility divs for debugging
|
|
410
|
+
* @default false
|
|
411
|
+
*/
|
|
412
|
+
debug: !1,
|
|
413
|
+
/**
|
|
414
|
+
* Whether to activate accessibility when tab key is pressed
|
|
415
|
+
* @default true
|
|
416
|
+
*/
|
|
417
|
+
activateOnTab: !0,
|
|
418
|
+
/**
|
|
419
|
+
* Whether to deactivate accessibility when mouse moves
|
|
420
|
+
* @default true
|
|
421
|
+
*/
|
|
422
|
+
deactivateOnMouseMove: !0
|
|
423
|
+
};
|
|
424
|
+
let ce = B;
|
|
425
|
+
const ue = {
|
|
426
|
+
/**
|
|
427
|
+
* Flag for if the object is accessible. If true AccessibilityManager will overlay a
|
|
428
|
+
* shadow div with attributes set
|
|
429
|
+
* @member {boolean}
|
|
430
|
+
* @memberof scene.Container#
|
|
431
|
+
*/
|
|
432
|
+
accessible: !1,
|
|
433
|
+
/**
|
|
434
|
+
* Sets the title attribute of the shadow div
|
|
435
|
+
* If accessibleTitle AND accessibleHint has not been this will default to 'container [tabIndex]'
|
|
436
|
+
* @member {string}
|
|
437
|
+
* @memberof scene.Container#
|
|
438
|
+
*/
|
|
439
|
+
accessibleTitle: null,
|
|
440
|
+
/**
|
|
441
|
+
* Sets the aria-label attribute of the shadow div
|
|
442
|
+
* @member {string}
|
|
443
|
+
* @memberof scene.Container#
|
|
444
|
+
*/
|
|
445
|
+
accessibleHint: null,
|
|
446
|
+
/**
|
|
447
|
+
* @member {number}
|
|
448
|
+
* @memberof scene.Container#
|
|
449
|
+
* @todo Needs docs.
|
|
450
|
+
*/
|
|
451
|
+
tabIndex: 0,
|
|
452
|
+
/**
|
|
453
|
+
* @member {boolean}
|
|
454
|
+
* @memberof scene.Container#
|
|
455
|
+
* @private
|
|
456
|
+
*/
|
|
457
|
+
_accessibleActive: !1,
|
|
458
|
+
/**
|
|
459
|
+
* @memberof scene.Container#
|
|
460
|
+
* @private
|
|
461
|
+
*/
|
|
462
|
+
_accessibleDiv: null,
|
|
463
|
+
/**
|
|
464
|
+
* Specify the type of div the accessible layer is. Screen readers treat the element differently
|
|
465
|
+
* depending on this type. Defaults to button.
|
|
466
|
+
* @member {string}
|
|
467
|
+
* @memberof scene.Container#
|
|
468
|
+
* @default 'button'
|
|
469
|
+
*/
|
|
470
|
+
accessibleType: "button",
|
|
471
|
+
/**
|
|
472
|
+
* Sets the text content of the shadow div
|
|
473
|
+
* @member {string}
|
|
474
|
+
* @memberof scene.Container#
|
|
475
|
+
*/
|
|
476
|
+
accessibleText: null,
|
|
477
|
+
/**
|
|
478
|
+
* Specify the pointer-events the accessible div will use
|
|
479
|
+
* Defaults to auto.
|
|
480
|
+
* @type {PointerEvents}
|
|
481
|
+
* @memberof scene.Container#
|
|
482
|
+
* @default 'auto'
|
|
483
|
+
*/
|
|
484
|
+
accessiblePointerEvents: "auto",
|
|
485
|
+
/**
|
|
486
|
+
* Setting to false will prevent any children inside this container to
|
|
487
|
+
* be accessible. Defaults to true.
|
|
488
|
+
* @member {boolean}
|
|
489
|
+
* @memberof scene.Container#
|
|
490
|
+
* @default true
|
|
491
|
+
*/
|
|
492
|
+
accessibleChildren: !0,
|
|
493
|
+
/**
|
|
494
|
+
* @member {number}
|
|
495
|
+
* @memberof scene.Container#
|
|
496
|
+
* @private
|
|
497
|
+
*/
|
|
498
|
+
_renderId: -1
|
|
499
|
+
};
|
|
500
|
+
class q {
|
|
501
|
+
/**
|
|
502
|
+
* Constructor for the DOMPipe class.
|
|
503
|
+
* @param renderer - The renderer instance that this DOMPipe will be associated with.
|
|
504
|
+
*/
|
|
505
|
+
constructor(e) {
|
|
506
|
+
this._destroyRenderableBound = this.destroyRenderable.bind(this), this._attachedDomElements = [], this._renderer = e, this._renderer.runners.postrender.add(this), this._domElement = document.createElement("div"), this._domElement.style.position = "absolute", this._domElement.style.top = "0", this._domElement.style.left = "0", this._domElement.style.pointerEvents = "none", this._domElement.style.zIndex = "1000";
|
|
507
|
+
}
|
|
508
|
+
/**
|
|
509
|
+
* Adds a renderable DOM container to the list of attached elements.
|
|
510
|
+
* @param domContainer - The DOM container to be added.
|
|
511
|
+
* @param _instructionSet - The instruction set (unused).
|
|
512
|
+
*/
|
|
513
|
+
addRenderable(e, t) {
|
|
514
|
+
this._attachedDomElements.includes(e) || (this._attachedDomElements.push(e), e.on("destroyed", this._destroyRenderableBound));
|
|
515
|
+
}
|
|
516
|
+
/**
|
|
517
|
+
* Updates a renderable DOM container.
|
|
518
|
+
* @param _domContainer - The DOM container to be updated (unused).
|
|
519
|
+
*/
|
|
520
|
+
updateRenderable(e) {
|
|
521
|
+
}
|
|
522
|
+
/**
|
|
523
|
+
* Validates a renderable DOM container.
|
|
524
|
+
* @param _domContainer - The DOM container to be validated (unused).
|
|
525
|
+
* @returns Always returns true as validation is not required.
|
|
526
|
+
*/
|
|
527
|
+
validateRenderable(e) {
|
|
528
|
+
return !0;
|
|
529
|
+
}
|
|
530
|
+
/**
|
|
531
|
+
* Destroys a renderable DOM container, removing it from the list of attached elements.
|
|
532
|
+
* @param domContainer - The DOM container to be destroyed.
|
|
533
|
+
*/
|
|
534
|
+
destroyRenderable(e) {
|
|
535
|
+
const t = this._attachedDomElements.indexOf(e);
|
|
536
|
+
t !== -1 && this._attachedDomElements.splice(t, 1), e.off("destroyed", this._destroyRenderableBound);
|
|
537
|
+
}
|
|
538
|
+
/** Handles the post-rendering process, ensuring DOM elements are correctly positioned and visible. */
|
|
539
|
+
postrender() {
|
|
540
|
+
var i;
|
|
541
|
+
const e = this._attachedDomElements;
|
|
542
|
+
if (e.length === 0) {
|
|
543
|
+
this._domElement.remove();
|
|
544
|
+
return;
|
|
545
|
+
}
|
|
546
|
+
const t = this._renderer.view.canvas;
|
|
547
|
+
this._domElement.parentNode !== t.parentNode && ((i = t.parentNode) == null || i.appendChild(this._domElement)), this._domElement.style.transform = `translate(${t.offsetLeft}px, ${t.offsetTop}px)`;
|
|
548
|
+
for (let n = 0; n < e.length; n++) {
|
|
549
|
+
const s = e[n], o = s.element;
|
|
550
|
+
if (!s.parent || s.globalDisplayStatus < 7)
|
|
551
|
+
o.remove(), e.splice(n, 1), n--;
|
|
552
|
+
else {
|
|
553
|
+
this._domElement.contains(o) || (o.style.position = "absolute", o.style.pointerEvents = "auto", this._domElement.appendChild(o));
|
|
554
|
+
const r = s.worldTransform, l = s._anchor, d = s.width * l.x, p = s.height * l.y;
|
|
555
|
+
o.style.transformOrigin = `${d}px ${p}px`, o.style.transform = `matrix(${r.a}, ${r.b}, ${r.c}, ${r.d}, ${r.tx - d}, ${r.ty - p})`, o.style.opacity = s.groupAlpha.toString();
|
|
556
|
+
}
|
|
557
|
+
}
|
|
558
|
+
}
|
|
559
|
+
/** Destroys the DOMPipe, removing all attached DOM elements and cleaning up resources. */
|
|
560
|
+
destroy() {
|
|
561
|
+
this._renderer.runners.postrender.remove(this);
|
|
562
|
+
for (let e = 0; e < this._attachedDomElements.length; e++) {
|
|
563
|
+
const t = this._attachedDomElements[e];
|
|
564
|
+
t.off("destroyed", this._destroyRenderableBound), t.element.remove();
|
|
565
|
+
}
|
|
566
|
+
this._attachedDomElements.length = 0, this._domElement.remove(), this._renderer = null;
|
|
567
|
+
}
|
|
568
|
+
}
|
|
569
|
+
q.extension = {
|
|
570
|
+
type: [
|
|
571
|
+
b.WebGLPipes,
|
|
572
|
+
b.WebGPUPipes,
|
|
573
|
+
b.CanvasPipes
|
|
574
|
+
],
|
|
575
|
+
name: "dom"
|
|
576
|
+
};
|
|
577
|
+
class pe {
|
|
578
|
+
constructor() {
|
|
579
|
+
this.interactionFrequency = 10, this._deltaTime = 0, this._didMove = !1, this._tickerAdded = !1, this._pauseUpdate = !0;
|
|
580
|
+
}
|
|
581
|
+
/**
|
|
582
|
+
* Initializes the event ticker.
|
|
583
|
+
* @param events - The event system.
|
|
584
|
+
*/
|
|
585
|
+
init(e) {
|
|
586
|
+
this.removeTickerListener(), this.events = e, this.interactionFrequency = 10, this._deltaTime = 0, this._didMove = !1, this._tickerAdded = !1, this._pauseUpdate = !0;
|
|
587
|
+
}
|
|
588
|
+
/** Whether to pause the update checks or not. */
|
|
589
|
+
get pauseUpdate() {
|
|
590
|
+
return this._pauseUpdate;
|
|
591
|
+
}
|
|
592
|
+
set pauseUpdate(e) {
|
|
593
|
+
this._pauseUpdate = e;
|
|
594
|
+
}
|
|
595
|
+
/** Adds the ticker listener. */
|
|
596
|
+
addTickerListener() {
|
|
597
|
+
this._tickerAdded || !this.domElement || (C.system.add(this._tickerUpdate, this, ee.INTERACTION), this._tickerAdded = !0);
|
|
598
|
+
}
|
|
599
|
+
/** Removes the ticker listener. */
|
|
600
|
+
removeTickerListener() {
|
|
601
|
+
this._tickerAdded && (C.system.remove(this._tickerUpdate, this), this._tickerAdded = !1);
|
|
602
|
+
}
|
|
603
|
+
/** Sets flag to not fire extra events when the user has already moved there mouse */
|
|
604
|
+
pointerMoved() {
|
|
605
|
+
this._didMove = !0;
|
|
606
|
+
}
|
|
607
|
+
/** Updates the state of interactive objects. */
|
|
608
|
+
_update() {
|
|
609
|
+
if (!this.domElement || this._pauseUpdate)
|
|
610
|
+
return;
|
|
611
|
+
if (this._didMove) {
|
|
612
|
+
this._didMove = !1;
|
|
613
|
+
return;
|
|
614
|
+
}
|
|
615
|
+
const e = this.events._rootPointerEvent;
|
|
616
|
+
this.events.supportsTouchEvents && e.pointerType === "touch" || globalThis.document.dispatchEvent(new PointerEvent("pointermove", {
|
|
617
|
+
clientX: e.clientX,
|
|
618
|
+
clientY: e.clientY,
|
|
619
|
+
pointerType: e.pointerType,
|
|
620
|
+
pointerId: e.pointerId
|
|
621
|
+
}));
|
|
622
|
+
}
|
|
623
|
+
/**
|
|
624
|
+
* Updates the state of interactive objects if at least {@link interactionFrequency}
|
|
625
|
+
* milliseconds have passed since the last invocation.
|
|
626
|
+
*
|
|
627
|
+
* Invoked by a throttled ticker update from {@link Ticker.system}.
|
|
628
|
+
* @param ticker - The throttled ticker.
|
|
629
|
+
*/
|
|
630
|
+
_tickerUpdate(e) {
|
|
631
|
+
this._deltaTime += e.deltaTime, !(this._deltaTime < this.interactionFrequency) && (this._deltaTime = 0, this._update());
|
|
632
|
+
}
|
|
633
|
+
}
|
|
634
|
+
const _ = new pe();
|
|
635
|
+
class O extends M {
|
|
636
|
+
constructor() {
|
|
637
|
+
super(...arguments), this.client = new g(), this.movement = new g(), this.offset = new g(), this.global = new g(), this.screen = new g();
|
|
638
|
+
}
|
|
639
|
+
/** @readonly */
|
|
640
|
+
get clientX() {
|
|
641
|
+
return this.client.x;
|
|
642
|
+
}
|
|
643
|
+
/** @readonly */
|
|
644
|
+
get clientY() {
|
|
645
|
+
return this.client.y;
|
|
646
|
+
}
|
|
647
|
+
/**
|
|
648
|
+
* Alias for {@link FederatedMouseEvent.clientX this.clientX}.
|
|
649
|
+
* @readonly
|
|
650
|
+
*/
|
|
651
|
+
get x() {
|
|
652
|
+
return this.clientX;
|
|
653
|
+
}
|
|
654
|
+
/**
|
|
655
|
+
* Alias for {@link FederatedMouseEvent.clientY this.clientY}.
|
|
656
|
+
* @readonly
|
|
657
|
+
*/
|
|
658
|
+
get y() {
|
|
659
|
+
return this.clientY;
|
|
660
|
+
}
|
|
661
|
+
/** @readonly */
|
|
662
|
+
get movementX() {
|
|
663
|
+
return this.movement.x;
|
|
664
|
+
}
|
|
665
|
+
/** @readonly */
|
|
666
|
+
get movementY() {
|
|
667
|
+
return this.movement.y;
|
|
668
|
+
}
|
|
669
|
+
/** @readonly */
|
|
670
|
+
get offsetX() {
|
|
671
|
+
return this.offset.x;
|
|
672
|
+
}
|
|
673
|
+
/** @readonly */
|
|
674
|
+
get offsetY() {
|
|
675
|
+
return this.offset.y;
|
|
676
|
+
}
|
|
677
|
+
/** @readonly */
|
|
678
|
+
get globalX() {
|
|
679
|
+
return this.global.x;
|
|
680
|
+
}
|
|
681
|
+
/** @readonly */
|
|
682
|
+
get globalY() {
|
|
683
|
+
return this.global.y;
|
|
684
|
+
}
|
|
685
|
+
/**
|
|
686
|
+
* The pointer coordinates in the renderer's screen. Alias for {@code screen.x}.
|
|
687
|
+
* @readonly
|
|
688
|
+
*/
|
|
689
|
+
get screenX() {
|
|
690
|
+
return this.screen.x;
|
|
691
|
+
}
|
|
692
|
+
/**
|
|
693
|
+
* The pointer coordinates in the renderer's screen. Alias for {@code screen.y}.
|
|
694
|
+
* @readonly
|
|
695
|
+
*/
|
|
696
|
+
get screenY() {
|
|
697
|
+
return this.screen.y;
|
|
698
|
+
}
|
|
699
|
+
/**
|
|
700
|
+
* This will return the local coordinates of the specified container for this InteractionData
|
|
701
|
+
* @param {Container} container - The Container that you would like the local
|
|
702
|
+
* coords off
|
|
703
|
+
* @param {PointData} point - A Point object in which to store the value, optional (otherwise
|
|
704
|
+
* will create a new point)
|
|
705
|
+
* @param {PointData} globalPos - A Point object containing your custom global coords, optional
|
|
706
|
+
* (otherwise will use the current global coords)
|
|
707
|
+
* @returns - A point containing the coordinates of the InteractionData position relative
|
|
708
|
+
* to the Container
|
|
709
|
+
*/
|
|
710
|
+
getLocalPosition(e, t, i) {
|
|
711
|
+
return e.worldTransform.applyInverse(i || this.global, t);
|
|
712
|
+
}
|
|
713
|
+
/**
|
|
714
|
+
* Whether the modifier key was pressed when this event natively occurred.
|
|
715
|
+
* @param key - The modifier key.
|
|
716
|
+
*/
|
|
717
|
+
getModifierState(e) {
|
|
718
|
+
return "getModifierState" in this.nativeEvent && this.nativeEvent.getModifierState(e);
|
|
719
|
+
}
|
|
720
|
+
/**
|
|
721
|
+
* Not supported.
|
|
722
|
+
* @param _typeArg
|
|
723
|
+
* @param _canBubbleArg
|
|
724
|
+
* @param _cancelableArg
|
|
725
|
+
* @param _viewArg
|
|
726
|
+
* @param _detailArg
|
|
727
|
+
* @param _screenXArg
|
|
728
|
+
* @param _screenYArg
|
|
729
|
+
* @param _clientXArg
|
|
730
|
+
* @param _clientYArg
|
|
731
|
+
* @param _ctrlKeyArg
|
|
732
|
+
* @param _altKeyArg
|
|
733
|
+
* @param _shiftKeyArg
|
|
734
|
+
* @param _metaKeyArg
|
|
735
|
+
* @param _buttonArg
|
|
736
|
+
* @param _relatedTargetArg
|
|
737
|
+
* @deprecated since 7.0.0
|
|
738
|
+
*/
|
|
739
|
+
// eslint-disable-next-line max-params
|
|
740
|
+
initMouseEvent(e, t, i, n, s, o, r, l, d, p, u, h, v, c, be) {
|
|
741
|
+
throw new Error("Method not implemented.");
|
|
742
|
+
}
|
|
743
|
+
}
|
|
744
|
+
class f extends O {
|
|
745
|
+
constructor() {
|
|
746
|
+
super(...arguments), this.width = 0, this.height = 0, this.isPrimary = !1;
|
|
747
|
+
}
|
|
748
|
+
// Only included for completeness for now
|
|
749
|
+
getCoalescedEvents() {
|
|
750
|
+
return this.type === "pointermove" || this.type === "mousemove" || this.type === "touchmove" ? [this] : [];
|
|
751
|
+
}
|
|
752
|
+
// Only included for completeness for now
|
|
753
|
+
getPredictedEvents() {
|
|
754
|
+
throw new Error("getPredictedEvents is not supported!");
|
|
755
|
+
}
|
|
756
|
+
}
|
|
757
|
+
class T extends O {
|
|
758
|
+
constructor() {
|
|
759
|
+
super(...arguments), this.DOM_DELTA_PIXEL = 0, this.DOM_DELTA_LINE = 1, this.DOM_DELTA_PAGE = 2;
|
|
760
|
+
}
|
|
761
|
+
}
|
|
762
|
+
T.DOM_DELTA_PIXEL = 0;
|
|
763
|
+
T.DOM_DELTA_LINE = 1;
|
|
764
|
+
T.DOM_DELTA_PAGE = 2;
|
|
765
|
+
const ve = 2048, fe = new g(), P = new g();
|
|
766
|
+
class me {
|
|
767
|
+
/**
|
|
768
|
+
* @param rootTarget - The holder of the event boundary.
|
|
769
|
+
*/
|
|
770
|
+
constructor(e) {
|
|
771
|
+
this.dispatch = new te(), this.moveOnAll = !1, this.enableGlobalMoveEvents = !0, this.mappingState = {
|
|
772
|
+
trackingData: {}
|
|
773
|
+
}, this.eventPool = /* @__PURE__ */ new Map(), this._allInteractiveElements = [], this._hitElements = [], this._isPointerMoveEvent = !1, this.rootTarget = e, this.hitPruneFn = this.hitPruneFn.bind(this), this.hitTestFn = this.hitTestFn.bind(this), this.mapPointerDown = this.mapPointerDown.bind(this), this.mapPointerMove = this.mapPointerMove.bind(this), this.mapPointerOut = this.mapPointerOut.bind(this), this.mapPointerOver = this.mapPointerOver.bind(this), this.mapPointerUp = this.mapPointerUp.bind(this), this.mapPointerUpOutside = this.mapPointerUpOutside.bind(this), this.mapWheel = this.mapWheel.bind(this), this.mappingTable = {}, this.addEventMapping("pointerdown", this.mapPointerDown), this.addEventMapping("pointermove", this.mapPointerMove), this.addEventMapping("pointerout", this.mapPointerOut), this.addEventMapping("pointerleave", this.mapPointerOut), this.addEventMapping("pointerover", this.mapPointerOver), this.addEventMapping("pointerup", this.mapPointerUp), this.addEventMapping("pointerupoutside", this.mapPointerUpOutside), this.addEventMapping("wheel", this.mapWheel);
|
|
774
|
+
}
|
|
775
|
+
/**
|
|
776
|
+
* Adds an event mapping for the event `type` handled by `fn`.
|
|
777
|
+
*
|
|
778
|
+
* Event mappings can be used to implement additional or custom events. They take an event
|
|
779
|
+
* coming from the upstream scene (or directly from the {@link EventSystem}) and dispatch new downstream events
|
|
780
|
+
* generally trickling down and bubbling up to {@link EventBoundary.rootTarget this.rootTarget}.
|
|
781
|
+
*
|
|
782
|
+
* To modify the semantics of existing events, the built-in mapping methods of EventBoundary should be overridden
|
|
783
|
+
* instead.
|
|
784
|
+
* @param type - The type of upstream event to map.
|
|
785
|
+
* @param fn - The mapping method. The context of this function must be bound manually, if desired.
|
|
786
|
+
*/
|
|
787
|
+
addEventMapping(e, t) {
|
|
788
|
+
this.mappingTable[e] || (this.mappingTable[e] = []), this.mappingTable[e].push({
|
|
789
|
+
fn: t,
|
|
790
|
+
priority: 0
|
|
791
|
+
}), this.mappingTable[e].sort((i, n) => i.priority - n.priority);
|
|
792
|
+
}
|
|
793
|
+
/**
|
|
794
|
+
* Dispatches the given event
|
|
795
|
+
* @param e - The event to dispatch.
|
|
796
|
+
* @param type - The type of event to dispatch. Defaults to `e.type`.
|
|
797
|
+
*/
|
|
798
|
+
dispatchEvent(e, t) {
|
|
799
|
+
e.propagationStopped = !1, e.propagationImmediatelyStopped = !1, this.propagate(e, t), this.dispatch.emit(t || e.type, e);
|
|
800
|
+
}
|
|
801
|
+
/**
|
|
802
|
+
* Maps the given upstream event through the event boundary and propagates it downstream.
|
|
803
|
+
* @param e - The event to map.
|
|
804
|
+
*/
|
|
805
|
+
mapEvent(e) {
|
|
806
|
+
if (!this.rootTarget)
|
|
807
|
+
return;
|
|
808
|
+
const t = this.mappingTable[e.type];
|
|
809
|
+
if (t)
|
|
810
|
+
for (let i = 0, n = t.length; i < n; i++)
|
|
811
|
+
t[i].fn(e);
|
|
812
|
+
else
|
|
813
|
+
y(`[EventBoundary]: Event mapping not defined for ${e.type}`);
|
|
814
|
+
}
|
|
815
|
+
/**
|
|
816
|
+
* Finds the Container that is the target of a event at the given coordinates.
|
|
817
|
+
*
|
|
818
|
+
* The passed (x,y) coordinates are in the world space above this event boundary.
|
|
819
|
+
* @param x - The x coordinate of the event.
|
|
820
|
+
* @param y - The y coordinate of the event.
|
|
821
|
+
*/
|
|
822
|
+
hitTest(e, t) {
|
|
823
|
+
_.pauseUpdate = !0;
|
|
824
|
+
const n = this._isPointerMoveEvent && this.enableGlobalMoveEvents ? "hitTestMoveRecursive" : "hitTestRecursive", s = this[n](
|
|
825
|
+
this.rootTarget,
|
|
826
|
+
this.rootTarget.eventMode,
|
|
827
|
+
fe.set(e, t),
|
|
828
|
+
this.hitTestFn,
|
|
829
|
+
this.hitPruneFn
|
|
830
|
+
);
|
|
831
|
+
return s && s[0];
|
|
832
|
+
}
|
|
833
|
+
/**
|
|
834
|
+
* Propagate the passed event from from {@link EventBoundary.rootTarget this.rootTarget} to its
|
|
835
|
+
* target {@code e.target}.
|
|
836
|
+
* @param e - The event to propagate.
|
|
837
|
+
* @param type - The type of event to propagate. Defaults to `e.type`.
|
|
838
|
+
*/
|
|
839
|
+
propagate(e, t) {
|
|
840
|
+
if (!e.target)
|
|
841
|
+
return;
|
|
842
|
+
const i = e.composedPath();
|
|
843
|
+
e.eventPhase = e.CAPTURING_PHASE;
|
|
844
|
+
for (let n = 0, s = i.length - 1; n < s; n++)
|
|
845
|
+
if (e.currentTarget = i[n], this.notifyTarget(e, t), e.propagationStopped || e.propagationImmediatelyStopped)
|
|
846
|
+
return;
|
|
847
|
+
if (e.eventPhase = e.AT_TARGET, e.currentTarget = e.target, this.notifyTarget(e, t), !(e.propagationStopped || e.propagationImmediatelyStopped)) {
|
|
848
|
+
e.eventPhase = e.BUBBLING_PHASE;
|
|
849
|
+
for (let n = i.length - 2; n >= 0; n--)
|
|
850
|
+
if (e.currentTarget = i[n], this.notifyTarget(e, t), e.propagationStopped || e.propagationImmediatelyStopped)
|
|
851
|
+
return;
|
|
852
|
+
}
|
|
853
|
+
}
|
|
854
|
+
/**
|
|
855
|
+
* Emits the event {@code e} to all interactive containers. The event is propagated in the bubbling phase always.
|
|
856
|
+
*
|
|
857
|
+
* This is used in the `globalpointermove` event.
|
|
858
|
+
* @param e - The emitted event.
|
|
859
|
+
* @param type - The listeners to notify.
|
|
860
|
+
* @param targets - The targets to notify.
|
|
861
|
+
*/
|
|
862
|
+
all(e, t, i = this._allInteractiveElements) {
|
|
863
|
+
if (i.length === 0)
|
|
864
|
+
return;
|
|
865
|
+
e.eventPhase = e.BUBBLING_PHASE;
|
|
866
|
+
const n = Array.isArray(t) ? t : [t];
|
|
867
|
+
for (let s = i.length - 1; s >= 0; s--)
|
|
868
|
+
n.forEach((o) => {
|
|
869
|
+
e.currentTarget = i[s], this.notifyTarget(e, o);
|
|
870
|
+
});
|
|
871
|
+
}
|
|
872
|
+
/**
|
|
873
|
+
* Finds the propagation path from {@link EventBoundary.rootTarget rootTarget} to the passed
|
|
874
|
+
* {@code target}. The last element in the path is {@code target}.
|
|
875
|
+
* @param target - The target to find the propagation path to.
|
|
876
|
+
*/
|
|
877
|
+
propagationPath(e) {
|
|
878
|
+
const t = [e];
|
|
879
|
+
for (let i = 0; i < ve && e !== this.rootTarget && e.parent; i++) {
|
|
880
|
+
if (!e.parent)
|
|
881
|
+
throw new Error("Cannot find propagation path to disconnected target");
|
|
882
|
+
t.push(e.parent), e = e.parent;
|
|
883
|
+
}
|
|
884
|
+
return t.reverse(), t;
|
|
885
|
+
}
|
|
886
|
+
hitTestMoveRecursive(e, t, i, n, s, o = !1) {
|
|
887
|
+
let r = !1;
|
|
888
|
+
if (this._interactivePrune(e))
|
|
889
|
+
return null;
|
|
890
|
+
if ((e.eventMode === "dynamic" || t === "dynamic") && (_.pauseUpdate = !1), e.interactiveChildren && e.children) {
|
|
891
|
+
const p = e.children;
|
|
892
|
+
for (let u = p.length - 1; u >= 0; u--) {
|
|
893
|
+
const h = p[u], v = this.hitTestMoveRecursive(
|
|
894
|
+
h,
|
|
895
|
+
this._isInteractive(t) ? t : h.eventMode,
|
|
896
|
+
i,
|
|
897
|
+
n,
|
|
898
|
+
s,
|
|
899
|
+
o || s(e, i)
|
|
900
|
+
);
|
|
901
|
+
if (v) {
|
|
902
|
+
if (v.length > 0 && !v[v.length - 1].parent)
|
|
903
|
+
continue;
|
|
904
|
+
const c = e.isInteractive();
|
|
905
|
+
(v.length > 0 || c) && (c && this._allInteractiveElements.push(e), v.push(e)), this._hitElements.length === 0 && (this._hitElements = v), r = !0;
|
|
906
|
+
}
|
|
907
|
+
}
|
|
908
|
+
}
|
|
909
|
+
const l = this._isInteractive(t), d = e.isInteractive();
|
|
910
|
+
return d && d && this._allInteractiveElements.push(e), o || this._hitElements.length > 0 ? null : r ? this._hitElements : l && !s(e, i) && n(e, i) ? d ? [e] : [] : null;
|
|
911
|
+
}
|
|
912
|
+
/**
|
|
913
|
+
* Recursive implementation for {@link EventBoundary.hitTest hitTest}.
|
|
914
|
+
* @param currentTarget - The Container that is to be hit tested.
|
|
915
|
+
* @param eventMode - The event mode for the `currentTarget` or one of its parents.
|
|
916
|
+
* @param location - The location that is being tested for overlap.
|
|
917
|
+
* @param testFn - Callback that determines whether the target passes hit testing. This callback
|
|
918
|
+
* can assume that `pruneFn` failed to prune the container.
|
|
919
|
+
* @param pruneFn - Callback that determiness whether the target and all of its children
|
|
920
|
+
* cannot pass the hit test. It is used as a preliminary optimization to prune entire subtrees
|
|
921
|
+
* of the scene graph.
|
|
922
|
+
* @returns An array holding the hit testing target and all its ancestors in order. The first element
|
|
923
|
+
* is the target itself and the last is {@link EventBoundary.rootTarget rootTarget}. This is the opposite
|
|
924
|
+
* order w.r.t. the propagation path. If no hit testing target is found, null is returned.
|
|
925
|
+
*/
|
|
926
|
+
hitTestRecursive(e, t, i, n, s) {
|
|
927
|
+
if (this._interactivePrune(e) || s(e, i))
|
|
928
|
+
return null;
|
|
929
|
+
if ((e.eventMode === "dynamic" || t === "dynamic") && (_.pauseUpdate = !1), e.interactiveChildren && e.children) {
|
|
930
|
+
const l = e.children, d = i;
|
|
931
|
+
for (let p = l.length - 1; p >= 0; p--) {
|
|
932
|
+
const u = l[p], h = this.hitTestRecursive(
|
|
933
|
+
u,
|
|
934
|
+
this._isInteractive(t) ? t : u.eventMode,
|
|
935
|
+
d,
|
|
936
|
+
n,
|
|
937
|
+
s
|
|
938
|
+
);
|
|
939
|
+
if (h) {
|
|
940
|
+
if (h.length > 0 && !h[h.length - 1].parent)
|
|
941
|
+
continue;
|
|
942
|
+
const v = e.isInteractive();
|
|
943
|
+
return (h.length > 0 || v) && h.push(e), h;
|
|
944
|
+
}
|
|
945
|
+
}
|
|
946
|
+
}
|
|
947
|
+
const o = this._isInteractive(t), r = e.isInteractive();
|
|
948
|
+
return o && n(e, i) ? r ? [e] : [] : null;
|
|
949
|
+
}
|
|
950
|
+
_isInteractive(e) {
|
|
951
|
+
return e === "static" || e === "dynamic";
|
|
952
|
+
}
|
|
953
|
+
_interactivePrune(e) {
|
|
954
|
+
return !e || !e.visible || !e.renderable || !e.measurable || e.eventMode === "none" || e.eventMode === "passive" && !e.interactiveChildren;
|
|
955
|
+
}
|
|
956
|
+
/**
|
|
957
|
+
* Checks whether the container or any of its children cannot pass the hit test at all.
|
|
958
|
+
*
|
|
959
|
+
* {@link EventBoundary}'s implementation uses the {@link Container.hitArea hitArea}
|
|
960
|
+
* and {@link Container._maskEffect} for pruning.
|
|
961
|
+
* @param container - The container to prune.
|
|
962
|
+
* @param location - The location to test for overlap.
|
|
963
|
+
*/
|
|
964
|
+
hitPruneFn(e, t) {
|
|
965
|
+
if (e.hitArea && (e.worldTransform.applyInverse(t, P), !e.hitArea.contains(P.x, P.y)))
|
|
966
|
+
return !0;
|
|
967
|
+
if (e.effects && e.effects.length)
|
|
968
|
+
for (let i = 0; i < e.effects.length; i++) {
|
|
969
|
+
const n = e.effects[i];
|
|
970
|
+
if (n.containsPoint && !n.containsPoint(t, this.hitTestFn))
|
|
971
|
+
return !0;
|
|
972
|
+
}
|
|
973
|
+
return !1;
|
|
974
|
+
}
|
|
975
|
+
/**
|
|
976
|
+
* Checks whether the container passes hit testing for the given location.
|
|
977
|
+
* @param container - The container to test.
|
|
978
|
+
* @param location - The location to test for overlap.
|
|
979
|
+
* @returns - Whether `container` passes hit testing for `location`.
|
|
980
|
+
*/
|
|
981
|
+
hitTestFn(e, t) {
|
|
982
|
+
return e.hitArea ? !0 : e != null && e.containsPoint ? (e.worldTransform.applyInverse(t, P), e.containsPoint(P)) : !1;
|
|
983
|
+
}
|
|
984
|
+
/**
|
|
985
|
+
* Notify all the listeners to the event's `currentTarget`.
|
|
986
|
+
*
|
|
987
|
+
* If the `currentTarget` contains the property `on<type>`, then it is called here,
|
|
988
|
+
* simulating the behavior from version 6.x and prior.
|
|
989
|
+
* @param e - The event passed to the target.
|
|
990
|
+
* @param type - The type of event to notify. Defaults to `e.type`.
|
|
991
|
+
*/
|
|
992
|
+
notifyTarget(e, t) {
|
|
993
|
+
var s, o;
|
|
994
|
+
if (!e.currentTarget.isInteractive())
|
|
995
|
+
return;
|
|
996
|
+
t ?? (t = e.type);
|
|
997
|
+
const i = `on${t}`;
|
|
998
|
+
(o = (s = e.currentTarget)[i]) == null || o.call(s, e);
|
|
999
|
+
const n = e.eventPhase === e.CAPTURING_PHASE || e.eventPhase === e.AT_TARGET ? `${t}capture` : t;
|
|
1000
|
+
this._notifyListeners(e, n), e.eventPhase === e.AT_TARGET && this._notifyListeners(e, t);
|
|
1001
|
+
}
|
|
1002
|
+
/**
|
|
1003
|
+
* Maps the upstream `pointerdown` events to a downstream `pointerdown` event.
|
|
1004
|
+
*
|
|
1005
|
+
* `touchstart`, `rightdown`, `mousedown` events are also dispatched for specific pointer types.
|
|
1006
|
+
* @param from - The upstream `pointerdown` event.
|
|
1007
|
+
*/
|
|
1008
|
+
mapPointerDown(e) {
|
|
1009
|
+
if (!(e instanceof f)) {
|
|
1010
|
+
y("EventBoundary cannot map a non-pointer event as a pointer event");
|
|
1011
|
+
return;
|
|
1012
|
+
}
|
|
1013
|
+
const t = this.createPointerEvent(e);
|
|
1014
|
+
if (this.dispatchEvent(t, "pointerdown"), t.pointerType === "touch")
|
|
1015
|
+
this.dispatchEvent(t, "touchstart");
|
|
1016
|
+
else if (t.pointerType === "mouse" || t.pointerType === "pen") {
|
|
1017
|
+
const n = t.button === 2;
|
|
1018
|
+
this.dispatchEvent(t, n ? "rightdown" : "mousedown");
|
|
1019
|
+
}
|
|
1020
|
+
const i = this.trackingData(e.pointerId);
|
|
1021
|
+
i.pressTargetsByButton[e.button] = t.composedPath(), this.freeEvent(t);
|
|
1022
|
+
}
|
|
1023
|
+
/**
|
|
1024
|
+
* Maps the upstream `pointermove` to downstream `pointerout`, `pointerover`, and `pointermove` events, in that order.
|
|
1025
|
+
*
|
|
1026
|
+
* The tracking data for the specific pointer has an updated `overTarget`. `mouseout`, `mouseover`,
|
|
1027
|
+
* `mousemove`, and `touchmove` events are fired as well for specific pointer types.
|
|
1028
|
+
* @param from - The upstream `pointermove` event.
|
|
1029
|
+
*/
|
|
1030
|
+
mapPointerMove(e) {
|
|
1031
|
+
var l, d;
|
|
1032
|
+
if (!(e instanceof f)) {
|
|
1033
|
+
y("EventBoundary cannot map a non-pointer event as a pointer event");
|
|
1034
|
+
return;
|
|
1035
|
+
}
|
|
1036
|
+
this._allInteractiveElements.length = 0, this._hitElements.length = 0, this._isPointerMoveEvent = !0;
|
|
1037
|
+
const t = this.createPointerEvent(e);
|
|
1038
|
+
this._isPointerMoveEvent = !1;
|
|
1039
|
+
const i = t.pointerType === "mouse" || t.pointerType === "pen", n = this.trackingData(e.pointerId), s = this.findMountedTarget(n.overTargets);
|
|
1040
|
+
if (((l = n.overTargets) == null ? void 0 : l.length) > 0 && s !== t.target) {
|
|
1041
|
+
const p = e.type === "mousemove" ? "mouseout" : "pointerout", u = this.createPointerEvent(e, p, s);
|
|
1042
|
+
if (this.dispatchEvent(u, "pointerout"), i && this.dispatchEvent(u, "mouseout"), !t.composedPath().includes(s)) {
|
|
1043
|
+
const h = this.createPointerEvent(e, "pointerleave", s);
|
|
1044
|
+
for (h.eventPhase = h.AT_TARGET; h.target && !t.composedPath().includes(h.target); )
|
|
1045
|
+
h.currentTarget = h.target, this.notifyTarget(h), i && this.notifyTarget(h, "mouseleave"), h.target = h.target.parent;
|
|
1046
|
+
this.freeEvent(h);
|
|
1047
|
+
}
|
|
1048
|
+
this.freeEvent(u);
|
|
1049
|
+
}
|
|
1050
|
+
if (s !== t.target) {
|
|
1051
|
+
const p = e.type === "mousemove" ? "mouseover" : "pointerover", u = this.clonePointerEvent(t, p);
|
|
1052
|
+
this.dispatchEvent(u, "pointerover"), i && this.dispatchEvent(u, "mouseover");
|
|
1053
|
+
let h = s == null ? void 0 : s.parent;
|
|
1054
|
+
for (; h && h !== this.rootTarget.parent && h !== t.target; )
|
|
1055
|
+
h = h.parent;
|
|
1056
|
+
if (!h || h === this.rootTarget.parent) {
|
|
1057
|
+
const c = this.clonePointerEvent(t, "pointerenter");
|
|
1058
|
+
for (c.eventPhase = c.AT_TARGET; c.target && c.target !== s && c.target !== this.rootTarget.parent; )
|
|
1059
|
+
c.currentTarget = c.target, this.notifyTarget(c), i && this.notifyTarget(c, "mouseenter"), c.target = c.target.parent;
|
|
1060
|
+
this.freeEvent(c);
|
|
1061
|
+
}
|
|
1062
|
+
this.freeEvent(u);
|
|
1063
|
+
}
|
|
1064
|
+
const o = [], r = this.enableGlobalMoveEvents ?? !0;
|
|
1065
|
+
this.moveOnAll ? o.push("pointermove") : this.dispatchEvent(t, "pointermove"), r && o.push("globalpointermove"), t.pointerType === "touch" && (this.moveOnAll ? o.splice(1, 0, "touchmove") : this.dispatchEvent(t, "touchmove"), r && o.push("globaltouchmove")), i && (this.moveOnAll ? o.splice(1, 0, "mousemove") : this.dispatchEvent(t, "mousemove"), r && o.push("globalmousemove"), this.cursor = (d = t.target) == null ? void 0 : d.cursor), o.length > 0 && this.all(t, o), this._allInteractiveElements.length = 0, this._hitElements.length = 0, n.overTargets = t.composedPath(), this.freeEvent(t);
|
|
1066
|
+
}
|
|
1067
|
+
/**
|
|
1068
|
+
* Maps the upstream `pointerover` to downstream `pointerover` and `pointerenter` events, in that order.
|
|
1069
|
+
*
|
|
1070
|
+
* The tracking data for the specific pointer gets a new `overTarget`.
|
|
1071
|
+
* @param from - The upstream `pointerover` event.
|
|
1072
|
+
*/
|
|
1073
|
+
mapPointerOver(e) {
|
|
1074
|
+
var o;
|
|
1075
|
+
if (!(e instanceof f)) {
|
|
1076
|
+
y("EventBoundary cannot map a non-pointer event as a pointer event");
|
|
1077
|
+
return;
|
|
1078
|
+
}
|
|
1079
|
+
const t = this.trackingData(e.pointerId), i = this.createPointerEvent(e), n = i.pointerType === "mouse" || i.pointerType === "pen";
|
|
1080
|
+
this.dispatchEvent(i, "pointerover"), n && this.dispatchEvent(i, "mouseover"), i.pointerType === "mouse" && (this.cursor = (o = i.target) == null ? void 0 : o.cursor);
|
|
1081
|
+
const s = this.clonePointerEvent(i, "pointerenter");
|
|
1082
|
+
for (s.eventPhase = s.AT_TARGET; s.target && s.target !== this.rootTarget.parent; )
|
|
1083
|
+
s.currentTarget = s.target, this.notifyTarget(s), n && this.notifyTarget(s, "mouseenter"), s.target = s.target.parent;
|
|
1084
|
+
t.overTargets = i.composedPath(), this.freeEvent(i), this.freeEvent(s);
|
|
1085
|
+
}
|
|
1086
|
+
/**
|
|
1087
|
+
* Maps the upstream `pointerout` to downstream `pointerout`, `pointerleave` events, in that order.
|
|
1088
|
+
*
|
|
1089
|
+
* The tracking data for the specific pointer is cleared of a `overTarget`.
|
|
1090
|
+
* @param from - The upstream `pointerout` event.
|
|
1091
|
+
*/
|
|
1092
|
+
mapPointerOut(e) {
|
|
1093
|
+
if (!(e instanceof f)) {
|
|
1094
|
+
y("EventBoundary cannot map a non-pointer event as a pointer event");
|
|
1095
|
+
return;
|
|
1096
|
+
}
|
|
1097
|
+
const t = this.trackingData(e.pointerId);
|
|
1098
|
+
if (t.overTargets) {
|
|
1099
|
+
const i = e.pointerType === "mouse" || e.pointerType === "pen", n = this.findMountedTarget(t.overTargets), s = this.createPointerEvent(e, "pointerout", n);
|
|
1100
|
+
this.dispatchEvent(s), i && this.dispatchEvent(s, "mouseout");
|
|
1101
|
+
const o = this.createPointerEvent(e, "pointerleave", n);
|
|
1102
|
+
for (o.eventPhase = o.AT_TARGET; o.target && o.target !== this.rootTarget.parent; )
|
|
1103
|
+
o.currentTarget = o.target, this.notifyTarget(o), i && this.notifyTarget(o, "mouseleave"), o.target = o.target.parent;
|
|
1104
|
+
t.overTargets = null, this.freeEvent(s), this.freeEvent(o);
|
|
1105
|
+
}
|
|
1106
|
+
this.cursor = null;
|
|
1107
|
+
}
|
|
1108
|
+
/**
|
|
1109
|
+
* Maps the upstream `pointerup` event to downstream `pointerup`, `pointerupoutside`,
|
|
1110
|
+
* and `click`/`rightclick`/`pointertap` events, in that order.
|
|
1111
|
+
*
|
|
1112
|
+
* The `pointerupoutside` event bubbles from the original `pointerdown` target to the most specific
|
|
1113
|
+
* ancestor of the `pointerdown` and `pointerup` targets, which is also the `click` event's target. `touchend`,
|
|
1114
|
+
* `rightup`, `mouseup`, `touchendoutside`, `rightupoutside`, `mouseupoutside`, and `tap` are fired as well for
|
|
1115
|
+
* specific pointer types.
|
|
1116
|
+
* @param from - The upstream `pointerup` event.
|
|
1117
|
+
*/
|
|
1118
|
+
mapPointerUp(e) {
|
|
1119
|
+
if (!(e instanceof f)) {
|
|
1120
|
+
y("EventBoundary cannot map a non-pointer event as a pointer event");
|
|
1121
|
+
return;
|
|
1122
|
+
}
|
|
1123
|
+
const t = performance.now(), i = this.createPointerEvent(e);
|
|
1124
|
+
if (this.dispatchEvent(i, "pointerup"), i.pointerType === "touch")
|
|
1125
|
+
this.dispatchEvent(i, "touchend");
|
|
1126
|
+
else if (i.pointerType === "mouse" || i.pointerType === "pen") {
|
|
1127
|
+
const r = i.button === 2;
|
|
1128
|
+
this.dispatchEvent(i, r ? "rightup" : "mouseup");
|
|
1129
|
+
}
|
|
1130
|
+
const n = this.trackingData(e.pointerId), s = this.findMountedTarget(n.pressTargetsByButton[e.button]);
|
|
1131
|
+
let o = s;
|
|
1132
|
+
if (s && !i.composedPath().includes(s)) {
|
|
1133
|
+
let r = s;
|
|
1134
|
+
for (; r && !i.composedPath().includes(r); ) {
|
|
1135
|
+
if (i.currentTarget = r, this.notifyTarget(i, "pointerupoutside"), i.pointerType === "touch")
|
|
1136
|
+
this.notifyTarget(i, "touchendoutside");
|
|
1137
|
+
else if (i.pointerType === "mouse" || i.pointerType === "pen") {
|
|
1138
|
+
const l = i.button === 2;
|
|
1139
|
+
this.notifyTarget(i, l ? "rightupoutside" : "mouseupoutside");
|
|
1140
|
+
}
|
|
1141
|
+
r = r.parent;
|
|
1142
|
+
}
|
|
1143
|
+
delete n.pressTargetsByButton[e.button], o = r;
|
|
1144
|
+
}
|
|
1145
|
+
if (o) {
|
|
1146
|
+
const r = this.clonePointerEvent(i, "click");
|
|
1147
|
+
r.target = o, r.path = null, n.clicksByButton[e.button] || (n.clicksByButton[e.button] = {
|
|
1148
|
+
clickCount: 0,
|
|
1149
|
+
target: r.target,
|
|
1150
|
+
timeStamp: t
|
|
1151
|
+
});
|
|
1152
|
+
const l = n.clicksByButton[e.button];
|
|
1153
|
+
if (l.target === r.target && t - l.timeStamp < 200 ? ++l.clickCount : l.clickCount = 1, l.target = r.target, l.timeStamp = t, r.detail = l.clickCount, r.pointerType === "mouse") {
|
|
1154
|
+
const d = r.button === 2;
|
|
1155
|
+
this.dispatchEvent(r, d ? "rightclick" : "click");
|
|
1156
|
+
} else r.pointerType === "touch" && this.dispatchEvent(r, "tap");
|
|
1157
|
+
this.dispatchEvent(r, "pointertap"), this.freeEvent(r);
|
|
1158
|
+
}
|
|
1159
|
+
this.freeEvent(i);
|
|
1160
|
+
}
|
|
1161
|
+
/**
|
|
1162
|
+
* Maps the upstream `pointerupoutside` event to a downstream `pointerupoutside` event, bubbling from the original
|
|
1163
|
+
* `pointerdown` target to `rootTarget`.
|
|
1164
|
+
*
|
|
1165
|
+
* (The most specific ancestor of the `pointerdown` event and the `pointerup` event must the
|
|
1166
|
+
* `{@link EventBoundary}'s root because the `pointerup` event occurred outside of the boundary.)
|
|
1167
|
+
*
|
|
1168
|
+
* `touchendoutside`, `mouseupoutside`, and `rightupoutside` events are fired as well for specific pointer
|
|
1169
|
+
* types. The tracking data for the specific pointer is cleared of a `pressTarget`.
|
|
1170
|
+
* @param from - The upstream `pointerupoutside` event.
|
|
1171
|
+
*/
|
|
1172
|
+
mapPointerUpOutside(e) {
|
|
1173
|
+
if (!(e instanceof f)) {
|
|
1174
|
+
y("EventBoundary cannot map a non-pointer event as a pointer event");
|
|
1175
|
+
return;
|
|
1176
|
+
}
|
|
1177
|
+
const t = this.trackingData(e.pointerId), i = this.findMountedTarget(t.pressTargetsByButton[e.button]), n = this.createPointerEvent(e);
|
|
1178
|
+
if (i) {
|
|
1179
|
+
let s = i;
|
|
1180
|
+
for (; s; )
|
|
1181
|
+
n.currentTarget = s, this.notifyTarget(n, "pointerupoutside"), n.pointerType === "touch" ? this.notifyTarget(n, "touchendoutside") : (n.pointerType === "mouse" || n.pointerType === "pen") && this.notifyTarget(n, n.button === 2 ? "rightupoutside" : "mouseupoutside"), s = s.parent;
|
|
1182
|
+
delete t.pressTargetsByButton[e.button];
|
|
1183
|
+
}
|
|
1184
|
+
this.freeEvent(n);
|
|
1185
|
+
}
|
|
1186
|
+
/**
|
|
1187
|
+
* Maps the upstream `wheel` event to a downstream `wheel` event.
|
|
1188
|
+
* @param from - The upstream `wheel` event.
|
|
1189
|
+
*/
|
|
1190
|
+
mapWheel(e) {
|
|
1191
|
+
if (!(e instanceof T)) {
|
|
1192
|
+
y("EventBoundary cannot map a non-wheel event as a wheel event");
|
|
1193
|
+
return;
|
|
1194
|
+
}
|
|
1195
|
+
const t = this.createWheelEvent(e);
|
|
1196
|
+
this.dispatchEvent(t), this.freeEvent(t);
|
|
1197
|
+
}
|
|
1198
|
+
/**
|
|
1199
|
+
* Finds the most specific event-target in the given propagation path that is still mounted in the scene graph.
|
|
1200
|
+
*
|
|
1201
|
+
* This is used to find the correct `pointerup` and `pointerout` target in the case that the original `pointerdown`
|
|
1202
|
+
* or `pointerover` target was unmounted from the scene graph.
|
|
1203
|
+
* @param propagationPath - The propagation path was valid in the past.
|
|
1204
|
+
* @returns - The most specific event-target still mounted at the same location in the scene graph.
|
|
1205
|
+
*/
|
|
1206
|
+
findMountedTarget(e) {
|
|
1207
|
+
if (!e)
|
|
1208
|
+
return null;
|
|
1209
|
+
let t = e[0];
|
|
1210
|
+
for (let i = 1; i < e.length && e[i].parent === t; i++)
|
|
1211
|
+
t = e[i];
|
|
1212
|
+
return t;
|
|
1213
|
+
}
|
|
1214
|
+
/**
|
|
1215
|
+
* Creates an event whose {@code originalEvent} is {@code from}, with an optional `type` and `target` override.
|
|
1216
|
+
*
|
|
1217
|
+
* The event is allocated using {@link EventBoundary#allocateEvent this.allocateEvent}.
|
|
1218
|
+
* @param from - The {@code originalEvent} for the returned event.
|
|
1219
|
+
* @param [type=from.type] - The type of the returned event.
|
|
1220
|
+
* @param target - The target of the returned event.
|
|
1221
|
+
*/
|
|
1222
|
+
createPointerEvent(e, t, i) {
|
|
1223
|
+
const n = this.allocateEvent(f);
|
|
1224
|
+
return this.copyPointerData(e, n), this.copyMouseData(e, n), this.copyData(e, n), n.nativeEvent = e.nativeEvent, n.originalEvent = e, n.target = i ?? this.hitTest(n.global.x, n.global.y) ?? this._hitElements[0], typeof t == "string" && (n.type = t), n;
|
|
1225
|
+
}
|
|
1226
|
+
/**
|
|
1227
|
+
* Creates a wheel event whose {@code originalEvent} is {@code from}.
|
|
1228
|
+
*
|
|
1229
|
+
* The event is allocated using {@link EventBoundary#allocateEvent this.allocateEvent}.
|
|
1230
|
+
* @param from - The upstream wheel event.
|
|
1231
|
+
*/
|
|
1232
|
+
createWheelEvent(e) {
|
|
1233
|
+
const t = this.allocateEvent(T);
|
|
1234
|
+
return this.copyWheelData(e, t), this.copyMouseData(e, t), this.copyData(e, t), t.nativeEvent = e.nativeEvent, t.originalEvent = e, t.target = this.hitTest(t.global.x, t.global.y), t;
|
|
1235
|
+
}
|
|
1236
|
+
/**
|
|
1237
|
+
* Clones the event {@code from}, with an optional {@code type} override.
|
|
1238
|
+
*
|
|
1239
|
+
* The event is allocated using {@link EventBoundary#allocateEvent this.allocateEvent}.
|
|
1240
|
+
* @param from - The event to clone.
|
|
1241
|
+
* @param [type=from.type] - The type of the returned event.
|
|
1242
|
+
*/
|
|
1243
|
+
clonePointerEvent(e, t) {
|
|
1244
|
+
const i = this.allocateEvent(f);
|
|
1245
|
+
return i.nativeEvent = e.nativeEvent, i.originalEvent = e.originalEvent, this.copyPointerData(e, i), this.copyMouseData(e, i), this.copyData(e, i), i.target = e.target, i.path = e.composedPath().slice(), i.type = t ?? i.type, i;
|
|
1246
|
+
}
|
|
1247
|
+
/**
|
|
1248
|
+
* Copies wheel {@link FederatedWheelEvent} data from {@code from} into {@code to}.
|
|
1249
|
+
*
|
|
1250
|
+
* The following properties are copied:
|
|
1251
|
+
* + deltaMode
|
|
1252
|
+
* + deltaX
|
|
1253
|
+
* + deltaY
|
|
1254
|
+
* + deltaZ
|
|
1255
|
+
* @param from - The event to copy data from.
|
|
1256
|
+
* @param to - The event to copy data into.
|
|
1257
|
+
*/
|
|
1258
|
+
copyWheelData(e, t) {
|
|
1259
|
+
t.deltaMode = e.deltaMode, t.deltaX = e.deltaX, t.deltaY = e.deltaY, t.deltaZ = e.deltaZ;
|
|
1260
|
+
}
|
|
1261
|
+
/**
|
|
1262
|
+
* Copies pointer {@link FederatedPointerEvent} data from {@code from} into {@code to}.
|
|
1263
|
+
*
|
|
1264
|
+
* The following properties are copied:
|
|
1265
|
+
* + pointerId
|
|
1266
|
+
* + width
|
|
1267
|
+
* + height
|
|
1268
|
+
* + isPrimary
|
|
1269
|
+
* + pointerType
|
|
1270
|
+
* + pressure
|
|
1271
|
+
* + tangentialPressure
|
|
1272
|
+
* + tiltX
|
|
1273
|
+
* + tiltY
|
|
1274
|
+
* @param from - The event to copy data from.
|
|
1275
|
+
* @param to - The event to copy data into.
|
|
1276
|
+
*/
|
|
1277
|
+
copyPointerData(e, t) {
|
|
1278
|
+
e instanceof f && t instanceof f && (t.pointerId = e.pointerId, t.width = e.width, t.height = e.height, t.isPrimary = e.isPrimary, t.pointerType = e.pointerType, t.pressure = e.pressure, t.tangentialPressure = e.tangentialPressure, t.tiltX = e.tiltX, t.tiltY = e.tiltY, t.twist = e.twist);
|
|
1279
|
+
}
|
|
1280
|
+
/**
|
|
1281
|
+
* Copies mouse {@link FederatedMouseEvent} data from {@code from} to {@code to}.
|
|
1282
|
+
*
|
|
1283
|
+
* The following properties are copied:
|
|
1284
|
+
* + altKey
|
|
1285
|
+
* + button
|
|
1286
|
+
* + buttons
|
|
1287
|
+
* + clientX
|
|
1288
|
+
* + clientY
|
|
1289
|
+
* + metaKey
|
|
1290
|
+
* + movementX
|
|
1291
|
+
* + movementY
|
|
1292
|
+
* + pageX
|
|
1293
|
+
* + pageY
|
|
1294
|
+
* + x
|
|
1295
|
+
* + y
|
|
1296
|
+
* + screen
|
|
1297
|
+
* + shiftKey
|
|
1298
|
+
* + global
|
|
1299
|
+
* @param from - The event to copy data from.
|
|
1300
|
+
* @param to - The event to copy data into.
|
|
1301
|
+
*/
|
|
1302
|
+
copyMouseData(e, t) {
|
|
1303
|
+
e instanceof O && t instanceof O && (t.altKey = e.altKey, t.button = e.button, t.buttons = e.buttons, t.client.copyFrom(e.client), t.ctrlKey = e.ctrlKey, t.metaKey = e.metaKey, t.movement.copyFrom(e.movement), t.screen.copyFrom(e.screen), t.shiftKey = e.shiftKey, t.global.copyFrom(e.global));
|
|
1304
|
+
}
|
|
1305
|
+
/**
|
|
1306
|
+
* Copies base {@link FederatedEvent} data from {@code from} into {@code to}.
|
|
1307
|
+
*
|
|
1308
|
+
* The following properties are copied:
|
|
1309
|
+
* + isTrusted
|
|
1310
|
+
* + srcElement
|
|
1311
|
+
* + timeStamp
|
|
1312
|
+
* + type
|
|
1313
|
+
* @param from - The event to copy data from.
|
|
1314
|
+
* @param to - The event to copy data into.
|
|
1315
|
+
*/
|
|
1316
|
+
copyData(e, t) {
|
|
1317
|
+
t.isTrusted = e.isTrusted, t.srcElement = e.srcElement, t.timeStamp = performance.now(), t.type = e.type, t.detail = e.detail, t.view = e.view, t.which = e.which, t.layer.copyFrom(e.layer), t.page.copyFrom(e.page);
|
|
1318
|
+
}
|
|
1319
|
+
/**
|
|
1320
|
+
* @param id - The pointer ID.
|
|
1321
|
+
* @returns The tracking data stored for the given pointer. If no data exists, a blank
|
|
1322
|
+
* state will be created.
|
|
1323
|
+
*/
|
|
1324
|
+
trackingData(e) {
|
|
1325
|
+
return this.mappingState.trackingData[e] || (this.mappingState.trackingData[e] = {
|
|
1326
|
+
pressTargetsByButton: {},
|
|
1327
|
+
clicksByButton: {},
|
|
1328
|
+
overTarget: null
|
|
1329
|
+
}), this.mappingState.trackingData[e];
|
|
1330
|
+
}
|
|
1331
|
+
/**
|
|
1332
|
+
* Allocate a specific type of event from {@link EventBoundary#eventPool this.eventPool}.
|
|
1333
|
+
*
|
|
1334
|
+
* This allocation is constructor-agnostic, as long as it only takes one argument - this event
|
|
1335
|
+
* boundary.
|
|
1336
|
+
* @param constructor - The event's constructor.
|
|
1337
|
+
*/
|
|
1338
|
+
allocateEvent(e) {
|
|
1339
|
+
this.eventPool.has(e) || this.eventPool.set(e, []);
|
|
1340
|
+
const t = this.eventPool.get(e).pop() || new e(this);
|
|
1341
|
+
return t.eventPhase = t.NONE, t.currentTarget = null, t.defaultPrevented = !1, t.path = null, t.target = null, t;
|
|
1342
|
+
}
|
|
1343
|
+
/**
|
|
1344
|
+
* Frees the event and puts it back into the event pool.
|
|
1345
|
+
*
|
|
1346
|
+
* It is illegal to reuse the event until it is allocated again, using `this.allocateEvent`.
|
|
1347
|
+
*
|
|
1348
|
+
* It is also advised that events not allocated from {@link EventBoundary#allocateEvent this.allocateEvent}
|
|
1349
|
+
* not be freed. This is because of the possibility that the same event is freed twice, which can cause
|
|
1350
|
+
* it to be allocated twice & result in overwriting.
|
|
1351
|
+
* @param event - The event to be freed.
|
|
1352
|
+
* @throws Error if the event is managed by another event boundary.
|
|
1353
|
+
*/
|
|
1354
|
+
freeEvent(e) {
|
|
1355
|
+
if (e.manager !== this)
|
|
1356
|
+
throw new Error("It is illegal to free an event not managed by this EventBoundary!");
|
|
1357
|
+
const t = e.constructor;
|
|
1358
|
+
this.eventPool.has(t) || this.eventPool.set(t, []), this.eventPool.get(t).push(e);
|
|
1359
|
+
}
|
|
1360
|
+
/**
|
|
1361
|
+
* Similar to {@link EventEmitter.emit}, except it stops if the `propagationImmediatelyStopped` flag
|
|
1362
|
+
* is set on the event.
|
|
1363
|
+
* @param e - The event to call each listener with.
|
|
1364
|
+
* @param type - The event key.
|
|
1365
|
+
*/
|
|
1366
|
+
_notifyListeners(e, t) {
|
|
1367
|
+
const i = e.currentTarget._events[t];
|
|
1368
|
+
if (i)
|
|
1369
|
+
if ("fn" in i)
|
|
1370
|
+
i.once && e.currentTarget.removeListener(t, i.fn, void 0, !0), i.fn.call(i.context, e);
|
|
1371
|
+
else
|
|
1372
|
+
for (let n = 0, s = i.length; n < s && !e.propagationImmediatelyStopped; n++)
|
|
1373
|
+
i[n].once && e.currentTarget.removeListener(t, i[n].fn, void 0, !0), i[n].fn.call(i[n].context, e);
|
|
1374
|
+
}
|
|
1375
|
+
}
|
|
1376
|
+
const ge = 1, ye = {
|
|
1377
|
+
touchstart: "pointerdown",
|
|
1378
|
+
touchend: "pointerup",
|
|
1379
|
+
touchendoutside: "pointerupoutside",
|
|
1380
|
+
touchmove: "pointermove",
|
|
1381
|
+
touchcancel: "pointercancel"
|
|
1382
|
+
}, L = class k {
|
|
1383
|
+
/**
|
|
1384
|
+
* @param {Renderer} renderer
|
|
1385
|
+
*/
|
|
1386
|
+
constructor(e) {
|
|
1387
|
+
this.supportsTouchEvents = "ontouchstart" in globalThis, this.supportsPointerEvents = !!globalThis.PointerEvent, this.domElement = null, this.resolution = 1, this.renderer = e, this.rootBoundary = new me(null), _.init(this), this.autoPreventDefault = !0, this._eventsAdded = !1, this._rootPointerEvent = new f(null), this._rootWheelEvent = new T(null), this.cursorStyles = {
|
|
1388
|
+
default: "inherit",
|
|
1389
|
+
pointer: "pointer"
|
|
1390
|
+
}, this.features = new Proxy({ ...k.defaultEventFeatures }, {
|
|
1391
|
+
set: (t, i, n) => (i === "globalMove" && (this.rootBoundary.enableGlobalMoveEvents = n), t[i] = n, !0)
|
|
1392
|
+
}), this._onPointerDown = this._onPointerDown.bind(this), this._onPointerMove = this._onPointerMove.bind(this), this._onPointerUp = this._onPointerUp.bind(this), this._onPointerOverOut = this._onPointerOverOut.bind(this), this.onWheel = this.onWheel.bind(this);
|
|
1393
|
+
}
|
|
1394
|
+
/**
|
|
1395
|
+
* The default interaction mode for all display objects.
|
|
1396
|
+
* @see Container.eventMode
|
|
1397
|
+
* @type {EventMode}
|
|
1398
|
+
* @readonly
|
|
1399
|
+
* @since 7.2.0
|
|
1400
|
+
*/
|
|
1401
|
+
static get defaultEventMode() {
|
|
1402
|
+
return this._defaultEventMode;
|
|
1403
|
+
}
|
|
1404
|
+
/**
|
|
1405
|
+
* Runner init called, view is available at this point.
|
|
1406
|
+
* @ignore
|
|
1407
|
+
*/
|
|
1408
|
+
init(e) {
|
|
1409
|
+
const { canvas: t, resolution: i } = this.renderer;
|
|
1410
|
+
this.setTargetElement(t), this.resolution = i, k._defaultEventMode = e.eventMode ?? "passive", Object.assign(this.features, e.eventFeatures ?? {}), this.rootBoundary.enableGlobalMoveEvents = this.features.globalMove;
|
|
1411
|
+
}
|
|
1412
|
+
/**
|
|
1413
|
+
* Handle changing resolution.
|
|
1414
|
+
* @ignore
|
|
1415
|
+
*/
|
|
1416
|
+
resolutionChange(e) {
|
|
1417
|
+
this.resolution = e;
|
|
1418
|
+
}
|
|
1419
|
+
/** Destroys all event listeners and detaches the renderer. */
|
|
1420
|
+
destroy() {
|
|
1421
|
+
this.setTargetElement(null), this.renderer = null, this._currentCursor = null;
|
|
1422
|
+
}
|
|
1423
|
+
/**
|
|
1424
|
+
* Sets the current cursor mode, handling any callbacks or CSS style changes.
|
|
1425
|
+
* @param mode - cursor mode, a key from the cursorStyles dictionary
|
|
1426
|
+
*/
|
|
1427
|
+
setCursor(e) {
|
|
1428
|
+
e || (e = "default");
|
|
1429
|
+
let t = !0;
|
|
1430
|
+
if (globalThis.OffscreenCanvas && this.domElement instanceof OffscreenCanvas && (t = !1), this._currentCursor === e)
|
|
1431
|
+
return;
|
|
1432
|
+
this._currentCursor = e;
|
|
1433
|
+
const i = this.cursorStyles[e];
|
|
1434
|
+
if (i)
|
|
1435
|
+
switch (typeof i) {
|
|
1436
|
+
case "string":
|
|
1437
|
+
t && (this.domElement.style.cursor = i);
|
|
1438
|
+
break;
|
|
1439
|
+
case "function":
|
|
1440
|
+
i(e);
|
|
1441
|
+
break;
|
|
1442
|
+
case "object":
|
|
1443
|
+
t && Object.assign(this.domElement.style, i);
|
|
1444
|
+
break;
|
|
1445
|
+
}
|
|
1446
|
+
else t && typeof e == "string" && !Object.prototype.hasOwnProperty.call(this.cursorStyles, e) && (this.domElement.style.cursor = e);
|
|
1447
|
+
}
|
|
1448
|
+
/**
|
|
1449
|
+
* The global pointer event.
|
|
1450
|
+
* Useful for getting the pointer position without listening to events.
|
|
1451
|
+
* @since 7.2.0
|
|
1452
|
+
*/
|
|
1453
|
+
get pointer() {
|
|
1454
|
+
return this._rootPointerEvent;
|
|
1455
|
+
}
|
|
1456
|
+
/**
|
|
1457
|
+
* Event handler for pointer down events on {@link EventSystem#domElement this.domElement}.
|
|
1458
|
+
* @param nativeEvent - The native mouse/pointer/touch event.
|
|
1459
|
+
*/
|
|
1460
|
+
_onPointerDown(e) {
|
|
1461
|
+
if (!this.features.click)
|
|
1462
|
+
return;
|
|
1463
|
+
this.rootBoundary.rootTarget = this.renderer.lastObjectRendered;
|
|
1464
|
+
const t = this._normalizeToPointerData(e);
|
|
1465
|
+
this.autoPreventDefault && t[0].isNormalized && (e.cancelable || !("cancelable" in e)) && e.preventDefault();
|
|
1466
|
+
for (let i = 0, n = t.length; i < n; i++) {
|
|
1467
|
+
const s = t[i], o = this._bootstrapEvent(this._rootPointerEvent, s);
|
|
1468
|
+
this.rootBoundary.mapEvent(o);
|
|
1469
|
+
}
|
|
1470
|
+
this.setCursor(this.rootBoundary.cursor);
|
|
1471
|
+
}
|
|
1472
|
+
/**
|
|
1473
|
+
* Event handler for pointer move events on on {@link EventSystem#domElement this.domElement}.
|
|
1474
|
+
* @param nativeEvent - The native mouse/pointer/touch events.
|
|
1475
|
+
*/
|
|
1476
|
+
_onPointerMove(e) {
|
|
1477
|
+
if (!this.features.move)
|
|
1478
|
+
return;
|
|
1479
|
+
this.rootBoundary.rootTarget = this.renderer.lastObjectRendered, _.pointerMoved();
|
|
1480
|
+
const t = this._normalizeToPointerData(e);
|
|
1481
|
+
for (let i = 0, n = t.length; i < n; i++) {
|
|
1482
|
+
const s = this._bootstrapEvent(this._rootPointerEvent, t[i]);
|
|
1483
|
+
this.rootBoundary.mapEvent(s);
|
|
1484
|
+
}
|
|
1485
|
+
this.setCursor(this.rootBoundary.cursor);
|
|
1486
|
+
}
|
|
1487
|
+
/**
|
|
1488
|
+
* Event handler for pointer up events on {@link EventSystem#domElement this.domElement}.
|
|
1489
|
+
* @param nativeEvent - The native mouse/pointer/touch event.
|
|
1490
|
+
*/
|
|
1491
|
+
_onPointerUp(e) {
|
|
1492
|
+
if (!this.features.click)
|
|
1493
|
+
return;
|
|
1494
|
+
this.rootBoundary.rootTarget = this.renderer.lastObjectRendered;
|
|
1495
|
+
let t = e.target;
|
|
1496
|
+
e.composedPath && e.composedPath().length > 0 && (t = e.composedPath()[0]);
|
|
1497
|
+
const i = t !== this.domElement ? "outside" : "", n = this._normalizeToPointerData(e);
|
|
1498
|
+
for (let s = 0, o = n.length; s < o; s++) {
|
|
1499
|
+
const r = this._bootstrapEvent(this._rootPointerEvent, n[s]);
|
|
1500
|
+
r.type += i, this.rootBoundary.mapEvent(r);
|
|
1501
|
+
}
|
|
1502
|
+
this.setCursor(this.rootBoundary.cursor);
|
|
1503
|
+
}
|
|
1504
|
+
/**
|
|
1505
|
+
* Event handler for pointer over & out events on {@link EventSystem#domElement this.domElement}.
|
|
1506
|
+
* @param nativeEvent - The native mouse/pointer/touch event.
|
|
1507
|
+
*/
|
|
1508
|
+
_onPointerOverOut(e) {
|
|
1509
|
+
if (!this.features.click)
|
|
1510
|
+
return;
|
|
1511
|
+
this.rootBoundary.rootTarget = this.renderer.lastObjectRendered;
|
|
1512
|
+
const t = this._normalizeToPointerData(e);
|
|
1513
|
+
for (let i = 0, n = t.length; i < n; i++) {
|
|
1514
|
+
const s = this._bootstrapEvent(this._rootPointerEvent, t[i]);
|
|
1515
|
+
this.rootBoundary.mapEvent(s);
|
|
1516
|
+
}
|
|
1517
|
+
this.setCursor(this.rootBoundary.cursor);
|
|
1518
|
+
}
|
|
1519
|
+
/**
|
|
1520
|
+
* Passive handler for `wheel` events on {@link EventSystem.domElement this.domElement}.
|
|
1521
|
+
* @param nativeEvent - The native wheel event.
|
|
1522
|
+
*/
|
|
1523
|
+
onWheel(e) {
|
|
1524
|
+
if (!this.features.wheel)
|
|
1525
|
+
return;
|
|
1526
|
+
const t = this.normalizeWheelEvent(e);
|
|
1527
|
+
this.rootBoundary.rootTarget = this.renderer.lastObjectRendered, this.rootBoundary.mapEvent(t);
|
|
1528
|
+
}
|
|
1529
|
+
/**
|
|
1530
|
+
* Sets the {@link EventSystem#domElement domElement} and binds event listeners.
|
|
1531
|
+
*
|
|
1532
|
+
* To deregister the current DOM element without setting a new one, pass {@code null}.
|
|
1533
|
+
* @param element - The new DOM element.
|
|
1534
|
+
*/
|
|
1535
|
+
setTargetElement(e) {
|
|
1536
|
+
this._removeEvents(), this.domElement = e, _.domElement = e, this._addEvents();
|
|
1537
|
+
}
|
|
1538
|
+
/** Register event listeners on {@link Renderer#domElement this.domElement}. */
|
|
1539
|
+
_addEvents() {
|
|
1540
|
+
if (this._eventsAdded || !this.domElement)
|
|
1541
|
+
return;
|
|
1542
|
+
_.addTickerListener();
|
|
1543
|
+
const e = this.domElement.style;
|
|
1544
|
+
e && (globalThis.navigator.msPointerEnabled ? (e.msContentZooming = "none", e.msTouchAction = "none") : this.supportsPointerEvents && (e.touchAction = "none")), this.supportsPointerEvents ? (globalThis.document.addEventListener("pointermove", this._onPointerMove, !0), this.domElement.addEventListener("pointerdown", this._onPointerDown, !0), this.domElement.addEventListener("pointerleave", this._onPointerOverOut, !0), this.domElement.addEventListener("pointerover", this._onPointerOverOut, !0), globalThis.addEventListener("pointerup", this._onPointerUp, !0)) : (globalThis.document.addEventListener("mousemove", this._onPointerMove, !0), this.domElement.addEventListener("mousedown", this._onPointerDown, !0), this.domElement.addEventListener("mouseout", this._onPointerOverOut, !0), this.domElement.addEventListener("mouseover", this._onPointerOverOut, !0), globalThis.addEventListener("mouseup", this._onPointerUp, !0), this.supportsTouchEvents && (this.domElement.addEventListener("touchstart", this._onPointerDown, !0), this.domElement.addEventListener("touchend", this._onPointerUp, !0), this.domElement.addEventListener("touchmove", this._onPointerMove, !0))), this.domElement.addEventListener("wheel", this.onWheel, {
|
|
1545
|
+
passive: !0,
|
|
1546
|
+
capture: !0
|
|
1547
|
+
}), this._eventsAdded = !0;
|
|
1548
|
+
}
|
|
1549
|
+
/** Unregister event listeners on {@link EventSystem#domElement this.domElement}. */
|
|
1550
|
+
_removeEvents() {
|
|
1551
|
+
if (!this._eventsAdded || !this.domElement)
|
|
1552
|
+
return;
|
|
1553
|
+
_.removeTickerListener();
|
|
1554
|
+
const e = this.domElement.style;
|
|
1555
|
+
e && (globalThis.navigator.msPointerEnabled ? (e.msContentZooming = "", e.msTouchAction = "") : this.supportsPointerEvents && (e.touchAction = "")), this.supportsPointerEvents ? (globalThis.document.removeEventListener("pointermove", this._onPointerMove, !0), this.domElement.removeEventListener("pointerdown", this._onPointerDown, !0), this.domElement.removeEventListener("pointerleave", this._onPointerOverOut, !0), this.domElement.removeEventListener("pointerover", this._onPointerOverOut, !0), globalThis.removeEventListener("pointerup", this._onPointerUp, !0)) : (globalThis.document.removeEventListener("mousemove", this._onPointerMove, !0), this.domElement.removeEventListener("mousedown", this._onPointerDown, !0), this.domElement.removeEventListener("mouseout", this._onPointerOverOut, !0), this.domElement.removeEventListener("mouseover", this._onPointerOverOut, !0), globalThis.removeEventListener("mouseup", this._onPointerUp, !0), this.supportsTouchEvents && (this.domElement.removeEventListener("touchstart", this._onPointerDown, !0), this.domElement.removeEventListener("touchend", this._onPointerUp, !0), this.domElement.removeEventListener("touchmove", this._onPointerMove, !0))), this.domElement.removeEventListener("wheel", this.onWheel, !0), this.domElement = null, this._eventsAdded = !1;
|
|
1556
|
+
}
|
|
1557
|
+
/**
|
|
1558
|
+
* Maps x and y coords from a DOM object and maps them correctly to the PixiJS view. The
|
|
1559
|
+
* resulting value is stored in the point. This takes into account the fact that the DOM
|
|
1560
|
+
* element could be scaled and positioned anywhere on the screen.
|
|
1561
|
+
* @param {PointData} point - the point that the result will be stored in
|
|
1562
|
+
* @param {number} x - the x coord of the position to map
|
|
1563
|
+
* @param {number} y - the y coord of the position to map
|
|
1564
|
+
*/
|
|
1565
|
+
mapPositionToPoint(e, t, i) {
|
|
1566
|
+
const n = this.domElement.isConnected ? this.domElement.getBoundingClientRect() : {
|
|
1567
|
+
width: this.domElement.width,
|
|
1568
|
+
height: this.domElement.height,
|
|
1569
|
+
left: 0,
|
|
1570
|
+
top: 0
|
|
1571
|
+
}, s = 1 / this.resolution;
|
|
1572
|
+
e.x = (t - n.left) * (this.domElement.width / n.width) * s, e.y = (i - n.top) * (this.domElement.height / n.height) * s;
|
|
1573
|
+
}
|
|
1574
|
+
/**
|
|
1575
|
+
* Ensures that the original event object contains all data that a regular pointer event would have
|
|
1576
|
+
* @param event - The original event data from a touch or mouse event
|
|
1577
|
+
* @returns An array containing a single normalized pointer event, in the case of a pointer
|
|
1578
|
+
* or mouse event, or a multiple normalized pointer events if there are multiple changed touches
|
|
1579
|
+
*/
|
|
1580
|
+
_normalizeToPointerData(e) {
|
|
1581
|
+
const t = [];
|
|
1582
|
+
if (this.supportsTouchEvents && e instanceof TouchEvent)
|
|
1583
|
+
for (let i = 0, n = e.changedTouches.length; i < n; i++) {
|
|
1584
|
+
const s = e.changedTouches[i];
|
|
1585
|
+
typeof s.button > "u" && (s.button = 0), typeof s.buttons > "u" && (s.buttons = 1), typeof s.isPrimary > "u" && (s.isPrimary = e.touches.length === 1 && e.type === "touchstart"), typeof s.width > "u" && (s.width = s.radiusX || 1), typeof s.height > "u" && (s.height = s.radiusY || 1), typeof s.tiltX > "u" && (s.tiltX = 0), typeof s.tiltY > "u" && (s.tiltY = 0), typeof s.pointerType > "u" && (s.pointerType = "touch"), typeof s.pointerId > "u" && (s.pointerId = s.identifier || 0), typeof s.pressure > "u" && (s.pressure = s.force || 0.5), typeof s.twist > "u" && (s.twist = 0), typeof s.tangentialPressure > "u" && (s.tangentialPressure = 0), typeof s.layerX > "u" && (s.layerX = s.offsetX = s.clientX), typeof s.layerY > "u" && (s.layerY = s.offsetY = s.clientY), s.isNormalized = !0, s.type = e.type, t.push(s);
|
|
1586
|
+
}
|
|
1587
|
+
else if (!globalThis.MouseEvent || e instanceof MouseEvent && (!this.supportsPointerEvents || !(e instanceof globalThis.PointerEvent))) {
|
|
1588
|
+
const i = e;
|
|
1589
|
+
typeof i.isPrimary > "u" && (i.isPrimary = !0), typeof i.width > "u" && (i.width = 1), typeof i.height > "u" && (i.height = 1), typeof i.tiltX > "u" && (i.tiltX = 0), typeof i.tiltY > "u" && (i.tiltY = 0), typeof i.pointerType > "u" && (i.pointerType = "mouse"), typeof i.pointerId > "u" && (i.pointerId = ge), typeof i.pressure > "u" && (i.pressure = 0.5), typeof i.twist > "u" && (i.twist = 0), typeof i.tangentialPressure > "u" && (i.tangentialPressure = 0), i.isNormalized = !0, t.push(i);
|
|
1590
|
+
} else
|
|
1591
|
+
t.push(e);
|
|
1592
|
+
return t;
|
|
1593
|
+
}
|
|
1594
|
+
/**
|
|
1595
|
+
* Normalizes the native {@link https://w3c.github.io/uievents/#interface-wheelevent WheelEvent}.
|
|
1596
|
+
*
|
|
1597
|
+
* The returned {@link FederatedWheelEvent} is a shared instance. It will not persist across
|
|
1598
|
+
* multiple native wheel events.
|
|
1599
|
+
* @param nativeEvent - The native wheel event that occurred on the canvas.
|
|
1600
|
+
* @returns A federated wheel event.
|
|
1601
|
+
*/
|
|
1602
|
+
normalizeWheelEvent(e) {
|
|
1603
|
+
const t = this._rootWheelEvent;
|
|
1604
|
+
return this._transferMouseData(t, e), t.deltaX = e.deltaX, t.deltaY = e.deltaY, t.deltaZ = e.deltaZ, t.deltaMode = e.deltaMode, this.mapPositionToPoint(t.screen, e.clientX, e.clientY), t.global.copyFrom(t.screen), t.offset.copyFrom(t.screen), t.nativeEvent = e, t.type = e.type, t;
|
|
1605
|
+
}
|
|
1606
|
+
/**
|
|
1607
|
+
* Normalizes the `nativeEvent` into a federateed {@link FederatedPointerEvent}.
|
|
1608
|
+
* @param event
|
|
1609
|
+
* @param nativeEvent
|
|
1610
|
+
*/
|
|
1611
|
+
_bootstrapEvent(e, t) {
|
|
1612
|
+
return e.originalEvent = null, e.nativeEvent = t, e.pointerId = t.pointerId, e.width = t.width, e.height = t.height, e.isPrimary = t.isPrimary, e.pointerType = t.pointerType, e.pressure = t.pressure, e.tangentialPressure = t.tangentialPressure, e.tiltX = t.tiltX, e.tiltY = t.tiltY, e.twist = t.twist, this._transferMouseData(e, t), this.mapPositionToPoint(e.screen, t.clientX, t.clientY), e.global.copyFrom(e.screen), e.offset.copyFrom(e.screen), e.isTrusted = t.isTrusted, e.type === "pointerleave" && (e.type = "pointerout"), e.type.startsWith("mouse") && (e.type = e.type.replace("mouse", "pointer")), e.type.startsWith("touch") && (e.type = ye[e.type] || e.type), e;
|
|
1613
|
+
}
|
|
1614
|
+
/**
|
|
1615
|
+
* Transfers base & mouse event data from the {@code nativeEvent} to the federated event.
|
|
1616
|
+
* @param event
|
|
1617
|
+
* @param nativeEvent
|
|
1618
|
+
*/
|
|
1619
|
+
_transferMouseData(e, t) {
|
|
1620
|
+
e.isTrusted = t.isTrusted, e.srcElement = t.srcElement, e.timeStamp = performance.now(), e.type = t.type, e.altKey = t.altKey, e.button = t.button, e.buttons = t.buttons, e.client.x = t.clientX, e.client.y = t.clientY, e.ctrlKey = t.ctrlKey, e.metaKey = t.metaKey, e.movement.x = t.movementX, e.movement.y = t.movementY, e.page.x = t.pageX, e.page.y = t.pageY, e.relatedTarget = null, e.shiftKey = t.shiftKey;
|
|
1621
|
+
}
|
|
1622
|
+
};
|
|
1623
|
+
L.extension = {
|
|
1624
|
+
name: "events",
|
|
1625
|
+
type: [
|
|
1626
|
+
b.WebGLSystem,
|
|
1627
|
+
b.CanvasSystem,
|
|
1628
|
+
b.WebGPUSystem
|
|
1629
|
+
],
|
|
1630
|
+
priority: -1
|
|
1631
|
+
};
|
|
1632
|
+
L.defaultEventFeatures = {
|
|
1633
|
+
/** Enables pointer events associated with pointer movement. */
|
|
1634
|
+
move: !0,
|
|
1635
|
+
/** Enables global pointer move events. */
|
|
1636
|
+
globalMove: !0,
|
|
1637
|
+
/** Enables pointer events associated with clicking. */
|
|
1638
|
+
click: !0,
|
|
1639
|
+
/** Enables wheel events. */
|
|
1640
|
+
wheel: !0
|
|
1641
|
+
};
|
|
1642
|
+
let J = L;
|
|
1643
|
+
const _e = {
|
|
1644
|
+
/**
|
|
1645
|
+
* Property-based event handler for the `click` event.
|
|
1646
|
+
* @memberof scene.Container#
|
|
1647
|
+
* @default null
|
|
1648
|
+
* @example
|
|
1649
|
+
* this.onclick = (event) => {
|
|
1650
|
+
* //some function here that happens on click
|
|
1651
|
+
* }
|
|
1652
|
+
*/
|
|
1653
|
+
onclick: null,
|
|
1654
|
+
/**
|
|
1655
|
+
* Property-based event handler for the `mousedown` event.
|
|
1656
|
+
* @memberof scene.Container#
|
|
1657
|
+
* @default null
|
|
1658
|
+
* @example
|
|
1659
|
+
* this.onmousedown = (event) => {
|
|
1660
|
+
* //some function here that happens on mousedown
|
|
1661
|
+
* }
|
|
1662
|
+
*/
|
|
1663
|
+
onmousedown: null,
|
|
1664
|
+
/**
|
|
1665
|
+
* Property-based event handler for the `mouseenter` event.
|
|
1666
|
+
* @memberof scene.Container#
|
|
1667
|
+
* @default null
|
|
1668
|
+
* @example
|
|
1669
|
+
* this.onmouseenter = (event) => {
|
|
1670
|
+
* //some function here that happens on mouseenter
|
|
1671
|
+
* }
|
|
1672
|
+
*/
|
|
1673
|
+
onmouseenter: null,
|
|
1674
|
+
/**
|
|
1675
|
+
* Property-based event handler for the `mouseleave` event.
|
|
1676
|
+
* @memberof scene.Container#
|
|
1677
|
+
* @default null
|
|
1678
|
+
* @example
|
|
1679
|
+
* this.onmouseleave = (event) => {
|
|
1680
|
+
* //some function here that happens on mouseleave
|
|
1681
|
+
* }
|
|
1682
|
+
*/
|
|
1683
|
+
onmouseleave: null,
|
|
1684
|
+
/**
|
|
1685
|
+
* Property-based event handler for the `mousemove` event.
|
|
1686
|
+
* @memberof scene.Container#
|
|
1687
|
+
* @default null
|
|
1688
|
+
* @example
|
|
1689
|
+
* this.onmousemove = (event) => {
|
|
1690
|
+
* //some function here that happens on mousemove
|
|
1691
|
+
* }
|
|
1692
|
+
*/
|
|
1693
|
+
onmousemove: null,
|
|
1694
|
+
/**
|
|
1695
|
+
* Property-based event handler for the `globalmousemove` event.
|
|
1696
|
+
* @memberof scene.Container#
|
|
1697
|
+
* @default null
|
|
1698
|
+
* @example
|
|
1699
|
+
* this.onglobalmousemove = (event) => {
|
|
1700
|
+
* //some function here that happens on globalmousemove
|
|
1701
|
+
* }
|
|
1702
|
+
*/
|
|
1703
|
+
onglobalmousemove: null,
|
|
1704
|
+
/**
|
|
1705
|
+
* Property-based event handler for the `mouseout` event.
|
|
1706
|
+
* @memberof scene.Container#
|
|
1707
|
+
* @default null
|
|
1708
|
+
* @example
|
|
1709
|
+
* this.onmouseout = (event) => {
|
|
1710
|
+
* //some function here that happens on mouseout
|
|
1711
|
+
* }
|
|
1712
|
+
*/
|
|
1713
|
+
onmouseout: null,
|
|
1714
|
+
/**
|
|
1715
|
+
* Property-based event handler for the `mouseover` event.
|
|
1716
|
+
* @memberof scene.Container#
|
|
1717
|
+
* @default null
|
|
1718
|
+
* @example
|
|
1719
|
+
* this.onmouseover = (event) => {
|
|
1720
|
+
* //some function here that happens on mouseover
|
|
1721
|
+
* }
|
|
1722
|
+
*/
|
|
1723
|
+
onmouseover: null,
|
|
1724
|
+
/**
|
|
1725
|
+
* Property-based event handler for the `mouseup` event.
|
|
1726
|
+
* @memberof scene.Container#
|
|
1727
|
+
* @default null
|
|
1728
|
+
* @example
|
|
1729
|
+
* this.onmouseup = (event) => {
|
|
1730
|
+
* //some function here that happens on mouseup
|
|
1731
|
+
* }
|
|
1732
|
+
*/
|
|
1733
|
+
onmouseup: null,
|
|
1734
|
+
/**
|
|
1735
|
+
* Property-based event handler for the `mouseupoutside` event.
|
|
1736
|
+
* @memberof scene.Container#
|
|
1737
|
+
* @default null
|
|
1738
|
+
* @example
|
|
1739
|
+
* this.onmouseupoutside = (event) => {
|
|
1740
|
+
* //some function here that happens on mouseupoutside
|
|
1741
|
+
* }
|
|
1742
|
+
*/
|
|
1743
|
+
onmouseupoutside: null,
|
|
1744
|
+
/**
|
|
1745
|
+
* Property-based event handler for the `pointercancel` event.
|
|
1746
|
+
* @memberof scene.Container#
|
|
1747
|
+
* @default null
|
|
1748
|
+
* @example
|
|
1749
|
+
* this.onpointercancel = (event) => {
|
|
1750
|
+
* //some function here that happens on pointercancel
|
|
1751
|
+
* }
|
|
1752
|
+
*/
|
|
1753
|
+
onpointercancel: null,
|
|
1754
|
+
/**
|
|
1755
|
+
* Property-based event handler for the `pointerdown` event.
|
|
1756
|
+
* @memberof scene.Container#
|
|
1757
|
+
* @default null
|
|
1758
|
+
* @example
|
|
1759
|
+
* this.onpointerdown = (event) => {
|
|
1760
|
+
* //some function here that happens on pointerdown
|
|
1761
|
+
* }
|
|
1762
|
+
*/
|
|
1763
|
+
onpointerdown: null,
|
|
1764
|
+
/**
|
|
1765
|
+
* Property-based event handler for the `pointerenter` event.
|
|
1766
|
+
* @memberof scene.Container#
|
|
1767
|
+
* @default null
|
|
1768
|
+
* @example
|
|
1769
|
+
* this.onpointerenter = (event) => {
|
|
1770
|
+
* //some function here that happens on pointerenter
|
|
1771
|
+
* }
|
|
1772
|
+
*/
|
|
1773
|
+
onpointerenter: null,
|
|
1774
|
+
/**
|
|
1775
|
+
* Property-based event handler for the `pointerleave` event.
|
|
1776
|
+
* @memberof scene.Container#
|
|
1777
|
+
* @default null
|
|
1778
|
+
* @example
|
|
1779
|
+
* this.onpointerleave = (event) => {
|
|
1780
|
+
* //some function here that happens on pointerleave
|
|
1781
|
+
* }
|
|
1782
|
+
*/
|
|
1783
|
+
onpointerleave: null,
|
|
1784
|
+
/**
|
|
1785
|
+
* Property-based event handler for the `pointermove` event.
|
|
1786
|
+
* @memberof scene.Container#
|
|
1787
|
+
* @default null
|
|
1788
|
+
* @example
|
|
1789
|
+
* this.onpointermove = (event) => {
|
|
1790
|
+
* //some function here that happens on pointermove
|
|
1791
|
+
* }
|
|
1792
|
+
*/
|
|
1793
|
+
onpointermove: null,
|
|
1794
|
+
/**
|
|
1795
|
+
* Property-based event handler for the `globalpointermove` event.
|
|
1796
|
+
* @memberof scene.Container#
|
|
1797
|
+
* @default null
|
|
1798
|
+
* @example
|
|
1799
|
+
* this.onglobalpointermove = (event) => {
|
|
1800
|
+
* //some function here that happens on globalpointermove
|
|
1801
|
+
* }
|
|
1802
|
+
*/
|
|
1803
|
+
onglobalpointermove: null,
|
|
1804
|
+
/**
|
|
1805
|
+
* Property-based event handler for the `pointerout` event.
|
|
1806
|
+
* @memberof scene.Container#
|
|
1807
|
+
* @default null
|
|
1808
|
+
* @example
|
|
1809
|
+
* this.onpointerout = (event) => {
|
|
1810
|
+
* //some function here that happens on pointerout
|
|
1811
|
+
* }
|
|
1812
|
+
*/
|
|
1813
|
+
onpointerout: null,
|
|
1814
|
+
/**
|
|
1815
|
+
* Property-based event handler for the `pointerover` event.
|
|
1816
|
+
* @memberof scene.Container#
|
|
1817
|
+
* @default null
|
|
1818
|
+
* @example
|
|
1819
|
+
* this.onpointerover = (event) => {
|
|
1820
|
+
* //some function here that happens on pointerover
|
|
1821
|
+
* }
|
|
1822
|
+
*/
|
|
1823
|
+
onpointerover: null,
|
|
1824
|
+
/**
|
|
1825
|
+
* Property-based event handler for the `pointertap` event.
|
|
1826
|
+
* @memberof scene.Container#
|
|
1827
|
+
* @default null
|
|
1828
|
+
* @example
|
|
1829
|
+
* this.onpointertap = (event) => {
|
|
1830
|
+
* //some function here that happens on pointertap
|
|
1831
|
+
* }
|
|
1832
|
+
*/
|
|
1833
|
+
onpointertap: null,
|
|
1834
|
+
/**
|
|
1835
|
+
* Property-based event handler for the `pointerup` event.
|
|
1836
|
+
* @memberof scene.Container#
|
|
1837
|
+
* @default null
|
|
1838
|
+
* @example
|
|
1839
|
+
* this.onpointerup = (event) => {
|
|
1840
|
+
* //some function here that happens on pointerup
|
|
1841
|
+
* }
|
|
1842
|
+
*/
|
|
1843
|
+
onpointerup: null,
|
|
1844
|
+
/**
|
|
1845
|
+
* Property-based event handler for the `pointerupoutside` event.
|
|
1846
|
+
* @memberof scene.Container#
|
|
1847
|
+
* @default null
|
|
1848
|
+
* @example
|
|
1849
|
+
* this.onpointerupoutside = (event) => {
|
|
1850
|
+
* //some function here that happens on pointerupoutside
|
|
1851
|
+
* }
|
|
1852
|
+
*/
|
|
1853
|
+
onpointerupoutside: null,
|
|
1854
|
+
/**
|
|
1855
|
+
* Property-based event handler for the `rightclick` event.
|
|
1856
|
+
* @memberof scene.Container#
|
|
1857
|
+
* @default null
|
|
1858
|
+
* @example
|
|
1859
|
+
* this.onrightclick = (event) => {
|
|
1860
|
+
* //some function here that happens on rightclick
|
|
1861
|
+
* }
|
|
1862
|
+
*/
|
|
1863
|
+
onrightclick: null,
|
|
1864
|
+
/**
|
|
1865
|
+
* Property-based event handler for the `rightdown` event.
|
|
1866
|
+
* @memberof scene.Container#
|
|
1867
|
+
* @default null
|
|
1868
|
+
* @example
|
|
1869
|
+
* this.onrightdown = (event) => {
|
|
1870
|
+
* //some function here that happens on rightdown
|
|
1871
|
+
* }
|
|
1872
|
+
*/
|
|
1873
|
+
onrightdown: null,
|
|
1874
|
+
/**
|
|
1875
|
+
* Property-based event handler for the `rightup` event.
|
|
1876
|
+
* @memberof scene.Container#
|
|
1877
|
+
* @default null
|
|
1878
|
+
* @example
|
|
1879
|
+
* this.onrightup = (event) => {
|
|
1880
|
+
* //some function here that happens on rightup
|
|
1881
|
+
* }
|
|
1882
|
+
*/
|
|
1883
|
+
onrightup: null,
|
|
1884
|
+
/**
|
|
1885
|
+
* Property-based event handler for the `rightupoutside` event.
|
|
1886
|
+
* @memberof scene.Container#
|
|
1887
|
+
* @default null
|
|
1888
|
+
* @example
|
|
1889
|
+
* this.onrightupoutside = (event) => {
|
|
1890
|
+
* //some function here that happens on rightupoutside
|
|
1891
|
+
* }
|
|
1892
|
+
*/
|
|
1893
|
+
onrightupoutside: null,
|
|
1894
|
+
/**
|
|
1895
|
+
* Property-based event handler for the `tap` event.
|
|
1896
|
+
* @memberof scene.Container#
|
|
1897
|
+
* @default null
|
|
1898
|
+
* @example
|
|
1899
|
+
* this.ontap = (event) => {
|
|
1900
|
+
* //some function here that happens on tap
|
|
1901
|
+
* }
|
|
1902
|
+
*/
|
|
1903
|
+
ontap: null,
|
|
1904
|
+
/**
|
|
1905
|
+
* Property-based event handler for the `touchcancel` event.
|
|
1906
|
+
* @memberof scene.Container#
|
|
1907
|
+
* @default null
|
|
1908
|
+
* @example
|
|
1909
|
+
* this.ontouchcancel = (event) => {
|
|
1910
|
+
* //some function here that happens on touchcancel
|
|
1911
|
+
* }
|
|
1912
|
+
*/
|
|
1913
|
+
ontouchcancel: null,
|
|
1914
|
+
/**
|
|
1915
|
+
* Property-based event handler for the `touchend` event.
|
|
1916
|
+
* @memberof scene.Container#
|
|
1917
|
+
* @default null
|
|
1918
|
+
* @example
|
|
1919
|
+
* this.ontouchend = (event) => {
|
|
1920
|
+
* //some function here that happens on touchend
|
|
1921
|
+
* }
|
|
1922
|
+
*/
|
|
1923
|
+
ontouchend: null,
|
|
1924
|
+
/**
|
|
1925
|
+
* Property-based event handler for the `touchendoutside` event.
|
|
1926
|
+
* @memberof scene.Container#
|
|
1927
|
+
* @default null
|
|
1928
|
+
* @example
|
|
1929
|
+
* this.ontouchendoutside = (event) => {
|
|
1930
|
+
* //some function here that happens on touchendoutside
|
|
1931
|
+
* }
|
|
1932
|
+
*/
|
|
1933
|
+
ontouchendoutside: null,
|
|
1934
|
+
/**
|
|
1935
|
+
* Property-based event handler for the `touchmove` event.
|
|
1936
|
+
* @memberof scene.Container#
|
|
1937
|
+
* @default null
|
|
1938
|
+
* @example
|
|
1939
|
+
* this.ontouchmove = (event) => {
|
|
1940
|
+
* //some function here that happens on touchmove
|
|
1941
|
+
* }
|
|
1942
|
+
*/
|
|
1943
|
+
ontouchmove: null,
|
|
1944
|
+
/**
|
|
1945
|
+
* Property-based event handler for the `globaltouchmove` event.
|
|
1946
|
+
* @memberof scene.Container#
|
|
1947
|
+
* @default null
|
|
1948
|
+
* @example
|
|
1949
|
+
* this.onglobaltouchmove = (event) => {
|
|
1950
|
+
* //some function here that happens on globaltouchmove
|
|
1951
|
+
* }
|
|
1952
|
+
*/
|
|
1953
|
+
onglobaltouchmove: null,
|
|
1954
|
+
/**
|
|
1955
|
+
* Property-based event handler for the `touchstart` event.
|
|
1956
|
+
* @memberof scene.Container#
|
|
1957
|
+
* @default null
|
|
1958
|
+
* @example
|
|
1959
|
+
* this.ontouchstart = (event) => {
|
|
1960
|
+
* //some function here that happens on touchstart
|
|
1961
|
+
* }
|
|
1962
|
+
*/
|
|
1963
|
+
ontouchstart: null,
|
|
1964
|
+
/**
|
|
1965
|
+
* Property-based event handler for the `wheel` event.
|
|
1966
|
+
* @memberof scene.Container#
|
|
1967
|
+
* @default null
|
|
1968
|
+
* @example
|
|
1969
|
+
* this.onwheel = (event) => {
|
|
1970
|
+
* //some function here that happens on wheel
|
|
1971
|
+
* }
|
|
1972
|
+
*/
|
|
1973
|
+
onwheel: null,
|
|
1974
|
+
/**
|
|
1975
|
+
* Enable interaction events for the Container. Touch, pointer and mouse
|
|
1976
|
+
* @memberof scene.Container#
|
|
1977
|
+
*/
|
|
1978
|
+
get interactive() {
|
|
1979
|
+
return this.eventMode === "dynamic" || this.eventMode === "static";
|
|
1980
|
+
},
|
|
1981
|
+
set interactive(a) {
|
|
1982
|
+
this.eventMode = a ? "static" : "passive";
|
|
1983
|
+
},
|
|
1984
|
+
/**
|
|
1985
|
+
* @ignore
|
|
1986
|
+
*/
|
|
1987
|
+
_internalEventMode: void 0,
|
|
1988
|
+
/**
|
|
1989
|
+
* Enable interaction events for the Container. Touch, pointer and mouse.
|
|
1990
|
+
* There are 5 types of interaction settings:
|
|
1991
|
+
* - `'none'`: Ignores all interaction events, even on its children.
|
|
1992
|
+
* - `'passive'`: **(default)** Does not emit events and ignores all hit testing on itself and non-interactive children.
|
|
1993
|
+
* Interactive children will still emit events.
|
|
1994
|
+
* - `'auto'`: Does not emit events but is hit tested if parent is interactive. Same as `interactive = false` in v7
|
|
1995
|
+
* - `'static'`: Emit events and is hit tested. Same as `interaction = true` in v7
|
|
1996
|
+
* - `'dynamic'`: Emits events and is hit tested but will also receive mock interaction events fired from a ticker to
|
|
1997
|
+
* allow for interaction when the mouse isn't moving
|
|
1998
|
+
* @example
|
|
1999
|
+
* import { Sprite } from 'pixi.js';
|
|
2000
|
+
*
|
|
2001
|
+
* const sprite = new Sprite(texture);
|
|
2002
|
+
* sprite.eventMode = 'static';
|
|
2003
|
+
* sprite.on('tap', (event) => {
|
|
2004
|
+
* // Handle event
|
|
2005
|
+
* });
|
|
2006
|
+
* @memberof scene.Container#
|
|
2007
|
+
* @since 7.2.0
|
|
2008
|
+
*/
|
|
2009
|
+
get eventMode() {
|
|
2010
|
+
return this._internalEventMode ?? J.defaultEventMode;
|
|
2011
|
+
},
|
|
2012
|
+
set eventMode(a) {
|
|
2013
|
+
this._internalEventMode = a;
|
|
2014
|
+
},
|
|
2015
|
+
/**
|
|
2016
|
+
* Determines if the container is interactive or not
|
|
2017
|
+
* @returns {boolean} Whether the container is interactive or not
|
|
2018
|
+
* @memberof scene.Container#
|
|
2019
|
+
* @since 7.2.0
|
|
2020
|
+
* @example
|
|
2021
|
+
* import { Sprite } from 'pixi.js';
|
|
2022
|
+
*
|
|
2023
|
+
* const sprite = new Sprite(texture);
|
|
2024
|
+
* sprite.eventMode = 'static';
|
|
2025
|
+
* sprite.isInteractive(); // true
|
|
2026
|
+
*
|
|
2027
|
+
* sprite.eventMode = 'dynamic';
|
|
2028
|
+
* sprite.isInteractive(); // true
|
|
2029
|
+
*
|
|
2030
|
+
* sprite.eventMode = 'none';
|
|
2031
|
+
* sprite.isInteractive(); // false
|
|
2032
|
+
*
|
|
2033
|
+
* sprite.eventMode = 'passive';
|
|
2034
|
+
* sprite.isInteractive(); // false
|
|
2035
|
+
*
|
|
2036
|
+
* sprite.eventMode = 'auto';
|
|
2037
|
+
* sprite.isInteractive(); // false
|
|
2038
|
+
*/
|
|
2039
|
+
isInteractive() {
|
|
2040
|
+
return this.eventMode === "static" || this.eventMode === "dynamic";
|
|
2041
|
+
},
|
|
2042
|
+
/**
|
|
2043
|
+
* Determines if the children to the container can be clicked/touched
|
|
2044
|
+
* Setting this to false allows PixiJS to bypass a recursive `hitTest` function
|
|
2045
|
+
* @memberof scene.Container#
|
|
2046
|
+
*/
|
|
2047
|
+
interactiveChildren: !0,
|
|
2048
|
+
/**
|
|
2049
|
+
* Interaction shape. Children will be hit first, then this shape will be checked.
|
|
2050
|
+
* Setting this will cause this shape to be checked in hit tests rather than the container's bounds.
|
|
2051
|
+
* @example
|
|
2052
|
+
* import { Rectangle, Sprite } from 'pixi.js';
|
|
2053
|
+
*
|
|
2054
|
+
* const sprite = new Sprite(texture);
|
|
2055
|
+
* sprite.interactive = true;
|
|
2056
|
+
* sprite.hitArea = new Rectangle(0, 0, 100, 100);
|
|
2057
|
+
* @member {IHitArea}
|
|
2058
|
+
* @memberof scene.Container#
|
|
2059
|
+
*/
|
|
2060
|
+
hitArea: null,
|
|
2061
|
+
/**
|
|
2062
|
+
* Unlike `on` or `addListener` which are methods from EventEmitter, `addEventListener`
|
|
2063
|
+
* seeks to be compatible with the DOM's `addEventListener` with support for options.
|
|
2064
|
+
* @memberof scene.Container
|
|
2065
|
+
* @param type - The type of event to listen to.
|
|
2066
|
+
* @param listener - The listener callback or object.
|
|
2067
|
+
* @param options - Listener options, used for capture phase.
|
|
2068
|
+
* @example
|
|
2069
|
+
* // Tell the user whether they did a single, double, triple, or nth click.
|
|
2070
|
+
* button.addEventListener('click', {
|
|
2071
|
+
* handleEvent(e): {
|
|
2072
|
+
* let prefix;
|
|
2073
|
+
*
|
|
2074
|
+
* switch (e.detail) {
|
|
2075
|
+
* case 1: prefix = 'single'; break;
|
|
2076
|
+
* case 2: prefix = 'double'; break;
|
|
2077
|
+
* case 3: prefix = 'triple'; break;
|
|
2078
|
+
* default: prefix = e.detail + 'th'; break;
|
|
2079
|
+
* }
|
|
2080
|
+
*
|
|
2081
|
+
* console.log('That was a ' + prefix + 'click');
|
|
2082
|
+
* }
|
|
2083
|
+
* });
|
|
2084
|
+
*
|
|
2085
|
+
* // But skip the first click!
|
|
2086
|
+
* button.parent.addEventListener('click', function blockClickOnce(e) {
|
|
2087
|
+
* e.stopImmediatePropagation();
|
|
2088
|
+
* button.parent.removeEventListener('click', blockClickOnce, true);
|
|
2089
|
+
* }, {
|
|
2090
|
+
* capture: true,
|
|
2091
|
+
* });
|
|
2092
|
+
*/
|
|
2093
|
+
addEventListener(a, e, t) {
|
|
2094
|
+
const i = typeof t == "boolean" && t || typeof t == "object" && t.capture, n = typeof t == "object" ? t.signal : void 0, s = typeof t == "object" ? t.once === !0 : !1, o = typeof e == "function" ? void 0 : e;
|
|
2095
|
+
a = i ? `${a}capture` : a;
|
|
2096
|
+
const r = typeof e == "function" ? e : e.handleEvent, l = this;
|
|
2097
|
+
n && n.addEventListener("abort", () => {
|
|
2098
|
+
l.off(a, r, o);
|
|
2099
|
+
}), s ? l.once(a, r, o) : l.on(a, r, o);
|
|
2100
|
+
},
|
|
2101
|
+
/**
|
|
2102
|
+
* Unlike `off` or `removeListener` which are methods from EventEmitter, `removeEventListener`
|
|
2103
|
+
* seeks to be compatible with the DOM's `removeEventListener` with support for options.
|
|
2104
|
+
* @memberof scene.Container
|
|
2105
|
+
* @param type - The type of event the listener is bound to.
|
|
2106
|
+
* @param listener - The listener callback or object.
|
|
2107
|
+
* @param options - The original listener options. This is required to deregister a capture phase listener.
|
|
2108
|
+
*/
|
|
2109
|
+
removeEventListener(a, e, t) {
|
|
2110
|
+
const i = typeof t == "boolean" && t || typeof t == "object" && t.capture, n = typeof e == "function" ? void 0 : e;
|
|
2111
|
+
a = i ? `${a}capture` : a, e = typeof e == "function" ? e : e.handleEvent, this.off(a, e, n);
|
|
2112
|
+
},
|
|
2113
|
+
/**
|
|
2114
|
+
* Dispatch the event on this {@link Container} using the event's {@link EventBoundary}.
|
|
2115
|
+
*
|
|
2116
|
+
* The target of the event is set to `this` and the `defaultPrevented` flag is cleared before dispatch.
|
|
2117
|
+
* @memberof scene.Container
|
|
2118
|
+
* @param e - The event to dispatch.
|
|
2119
|
+
* @returns Whether the {@link FederatedEvent.preventDefault preventDefault}() method was not invoked.
|
|
2120
|
+
* @example
|
|
2121
|
+
* // Reuse a click event!
|
|
2122
|
+
* button.dispatchEvent(clickEvent);
|
|
2123
|
+
*/
|
|
2124
|
+
dispatchEvent(a) {
|
|
2125
|
+
if (!(a instanceof M))
|
|
2126
|
+
throw new Error("Container cannot propagate events outside of the Federated Events API");
|
|
2127
|
+
return a.defaultPrevented = !1, a.path = null, a.target = this, a.manager.dispatchEvent(a), !a.defaultPrevented;
|
|
2128
|
+
}
|
|
2129
|
+
};
|
|
2130
|
+
w.add(ce);
|
|
2131
|
+
w.mixin(Z, ue);
|
|
2132
|
+
w.add(J);
|
|
2133
|
+
w.mixin(Z, _e);
|
|
2134
|
+
w.add(q);
|